more parallel ''exists'' encoding variants
This commit is contained in:
parent
58e784408c
commit
1458d93408
@ -17,11 +17,13 @@ The included encoding files provide the following functionalities:
|
||||
* Parameters: `_parallel` (default value: `0`)
|
||||
* Value `1`: “forall” parallel actions that can be arranged in any sequence
|
||||
* Value `2`: “exists” parallel actions that can be arranged in some sequence
|
||||
* Value `3`: “exists“ parallel actions omitting achievement of preconditions
|
||||
* Value `4`: “exists“ parallel actions like `3` implemented by acyclicity
|
||||
* Otherwise: sequential actions
|
||||
|
||||
### [redundancy.lp](redundancy.lp): enforcement of ‘redundant’ actions to constrain parallel plans
|
||||
* Remarks:
|
||||
* Only relevant together with parallel actions
|
||||
* Only relevant together with parallel actions not implemented by acyclicity
|
||||
* Encoded constraints seem rather ineffective though
|
||||
* Heavy space overhead in combination with “exists” parallel actions
|
||||
|
||||
@ -44,13 +46,23 @@ plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instan
|
||||
|
||||
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - preprocess.lp strips-incremental.lp -c _parallel=2
|
||||
|
||||
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - preprocess.lp strips-incremental.lp -c _parallel=3
|
||||
|
||||
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - preprocess.lp strips-incremental.lp -c _parallel=4
|
||||
|
||||
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - preprocess.lp strips-incremental.lp -c _parallel=1 redundancy.lp
|
||||
|
||||
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - preprocess.lp strips-incremental.lp -c _parallel=2 redundancy.lp
|
||||
|
||||
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - preprocess.lp strips-incremental.lp -c _parallel=3 redundancy.lp
|
||||
|
||||
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - preprocess.lp strips-incremental.lp --outf=1 | grep -A1 -e "ANSWER" | tail -n1 | clingo - postprocess.lp <(plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl)
|
||||
|
||||
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - preprocess.lp strips-incremental.lp --outf=1 -c _parallel=1 | grep -A1 -e "ANSWER" | tail -n1 | clingo - postprocess.lp <(plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl)
|
||||
|
||||
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - preprocess.lp strips-incremental.lp --outf=1 -c _parallel=2 | grep -A1 -e "ANSWER" | tail -n1 | clingo - postprocess.lp <(plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl)
|
||||
|
||||
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - preprocess.lp strips-incremental.lp --outf=1 -c _parallel=3 | grep -A1 -e "ANSWER" | tail -n1 | clingo - postprocess.lp <(plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl)
|
||||
|
||||
plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl | clingo - preprocess.lp strips-incremental.lp --outf=1 -c _parallel=4 | grep -A1 -e "ANSWER" | tail -n1 | clingo - postprocess.lp <(plasp ../../instances/PDDL/ipc-2000-elevator-m10-strips/domain.pddl ../../instances/PDDL/ipc-2000-elevator-m10-strips/problem-04-00.pddl)
|
||||
```
|
||||
|
@ -1,8 +1,9 @@
|
||||
% 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).
|
||||
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).
|
||||
@ -12,22 +13,25 @@ disabled(A,A2) :- disable(A,A2).
|
||||
#program step(t).
|
||||
|
||||
defeated(A,t) :- active(A), postcondition(A,X,V), fluent(X), not holds(X,V,t),
|
||||
_parallel = 1 : _parallel != 2.
|
||||
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).
|
||||
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).
|
||||
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).
|
||||
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), _parallel = 1 : _parallel != 2.
|
||||
:- active(A), not occurs(A,t), not defeated(A,t), 1 < _parallel, _parallel < 4.
|
||||
|
@ -1,6 +1,8 @@
|
||||
% Constant '_parallel' to enable parallel actions
|
||||
% - value '1': "forall" parallel actions that can be arranged in any sequence
|
||||
% - value '2': "exists" parallel actions that can be arranged in some sequence
|
||||
% - value '3': "exists" parallel actions omitting achievement of preconditions
|
||||
% - value '4': "exists" parallel actions like '3' implemented by acyclicity
|
||||
% - otherwise: sequential actions
|
||||
|
||||
#const _parallel = 0.
|
||||
@ -13,15 +15,20 @@
|
||||
|
||||
diverge(A1,A2,X) :- active(A1), active(A2), A1 < A2, postcondition(A1,X,V),
|
||||
has_condition(A2,X,1), not postcondition(A2,X,V),
|
||||
_parallel = 1 : _parallel != 2.
|
||||
0 < _parallel, _parallel < 5.
|
||||
diverge(A1,A2) :- diverge(A1,A2,X).
|
||||
|
||||
exclude(A1,A2) :- diverge(A1,A2), precondition(A1,X,V), _parallel = 1,
|
||||
exclude(A1,A2) :- diverge(A1,A2), precondition(A1,X,V), _parallel != 2,
|
||||
has_condition(A2,X,0), not precondition(A2,X,V).
|
||||
|
||||
disable(A1,A2) :- active(A1), active(A2), A1 != A2, postcondition(A1,X,V),
|
||||
has_condition(A2,X,0), not precondition(A2,X,V),
|
||||
_parallel = 2, not diverge(A1,A2), not diverge(A2,A1).
|
||||
not diverge(A1,A2), not diverge(A2,A1),
|
||||
not exclude(A1,A2), not exclude(A2,A1),
|
||||
1 < _parallel, _parallel < 5.
|
||||
|
||||
disable :- #sum{ 1,A1 : disable(A1,A2), _parallel = 4;
|
||||
-1,A2 : disable(A1,A2), _parallel = 4 } > 0.
|
||||
|
||||
scope(X,V) :- active(A), precondition(A,X,V), _parallel = 2.
|
||||
|
||||
@ -60,7 +67,9 @@ change(X,t) :- holds(X,V,t-1), not holds(X,V,t).
|
||||
|
||||
% Generate actions
|
||||
|
||||
1 {occurs(A,t) : active(A)}.
|
||||
{occurs(A,t) : active(A)}.
|
||||
|
||||
:- not occurs(A,t) : active(A).
|
||||
|
||||
:- occurs(A,t), postcondition(A,X,V), fluent(X), not holds(X,V,t).
|
||||
|
||||
@ -70,7 +79,7 @@ effect(X,t) :- occurs(A,t), postcondition(A,X,V), fluent(X), not precondition(A,
|
||||
|
||||
% Checks w.r.t. parallel mode
|
||||
|
||||
:- _parallel != 1, _parallel != 2, #count{A : occurs(A,t)} > 1.
|
||||
:- _parallel != 1, _parallel != 2, _parallel != 3, _parallel != 4, #count{A : occurs(A,t)} > 1.
|
||||
|
||||
:- _parallel != 2, occurs(A,t), precondition(A,X,V), not holds(X,V,t-1).
|
||||
|
||||
@ -85,11 +94,15 @@ proceed(X,V,t) :- holds(X,V,t-1), scope(X,V).
|
||||
proceed(X,V,t) :- occurs(A,t), postcondition(A,X,V), scope(X,V), not precondition(A,X,V),
|
||||
perform(A,t).
|
||||
|
||||
perform(A1,t) :- active(A1), _parallel = 2, not occurs(A1,t).
|
||||
perform(A1,t) :- active(A1), _parallel = 2,
|
||||
proceed(X,V,t) : precondition(A1,X,V); perform(A2,t) : disable(A1,A2).
|
||||
perform(A1,t) :- active(A1), 1 < _parallel, _parallel < 4, not occurs(A1,t).
|
||||
perform(A1,t) :- active(A1), 1 < _parallel, _parallel < 4,
|
||||
proceed(X,V,t) : precondition(A1,X,V), _parallel = 2;
|
||||
perform(A2,t) : disable(A1,A2).
|
||||
|
||||
:- _parallel = 2, active(A), not perform(A,t).
|
||||
:- 1 < _parallel, _parallel < 4, active(A), not perform(A,t).
|
||||
|
||||
#edge((A1,t),(A2,t)) : occurs(A1,t), disable(A1,A2), _parallel = 4, not disable.
|
||||
#edge((A1,t),(A2,t)) : occurs(A2,t), disable(A1,A2), disable.
|
||||
|
||||
% CHECK PROGRAM
|
||||
|
||||
|
Reference in New Issue
Block a user