?? oldblocks
字號:
;;; This file contains a SHOP domain representation of the block-stacking;;; algorithm from the following paper:;;; N. Gupta and D. Nau, On the complexity of blocks-world planning,;;; Artificial Intelligence 56(2-3):223-254, August 1992.;;; ------------------------------------------------------------------------;;; Declare all the data;;; ------------------------------------------------------------------------(defdomain oldblocks ( ;; basic block-stacking operators (:operator (!pickup ?a) () ((clear ?a) (on-table ?a)) ((holding ?a))) (:operator (!putdown ?b) () ((holding ?b)) ((on-table ?b) (clear ?b))) (:operator (!stack ?c ?d) () ((holding ?c) (clear ?d)) ((on ?c ?d) (clear ?c))) (:operator (!unstack ?e ?f) () ((clear ?e) (on ?e ?f)) ((holding ?e) (clear ?f))) ;; book-keeping methods & ops, to keep track of what needs to be done (:operator (!!assert ?g) () () ?g ;; Since !!ASSERT isn't a real blocks-world operator, make its cost 0 0) (:method (achieve-goals ?goals) () ((assert-goals ?goals nil) (move-block))) (:method (assert-goals (?goal . ?goals) ?out) () ((assert-goals ?goals ((goal ?goal) . ?out)))) (:method (assert-goals nil ?out) () ((!!assert ?out))) ;; The methods and operators for doing the actual planning (:method (move-block) ;; method for moving x from y to z ((clear ?x) (not (nomove ?x)) (on ?x ?y) (goal (on ?x ?z)) (not (same ?x ?z)) (clear ?z) (not (need-to-move ?z))) ((!unstack ?x ?y) (!stack ?x ?z) (!!assert ((nomove ?x))) (move-block)) ;; method for moving x from y to table ((clear ?x) (not (nomove ?x)) (on ?x ?y) (goal (on-table ?x))) ((!unstack ?x ?y) (!putdown ?x) (!!assert ((nomove ?x))) (move-block)) ;; method for moving x from table to y ((clear ?x) (not (nomove ?x)) (on-table ?x) (goal (on ?x ?y)) (clear ?y) (not (need-to-move ?y))) ((!pickup ?x) (!stack ?x ?y) (!!assert ((nomove ?x))) (move-block)) ;; method for moving x out of the way ((clear ?x) (not (nomove ?x)) (on ?x ?y) (need-to-move ?x)) ((!unstack ?x ?y) (!putdown ?x) (move-block)) ;; if nothing else matches, then we're done nil nil) ;; state axioms (:- (same ?x ?x) nil) (:- (need-to-move ?x) ;; need to move x if x needs to go from one block to another ((on ?x ?y) (goal (on ?x ?z)) (not (same ?y ?z))) ;; need to move x if x needs to go from table to block ((on-table ?x) (goal (on ?x ?z))) ;; need to move x if x needs to go from block to table ((on ?x ?y) (goal (on-table ?x))) ;; need to move x if x is on y and y needs to be clear ((on ?x ?y) (goal (clear ?y))) ;; need to move x if x is on z and something else needs to be on z ((on ?x ?z) (goal (on ?y ?z)) (not (same ?x ?y))) ;; need to move x if x is on something else that needs to be moved ((on ?x ?w) (need-to-move ?w))) ))
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -