## Solution Set 2

### Problem 2

Part A
It will be necessary to add the fluent "empty(B)" meaning that box B is empty.

Action: put(O,B,L)
Preconditions: atc(L), ato(O,L), atb(B,L), empty(B).
Deletelist: ato(O,L), empty(B).

Action: remove(O,B,L)
Preconditions: in(O,B), atb(B,L), atc(L).
Deletelist: in(O,B).

Action: go(LTO, LFROM) -- The courier goes emptyhanded from LTO to LFROM
Preconditions: atc(LFROM).
Dellist: atc(LFROM).

Action: carry(B,LTO,LFROM).
Preconditions: atb(B,LFROM), atc(LFROM).
Deletelist: atb(B,LFROM), atc(LFROM).

Part B .
We illustrate each axiom with one choice of time; the complete set of axioms has these with every choice of time.

Domain constraints:

at_o1_l1_0 => ~at_o1_l2_0
at_o2_l1_0 => ~at_o2_l2_0
(An object is not at two different places at one time.)

at_o1_l1_0 => ~inbox_o1_0
at_o1_l2_0 => ~inbox_o1_0
at_o2_l1_0 => ~inbox_o2_0
at_o2_l2_0 => ~inbox_o2_0
(An object is not both at a location and in the box.)

inbox_o1_0 => ~inbox_o2_0
(The box does not contain both objects.)

at_o1_l1_0 V at_o1_l2_0 V inbox_o1_0.
at_o2_l1_0 V at_o2_l2_0 V inbox_o2_0.
(Each object is either at a location or in the box.)

atbox_l1_0 V atbox_l2_0.
atc_l1_0 V atc_l2_0
(The box and the courier are each at some location.)

atbox_l1_0 => ~atbox_l2_0.
atc_l1_0 => ~atc_l2_0.
(Neither the box nor the courier can be at two locations.)

Causal axioms:

putbox_o1_0 => inbox_o1_1.
putbox_o2_0 => inbox_o2_1.

remove_o1_0 ^ atbox_l1_0 => at_o1_l1_1.
remove_o2_0 ^ atbox_l1_0 => at_o2_l1_1.
remove_o1_0 ^ atbox_l2_0 => at_o1_l2_1.
remove_o2_0 ^ atbox_l2_0 => at_o2_l2_1.

go_l2_0 => atc_l2_1.
go_l1_0 => atc_l1_1.

carry_l2_0 => atc_l2_1 ^ atbox_l2_1
carry_l1_0 => atc_l1_1 ^ atbox_l1_1

Preconditions:

putbox_o1_0 => [atc_l1_0 ^ atbox_l1_0 ^ at_o1_l1_0] V [atc_l2_0 ^ atbox_l2_0 ^ at_o1_l2_0].
putbox_o2_0 => [atc_l1_0 ^ atbox_l1_0 ^ at_o2_l1_0] V [atc_l2_0 ^ atbox_l2_0 ^ at_o2_l2_0].

remove_o1_0 => inbox_o1_0 ^ [[atc_l1_0 ^ atbox_l1_0] V [atc_l2_0 ^ atbox_l2_0]].
remove_o2_0 => inbox_o2_0 ^ [[atc_l1_0 ^ atbox_l1_0] V [atc_l2_0 ^ atbox_l2_0]].

go_l2_0 => atc_l1_0.
go_l1_0 => atc_l2_0.

carry_l1_0 => atc_l2_0 ^ atbox_l2_0.
carry_l2_0 => atc_l1_0 ^ atbox_l1_0.

Frame axioms.

put_o1_0 => [atbox_l1_1 <=> atbox_l1_0].
put_o1_0 => [atc_l1_1 <=> atc_l1_0].
put_o1_0 => [at_o2_l1_1 <=> at_o2_l1_0]
put_o1_0 => [at_o2_l2_1 <=> at_o2_l2_0]
put_o2_0 => [atbox_l1_1 <=> atbox_l1_0].
put_o2_0 => [atc_l1_1 <=> atc_l1_0].
put_o2_0 => [at_o1_l1_1 <=> at_o1_l1_0]
put_o2_0 => [at_o1_l2_1 <=> at_o1_l2_0]

remove_o1_0 => [atbox_l1_1 <=> atbox_l1_0].
remove_o1_0 => [atc_l1_1 <=> atc_l1_0].
remove_o1_0 => [at_o2_l1_1 <=> at_o2_l1_0]
remove_o1_0 => [at_o2_l2_1 <=> at_o2_l2_0]
remove_o2_0 => [atbox_l1_1 <=> atbox_l1_0].
remove_o2_0 => [atc_l1_1 <=> atc_l1_0].
remove_o2_0 => [at_o1_l1_1 <=> at_o1_l1_0]
remove_o2_0 => [at_o1_l2_1 <=> at_o1_l2_0]

go_l1_0 => [atbox_l1_1 <=> atbox_l1_0].
go_l1_0 => [at_o1_l1_1 <=> at_o1_l1_0].
go_l1_0 => [at_o1_l2_1 <=> at_o1_l2_0].
go_l1_0 => [inbox_o1_1 <=> inbox_o1_0].
go_l1_0 => [at_o2_l1_1 <=> at_o2_l1_0].
go_l1_0 => [at_o2_l2_1 <=> at_o1_l2_0].
go_l1_0 => [inbox_o2_1 <=> inbox_o2_0].
go_l2_0 => [atbox_l1_1 <=> atbox_l1_0].
go_l2_0 => [at_o1_l1_1 <=> at_o1_l1_0].
go_l2_0 => [at_o1_l2_1 <=> at_o1_l2_0].
go_l2_0 => [inbox_o1_1 <=> inbox_o1_0].
go_l2_0 => [at_o2_l1_1 <=> at_o2_l1_0].
go_l2_0 => [at_o2_l2_1 <=> at_o1_l2_0].
go_l2_0 => [inbox_o2_1 <=> inbox_o2_0].

carry_l1_0 => [at_o1_l1_1 <=> at_o1_l1_0].
carry_l1_0 => [at_o1_l2_1 <=> at_o1_l2_0].
carry_l1_0 => [inbox_o1_1 <=> inbox_o1_0].
carry_l1_0 => [at_o2_l1_1 <=> at_o2_l1_0].
carry_l1_0 => [at_o2_l2_1 <=> at_o1_l2_0].
carry_l1_0 => [inbox_o2_1 <=> inbox_o2_0].
carry_l2_0 => [at_o1_l1_1 <=> at_o1_l1_0].
carry_l2_0 => [at_o1_l2_1 <=> at_o1_l2_0].
carry_l2_0 => [inbox_o1_1 <=> inbox_o1_0].
carry_l2_0 => [at_o2_l1_1 <=> at_o2_l1_0].
carry_l2_0 => [at_o2_l2_1 <=> at_o1_l2_0].
carry_l2_0 => [inbox_o2_1 <=> inbox_o2_0].

Exactly one action putbox_o1_0 V putbox_o2_0 V remove_o1_0 V remove_o2_0 V go_l1_0 V go_l2_0 V carry_l1_0 V carry_l2_0
~(A1 & A2) for each pair of different actions A1,A2 (28 such axioms).

Part C
(Note: There was a typo in the original version of the problem set. In the initial conditions, read "B2 is empty at L2" rather than "B3 is empty at L2."

Plan 1

POP part I
Begin with two steps:
*START* has effects: ato(o1,l1), in(o2,b1), atb(b1,l2), atc(l2), empty(b3), atb(b2,l3).
*END* has precondition: ato(o1,l2).

POP part II
To achieve the precondition ato(o1,l2) of *END*, add the step S1=remove(o1,?BA,l2), setting a causal link between S1 and *END* with label ato(o1,l2). S1 has preconditions in(o1,?BA), atb(?BA,l2). atc(l2) and effects ato(o1,l2), empty(?BA), ~in(o1,?BA)

POP part III
To achieve the precondition in(o1,?BA) of S1, add step S2=put(o1,?BA,?LA), setting a causal link from S2 to S1 with label in(o1,?BA). S2 has preconditions atc(?LA), ato(o1,?LA), atb(?BA,?LA), empty(?BA), and effects in(o1,?BA), ~ato(o1,?LA), ~empty(?BA).

POP part IV
To achieve the precondition atb(?BA,l2) of S1, add step S3=carry(?BA,?LB,l2), setting a causal link from S3 to S1 with label atb(?BA,l2). S3 has preconditions atb(?BA,?LB), atc(?LB), and effects atb(?BA,l2), atc(l2). ~atb(?BA,?LB), ~atc(?LB).

POP part V
To achieve precondition atc(l2) of S1, add a causal link labelled atc(l2) from S3 to S1.

POP part VI
To achieve precondition ato(o1,?LA) of S2, bind ?LA to l1 and add a causal link from *START* to S2 labelled ato(o1,l1).

POP part VII
To achieve the precondition atc(l1) of S2, add step S4=carry(?BB,?LC,l1), setting a causal link from S4 to S2 with label atc(l1). S4 has preconditions atb(?BB,?LC), atc(?LC) and effects atb(?BB,l1), atc(l1), ~atb(?BB,?LC), ~atc(?LC).

POP part VIII
To achieve the precondition empty(?BA) of S2, add the step S5=remove(?OA,?BA,?LD) setting a causal link from S5 to S2 with label empty(?BA). S5 has preconditions in(?OA,?BA), atb(?BA,?LD), atc(?LD), and effects ato(?OA,?LD), empty(?BA), in(?OA,?BA).

POP part IX
To achieve precondition atb(?BA,?LB) of S3, bind ?BB to ?BA and ?LB to l1, and add a causal link labelled atb(?BA,l1) from S4 to S3.

POP part X
To achieve precondition atc(l1) of S3, add a causal link labelled atc(l1) from S4 to S3.

POP part XI
To achieve precondition atb(?BA,?LC) of S4, bind ?BA to b1 and ?LC to l2 and add a causal link from *START* to S4 labelled atb(b1,l2).

POP part XII
To achieve precondition atc(?LC) of S4, bind ?LC to l2 and set a causal link from *START* to s4 labelled atc(l2).

POP parts XIII, XIV, XV
To achieve preconditions in(?OA,b1), atb(b1,l2), atc(l2) of S5, bind ?OA to o2, ?BA to b1, and set the corresponding causal links from *START* to S5.

POP part XVI
The effect ~atb(b1,l1) of S3 potentially clobbers the causal link from S4 to S2 labelled atb(b1,l1). Therefore, add a temporal link placing S3 after S2.

POP part XVII
The effect ~atb(b1,l2) of S4 potentially clobbers the causal link from *START* to S5 labelled atb(b1,l2). Therefore, add a temporal link placing S4 after S5.

Plan 2

Parts I through X are the same as for plan 1.

POP part XI
To achieve precondition atb(?BA,?LC) of S4, bind ?BA to b1 and ?LC to l2, and set a causal link from *START* to S4 labelled atb(b1,l2).

POP part XII
To achieve precondition atc(l2) of S4, set a causal link from *START* to S4 labelled atc(l2).

POP part XIII
To achieve precondition in(?OA,b1) of S5, bind ?OA to o2 and set a causal link from *START* to S5 labelled in(o2,b1).

POP part XIV
To achieve precondition atb(b1,?LD) of S5, bind ?LD to l1, and add a causal link labelled atb(b1,l1) from S4 to S5.

POP part XV
To achieve precondition atc(l1) of S5, add a causal link labelled atc(l1) to S5.

POP part XVI
The effect ~atb(b1,l1) of S3 potentially clobbers the causal link from S4 to S2 labelled atb(b1,l1). Therefore, add a temporal link placing S3 after S2.

Plan 3

Parts I-VI are the same as in plan 1.

POP part VII
To achieve the precondition atc(l1) of S2, add step S4=carry(?BB,?LC,l1), setting a causal link from S4 to S2 with label atc(l1). S4 has preconditions atc(?LC), atb(?BB,?LC) and effects atc(l1), atb(?BB,l1), ~atc(?LC), ~atb(?BB,?LC).

POP part VIII
To achieve the precondition empty(?BA) of S2, bind ?BA to b2 and add a causal link from *START* to S2.

POP part IX
To achieve precondition atb(b2,?LB) of S3, bind ?LB to l1 and ?BB to b2, and add a causal link labelled atb(b2,l1) from S4 to S3.

POP part X
To achieve precondition atc(l1) of S3, add a causal link labelled atc(l1) from S4 to S3.

POP part XI
To achieve precondition atc(?LC) of S4, add a step S5=go(?LD,?LC) and set a causal link labelled atc(?LC) from S5 to S4. The precondition of S5 is atc(?LD) and the effects are atc(?LC), ~atc(?LD).

POP part XII
To achieve precondition atb(b2,?LC) of S5, bind ?LC to l3 and set a causal link from *START* to S5 labelled atb(b2,l3).

POP part XIII
To achieve precondition atc(?LD) of S5, bind ?LD to l2 and set a causal link from *START* to S5 labelled atc(l2).

POP part XVI
The effect ~atc(l1) of S3 potentially clobbers the causal link from S4 to S2 labelled atc(l1). Therefore, add a temporal link placing S3 after S2.