1:-include(library('ec_planner/ec_test_incl')). 2:-expects_dialect(pfc). 3 % loading(always,'ecnet/PlayNeed.e'). 4%; 5%; Copyright (c) 2005 IBM Corporation and others. 6%; All rights reserved. This program and the accompanying materials 7%; are made available under the terms of the Common Public License v1.0 8%; which accompanies this distribution, and is available at 9%; http://www.eclipse.org/legal/cpl-v10.html 10%; 11%; Contributors: 12%; IBM - Initial implementation 13%; 14%; A complete story understanding program will require representations 15%; of common human needs \fullcite{SchankAbelson:1977}. 16%; 17%; @book{SchankAbelson:1977, 18%; author = "Schank, Roger C. and Abelson, Robert P.", 19%; year = "1977", 20%; title = "Scripts, Plans, Goals, and Understanding: An Inquiry into Human Knowledge Structures", 21%; address = "Hillsdale, NJ", 22%; publisher = "Lawrence Erlbaum", 23%; } 24%; 25%; The PlayNeed representation deals with one type of need, the need 26%; to play. 27%; Our underlying theory of human needs consists of the following sequence: 28%; (1) A need is unsatisfied. 29%; (2) Given certain stimuli and an unsatisfied need, an intention 30%; to satisfy the need is activated. 31%; (3) The intention is acted upon. 32%; (4) The need is satisfied. 33%; agent has an unsatisfied need to play. 34 35% fluent HungryToPlay(agent) 36 % fluent(hungryToPlay(agent)). 37==> mpred_prop(hungryToPlay(agent),fluent). 38==> meta_argtypes(hungryToPlay(agent)). 39 40 41% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:33 42%; agent has the intention to play outside. 43 44% fluent IntentionToPlay(agent,outside) 45 % fluent(intentionToPlay(agent,outside)). 46% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:35 47==> mpred_prop(intentionToPlay(agent,outside),fluent). 48==> meta_argtypes(intentionToPlay(agent,outside)). 49 50 51% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:35 52%; agent has a satisfied need to play. 53 54% fluent SatiatedFromPlay(agent) 55 % fluent(satiatedFromPlay(agent)). 56% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:37 57==> mpred_prop(satiatedFromPlay(agent),fluent). 58==> meta_argtypes(satiatedFromPlay(agent)). 59 60 61% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:38 62%; At any time, an agent is in one of three states with respect 63%; to the need to play: 64 65% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:40 66% xor HungryToPlay, IntentionToPlay, SatiatedFromPlay 67% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:41 68xor([hungryToPlay,intentionToPlay,satiatedFromPlay]). 69%; agent intends to play at location outside. 70 71% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:43 72% event IntendToPlay(agent,outside) 73 % event(intendToPlay(agent,outside)). 74% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:44 75==> mpred_prop(intendToPlay(agent,outside),event). 76==> meta_argtypes(intendToPlay(agent,outside)). 77 78 79% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:44 80%; agent plays at location outside. 81 82% event Play(agent,outside) 83 % event(play(agent,outside)). 84% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:46 85==> mpred_prop(play(agent,outside),event). 86==> meta_argtypes(play(agent,outside)). 87 88 89% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:47 90%; agent acts on the intention to play outside. 91 92% fluent ActOnIntentionToPlay(agent,outside) 93 % fluent(actOnIntentionToPlay(agent,outside)). 94% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:49 95==> mpred_prop(actOnIntentionToPlay(agent,outside),fluent). 96==> meta_argtypes(actOnIntentionToPlay(agent,outside)). 97 98% noninertial ActOnIntentionToPlay 99% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:50 100==> noninertial(actOnIntentionToPlay). 101%; A trigger axiom activates an intention for an agent to play when 102%; the agent has an unsatisfied need for play, the agent likes snow, 103%; the agent is awake, and 104%; the agent is in a room that looks out onto an outside area where it 105%; is snowing: 106% [agent,room,outside,time] 107% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:57 108% HoldsAt(HungryToPlay(agent),time) & 109% HoldsAt(LikeSnow(agent),time) & 110% HoldsAt(At(agent,room),time) & 111% LookOutOnto(room)=outside & 112% HoldsAt(Awake(agent),time) & 113% HoldsAt(Snowing(outside),time) -> 114% Happens(IntendToPlay(agent,outside),time). 115% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:63 116axiom(happens(intendToPlay(Agent, Outside), Time), 117 118 [ holds_at(hungryToPlay(Agent), Time), 119 holds_at(likeSnow(Agent), Time), 120 holds_at(at(Agent, Room), Time), 121 equals(lookOutOnto(Room), Outside), 122 holds_at(awake(Agent), Time), 123 holds_at(snowing(Outside), Time) 124 ]). 125 126 127% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:65 128%; A story understanding program will need a detailed representation 129%; of intention \fullcite{CohenLevesque:1990}. 130%; 131%; @article{CohenLevesque:1990, 132%; author = "Philip R. Cohen and Hector J. Levesque", 133%; year = "1990", 134%; title = "Intention is choice with commitment", 135%; journal = "Artificial Intelligence", 136%; volume = "42", 137%; pages = "213--261", 138%; } 139%; 140%; In our simplified representation, once an intention to 141%; perform $e$ is activated, it persists until it is acted 142%; upon. Intentions are represented by inertial fluents. 143%; If an intention to perform $e$ is active at time point $t$, 144%; the agent may or may not perform $e$ at time point $t$. 145%; That is, we do not know exactly when the agent will act on the 146%; intention. 147%; This is a case of nondeterminism, 148%; which we handle by introducing a noninertial fluent corresponding 149%; to each intention fluent that 150%; indicates whether the agent does or does not in fact act 151%; on an intention at a given time. 152%; Since each ground term of the new noninertial fluent multiplies the 153%; number of models by $2^{n}$ where $n$ is the number of time points, 154%; in practice we may constrain the truth value of the fluent 155%; at various time points. 156%; In the case of the need to play, 157%; HoldsAt(ActOnIntentionToPlay(agent, outside), time) 158%; represents that 159%; HoldsAt(IntentionToPlay(agent, outside), time) is acted 160%; upon at time. 161%; Effect axioms state that 162%; if an agent intends to play in an outside area, 163%; the agent will have an intention to play in the outside area 164%; and will no longer be in the hungry-to-play state: 165% [agent,outside,time] 166% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:104 167% Initiates(IntendToPlay(agent,outside),IntentionToPlay(agent,outside),time). 168axiom(initiates(intendToPlay(Agent, Outside), intentionToPlay(Agent, Outside), Time), 169 []). 170 171 172% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:106 173% [agent,outside,time] 174% Terminates(IntendToPlay(agent,outside),HungryToPlay(agent),time). 175% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:107 176axiom(terminates(intendToPlay(Agent, Outside), hungryToPlay(Agent), Time), 177 []). 178 179 180% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:109 181%; A trigger axiom states that if an agent has the intention 182%; to play in an outside area, 183%; the agent acts on the intention to play in the outside area, and 184%; the agent is at the outside area, 185%; the agent plays in the outside area: 186% [agent,outside,time] 187% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:115 188% HoldsAt(IntentionToPlay(agent,outside),time) & 189% HoldsAt(ActOnIntentionToPlay(agent,outside),time) & 190% HoldsAt(At(agent,outside),time) -> 191% Happens(Play(agent,outside),time). 192% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:118 193axiom(happens(play(Agent, Outside), Time), 194 195 [ holds_at(intentionToPlay(Agent, Outside), Time), 196 holds_at(actOnIntentionToPlay(Agent, Outside), Time), 197 holds_at(at(Agent, Outside), Time) 198 ]). 199 200 201% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:120 202%; Effect axioms state that if an agent plays in an 203%; outside area, the agent will be satiated from play 204%; and will no longer have an intention to play in 205%; the outside area: 206% [agent,outside,time] 207% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:125 208% Initiates(Play(agent,outside),SatiatedFromPlay(agent),time). 209axiom(initiates(play(Agent, Outside), satiatedFromPlay(Agent), Time), 210 []). 211 212 213% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:127 214% [agent,outside,time] 215% Terminates(Play(agent,outside),IntentionToPlay(agent,outside),time). 216% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:128 217axiom(terminates(play(Agent, Outside), intentionToPlay(Agent, Outside), Time), 218 []). 219 220 221% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/ecnet/PlayNeed.e:130 222%; End of file.