CSSE413 Artificial Intelligence
Fall 2006-2007
Programming Assignment -- Search
(Please put in your turnin folder, labeled as HW3)
Due as described on the assignment webpage
Intro Discussion
Goal:� The goal of this lab assignment is for you to gain expertise in using intelligent search in a domain well suited to it. �Specifically, the problem is to create an A* search for a variation of the domain called �blocks world,� so that you can find guaranteed optimal solutions, and also so that you can find suboptimal solutions fast.� Both of these are common roles for search.
Domain:� The basic domain �blocks world� is a famous
one in AI, often used as a model domain for planning.� We�ll get back to talking about it for that
purpose in
The problems are always shown with two arrangements of the
same blocks on a table, one called the
For simplicity, assume that all moves from one state to the next can be described in the following rather concise way to the magical, Mechanical Arm which performs them:
Move(block_ID,
start_position, end_position),
Where the block ID is one of those pictured in the problem,
and the positions are either �On Table� or �On � some other block.� For example, a legal move from the
Move(4, On 5, On Table),
Legalities in the domain:�
It is not legal to move blocks out from under other blocks, or to insert
a block into the middle of a stack.� The
Table is assumed to be infinite in size, allowing any number of stacks in the
Your variation of this domain:� This is called �colored blocks world,� and it makes the following slight complication to the traditional blocks world:� There can be more than one block with the same identity!� This is shown as having multiple blocks of the same colors, in Fig. 2:
Thus either blue (�B�) block in the
Hint: To describe transitions using the mechanical arm in this domain, you need to give the blocks unique identities, so that you can say uniquely what is being moved to get from one state to the next.
Your project: �Use A* search to solve problems in colored blocks world!� Specifically, it should do the following things:
1. �Read in files containing problem descriptions such as this one for the problem shown in Fig. 2 (you can vary the format of these problem descriptions to suit your language):
(Start
(On Table Red-1)
(On Table Yellow-1)
(On Yellow-1 Blue-1)
(On Table Green-1)
(On Green-1 Red-2)
(On Red-2 Blue-2))
(Goal
(On Table Blue-x1)
(On Table Green-x2)
(On Table Red-x3)
(On Red-x3 Red-x4)
(On Red-x4 Blue-x5)
(On Table Yellow-x6))
2. �Display the solutions as a series of moves, as
described, which take the
Move(Blue-1, On Yellow-1, On
Table)
Move(Blue-2, On Red-2, On
Table)
Move(Red-2, On Green-1, On
Red-1)
Move(Blue-2, On Table, On
Red-2)
at which point the
3. �Use an admissible heuristic of your invention to solve these problems optimally.
4. �Allow a way to �tune� that heuristic so as to
improve its performance on large problems, at possibly a slight additional cost
in the length of the solution path.� Note
that there is an easy solution to all these problems, namely, just unstack all
the blocks from the
Tools:� You will have two development environments to choose from; you can pick which one is right -- for you -- for this task.�� Namely, you can use either Scheme or Java.� So long as your assistants and instructors can read your source code and test your programs in either Petit Scheme or Eclipse, respectively.
You may want to spend a little time designing how you want your solution to be put together. Since it is to read in and solve problems of arbitrary size, some forethought on that will help in the long run.
You�ll want to decide what a �node� will look like, in general, and a �state� of each kind of problem at that node, and how you might need to remember �paths� so you can report what a �solution� looks like after a successful search.� And how to parse the list of �open nodes� with this particular search method.
Additionally, consider exactly how you want the problems to be described, as input to your programs, to minimize the effort for that. �Something like the method shown above probably works better in Scheme, not so well in Java.� Your instructor will be open to alternative ideas on this, so long as it�s feasible for him to test your program!
Note: It would be useful to take a crack at this early � If it turns out to be too much, We�ll revise the assignment downward or extend the deadline. However, this is about the right size for you to end-up feeling like you really designed software with some general search capability.
Detailed description
1. Be sure you understand how A* works, from Ch 4 in Russell & Norvig.
1a.� If you want to �warm up� with an unintelligent search from Ch 3, that�s fine.� If it really runs, you can include that in what you turn in for some small amount of extra credit.� However, mostly we�re interested in how well you can use intelligent search (A* in particular).
2. Be sure you
understand how colored blocks world is defined, from the above
definition.� Ask questions early!