Updated PDDL meta encoding to recent changes of output format.
This commit is contained in:
parent
340db244f6
commit
f2d3aee662
@ -3,29 +3,34 @@
|
|||||||
#program base.
|
#program base.
|
||||||
|
|
||||||
% Establish initial state
|
% Establish initial state
|
||||||
holds(Predicate, 0) :- initialState(Predicate).
|
holds(Variable, Value, 0) :- initialState(Variable, Value).
|
||||||
|
holds(variable(Variable), value(Variable, false), 0) :- variable(variable(Variable)), {initialState(variable(Variable), _)} 0.
|
||||||
|
|
||||||
#program step(t).
|
#program step(t).
|
||||||
|
|
||||||
% Perform actions
|
% Perform actions
|
||||||
1 {occurs(action(Action), t) : action(Action)} 1.
|
1 {occurs(Action, t) : action(Action)} 1.
|
||||||
|
|
||||||
% Check preconditions
|
% Check preconditions
|
||||||
:- occurs(Action, t), precondition(Action, Predicate, true), not holds(Predicate, t - 1).
|
:- occurs(Action, t), precondition(Action, Variable, Value), not holds(Variable, Value, t - 1).
|
||||||
:- occurs(Action, t), precondition(Action, Predicate, false), holds(Predicate, t - 1).
|
|
||||||
|
|
||||||
% Apply effects
|
% Apply effects
|
||||||
caused(Predicate, true, t) :- occurs(Action, t), postcondition(Action, Predicate, true).
|
caused(Variable, Value, t) :- occurs(Action, t), postcondition(Action, _, Variable, Value).
|
||||||
caused(Predicate, false, t) :- occurs(Action, t), postcondition(Action, Predicate, false).
|
modified(Variable, t) :- caused(Variable, Value, t).
|
||||||
|
|
||||||
holds(Predicate, t) :- caused(Predicate, true, t).
|
holds(Variable, Value, t) :- caused(Variable, Value, t).
|
||||||
holds(Predicate, t) :- holds(Predicate, t - 1), not caused(Predicate, false, t).
|
holds(Variable, Value, t) :- holds(Variable, Value, t - 1), not modified(Variable, t).
|
||||||
|
|
||||||
|
% Check that variables have unique values
|
||||||
|
:- variable(Variable), not 1 {holds(Variable, Value, t) : contains(Variable, Value)} 1.
|
||||||
|
|
||||||
|
% Check mutexes
|
||||||
|
%:- mutexGroup(MutexGroup), not {holds(Variable, Value, t) : contains(MutexGroup, Variable, Value)} 1.
|
||||||
|
|
||||||
#program check(t).
|
#program check(t).
|
||||||
|
|
||||||
% Verify that goal is met
|
% Verify that goal is met
|
||||||
:- query(t), goal(Predicate, true), not holds(Predicate, t).
|
:- query(t), goal(Variable, Value), not holds(Variable, Value, t).
|
||||||
:- query(t), goal(Predicate, false), holds(Predicate, t).
|
|
||||||
|
|
||||||
#show query/1.
|
#show query/1.
|
||||||
#show occurs/2.
|
#show occurs/2.
|
||||||
|
Reference in New Issue
Block a user