2016-11-15 18:57:52 +01:00
|
|
|
% Additional rules for enforcing the inclusion of parallel actions in plans,
|
|
|
|
% whenever such 'redundant' actions are compatible with states and other actions
|
|
|
|
|
2017-01-17 10:12:37 +01:00
|
|
|
% BASE PROGRAM
|
|
|
|
|
2017-01-17 17:15:21 +01:00
|
|
|
selfdefeat(A) :- selfdefeat(A,X).
|
|
|
|
disjoin(A,A1) :- active(A), has_condition(A,X,P), selfdefeat(A1,X), not selfdefeat(A).
|
2017-01-17 10:12:37 +01:00
|
|
|
|
2017-01-16 17:15:19 +01:00
|
|
|
compatible(A,A1) :- active(A), active(A1), A != A1, 1 < _parallel, _parallel < 4,
|
2017-01-17 17:15:21 +01:00
|
|
|
not diverge(A,A1), not exclude(A,A1), not disable(A,A1) : disable(A1,A).
|
2016-11-15 21:16:01 +01:00
|
|
|
compatible(A) :- compatible(A,A1).
|
2017-01-17 17:15:21 +01:00
|
|
|
compatible(A) :- active(A), active(A1), A != A1, _parallel = 1, not selfdefeat(A),
|
|
|
|
not diverge(A,A1), not exclude(A,A1), not disjoin(A,A1).
|
2016-11-15 21:16:01 +01:00
|
|
|
|
2017-01-18 10:12:52 +01:00
|
|
|
disable(A,A1,A2) :- compatible(A,A1), compatible(A,A2), compatible(A1,A2),
|
|
|
|
disable(A1,A2), not disable(A1,A).
|
2016-11-15 19:34:07 +01:00
|
|
|
|
2017-01-17 17:15:21 +01:00
|
|
|
disabled(A,A2) :- disable(A,A1,A2).
|
2017-01-18 10:12:52 +01:00
|
|
|
disabled(A,A1) :- compatible(A), disable(A,A1).
|
2017-01-17 10:12:37 +01:00
|
|
|
|
2017-01-17 17:15:21 +01:00
|
|
|
% STEP PROGRAM
|
2016-11-15 18:57:52 +01:00
|
|
|
|
2017-01-17 17:15:21 +01:00
|
|
|
#program step(t).
|
2016-11-15 18:57:52 +01:00
|
|
|
|
2017-01-17 17:15:21 +01:00
|
|
|
defeated(A,t) :- compatible(A), postcondition(A,X,V), fluent(X), not holds(X,V,t).
|
2016-11-15 18:57:52 +01:00
|
|
|
|
2017-01-17 17:15:21 +01:00
|
|
|
defeated(A,t) :- compatible(A), precondition(A,X,V), not holds(X,V,t-1), _parallel != 2.
|
|
|
|
defeated(A,t) :- compatible(A), precondition(A,X,V), not has_condition(A,X,1), not holds(X,V,t),
|
|
|
|
_parallel = 1.
|
|
|
|
defeated(A,t) :- compatible(A), has_condition(A,X,1), not has_condition(A,X,0), single(X,t).
|
2017-01-16 17:15:19 +01:00
|
|
|
|
2016-11-15 21:16:01 +01:00
|
|
|
proceed(A,X,V,t) :- compatible(A), holds(X,V,t-1), scope(X,V).
|
2017-01-17 17:15:21 +01:00
|
|
|
proceed(A,X,V,t) :- compatible(A,A1), not disable(A1,A), perform(A,A1,t), occurs(A1,t),
|
|
|
|
scope(X,V), postcondition(A1,X,V), not precondition(A1,X,V).
|
2016-11-15 18:57:52 +01:00
|
|
|
|
2017-01-17 17:15:21 +01:00
|
|
|
perform(A,A1,t) :- compatible(A,A1), not disable(A1,A),
|
2017-01-16 17:15:19 +01:00
|
|
|
proceed(A,X,V,t) : precondition(A1,X,V), _parallel = 2;
|
2017-01-18 10:12:52 +01:00
|
|
|
alright(A,A2,t) : disable(A,A1,A2).
|
|
|
|
|
|
|
|
alright(A,A1,t) :- disabled(A,A1), not occurs(A1,t).
|
|
|
|
alright(A,A1,t) :- perform(A,A1,t).
|
2016-11-15 18:57:52 +01:00
|
|
|
|
2017-01-16 17:15:19 +01:00
|
|
|
defeated(A,t) :- compatible(A), precondition(A,X,V), not proceed(A,X,V,t), _parallel = 2.
|
2017-01-18 10:12:52 +01:00
|
|
|
defeated(A,t) :- compatible(A), disable(A,A1), not alright(A,A1,t).
|
2016-11-15 18:57:52 +01:00
|
|
|
|
2017-01-17 17:15:21 +01:00
|
|
|
:- compatible(A), not occurs(A,t), not defeated(A,t), 0 < _parallel, _parallel < 4.
|