;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; AWARENESS OF NOT KNOWING SOMETHING, ;; ;; AND ASKING IN ORDER TO FIND OUT ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; We again define a small Gridworld with 2 places (home, grove1) ;; connected by path1. The robot ME is initially at home and hungry, ;; but there is nothing edible at home. There is a mushroom (mushroom1) ;; at Grove1, as well as an animate agent Grunt, neither of which ;; ME knows about. Since ME likes to walk (and has no other options), ;; he goes to Grove1 and learns that mushroom1 and Grunt are there. ;; The mushroom is edible, but ME doesn't know it; so he shouldn't ;; try to eat it right away (it might be poisonous). We model this ;; situation by using a pair of preconditions in the `eat' operator: ;; not only must the object be edible, ME must know WHETHER it is ;; edible. (We need not separately require that ME knows THAT it ;; is edible, because if it is edible and ME knows WHETHER it is ;; edible then ME knows THAT it is edible.) So to satisfy the ;; knows_whether precondition, ME must ask Grunt about it. ;; ;; We design ME so that it likes to acquire whether-knowledge. ;; We supply an ask_whether operator to make this possible. This ;; has preconditions that the entity asked must be able to talk, ;; and must know the answer to the question (and the asker must ;; not know the answer -- otherwise ME will keep asking, just for ;; fun!), and so Grunt will be the only candidate (we have ruled ;; out the possibility of ME asking HIMSELF the question by our ;; general constraint that the bindings for distinct parameters ;; of an operator must be distinct.) ;; ;; First (load "gridworld-notime.lisp") ;; and (load "develop.lisp") ;; and then (load "eg-dialog-world.lisp") ;; (which is this file) ;; Possible continuation: ;; (initialize-state) ;; (go!) (def-roadmap '(home grove1) '((path1 home grove1))); 2 points, 1 road (def-object 'robot '(is_animate can_talk)) (def-object 'sasquatch '(is_animate can_talk)) (def-object 'mushroom '(plant)) ; (def-object 'tree '(is_alive is_inanimate)) ; (def-object 'apple '(edible)); no good -- it's no longer edible when eaten! ; (def-object 'banana '(edible)); ----------------ditto ------------------ (place-object 'ME 'robot 'home 0 nil ; no associated-things '((hungry me)) nil) ; no propositional attitudes ; (place-object 'apple-tree1 'tree 'grove1 0 nil ; We'll supply apple separately ; nil nil ) ; no other current-state facts or prop. attitudes ; (place-object 'apple1 'apple 'grove1 0 nil ; no associated-things ; '((edible apple1) (has apple-tree1 apple1)) nil ) ; no attit.'s ; (place-object 'banana1 'banana 'home 0 nil ; no associated-things ; '((edible banana1)) nil ) ; no prop. attitudes (place-object 'Grunt 'sasquatch 'grove1 0 nil ; no associated-things nil '((knows_whether Grunt (edible mushroom1))) ) ; prop'l attitude (place-object 'mushroom1 'mushroom 'grove1 0 nil ; no associated-things '((edible mushroom1)) nil) ; no propositional attitudes (setq eat (make-op :name 'eat :pars '(?y ?z); ME eats ?y at ?z :preconds '((is_at me ?z) (is_at ?y ?z) (hungry me) (edible ?y) (knows_whether me (edible ?y)) ) :effects '((not (is_at ?y ?z)) (not (edible ?y)) (not (hungry me)) ) :value 2 )); NB: no other eater besides ME is allowed (setq ask-whether (make-op :name 'ask-whether :pars '(?y ?w ?z) ; ME asks ?y whether ?w is true, at location ?z :preconds '((is_at me ?z) (is_at ?y ?z) (can_talk ?y) (knows_whether ?y ?w) (not (knows_whether me ?w)) ) :effects '((knows_whether me ?w)) :value 2 )) (setq sleep (make-op :name 'sleep :pars '() :preconds '((not (hungry me))) :effects '((hungry me)) :value 2 )) (setq walk (make-op :name 'walk :pars '(?x ?y ?z); walk from point ?x to :preconds '((is_at ME ?x) ; point ?y on road ?z (is_on ?x ?z) (is_on ?y ?z) ) :effects '((is_at ME ?y) (not (is_at ME ?x)) (hungry ME) ) :value 1 )) (setq *operators* '(eat ask-whether sleep walk)) (setq *search-beam* (list (cons 4 *operators*) (cons 3 *operators*) (cons 3 *operators*) )) ;; The state-value function here is presumed to be the generic one ;; in `develop.lisp'. ;; SAMPLE RUN: ;;=============