Introduction to Artificial Intelligence (CS236501)

advertisement
Introduction to Artificial Intelligence (CS236501)
Home assignment #1 – Search
Due date: Tuesday, December 26, at 12:00 noon
Submit your work in pairs.
Only typed (i.e., not handwritten) submissions will be accepted.
T.A. in charge: Danny Albocher (dannya@cs.technion.ac.il)
Exercise Goals:
In this assignment you'll learn the importance of the experimental approach to AI problems. You'll be presented
with an informed search algorithm you'll be asked to understand and analyze under various conditions. Since making
concrete a-priori claims on heuristic algorithms is quite difficult and often impossible, your analysis will be strongly
based on experiments you will plan and conduct.
To complete the exercise you will submit a small research report with your conclusions, backed by experiment
results provided as statistics, charts and graphs.
The Algorithm:
By now, we are familiar with heuristic search algorithms of various types. These algorithms differ in searching
time, resources used, quality of solution, completeness and more. In this exercise, you'll investigate a variation of the
weighted A* algorithm (WA*). The algorithm presented below, which we will call "Iterative weighted A*" (IWA*), will
find an initial solution to the given search problem, and perform iterative improvements to the solution, as long as it is
allowed to run.
The algorithm works in two phases:
Phase I – Simple WA*
In this phase a standard WA* is run on the problem in order to find an initial solution (what can you
say about this solution?). Note there are a few ways to define the weight on WA*. Please define it such that:
f  state   1  w  g  state   w  h  state 
w 0,1 .
Experimentation: Select an interesting set of weight values and apply the algorithm to a random set of
problems. Study the effect of the weight coefficient. Explain your findings in graphs and words. Note that for
certain values of w the algorithm would take a long time to run. You can avoid these. Compare between
w  0.99 and w  1 , explain the results.
Implement this phase keeping in mind the next one (i.e. you must save the solution path).
Phase II – IWA*
The iterative improvement is done by repeatedly selecting sub-paths of the solution provided in Phase
I, and applying WA* from the first node of the sub-path to the last node of the sub-path, in order to
find a possibly shorter path between them, effectively performing a "short cut" in the original path
(see visualization below).
Experimentation:
Reuse your WA* code to perform iterative improvements to the initial solution from the previous
phase.
Choose a different weight for the WA* performed in this phase and study its affect together with the
weight used for the first phase.
Selection of the paths to shorten should be done as follows:
a. Select a specific size of sub-path you would like to shorten (think why trying to shorten very
short or very long sub-path is not efficient). Move along the original path and perform the
local WA* on sub-paths of the selected size. Iteratively increase the selected size and run
over the path.
b. Try to improve the above algorithm by skipping sub-paths that aren't likely to be improved.
How did you decide which sub-paths aren't worth improving? Implement and explain the
results.
c. Bonus – suggest a completely new iterative sub-path selection technique and justify your
choice. Implement and compare to the original method suggested above.
Initial State
Phase I path
Sub-Path
Goal State
Initial State
Short cut on
Sub-Path
Goal State
Points to research:
While conduction your experiments, use the following question as guidelines. You are encouraged to
add any other interesting conclusions you might have from your experiments. Consider the following
questions for Phase I alone, and together with Phase II:
1. How does the weight affect the solution? (Time / quality / memory etc.)
2. Under what conditions is this algorithm complete?
3. Under what conditions is this algorithm optimal (finds the shortest path to the goal state)?
Problem domain:
The Fifteen-Puzzle consists of a four-by-four tile board, with 15 tiles numbered one through fifteen,
leaving one empty cell. The tiles are slideable, allowing the player to move the 2-4 tiles adjacent to the empty
cell, to take its place. Given a random board (i.e. "Problem" board below) the goal is to reorder the tiles so
that they appear in sequential order from the top left to the bottom right (see "Solution").
Problem
Solution
Domain specific instructions:
1. Given the above definition, you should convert this puzzle into a search problem. That is, you should
formally define the search space, state successor function, and goal state. Note that not all random
fills of the board are solvable! Half of the boards in this domain cannot be brought to the goal state by
legal moves.
You are encouraged to use the "Manhattan Distance" heuristic. A small bonus will be given for a
comparison with another better (time) heuristic.
2. In order to create an initial state for the puzzle, you are given two options.
a. Start with an ordered (solved) puzzle, and apply a random sequence of reverse legal
operations (note that in our problem reverse operations are the same as regular operations).
This will yield you a new search problem (which difficulty depends on the length of the
random sequence). Use a sufficiently high number of random moves, and explain your
choice.
b. Search for, or develop, an algorithm that efficiently finds a solvable board without using the
above technique. A small bonus will be given for choosing this option.
Implementation
You will need to implement the algorithm above on the puzzle domain. Any of the following
programming languages can be used in this assignment: C/C++, Java and Lisp. The important part is that
your code is readable to anyone without perfect knowledge of the language. Remember your implementation
is the means and not the goal, but programming mistakes will probably mean your goal will be missed. Any
other readable language will be considered if properly documented (please ask by email).
To Do Summary
0. Study the problem domain. Formally define the search space, successor function and goal predicate.
1. If chosen, develop an appropriate heuristic. Submit a description of your heuristic function and
explain its advantages and disadvantages compared to the Manhattan Distance heuristic.
2. Implement the algorithms in phases I and II. Answer the questions along.
3. Create a large enough set of problems (initial states), where large enough means it allows you to
extract meaningful conclusions from your tests (probably at least 20 problems). Execute the
algorithm on these problems with different values of the two tuning parameters (Phase I weight,
Phase II weight).
Note that this is a type of "anytime" algorithm, and as such it can be stopped at any time. Bound
either running time or total number of nodes developed, and stop the algorithm when this time is
reached. Analyze the final result of the different weight parameters for this bound in terms of the
following measurements:
 Running time (the total number of generated nodes along with the running time in seconds)
 Memory usage (the maximal number of nodes held in memory at any given time)
 Quality of the solution found (the length of the path to goal).
Organize the measurements in tables and graphs as you see fit.
4. Draw conclusions from your results. Please use words to explain the meaning of your results, and not
merely to describe them.
Note: the analysis of experiments constitutes the main point of this assignment. Therefore, you
should discuss your experimental results at great length, explaining the nature of your results and
observations.
5. Submit all your code, which should be accompanied with both internal and external documentation.
Remember to clearly state what part of your code is not original.
6.
Your entire submission should be in hard copy (no electronic submission is necessary for this
assignment).
Submit your work in pairs. In order to find a partner, you might take advantage of the “Find a partner”
mechanism available on the course Web page at http://webcourse.technion.ac.il/236501 (see buttons on the
left).
Note: Before sending your question by email, please make sure you’ve checked the “Updates and FAQ”
section of the course web site (http://webcourse.technion.ac.il/236501)
Good luck! 
Download