From 367f49253e9b8498c3fccba9ea659ef3b060ade9 Mon Sep 17 00:00:00 2001 From: gebser Date: Tue, 15 Nov 2016 21:16:01 +0100 Subject: [PATCH] finalizing redundant rules to restrict number of parallel plans --- encodings/strips/redundancy.lp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/encodings/strips/redundancy.lp b/encodings/strips/redundancy.lp index ad8b891..ef67f92 100644 --- a/encodings/strips/redundancy.lp +++ b/encodings/strips/redundancy.lp @@ -1,11 +1,13 @@ % 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, _parallel = 2, - not diverge(A,A1), not diverge(A1,A). -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), _parallel = 2. +compatible(A,A1) :- active(A), active(A1), A != A1, _parallel = 2, + not diverge(A,A1), not diverge(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). #program step(t). @@ -17,16 +19,15 @@ 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). -proceed(A,X,V,t) :- active(A), holds(X,V,t-1), scope(X,V). +proceed(A,X,V,t) :- compatible(A), holds(X,V,t-1), scope(X,V). 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). 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); perform(A,A2,t) : disable(A,A1,A2). -perform(A,A,t) :- active(A), _parallel = 2, - proceed(A,X,V,t) : precondition(A,X,V); perform(A,A2,t) : disable(A,A2). -defeated(A,t) :- _parallel = 2, active(A), not perform(A,A,t). +defeated(A,t) :- compatible(A), precondition(A,X,V), not proceed(A,X,V,t). +defeated(A,t) :- compatible(A), disable(A,A2), not perform(A,A2,t). :- active(A), not occurs(A,t), not defeated(A,t), _parallel = 1 : _parallel != 2.