|
Post by Angelo Cafaro on Feb 11, 2011 14:28:21 GMT -5
I didn't really find any good code to follow on DFS and Iterative deepening and heuristics. So i just took BFS and modified it. But now im wondering if the algorithms are actually correct. They return the result im looking for but the details may be off. For instance DFS is supposed to save space by only keeping track of part of the search tree, i'm not sure im doing that. I don't even see how they implement the search tree or node datastructure in the book. The question being: do you have pseudocode of DFS and Iterative Deepening? DFS and BFS only differ by the way you update the frontier. So if you insert nodes to explore in the back of the frontier you are implementing a BFS, on the other hand, if you insert the nodes to explore at the front of the frontier you are implementing a DFS. For the Iterative Deepening DFS you could use a limit value passed to the DFS and the stop expanding a node if its depth is equal to the limit. Then you could call several time this modified DFS passing an increasing limit value, let's say starting by 0 (only the root) until infinite (you can use a great integer number for example)
|
|
|
Post by niccolo on Feb 12, 2011 9:17:37 GMT -5
Hi, I wanted to generate a random environment using the provided function, but I am unable to start the random sequence generation from different seeds. Thus, the random number that I get are always the same and therefore I generate always the same environment (or sequence of them). I found this link www.cs.cmu.edu/Groups/AI/html/cltl/clm/node133.htmlBut I am not sure to understand how I should do.
|
|
|
Post by Angelo Cafaro on Feb 12, 2011 12:30:48 GMT -5
Hi, I wanted to generate a random environment using the provided function, but I am unable to start the random sequence generation from different seeds. Thus, the random number that I get are always the same and therefore I generate always the same environment (or sequence of them). I found this link www.cs.cmu.edu/Groups/AI/html/cltl/clm/node133.htmlBut I am not sure to understand how I should do. Hello Niccolo, try this line where n is the upper-bound for your range (only for the first time): (random n (make-random-state T)) then you can use the random expression as usual (again, you have to substitute n): (random n) Let me know if this works....
|
|
|
Post by niccolo on Feb 12, 2011 13:18:15 GMT -5
It actually doesn't work.
Try this simple code:
I always get the same sequence:
|
|
|
Post by Angelo Cafaro on Feb 12, 2011 13:38:27 GMT -5
It actually doesn't work. Try this simple code: I always get the same sequence: Well, I'm not sure about the perfect solution but this workaround should be ok for you: (print (random 10 (make-random-state T))) (print (random 10 (make-random-state T))) (print (random 10 (make-random-state T)))
|
|