next up previous
Next: 12.0.4 node-operationの定義 Up: 12 迷路問題における状態空間の生成 Previous: 12.0.2 next-statesの定義

12.0.3 goal-searchの定義

goal-search を定義すると,
(defun goal-search (s g)
  (breadth-first nil s g))
というような形になって,
> (goal-search '(robot at (0 0)) '(robot at (4 3)))
((robot at (0 0))
 (robot at (1 0))
 (robot at (2 0))
 (robot at (3 0))
 (robot at (3 1))
 (robot at (3 2))
 (robot at (4 2))
 (robot at (4 3)))

> (goal-search '(robot at (0 0)) '(robot at (0 3)))
((robot at (0 0))
 (robot at (1 0))
 (robot at (2 0))
 (robot at (3 0))
 (robot at (3 1))
 (robot at (2 1))
 (robot at (1 1))
 (robot at (1 2))
 (robot at (0 2))
 (robot at (0 3)))

> (goal-search '(robot at (0 0)) '(robot at (2 4)))
((robot at (0 0))
 (robot at (1 0))
 (robot at (2 0))
 (robot at (3 0))
 (robot at (3 1))
 (robot at (3 2))
 (robot at (4 2))
 (robot at (4 3))
 (robot at (3 3))
 (robot at (3 4))
 (robot at (2 4)))
というようになる.

generated through LaTeX2HTML. M.Inaba 平成18年5月7日