patrick
/
plasp
Archived
1
0
Fork 0

Added simple encoding for translated PDDL instances.

This commit is contained in:
Patrick Lühne 2016-06-13 03:48:04 +02:00
parent 6b88cb7926
commit 7899d3e262
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
#include <incmode>.
#program base.
% Establish initial state
holds(Predicate, 0) :- initialState(Predicate).
#program step(t).
% Perform actions
1 {occurs(action(Action), t) : action(Action)} 1.
% Check preconditions
:- occurs(Action, t), precondition(Action, Predicate, true), not holds(Predicate, t - 1).
:- occurs(Action, t), precondition(Action, Predicate, false), holds(Predicate, t - 1).
% Apply effects
caused(Predicate, true, t) :- occurs(Action, t), postcondition(Action, Predicate, true).
caused(Predicate, false, t) :- occurs(Action, t), postcondition(Action, Predicate, false).
holds(Predicate, t) :- caused(Predicate, true, t).
holds(Predicate, t) :- holds(Predicate, t - 1), not caused(Predicate, false, t).
#program check(t).
% Verify that goal is met
:- query(t), goal(Predicate, true), not holds(Predicate, t).
:- query(t), goal(Predicate, false), holds(Predicate, t).
#show query/1.
#show occurs/2.