These are 5 action descriptions with conditional effects:

Action(A, Precond:{X}, Effect:{when P : ~X), Z})

Action(B, Precond:{Y}, Effect:{when Z : ~P), ~Y,~Z,X})

Action(C, Precond:{~Z}, Effect:{when P : ~X), Y})

Action(D, Precond:{~X}, Effect:{when Q : X)})

Action(E, Precond:{Z}, Effect:{when Q : ~Z)})

What state would result from executing the action sequence [E,D,A,B,C] in the state {P,Q,Y,Z}?

I know the answer but I really don't know how to achieve it. Anyone please shed some light? (Please include workings)


I will turn my comment into an answer. Recall that if your state is $\{P,Q,Y,Z\}$, and an effect of an action is $\sim\!Z$ (from now on written $\neg Z$), then the new state will not contain $Z$, i.e., the state will be, if nothing else is an effect, $\{P,Q,Y\}$.

Since the question asks what the result of a sequence of actions will be, we need to solve this in the order of that sequence. The sequence asked was $[E,D,A,B,C]$, and the state was $\{P,Q,Y,Z\}$? Observe that we by square brackets denote a sequence (i.e., an ordered list) and by curly brackets, an unordered set (the usual kind).

Action $E$ in state $\{P,Q,Y,Z\}$: Precondition $Z$ is good since $Z$ is in the state. Effect is "when $Q$, $\neg Z$". The new state will thus be $\{P,Q,Y\}$. We omit writing $\neg Z$ since every element not occurring in the state will be assumed to be not held.

Action $D$ in state $\{P,Q,Y\}$: Precondition $\neg X$ is good. Effect: "when $Q$, $X$". Hence new state will be $\{P,Q,X,Y\}$.

Action $A$ in state $\{P,Q,X,Y\}$: Precondition is good, $X$ is in the state. Effect: "when $P$, $\neg X$, and $Z$". $P$ is in the state, hence we remove $X$ and we also add $Z$. New state is $\{P,Q,Y,Z\}$.

Action $B$ in state $\{P,Q,Y,Z\}$: Precondition $Y$ is good. Effect "when $Z$, $\neg P$, also $\neg Y$, $\neg Z$ and $X$". $Z$ is true, hence we lose $P$. We also lose $Y$ and $Z$ and gain $X$. New state is $\{Q,X\}$.

Action $C$ in state $\{Q,X\}$: Precondition is $\neg Z$, so good. Effect: "when $P$, $\neg X$, and $Y$". This is the first time we encounter an implication in which the antecedent $P$ is false, so we don't remove $X$. We still add $Y$, though. Hence the new, and final state is $$ \{Q,X,Y\}. $$

  • $\begingroup$ wow I didn't expect an answer this detailed. Thank you so much I now fully understand how the flow works now! Too bad I don't have enough rep to vote you up.. $\endgroup$ – compski Jul 17 '13 at 9:59
  • $\begingroup$ didn't know "Action(B, Precond:{Y}, Effect:{when Z : ~P), ~Y,~Z,X})" means if there is a Y in {P,Q,Y,Z} replace Z by deleting P,Y and put X in it so it becomes {Q,X}. I was thinking why on earth doesn't the EFFECT include all the states into a bracket like {(when Z:~P,~Y,~Z,X)}) confused me loads $\endgroup$ – compski Jul 17 '13 at 10:10
  • $\begingroup$ There is a typo in your example, it should be: Action(B, Precond:{Y}, Effect:{(when Z : ~P), ~Y,~Z,X}). It means that if you want to do Action B, you need to have Y in your state. Furthermore, after action B has been done, you do not have Y, nor Z, but you have X. Furthermore, if Z was in the state before the action, then you will no longer have P. $\endgroup$ – Pål GD Jul 17 '13 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.