Added conditional effect support for SAS translator output.

This commit is contained in:
2016-05-23 18:16:44 +02:00
parent bc5f8edb67
commit 3a2dfd97b8
4 changed files with 113 additions and 50 deletions

View File

@@ -1,8 +1,9 @@
#include <incmode>.
% Check feature requirements
:- requiresFeature(actionCosts, true).
:- requiresFeature(axiomRules, true).
:- requiresFeature(actionCosts).
:- requiresFeature(axiomRules).
:- requiresFeature(conditionalEffects).
#program base.
@@ -18,18 +19,21 @@ holds(Var, Val, 0) :- initialState(Var, Val).
:- occurs(A, t), precondition(A, Var, Val), not holds(Var, Val, t - 1).
% Apply effects
caused(Var, Val, t) :- occurs(A, t), postcondition(A, Var, Val).
caused(Var, Val, t) :- occurs(A, t), contains(A, E), postcondition(E, Var, Val).
modified(Var, t) :- caused(Var, Val, t).
holds(Var, Val, t) :- caused(Var, Val, t).
holds(Var, Val, t) :- holds(Var, Val, t - 1), not modified(Var, t).
% Check that variables without <none of those> values are unique
:- variable(V), Var = variable(V), not contains(Var, noneValue), not 1 {holds(Var, Val, t) : contains(Var, Val)} 1.
:- variable(X), Var = variable(X), not contains(Var, noneValue), not 1 {holds(Var, Val, t) : contains(Var, Val)} 1.
:- contains(Var, noneValue), not {holds(Var, Val, t) : contains(Var, Val)} 1.
% Check mutexes
:- mutexGroup(M), not {holds(Var, Val, t) : contains(M, Var, Val)} 1.
:- mutexGroup(X), M = mutexGroup(X), not {holds(Var, Val, t) : contains(M, Var, Val)} 1.
% Output predicate
do(L, t) :- occurs(A, t), label(A, action(L)).
#program check(t).
@@ -37,4 +41,4 @@ holds(Var, Val, t) :- holds(Var, Val, t - 1), not modified(Var, t).
:- query(t), goal(Var, Val), not holds(Var, Val, t).
#show query/1.
#show occurs/2.
#show do/2.