From: AAAI-87 Proceedings. Copyright ©1987, AAAI (www.aaai.org). All rights reserved. Compiling Plan Expressed in Qualitative Operators from Domains recess Theory John C. Mogge Qualitative Reasoning Group Department of Computer Science University of Illinois at Urbana-Champaign Abstract The study of Qualitative Physics has concentrated on expressing qualitatively how the physical world behaves. Qualitative Physics systems accept partial descriptions of the world and output the possible changes that can occur. These systems currently assume that the world is left untouched by human or robot agents, limiting them to certain types of problem solving. For instance, a stateof-the-art qualitative physics system can diagnose faulty electrical circuits but can not construct plans to rewire circuits to change their behavior. This paper describes an approach to planning in physical domains and a working implementation which integrates Forbus’ Qualitative Prointerval-based plancess Engine (QPE) with a temporal ner. The approach involves compiling QPE expressions describing a physical domain into a set of operators and rules of the planner. The planner can then construct plans involving processes, existence of individuals, and changes in quantities. We describe how the compilation is performed, the types derivable plans, and current limitations in our approach. capabilities without rest Introduction The study requires ing qualitatively how the Physics accept systems output the possible rently assume robot For agents, rewire circuits domains ticular gine electrical Sections Operator Compiler sion in section QPE is an implementation as the deductions it sanctions. erator [F or b us, 861, with Compiler, domain goals that require inition processes The (TPLAN) expressions describing operators the Operator of liquid Operator Compiler can happen could the two powerful prove in the world. constructed and Furthermore, debugged useful systems. states, on Op- using QPE, Introduction database outputs solve increased envisions while TPLAN once a domain 3 given the defcan physics adding physics inequalities the the- such but as mea- have two components: by D). of five components: preconditions quantity (outside conditions process, Figure of in- quantities and uses sym- (signified process, during Examples sources, and influences 1 shows of (inequal- a typical the process definition. planner in applications, QPE asserted on quantities. for describ- are meaningful, as a collection in the such are liquid how processes order Thus, with aspects qualitative Quantities on the process, puts TPLAN operator involved relations a physical Compiler This values. quantitya) a process knowledge) process liquid by A) and derivative defines individuals QPT’s for achievmg flow, such as the in the world from various QPT other a syntax as a partial are irrelevant. (signified (QPT) En- based called For instance, flows. a par- Process of liquid in a container. due to its integration changes which integrates implementation, liquid in physical the Qualitative to occur. the effects can plans to amounts ities), a set of TPLAN for creating matching amount been QPE system to planning a planner The for a liquid flow process. an operator goals accepts and compiles sured Theory individuals. Like other numeric cur- behavior. system, 831. physics but can not construct than (GREATER-THAN quantity1 solving. The by discus- of processes provides affect quantities and ignoring fluid paths, and processes. models Process and for expressing and how they are containers, rather 4, followed Examples QPT in a domain active amount to rele- does. to refer to the language processes, flow, and boiling. bolic, and TPLAN Compiler of Qualitative physical Qualitative or actions to Q which one models QPT of QPE in section 841. We use the term QPT flow, heat systems then 5. ing individuals by human the actions) (to relate the Operator is presented Introduction ories, of problem qualitative implementation physics [Allen and Koomen, types an approach and a working qualitative These the physics Formalizing possible vocabulary aspects what 2 (Forbus, world as an agent’s 2 and 3 describe vant to understanding on express- of the untouched to certain their describes behaves. can occur. is left circuits to change paper (QPE) that world them world descriptions a state-of-the-art faulty This the limiting instance, diagnose physical partial changes that has concentrated (such of planning. for instance). of individuals, Physics The user can design the task some use of the physics processes, dividuals of Qualitative little work. about of the domain become 1 requires worrying what plans has planning is an implementation described TPLAN qualified temporal the possible adopts 1. Intervals 2. Variables temporal 831. by intervals runs on top of a time maintains ble 1 shows of the in [Allen and Koomen, of facts The planner which to TPL over between values a relation are denoted are denoted which logic described relationships the following interval-based TPLAN by symbols in :Allen, 831, Ta- conventions: starting starting a hold. intervals. can have. syntactic by symbols keeps they with with “9’. “?“. OPERATOR pickup PRECONDITIONS: (clear ?object) $clear-object (on ?object ?surface) $on EFFECTS: (pickup ?object ?surface) $pickup (clear ?surface) $clear-surface CONSTRAINTS: $clear-object ( :M) $pickup $on (:O) $pickup $on (:M) $clear-surface Process : (LIQUID-FLOW ?src-can ?dst-can ?liq) Individuals: (CONTAINER ?src-can) (CONTAINER ?dst-can) (CONTAINED-LIQUID (CL ?liq ?src-can)) (FLUID-PATH (FP ?src-can ?&t-can)) Preconditions: (VALVE-OPEN (FP ?src-can ?dst-can)) quantity Conditions: (GREATER-THAM (A (PRESSURE ?src-can)) (A (PRESSURE ?dst-can))) Relations: (IJUANTITYFLOW-RATE) (q= FLOW-RATE (- (PRESSURE ?src-can) (PRESSURE ?dst-can))) Influences: (I+ (AMOUNT-OF (CL ?liq ?dst-can)) (A FLOW-RATE)) (I- (AMOUNT-OF (CL?liq ?src-can)) (A FLOW-RATE)) Figure Table 1: Definition of Process 1: Seven Possible Values Value Description Inverse :< before :> Liquid of Interval Figure chaining, express I :O’ I overlaps 3 meets Relations and their 1 :OI finishes :D ! during ..- equals relation / * started as a disjunction means finished :DI ..- encloses and written “is before 4. Facts by Figure with the 3: A Temporally Rule definitions 4 equals two intervals as a list. interval tecedents For instance, (:< :>) over which they hold. (OH A TABLE) $IHTERVAL~ denotes a fact (ON A TABLE) which holds over $IHTERVAL~. facts assigning These 3.1 the same separate intervals interval constrained to world. ‘Allen adopts 831, with and Koomen, operator ure 2 defines object TPLAN an operator if it is clear the object’s the temporal preconditions old location. relations among can perform of action temporally qualified and effects. The facts to change presented patterns For instance, which can be applied on something. PICKUP’s constraints unifying to intersect :D :DI in deFig- to an effects field constrains with the precondi- 230 temporal Planning laws of the domain operators for solving TPLAN goals, Our time logic supports tempo- their a rule until antecedents relation is a subset to assert consequents 3 demonstrates these of (:S over features. intersect, Given (OVER A C) intersection. perator physics fixed sets water resting burner. the does uses rules as as well as forward QPE such action The Operator situations given can envision not burner what might what at some in process modeling of possible water point happen and might definitions. (implemented is temporally containing a pot containing of the envision actions the support unless we While as additional weak and multiplies world states the happen the by the number combinations. Compiler by modeling states can agent size of the envisionment about temperatures pot off of the support of consistent QPE relative to model assumptions), reason For instance, on a burner, on the if we move QPE systems However, attempt Compiler of individuals. depending possible chaining over their The Operator Rules backward Figure conamong and :=)) field: temporal temporal us to inhibit :OI be- behav- relations (meaning :0 intersection. torics Rules-model :FI is asserted tions and effects. 3.2 allowing :SI constraints The additional the antecedents. are known :F and consequent on the with an- consequents to be (:=). model PICKUP and resting matching Qualitative the agent the facts effects, preconditions and rule defi- each in turn. an action and Rule definitions, preconditions, (ON A B) and (ON B C) w h ose intervals is equivalent are used in operator defines Inference to operator like operator constraints. places ral intersections, their Operators scribing clear with conventions We describe An operator the them syntactic nitions. paired Qualified are similar behaving like operator ditions, is expressed Thus, 5. Two if we by or after.” are paired Thus, infer processes by :FI between rules. occurence. ing like operator temporal inference as rules, we can both RULE Antecedents: (ON ?x ?y) $on-xy (ON ?y ?z) $on-yz Temporal Conditions: Exists (INTERSECTION $on-xy $on-yz) called $intersection Consequents: (OVER ?x ?z) $intersection Consequent Constraints: having 3. The constrained processes PICKUP met bv.a overlapped I :SI starts :F after I of Operator Flow Description :MI I temporally QPT plan for their Inverses :M 2: Definition actions is more Compiler is an attempt within TPLAN, constrained approach 1. The user models in QPT than involves to avoid this combinawhose search QPE’s three the individuals through envisionment. steps: and physical pro cesses 2. The of the domain. Operator compiles Compiler operators ing processes the model of step “OC” marks rules and operators ’ ‘USER’ ’ marks rules and operators !les goale are indented under the 1 and plans involv- and individuals. 3. The user models in TPLAN form in the domain These analyzes and rules for constructing actions the actions and the temporal must be made an agent can per- laws of the domain. relevant to the output of step 2. For example, erate plans assume involving flow process and individuals and valved fluid paths. output operators a simple underneath it. position of faucets. The vocabulary container FAUCET SINK fluid path We then underneath following model FAUCET relevant operators to the operator would allow such as the valve three steps can now be For example, on the amount one to any con- one geometric scenarios. and re- For instance, actions Other initially a non-zero rules that from faucets by these planning POT1 having TPLAN in the physics, produced would by which a for the kitchen For instance, quantities used to solve specific assert Compiler descriptions. us to move objects. certain liquid sources, the means World geometry and the physics. us to modify a liquid In step 3 we construct an exterior would permit and gen- 1 we model such as containers, to the process rule establishes geometry a kitchen In step In step 2, the Operator Blocks late the geometry tainer to model and rules which include liquid flow is initiated. describe we want liquid flows. counter, of water, we could liquid solve any of the problems: 1. Increase the amount 2. Increase the pressure of water COAL, Increase the amount of water in the liquid state in POT1 SOLUTION Apply OC rule that increases POTl’s amount of water by creating a liquid flow from some source and fluid path Over the course of planning, “some source” is unified with FAUCET The rest of the trace assumes this GOAL Make POT1 a container SOLUTION Unify this goal with an initial given. GOAL Make FAUCET a container SOLUTION Apply OC rule which says liquid sources are containers GOAL. Wake FAUCET a liquid source SOLUTION Unify this goal with an initial given GOAL Get some water znto container FAUCET. SOLUTION Unify this goal rlth an Initial given GOAL Find a flurd path from FAUCET to POT1 SOLUTION Apply an OC rule which says exterior fluid paths are fluid paths GOAL Find an exterior fluid path from FAUCET to POT1 SOLUTION. Apply a USER rule which says that an exterior fluid path exists when a container is under FAUCET GOAL. Make POTl’s location be underneath FAUCET SOLUTION. Apply USER operator to move POT1 from the counter to underneath FAUCET. GOAL Make FAUCET’B pressure be greater than POTl’s pressure SOLUTION. Unify this goal with an initial given GOAL: Make the fluid path’s valve position be open SOLUTION. Apply USER operator for opening FAUCET’s valve Figure amples problems and assert (CONTAINER inference engine will assert in POT1 may seem trivial. However, our running require complex plans such as the one traced domain model Figure 4 shows generated to initiate a liquid is used to infer source. of the Operator the because of QPT’s encoded as a set of preconditions achieving causal the faucet a process ordering initial of simple and their for influencing rules and operators Later, QPT a rule expressions processes creating Similarly, are a rule for QPT permitting enforces compilation quantities. the primary Water to POT1 expressions of QPT a POTI) in certain situations, QPE’s the following in those situations: Expressmg a DEFENTITY as a TPLAN rule is simple. The antecedent and consequents are left unchanged, except that the consequents hold over the same time intervalas the antecedent. In the above example, (HAS-qUA!JTITYPOT1 VOLUME) and (GREATER-THAN (A (VOLUME ~0~111 ZERO) would hold over the interval over which (CONTAINER POTI) holds. For TPLAN the above DEFENTITY would be expressed as: RULE Antecedents: (CONTAINER ?X) $C Consequents: (HAS-QUAHTITY ?X VOLUME) $C (GREATER-THAN (A (VOLUME ?x)) ZERO) $c Since TPLAN treats rules. Section 4.3 describes as well as forward to all QPT domain models. the above into TPLAN applicable use of if it is a liquid from QPT and effects, changes, 4.1 and 4.2 describe compilation 4, rule is used goal. Since is straightforward. operators Sections of causality. on all quantity One is a container Such rules are simple to construct notion in Figure backward-chaining Compiler. flow to solve that for Adding (HAS-QUAIITITYPOT1 VOLUME) (GREATER-THA~J(A (voLu14EeoT1)) ZERO) ex- is detailed. examples by the of a Plan in POT1 since our QPT rules 4: Trace (DEFEIITIT~(CONTAINER ?x) (HAS-quAfJT1~y?x VOLUME) (GREATER-THA~I(A (voLUJ~E?x)) 2~~0) 3. Fill the sink with water These Compiler source and liquid drain and have TPLAN constructed by the Operator constructed by the user solution which introduces rules chaining rule to achieve as backward inference goals which rules, chaining operators TPLAN could use unify with any of the con- sequents. 4.1 Compilation .A QPT entity definition is an expression (DEFENTITY <pattern> <consequents>) <consequents> are asserted in every <pattern> is true. This scheme of Entity Definitions Thus, of the form situation where in which if we have the following definition proportionality is used on all consequents assertions. For instance, except for qualitative the following definition (DEFENTITY (CONTAII;ED-LI~UID?x) (HAS-qUAHTITY ?X LEVEL) (QPROP (LEVEL TX) (AMOUNT-OF ?x))) gives contained liquids a quantity LEVEL which increaseswhen the A;.IOU:;T-OF contained liquid increases and decreases when Hogge 231 AMOUNT-OF decreases. Encoding the QPROP as a rule consequent would not tell the planner that it can increase a contained liquid’s LEVEL by increasing the AMOUNT-OF contained liquid (and likewise for decreasing the LEVEL). Thus, the above PEFENTITY is instead compiled into the following rules. RULE Antecedents:'(CONTAINED-LIPUID?X) $cl Consequents: (HAS-qUANTITY ?X LEVEL) $cl RULE Antecedents: (CONTAINED-LIqUID ?X> $cl (INCREASING (AM~UMT-OF ?x) mwsE) $inc Temporal Conditions: Exists (INTERSECTION $cl $inc) called $int Consequents: (INCREASING (LEVEL ?X) ?cAusE) $int RULE Antecedents: (CONTAINED-LIQUID ?X) $cl (DECREASING (AMOUNT-OF ?x) ?cAusE) $dec Temporal Conditions: Exists (INTERSECTION $cl $dec) called $int Consequents: (DECREASING (LEVEL ?X) ?CAUSE) $int The first rule is the the DEFENTITY, result while the second extracted QPROP. uid exists during The second The QPE The definitions, 4.2 rule says that employed which rules encode Compilation The antecedents these their in the next section. of Process Definitions of a process definition (DEFPROCESS) are its consequents are its process form (such as the PROCESS l), relations, and influences. situation are asserted. as a rule which asserts of the antecedents. Bow process antecedent holds The temporal While lations refer unique in Figure local is expressed in TPLAN in Figure inter- during, involving containing the process, and after local quantities while all others FLOW-RATE; depend process. other the process. the intersection. 5 refer to local quantity of the quan- ality assertions 232 from the DEFPROCESS each of them. be compiled we extract Thus, into separate Planning the Q= are asserted over Our goal water are asserted over LEVEL. thus, they hold rules. all qualitative and create assertion changes and stoppered is to make Assume uid’s water the that and a qualitative Figure As with DEFENTITY, of planning we are given a faucet over $INT. express As an example that of the effects Process Universal QPE Rules re- Each Thus, LIQUID-FLOW OPERATOR Preconditions: (greater-than ?x ?y) $> (increasing ?y ?cause) $increasing Consequents: (equal-to ?x ?y> $= Constraints: $> (:M) $= $increasing (:M :FI :DI :O) $= 5 the liquid and influences quantities hold only during of antecedents, intervals specifies the antecedents form over the temporal on relations to any before, and influences the intersection This the field of $INT, the temporal intersection of the ($cl, $c2, $fp, $cl; $vo, and $gt). local quantities may exist matching For instance, constraints they while From The Operator Compiler enforces consistency during planning by including such rules in its compilation of QPT domains. Also included are a set of operators for planning changes in quantities. Section 4.1 described the encoding of qualitative proportionalities, in which rules of the form “If X is increasing then Y is increasing” are output for each qualitative proportionality. These rules allow us to construct operators which achieve inequalities between two quantities by achieving an increase or decrease in one of them. For instance, if we are given that quantity X is greater than quantity Y, we can solve the goal of making X equal to Y by either decreasing X or increasing Y. The latter is encoded as follows: over intervals on whether tities the process conditions, A DEFPROCESS in which facts hold, the consequents section in in process and quantity in every ex- expressions Compiled 1 RULE Antecedents: (equal-to ?x ?y) $= (greater-than ?x ?y) $> Consequents: $= (:< :> :M :MI) $> in similar occurrence Operator of Figure QPE encodes a set of universal rules applicable to all physical domains. For instance, value X can not be both equal to Y and greater than Y at the same time. This can be expressed as the following TPLAN rule: over the in- preconditions, that liq- over $IFJC, and individuals, Figure the if a contained are handled in handling are covered 4.3 from proportionality which 5: Definition similarly. of qualitative is also used to handle Figure QPROP the level is increasing and Q=) Q=, method DEFENTITY and third rule is interpreted a variety (QPROP-, fashion. then third supports pressions the $CL, its AMOUNT-OF is increasing $CL and $INC intersect, tersection of extracting RULE Process-Liquid-Flow Antecedents: (CONTAINER ‘src-can) $CI (CONTAINER ‘dst-can) 3~2 <FLUID-PATH (FP 7src-can ‘dst-can)) Sfp (CONTAINED-LIQUID (CL 711q ?src-can)) 3~1 (VALVE-OPEN (FP ?src-can 7dst-can)) ho (GREATER-THAN (A (PRESSURE-DIFFERENCE (FP ?src-can ‘dst-can))) ZERO) Sgt Temporal Condltlons, Exists (INTERSECTION $cl ScZ Ofp Scl Svo $gt) called Sint Consequent. (LIQUID-FLOW ‘src-can ‘dst-can ?liq) $int (IJUANTITY (LOCAL-QUANTITY FLOW-RATE (LIQUID-FLOW ‘src-can ‘dst-can ‘liq) 1) $lnt (INCREASING (ACCOUNT-OF (CL ?liq ?dst-can)) (A (LOCAL-QUANTITY FLOW-RATE (LIQUID-FLOW ?erc-can ?det-can ?liq)))) $mt tsrc-can)) (DECREASING (AMOUNT-OF (cr. ?liq (A (LOCAL-QUANTITY FLOW-RATE (LIQUID-FLOW ‘src-can ‘dst-can 71iq)))) $lnt our domain proportionality level increases 6 traces level when in quantities, suppose sink containing be greater includes stating than water. SOME- a liquid flow process that the amount a contained of water liq- increases. the plan which solves our goal. proportionrules which of Figure 1 would 5 Discussion We have described an Operator planning in physical problems Compiler domains. which The solves compiler simple handlr 6 GOAL: (GREATER-THAN (LEVEL SINK-WATER) SOME-LEVEL) SOLUTION: Apply an inequality change operator which achieves (GREATER-THAN ?X ?y) by increasing ?x. GOAL: (INCREASE (LEVEL SINK-'JATER)?cause) SOLUTION: Apply QPROP rule which says (LEVEL ?x) increases when (AMOUNT-OF ?x) increases and ?x is a contained liquid. GOAL: (CONTAINED-LIQUID sink-water) SOLUTION: Unify with initial given. Acknowledgements Many thanks go to Ken Forbus ful suggestions hainer with gave Ken Collins helpful Forbus, were Ken comments Brian helpful on this Falkenhainer, The Barry through Contract Falken- Discussions Smith, QPT of Naval and use- and Brian document. the Office direction Forbus in constructing used in the examples. this project for providing on this research. and John domain Research models supported No. N00014-85-K-0225. GOAL: (INCREASE (AMOUNT-OFsrNK-wATER) ) SOLUTION: Apply liquid flow operator with destination SINK and source FAUCET. References [Allen, 831 Allen, Figure 6: Trace of a Plan for Changing a Quantity J.F., ral Intervals”, “Maintaining Knowledge about of the ACM, Communications Tempo- vol. 26, pp. 832-843. most syntactic from QPT features models have allowed Figure of liquid generation 1) involving tities. This The section tities. of simple describes plans (such makes as that which in in quan- limitations. primary naive [Allen and Koomen, ning is its overly changes in quan- gence, while any influence negative causes it to increase, on a quantity causes decreasing Under tively it to these influences more, assumptions, the assumption valid, they flow into #l rising than the sink’s or fools the planner into Further- into thinking the water maximum that level and also these by the operators inequalities. do solve simple problems given posi- negatively inequalities planning. are made instance, a sink drain and lowering. level, assuming as goals during for achieving For tities. greater assumptions 4.3 by increasing a liquid level, assumption level is both the minimum These section level and #2 fools the planner level will become are introduced if a liquid water the water the water lower than can be achieved one of the two quantities. influences thinking some described Although involving water they are changes draining out in not in quanof a sink and a goal of filling the sink, the planner can use the inequality operators on the faucet. to generate lution is partial greater than be resolved rates the drain through and quantity since text. Unfortunately, a rule’s is beyond One limitation pendence on QPT. QPT can QPT currently QPT rate. QPE While changes effects require TPLAN’s ambiguities problems complex could involving for our compiled depend on the con- context-dependent rules and capabilities. of the Operator The compiler affect many are too The so- the flow rate must be on a quantity formulating individuals. that such rate simulation, Compiler is bound the does not provide individuals would planner. specifies be used to model of interacting which a plan which turns since nothing rules, operators 841 Forbus, [Forbus, Intelligence 861 Forbus, Technical inequality physical the additional arises world. definlGons process.) complexity from its de- by the limits to which a mechanism (Process Joint and Koomen, Model”, Conference J.A., “Planof the Proceedings on Artificial Intelli- pp. 741-747. Conference ficial decrease. 2. Any quantity J.F. World K.D., “Qualitative Proceedings on Artificial Reasoning of the Seventh about August, Intelligence, Phys- International 1981. assumptions: on a quantity influence International Processes”, Joint 831 Allen, a Temporal 811 Forbus, ical [Forbus, 1. Any positive Using Eighth [Forbus, shortcoming goals involving several rules shown and changes its current for solving strategy flow, and boiling individuals, Compiler’s strategy The It has been used to compile flow, heat processes, Operator optimistic of QPT. Such For instance, for modeling explicitly sets state imprc~vements in the compiler to and Report nois. Department K.D., 24, K.D., “Qualitative Process Theory”, Arti- 1984. “The Qualitative UEUCDCS-R-86-1288, of Computer Science, Process University December, Engine”, of Illi1986.