Problem Detail: 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)
Asked By : compski
Answered By : Pål GD
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}. $$
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/13257