This repository has been archived on 2023-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
plasp/encodings/strips/redundancy.lp

38 lines
1.7 KiB
Plaintext
Raw Normal View History

% Additional rules for enforcing the inclusion of parallel actions in plans,
% whenever such 'redundant' actions are compatible with states and other actions
compatible(A,A1) :- active(A), active(A1), A != A1, 1 < _parallel, _parallel < 4,
not diverge(A,A1), not diverge(A1,A),
not exclude(A,A1), not exclude(A1,A).
compatible(A) :- compatible(A,A1).
disable(A,A1,A2) :- disable(A1,A2), compatible(A,A1), compatible(A,A2).
disabled(A,A2) :- disable(A,A1,A2).
disabled(A,A2) :- disable(A,A2).
2016-11-15 19:34:07 +01:00
#program step(t).
defeated(A,t) :- active(A), postcondition(A,X,V), fluent(X), not holds(X,V,t),
1 < _parallel, _parallel < 4.
defeated(A,t) :- _parallel = 1, active(A), precondition(A,X,V), not holds(X,V,t-1).
defeated(A,t) :- _parallel = 1, active(A), precondition(A,X,V), not holds(X,V,t).
defeated(A,t) :- _parallel = 1, active(A), postcondition(A,X,V), not precondition(A,X,V),
single(X,t).
defeated(A,t) :- _parallel = 3, active(A), precondition(A,X,V), not holds(X,V,t-1).
proceed(A,X,V,t) :- compatible(A), holds(X,V,t-1), scope(X,V).
2016-11-15 19:34:07 +01:00
proceed(A,X,V,t) :- compatible(A,A1), occurs(A1,t), perform(A,A1,t),
postcondition(A1,X,V), scope(X,V), not precondition(A1,X,V).
2016-11-15 19:34:07 +01:00
perform(A,A1,t) :- disabled(A,A1), not occurs(A1,t).
perform(A,A1,t) :- compatible(A,A1),
proceed(A,X,V,t) : precondition(A1,X,V), _parallel = 2;
perform(A,A2,t) : disable(A,A1,A2).
defeated(A,t) :- compatible(A), precondition(A,X,V), not proceed(A,X,V,t), _parallel = 2.
defeated(A,t) :- compatible(A), disable(A,A2), not perform(A,A2,t).
:- active(A), not occurs(A,t), not defeated(A,t), 1 < _parallel, _parallel < 4.