;;; Designed to test the code in "a-star-hash.lisp" for finding shortest paths ;;; on the small graph discussed in class. For simplicity, this has been ;;; designed to work usefully only when the goal is state G, but any state ;;; can be used used as a start state. To find a shortest path from S to G, ;;; for example, evaluate ;;; (find-shortest-path 's 'g #'successors #'heuristic-dist). (defun successors (state) (case state ((s) '((a . 3) (d . 4))) ((a) '((s . 3) (b . 4) (d . 5))) ((b) '((a . 4) (c . 4) (e . 5))) ((c) '((b . 4))) ((d) '((s . 4) (a . 5) (e . 2))) ((e) '((b . 5) (d . 2) (f . 4))) ((f) '((e . 4) (g . 3))) ((g) '((f . 3))) )) (defun heuristic-dist (state goal) (if (eql goal 'g) ; designed to do something interesting (case state ; only when goal state is G ((s) 11.0) ((a) 10.4) ((b) 6.7) ((c) 4.0) ((d) 8.8) ((e) 6.9) ((f) 3.0) ((g) 0.0) ) 0.0 ; default is 0 for any other goal state ))