Next: 7 統一的状態空間探索手続きの構造
Up: 6 状態空間の生成
Previous: 6.4 移動操作の生成
結局積み木の問題は,ある状態から,ある状態を作るために,どのような動作
列が必要かを示す手続きが必要で,それをfinalに渡すことで求める結果を得
ることができます.たとえば,横型探索を用いるとすると,
(defun block-motion-sequence
(start goal)
(block-operations
(breadth-first nil start goal)))
という具合に記述ができます.
これが働くための条件としては,
(defun node-equal (a b) (set= a b))
(defun new-nodes (path graph)
(remove-if
#'(lambda (n) (node-member n path))
(next-blocks-states (first path))))
と再定義する必要があります.
これにより,
状態を集合として扱うために,状態内部の表現順序が変っても,
全体のグラフ記述が与えられなくても
動作列が生成されることになります.
> (block-motion-sequence
'((a on b) (b on table) (c on d) (d on table))
'((a on table) (b on a) (c on table) (d on c)))
((move a from b to table)
(move b from table to a)
(move c from d to table)
(move d from table to c))
> (block-motion-sequence
'((c on table) (a on table) (b on table))
'((b on table) (a on b) (c on a)))
((move a from table to b)
(move c from table to a))
> (block-motion-sequence
'((b on table) (a on b) (c on a))
'((c on table) (a on table) (b on table)))
((move c from a to table)
(move a from b to table))
という具合になります.
generated through LaTeX2HTML. M.Inaba 平成18年5月6日