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