|
I played with the Pacman programming assignment given to the Standford class (NOT to our online class) and found a result for the trickySearch Q7 problem with only 379 search nodes expanded. In the statement of the question, it is said that it is hard to get fewer than 7000 nodes expanded. Thus, the result I get seems almost too good to be true. As far as I can tell, by putting an explicit check to verify that the heuristic cost never decreases by more than 1 at each step in the expansion, my heuristic is consistent. I am also pretty sure that it is admissible. Is there anything else I can do to verify that I use a valid heuristic? I should note that the heuristic I use is particularly suited to maze layouts like the trickySearch one. When I use it for the seemingly simpler tinySearch, I get 568 nodes expanded. Have you tried running it on mediumSearch?
(16 Oct '11, 06:03)
Maxim
Yes, and I had to stop it since, after 20 minutes of run time, it had not come up with a solution and was requiring over 2GB of memory.
(16 Oct '11, 08:31)
aroberge
can you link to the assignment pages and any other references pls ;)
(16 Oct '11, 08:34)
Merlin
http://robots.stanford.edu/cs221/progAssignments/PA1/search.html
(16 Oct '11, 08:45)
aroberge
Those assignments were a blast. I got 6,110 nodes expanded for trickySearch and 414 nodes expanded on tinySearch (using the AStarFoodSearchAgent).
(27 Nov '11, 03:25)
Tom Chappell
|
|
Here is a graph of the costs along the optimal path in trickySearch, with the estimated remaining cost (heuristic) stacked above the computed cost (which is of course linear). The heuristic is the aforementioned minimum spanning tree (MST) length + cost to the closest food. Things to note are:
Of course the graph doesn't prove anything. To prove consistency (or at least, to convince myself), this is my reasoning:
|
|
@gbayliss Stanford course downloads are on the course schedule here but already the lecture 1 link is busted.
@aroberge Can you offer any tips for installing cs221 code and Python - was it easy to get working? Python is extremely easy to install. If you have a Mac or a Linux box, it should be there already. If not, head to python.org and follow the links. As for "installing" the code, you simply have to download it, unzip it somewhere. Simply typing "python a_program.py" will run it - no installation step needed.
I should have clarified what I meant about installing the code: I was referring to the code samples for the assignment - not Python itself.
Thanks for your help, sorry not replying earlier. Loaded pacman under Ubuntu on VirtualBox. Great stuff but going to find getting to grips with the Python code hard - untyped variables makes understanding harder I think.
|
|
I have had a few seemingly ok heuristics for Q7 - one that finds the optimal solution with 10849 expanded nodes, one that finds an almost optimal solution in 7389 expanded nodes. (The heuristics are taking topology of the maze into account) However, on mediumSearch, the only solutions I could find before my computer melted (rather, ran out of memory) were clearly suboptimal solutions (pacmans oscillating left and right in the maze, eating a few dots on the rigth, turning around, nibbling on the left and back again) that were found in less than 20'000 expanded notes. The heuristics were not admissable for those. Question: Has anyone found a heuristic that solves mediumSearch optimally and finishes in finite time / memory? I have an idea for a solution, but that would require a totally different solution state. I have already spent way too much time on this heuristic and would like to know if there's hope to actually solve it. So I have a heuristic that works in all mazes but mediumSearch and bigSearch. (trickySearch with optimal solution in 9615 expanded nodes). Would be interesting to hear from others how they are faring. I suspect that my heuristic would solve mediumSearch, but I haven't been able to run it to completion.
I have run mediumSearch with my heuristic and it didn't complete before it ate up 6 GB of memory...
found a really good article about heuristics for A* search and how it influences the speed and accuracy of the search: http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html
|
|
Mine does Q7 with 5893 nodes expanded... What are other peoples' results? (Mine completes in 1.2 seconds) I have Q4 as 547 nodes expanded with a "total cost of 210". @aroberge I'm interested in your check for consistency... What is h_cost and what is new_h_cost? Actually... I think I see. So, h_cost is the heuristic of the current position, and new_h_cost must be the heuristic for the successor... I am curious if my heuristic for Q7 is inconsistent or not, given how easy it was to get 5893 as an answer. More later.
Yep! Sure enough! Consistency problems! Damnit! hehe...
For Q7, I got:
6,110 nodes expanded, total cost 60 (trickySearch)
414 nodes expanded, total cost 27 (tinySearch)
For Q4, I got:
549 nodes expanded, total cost 210
(I've got the heuristic consistency check in my aStarSearch)
Q7: (tricky search) 60 cost, 215 expanded in 0.1 seconds. Consistency is guarantied by heuristic construction. However, I've inserted code to check for consistency on each step. No warnings so far.
tinySearch - 27 cost, 52 expanded. smallSearch - 34 cost, 57 expanded.
Heuristic is O(n^3), where n is a number of food dots.
In Q7 my best score in trickySearch is:
Path found with total cost of 60 in 1.6 seconds
Search nodes expanded: 1130
@red75prim
I'm interested in what heuristic you used. Could we contact by email? (It should appear in my profile)
@maacruz, I can't see your email. However, I can give a hint: consider the length of minimum spanning tree for remaining food dots.
BTW, I implemented slightly different priority queue to get 215 expanded nodes. If program uses util.PriorityQueue, then it expands 255 nodes.
@red75prim: Hey, I did the same thing ! Length of minimumum spanning tree (using maze distances) + distance to closest food. 247 nodes expanded with the stock util.PriorityQueue in 0.1 s. I used Dijkstra and a cache to speed up the calculations.
@ibatugow. Cache, yes, but I was too lazy to implement Dijkstra's algo...
[Staring at source code]
Well, yes, it's Dijkstra (BFS + tuned getSuccessors).
Thanks! But I think it is an inconsistent heuristic (I can think of one such a tree where you remove a node and the resulting total length then is greater), or I'm not making the right approach (my implementation is inconsistent). My email is maacruz in gmail.
Looking back...
With my first approach for Q7, TrickySearch I got:
5380 nodes expanded, total path cost 60, in 1.8 seconds
A solution with 215 nodes expanded is pretty impressive. I am also curious about the approach taken here.
Finally got it. Needed a small trick (which I had used in my previous heuristic) with packman to solve the inconsistency.
255 nodes expanded in trickySearch in 1.4 seconds (completely unoptimized although I cache things)
maacruz: could you email me? myusername at gmail dot com
Anyone have pointers on how to actually implement the MST based on a maze?
|