The Monkey and the Trainer: Discussion, Part 2 Date: Sun, 6 Jun 1999 From: Joohyung Lee To: TAG I think we can assign more active role to the trainer as an agent. In previous descriptions, the trainer was a little bit lazy. She doesn't climb up the box herself. I think it's also possible to think of the case when the monkey just waits until the trainer pushes the box, climbs up, grasps the banana, climbs down, and walks to the monkey to give it the banana(What a lucky monkey!). Plan 1 below is such a case. Also using new ccalc's feature for specifying subgoals, we may represent a plan where the trainer foils the monkey's desire to grasp the banana earlier by making the trainer walking away temporarily with monkey on her. Plan 4 below is such a case. The sorts hierarchy is like this, object / \ agent pedestal / \ / \ monkey trainer box Here, "pedestal" represents something on which an agent can climb up to make herself higher. The trainer is both an agent and a pedestal. What's still uncertain to me is the role of 'scream'. This is somewhat different from other actions since it causes another action to occur via the fluent 'prompted', while other actions just affect values of some fluents, not involving other actions. In previous descriptions, It seems to me that 'scream' should have a relevant action at the right next time. Either the trainer should walk to the monkey(in UTEP KRGROUP's description), or both the monkey and the trainer should be at the same position at the right next time(in hudson's description). However, if we generalize the description to make the trainer be more active, it may be the case that we can't gurantee the relevant action's occurrence at the right next time. For example, if trainer is on top of the box at l2 at some time, and then monkey screams, we can't gurantee their presence at the same location at the right next time. The trainer first should come down to the ground. The problem here is that the following relevant action can't occur right after the causing action('scream') because of some constraint. If an action triggers another action to occur not just at the right next time, how can we deal with this? For the 'scream' part, I just adopted from hudson's description, which is insufficent to answer the above problem. I guess there are a few things to be detailed if we generalize like this. 1. Do we allow two agent can be both on the box? i.e., does the box have enough space for two? Previously we didn't need to consider it since the monkey is the only one to climb the box. I assumed the space is enough. This made Plan 6 valid. 2. Does the trainer strong enough to move the box when the monkey is on top of the box? or vice versa? I assumed so, and this made Plan 5 valid. Below is my description of domain and some plans I tested. ---------------------------------------------------------- % monkey-trainer.c :- include 'C'; 'monkey-trainer.p'. :- sorts object >> ( (agent; pedestal) ); pedestal >> ( (trainer; box) ); agent >> ( (monkey; trainer) ); location. :- variables AG, AG1 :: agent; M :: monkey; T :: trainer; BP, BP1 :: pedestal; B :: box; O :: object; L, L1 :: location; A, A1 :: action. :- constants monkey1 :: monkey; lisa :: trainer; banana :: object; box1 :: box; l1, l2, l3, l4 :: location; at(object, location) :: inertialTrueFluent; onPedestal(agent, pedestal) :: inertialFluent; hasBanana(agent) :: inertialFluent; prompted :: defaultFalseFluent; walk(agent, location), pushBox(agent, location), climbPedestal(agent, pedestal), downPedestal(agent, pedestal), graspBanana(agent), giveBanana(agent, agent), scream :: action. :- show positive. nonexecutable A && A1 if -(A=A1). walk(AG, L) causes at(AG, L). nonexecutable walk(AG, L) if at(AG, L). % nonexecutable when AG is already at destination nonexecutable walk(AG, L) if onPedestal(AG, BP). % nonexecutable when AG is on pedestal. pushBox(AG, L) causes at(AG, L). pushBox(AG, L) causes at(box1, L). nonexecutable pushBox(AG, L) if at(AG, L). % nonexecutable when AG is already at destination nonexecutable pushBox(AG, L) if onPedestal(AG, BP). % nonexecutable when AG is on pedestal. nonexecutable pushBox(AG, L) if at(AG, L1) && -at(box1, L1). % nonexecutable when AG and box is not in the same place to start climbPedestal(AG, BP) causes onPedestal(AG, BP). nonexecutable climbPedestal(AG, BP) if (AG=BP). % trainer can't climb up itself nonexecutable climbPedestal(AG, BP) if onPedestal(AG, BP1). % can't climb up if already on some pedestal nonexecutable climbPedestal(AG, BP) if at(AG, L) && -at(BP, L). % nonexecutable when pedestal is not where AG is downPedestal(AG, BP) causes -onPedestal(AG, BP). nonexecutable downPedestal(AG, BP) if -onPedestal(AG, BP). % can't come down if not on pedestal nonexecutable downPedestal(AG, BP) if onPedestal(AG, BP1) && -(BP=BP1). % nonexecutable when AG is on other pedestal. scream causes prompted. caused false if at(M, L) && -at(T, L) after prompted. % can't trainer ignore scream? %%%%%nonexecutable walk(T, L) if -prompted. graspBanana(AG) causes hasBanana(AG). % if onPedestal(AG, BP). nonexecutable graspBanana(AG) if (/\BP: -onPedestal(AG, BP)). % can't grasp if not on some pedestal nonexecutable graspBanana(AG) if at(AG, L) && -at(banana, L). % can't grasp if not under banana caused -at(O, L1) if at(O, L) && -(L=L1). caused at(banana, L) if at(AG, L) && hasBanana(AG). caused at(AG, L) if at(BP, L) && onPedestal(AG, BP). always at(O, l1) ++ at(O, l2) ++ at(O, l3) ++ at(O, l4). always at(AG, L) && onPedestal(AG, BP) ->> at(BP, L). giveBanana(AG, AG1) causes hasBanana(AG1). giveBanana(AG, AG1) causes -hasBanana(AG). nonexecutable giveBanana(AG, AG1) if -hasBanana(AG). nonexecutable giveBanana(AG, AG1) if at(AG, L) && at(AG1, L1) && -(L=L1). % both agent have to be in the same location nonexecutable giveBanana(AG, AG1) if onPedestal(AG, BP) && -onPedestal(AG, BP). nonexecutable giveBanana(AG, AG1) if -onPedestal(AG1, BP) && onPedestal(AG, BP). % both should be on box or on earth to exchange banana ----------------------------------------------------------------- % monkey-trainer.p :- plan facts :: % monkey uses box to climb up as he did before. 0: -prompted, 0: (/\ AG: /\BP: -onPedestal(AG, BP)), 0: (/\ AG: -hasBanana(AG)), 0: at(monkey1, l1), 0: at(banana, l2), 0: at(box1, l3), 0: at(lisa, l4); goals :: 2: at(box1, l2), 4: hasBanana(monkey1). :- plan % monkey just waits for trainer to get him the banana. label :: 1; facts :: 0: -prompted, 0: (/\ AG: /\BP: -onPedestal(AG, BP)), 0: (/\ AG: -hasBanana(AG)), 0: at(monkey1, l1), 0: at(banana, l2), 0: at(box1, l3), 0: at(lisa, l4); goals :: 1: at(monkey1, l1), 4: hasBanana(lisa), 5: at(monkey1, l1), 6: at(lisa, l1), 7: hasBanana(monkey1). :- plan % monkey climb up trainer to reach the banana label :: 2; facts :: 0: -prompted, 0: (/\ AG: /\BP: -onPedestal(AG, BP)), 0: (/\ AG: -hasBanana(AG)), 0: at(monkey1, l1), 0: at(banana, l2), 0: at(box1, l3), 0: at(lisa, l4); goals :: 1: at(monkey1, l2), 4: at(box1, l3), 4: hasBanana(monkey1). :- plan % monkey scream to trainer to come label :: 3; facts :: 0: -prompted, 0: (/\ AG: /\BP: -onPedestal(AG, BP)), 0: (/\ AG: -hasBanana(AG)), 0: at(monkey1, l1), 0: at(banana, l2), 0: at(box1, l3), 0: at(lisa, l4); goals :: 1: at(monkey1, l2), 2: prompted, 5: hasBanana(monkey1). :- plan % monkey climb up trainer to reach the banana, temporarily walk away from banana label :: 4; facts :: 0: -prompted, 0: (/\ AG: /\BP: -onPedestal(AG, BP)), 0: (/\ AG: -hasBanana(AG)), 0: at(monkey1, l1), 0: at(banana, l2), 0: at(box1, l3), 0: at(lisa, l4); goals :: 1: at(monkey1, l2), 2: at(lisa, l2), 4: at(monkey1, l3), 6: hasBanana(monkey1). :- plan % trainer pushes box with monkey on top of it. label :: 5; facts :: 0: -prompted, 0: (/\ AG: /\BP: -onPedestal(AG, BP)), 0: (/\ AG: -hasBanana(AG)), 0: at(monkey1, l1), 0: at(banana, l2), 0: at(box1, l3), 0: at(lisa, l4); goals :: 3: at(monkey1, l1), 3: onPedestal(monkey1, box1), 5: hasBanana(monkey1). :- plan % trainer gives banana to monkey on top of box label :: 6; facts :: 0: -prompted, 0: (/\ AG: /\BP: -onPedestal(AG, BP)), 0: (/\ AG: -hasBanana(AG)), 0: at(monkey1, l1), 0: at(banana, l2), 0: at(box1, l3), 0: at(lisa, l4); goals :: 1: at(monkey1, l1), 4: hasBanana(lisa), 7: hasBanana(monkey1). ------------------------------------------------------------------ %output | ?- loadf('monkey-trainer.c'). % loading file /v/hank/v63/appsmurf/ccalc_0601/monkey-trainer.c % loading file /v/hank/v63/appsmurf/ccalc_0601/C % loading file /v/hank/v63/appsmurf/ccalc_0601/monkey-trainer.p % 77 atoms, 1489 rules, 1393 clauses, 760 msec. yes | ?- plan 0. (230 msec) calling rel_sat... 0. at(banana,l2) at(box1,l3) at(lisa,l4) at(monkey1,l1) ACTIONS: walk(monkey1,l3) 1. at(banana,l2) at(box1,l3) at(lisa,l4) at(monkey1,l3) ACTIONS: pushBox(monkey1,l2) 2. at(banana,l2) at(box1,l2) at(lisa,l4) at(monkey1,l2) ACTIONS: climbPedestal(monkey1,box1) 3. at(banana,l2) at(box1,l2) at(lisa,l4) at(monkey1,l2) onPedestal(monkey1,box1) ACTIONS: graspBanana(monkey1) 4. hasBanana(monkey1) at(banana,l2) at(box1,l2) at(lisa,l4) at(monkey1,l2) onPedestal(monkey1,box1) run time (seconds) 0.04 Verify plan? (y/n) y verifying.... The plan is verified! yes | ?- plan 1. (400 msec) calling rel_sat... 0. at(banana,l2) at(box1,l3) at(lisa,l4) at(monkey1,l1) ACTIONS: walk(lisa,l3) 1. at(banana,l2) at(box1,l3) at(lisa,l3) at(monkey1,l1) ACTIONS: pushBox(lisa,l2) 2. at(banana,l2) at(box1,l2) at(lisa,l2) at(monkey1,l1) ACTIONS: climbPedestal(lisa,box1) 3. at(banana,l2) at(box1,l2) at(lisa,l2) at(monkey1,l1) onPedestal(lisa,box1) ACTIONS: graspBanana(lisa) 4. hasBanana(lisa) at(banana,l2) at(box1,l2) at(lisa,l2) at(monkey1,l1) onPedestal(lisa,box1) ACTIONS: downPedestal(lisa,box1) 5. hasBanana(lisa) at(banana,l2) at(box1,l2) at(lisa,l2) at(monkey1,l1) ACTIONS: pushBox(lisa,l1) 6. hasBanana(lisa) at(banana,l1) at(box1,l1) at(lisa,l1) at(monkey1,l1) ACTIONS: giveBanana(lisa,monkey1) 7. hasBanana(monkey1) at(banana,l1) at(box1,l1) at(lisa,l1) at(monkey1,l1) run time (seconds) 0.09 Verify plan? (y/n) y verifying....... The plan is verified! yes | ?- plan 2. (220 msec) calling rel_sat... 0. at(banana,l2) at(box1,l3) at(lisa,l4) at(monkey1,l1) ACTIONS: walk(monkey1,l2) 1. at(banana,l2) at(box1,l3) at(lisa,l4) at(monkey1,l2) ACTIONS: walk(lisa,l2) 2. at(banana,l2) at(box1,l3) at(lisa,l2) at(monkey1,l2) ACTIONS: climbPedestal(monkey1,lisa) 3. at(banana,l2) at(box1,l3) at(lisa,l2) at(monkey1,l2) onPedestal(monkey1,lisa) ACTIONS: graspBanana(monkey1) 4. hasBanana(monkey1) at(banana,l2) at(box1,l3) at(lisa,l2) at(monkey1,l2) onPedestal(monkey1,lisa) run time (seconds) 0.04 Verify plan? (y/n) y verifying.... The plan is verified! yes | ?- plan 3. (290 msec) calling rel_sat... 0. at(banana,l2) at(box1,l3) at(lisa,l4) at(monkey1,l1) ACTIONS: walk(monkey1,l2) 1. at(banana,l2) at(box1,l3) at(lisa,l4) at(monkey1,l2) ACTIONS: scream 2. prompted at(banana,l2) at(box1,l3) at(lisa,l4) at(monkey1,l2) ACTIONS: walk(lisa,l2) 3. at(banana,l2) at(box1,l3) at(lisa,l2) at(monkey1,l2) ACTIONS: climbPedestal(monkey1,lisa) 4. at(banana,l2) at(box1,l3) at(lisa,l2) at(monkey1,l2) onPedestal(monkey1,lisa) ACTIONS: graspBanana(monkey1) 5. hasBanana(monkey1) at(banana,l2) at(box1,l3) at(lisa,l2) at(monkey1,l2) onPedestal(monkey1,lisa) run time (seconds) 0.05 Verify plan? (y/n) y verifying..... The plan is verified! yes | ?- plan 4. (340 msec) calling rel_sat... 0. at(banana,l2) at(box1,l3) at(lisa,l4) at(monkey1,l1) ACTIONS: walk(monkey1,l2) 1. at(banana,l2) at(box1,l3) at(lisa,l4) at(monkey1,l2) ACTIONS: walk(lisa,l2) 2. at(banana,l2) at(box1,l3) at(lisa,l2) at(monkey1,l2) ACTIONS: climbPedestal(monkey1,lisa) 3. at(banana,l2) at(box1,l3) at(lisa,l2) at(monkey1,l2) onPedestal(monkey1,lisa) ACTIONS: walk(lisa,l3) 4. at(banana,l2) at(box1,l3) at(lisa,l3) at(monkey1,l3) onPedestal(monkey1,lisa) ACTIONS: walk(lisa,l2) 5. at(banana,l2) at(box1,l3) at(lisa,l2) at(monkey1,l2) onPedestal(monkey1,lisa) ACTIONS: graspBanana(monkey1) 6. hasBanana(monkey1) at(banana,l2) at(box1,l3) at(lisa,l2) at(monkey1,l2) onPedestal(monkey1,lisa) run time (seconds) 0.07 Verify plan? (y/n) y verifying...... The plan is verified! yes | ?- plan 5. (280 msec) calling rel_sat... 0. at(banana,l2) at(box1,l3) at(lisa,l4) at(monkey1,l1) ACTIONS: walk(lisa,l3) 1. at(banana,l2) at(box1,l3) at(lisa,l3) at(monkey1,l1) ACTIONS: pushBox(lisa,l1) 2. at(banana,l2) at(box1,l1) at(lisa,l1) at(monkey1,l1) ACTIONS: climbPedestal(monkey1,box1) 3. at(banana,l2) at(box1,l1) at(lisa,l1) at(monkey1,l1) onPedestal(monkey1,box1) ACTIONS: pushBox(lisa,l2) 4. at(banana,l2) at(box1,l2) at(lisa,l2) at(monkey1,l2) onPedestal(monkey1,box1) ACTIONS: graspBanana(monkey1) 5. hasBanana(monkey1) at(banana,l2) at(box1,l2) at(lisa,l2) at(monkey1,l2) onPedestal(monkey1,box1) run time (seconds) 0.07 Verify plan? (y/n) y verifying..... The plan is verified! yes | ?- plan 6. (420 msec) calling rel_sat... 0. at(banana,l2) at(box1,l3) at(lisa,l4) at(monkey1,l1) ACTIONS: walk(lisa,l3) 1. at(banana,l2) at(box1,l3) at(lisa,l3) at(monkey1,l1) ACTIONS: pushBox(lisa,l2) 2. at(banana,l2) at(box1,l2) at(lisa,l2) at(monkey1,l1) ACTIONS: climbPedestal(lisa,box1) 3. at(banana,l2) at(box1,l2) at(lisa,l2) at(monkey1,l1) onPedestal(lisa,box1) ACTIONS: graspBanana(lisa) 4. hasBanana(lisa) at(banana,l2) at(box1,l2) at(lisa,l2) at(monkey1,l1) onPedestal(lisa,box1) ACTIONS: walk(monkey1,l2) 5. hasBanana(lisa) at(banana,l2) at(box1,l2) at(lisa,l2) at(monkey1,l2) onPedestal(lisa,box1) ACTIONS: climbPedestal(monkey1,box1) 6. hasBanana(lisa) at(banana,l2) at(box1,l2) at(lisa,l2) at(monkey1,l2) onPedestal(lisa,box1) onPedestal(monkey1,box1) ACTIONS: giveBanana(lisa,monkey1) 7. hasBanana(monkey1) at(banana,l2) at(box1,l2) at(lisa,l2) at(monkey1,l2) onPedestal(lisa,box1) onPedestal(monkey1,box1) run time (seconds) 0.09 Verify plan? (y/n) y verifying....... The plan is verified! yes | ?- ============== Date: Mon, 12 Jul 1999 From: Vladimir Lifschitz To: TAG I remembered some of the difficulties involved in our attempts to formalize the monkey and the trainer problem when I was reading the section of John McCarthy's paper "Elaboration Tolerance" entitled "Actions by Persons and Joint Actions of Groups." McCarthy writes: When there is more than one actor acting, we can consider three levels of complexity. The simplest level is when the actors act jointly to achieve the goal. The second level is when one actor (or more than one) does something to motivate the others, e.g. one person pays another to do something. This generalizes to a hierarchy of influence. The hard level is when the actors have competing motivations and must negotiate or fight. This is the subject of game theory, and we won't pursue it in this article. Maybe these remarks will help us improve the formalizations proposed so far. The paper is available at http://www-formal.stanford.edu/jmc/elaboration/elaboration.html .