CS 470 Artificial Intelligence
Winter 2006, Instructor: Jeffrey Horn
HOMEWORK 1:
(program 1 version b): Uninformed State Space Search
in LISP!
Handed out/Assigned: |
Friday, Feb. 17, 2006 |
Due: |
Friday Feb. 24, 2006 |
- OK, here's the scaled down version of HW 1.
- Those who finished the original version will get extra
credit and DON'T have to do this one! Those who worked on the first
version but did not finish can turn that in for extra credit, and still have to
do THIS one!
- OK, this one is BLOCKS WORLD (see in our
text)
- Here is working code.
- Two scheme files:
moveblocks.scm
graphblocksUMB.scm
- (you need both, but just open "moveblocks", run it, and use
"(solve initial goal)" to use it, where "initial" and "goal" can be any states.
See top of "moveblocks" for some pre-defined states from our class discussions.
Use the function "graphplan", as in ""(graphplan (solve initial goal))", to see
the actual plan returned by "solve").
- This code does NOT check for duplicate states. That is
your job! That is, add code to check for duplicate states:
- Do this by maintaining a list of visited states (called the
"closed" list in our book).
- Look at the function "search". It is recursive. This is
the function that maintains a list of plans (the "plan-q"), taking plans off the
front of the queue "(car plan-q)", evaluating each to yield a state, checking
that state to see if it is equal to the goal, returning the plan and exiting if
the plan evaluates to the goal, and if not, then generating all one-move
successor plans and adding those to the back of the plan-q. So here is a
good place to check the state that a plan evaluates to, and seeing if that state
is on the list of previously visited states. If the state is already on
the list, then discard this plan; we already have a (shorter, and therefore
better) plan to get to this state, since we have already been there. If
the state is not on the list, then continue as before (but don't forget to add
the state to the list of visited states!).
- Once you have duplicate state checking working (test it with
"(solve initial goal)"), you should now be able to solve:
- (solve goal dave_goal) in a few seconds rather than a few
minutes (without dup. state checking)
- (solve flatten4init flatten4goal) in a few seconds rather
than a few minutes (without dup. state checking)
- (solve flatten5init flatten5goal) in several minutes
rather than > 1/2hr (w/o dup. state checking, this instance kept
running beyond one half hour on my thinkPad, so I killed it...)
- MAYBE (solve flatten6init flatten6goal). I don't
know about this one. Even with dup. state checking, this one was still
running on my machine after 25 minutes...
- Don't neglect to read chapters 7 and 8 on search.
- If you have not done so yet, download and install
DR. SCHEME.
- Here are some SCHEME TIPS
- (And
here
is the pseudo code for the uninformed state space search algorithm that our code
implements, without duplicate state checking).
- (And
here
is the pseudo code for the uninformed state space search algorithm WITH LOOP
CHECKING).
- Don't forget that I still want the following (for either the
Missionary-Cannibals problem or Blocks-World):
- Additional questions:
- Draw me a partial state space graph for theproblem.
(In the state space graph, use your state representation in the labels
for the states, and your "move" function for labeling the edges).
- Calculate the total number of states.
- What is the branching factor (approx. avg.) of your graph?