2016-05-22 22:50:20 +02:00
|
|
|
#include <incmode>.
|
|
|
|
|
2016-05-23 16:57:12 +02:00
|
|
|
% Check feature requirements
|
2016-05-23 18:16:44 +02:00
|
|
|
:- requiresFeature(actionCosts).
|
|
|
|
:- requiresFeature(axiomRules).
|
|
|
|
:- requiresFeature(conditionalEffects).
|
2016-05-23 16:57:12 +02:00
|
|
|
|
2016-05-22 22:50:20 +02:00
|
|
|
#program base.
|
|
|
|
|
|
|
|
% Establish initial state
|
2016-05-23 16:28:06 +02:00
|
|
|
holds(Var, Val, 0) :- initialState(Var, Val).
|
2016-05-22 22:50:20 +02:00
|
|
|
|
|
|
|
#program step(t).
|
|
|
|
|
|
|
|
% Perform actions
|
2016-05-23 16:28:06 +02:00
|
|
|
1 {occurs(action(A), t) : action(A)} 1.
|
2016-05-22 22:50:20 +02:00
|
|
|
|
|
|
|
% Check preconditions
|
2016-05-23 16:28:06 +02:00
|
|
|
:- occurs(A, t), precondition(A, Var, Val), not holds(Var, Val, t - 1).
|
2016-05-22 22:50:20 +02:00
|
|
|
|
|
|
|
% Apply effects
|
2016-05-24 01:42:15 +02:00
|
|
|
caused(Var, Val, t) :- occurs(A, t), postcondition(A, _, Var, Val).
|
2016-05-23 16:28:06 +02:00
|
|
|
modified(Var, t) :- caused(Var, Val, t).
|
2016-05-22 22:50:20 +02:00
|
|
|
|
2016-05-23 16:28:06 +02:00
|
|
|
holds(Var, Val, t) :- caused(Var, Val, t).
|
|
|
|
holds(Var, Val, t) :- holds(Var, Val, t - 1), not modified(Var, t).
|
2016-05-23 00:24:48 +02:00
|
|
|
|
2016-05-24 01:42:15 +02:00
|
|
|
% Check that variables have unique values
|
|
|
|
:- variable(X), Var = variable(X), not 1 {holds(Var, Val, t) : contains(Var, Val)} 1.
|
2016-05-23 16:45:55 +02:00
|
|
|
|
|
|
|
% Check mutexes
|
2016-05-23 18:16:44 +02:00
|
|
|
:- mutexGroup(X), M = mutexGroup(X), not {holds(Var, Val, t) : contains(M, Var, Val)} 1.
|
|
|
|
|
2016-05-22 22:50:20 +02:00
|
|
|
#program check(t).
|
|
|
|
|
|
|
|
% Verify that goal is met
|
2016-05-23 16:28:06 +02:00
|
|
|
:- query(t), goal(Var, Val), not holds(Var, Val, t).
|
2016-05-22 22:50:20 +02:00
|
|
|
|
|
|
|
#show query/1.
|
2016-05-24 01:42:15 +02:00
|
|
|
#show occurs/2.
|