concepts.dm.pdsketch.strips.strips_grounded_expression.GStripsDerivedPredicate#
- class GStripsDerivedPredicate[source]#
Bases:
GSExpression
Grounded STRIPS version of derived predicates.
Methods
compile
()Compile the expression into a function that takes a state as input and returns a boolean value.
filter_propositions
(propositions[, state])Filter the propositions in this expression.
Iterate over all propositions that are used in this expression.
relax
()Delete relaxation of a derived predicate.
Attributes
The name of the derived predicate.
The arguments of the derived predicate.
The name of the positive proposition corresponding to this derived predicate.
The name of the negative proposition corresponding to this derived predicate.
The positive effect of the derived predicate.
The negative effect of the derived predicate.
A tuple of the positive and negative effects of the derived predicate.
- __init__(name, arguments, expression_true=None, expression_false=None, is_relaxed=False, effects=None)[source]#
Initialize the grounded derived predicate.
- Parameters:
name (str) – the name of the derived predicate.
arguments (Sequence[str]) – the arguments of the derived predicate.
expression_true (GSBoolOutputExpression | None) – the expression for the true case. Optional if
effects
is provided.expression_false (GSBoolOutputExpression | None) – the expression for the false case. Optional if
effects
is provided.is_relaxed (bool) – whether the derived predicate has been delete-relaxed.
effects (Iterable[GSConditionalAssignExpression] | None) – the effects of the derived predicate. Optional if
expression_true
andexpression_false
are provided.
- __new__(**kwargs)#
- compile()[source]#
Compile the expression into a function that takes a state as input and returns a boolean value.
- filter_propositions(propositions, state=None)[source]#
Filter the propositions in this expression. Only the propositions in the given set will be kept. Note that this function also takes a state as input, essentially, the state is the initial state of the environment, and the propositions contains all propositions that will be possibly changed by actions. Therefore, for propositions outside the propositions set, their value will stay as the same value as in the initial state. See, for example, the implementation for
GSSimpleBoolExpression.filter_propositions()
for more details.- Parameters:
- Returns:
the filtered expression.
- Return type:
- relax()[source]#
Delete relaxation of a derived predicate. Essentially, it removes all delete effects for the inner simple assignment expression.
- Return type:
- effects: Tuple[GSConditionalAssignExpression, ...]#
A tuple of the positive and negative effects of the derived predicate.
- neg_effect: GSConditionalAssignExpression#
The negative effect of the derived predicate.
- pos_effect: GSConditionalAssignExpression#
The positive effect of the derived predicate.