| AI Fall 2006 - HW2 FAQ |
|   AI Home   |   HW2 Assignment |
+ Sample problems?
|
Question: | Can we see some sample 3-jug problems and solutions? |
|
Answer: |
|
+ BFS depth limitation?
|
Question: | Is there an easy way to limit BFS search depth (using Dave's code)? |
|
Answer: | If you are using Dave's BFS search code, you will need to make changes to limit the depth of the search. Here are a few possibilities: Change the queue to something that not only holds a list of states, but to something that holds a list of labeled states, where each state saved in the queue also has a label (an indication of the depth at which that state was generated). Don't expand any state whose depth is the maximum. For example, each thing put on the queu could look like this: (depth state), where depth is an integer and state is something like '(1 2 3). Another approach is to keep track of state depths using another data structure, like the parentlist used by Dave's code. You could use an association list to be able to save and lookup the depth of any state visited so far. Note that is you do not visit the same state multiple times (Dave's BFS code that uses the parentlist does this), it is entirely possible to run out of states before you reach the depth limit. This implies there is no possible solution to the current problem. |
+ DFS is slow?
|
Question: | My DFS is slow, is this normal? |
|
Answer: | Yes, this is to be expected. You can include code to avoid visiting states that have already been visited (like Dave's BFS code) and this will speed things up significantly. Note that Dave's code for managing parentlist (which is used by unique-successor) is not efficient, a hash table would be much better for this. |