concepts.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.

iter_propositions()

Iterate over all propositions that are used in this expression.

relax()

Delete relaxation of a derived predicate.

Attributes

name

The name of the derived predicate.

arguments

The arguments of the derived predicate.

pos_name

The name of the positive proposition corresponding to this derived predicate.

neg_name

The name of the negative proposition corresponding to this derived predicate.

pos_effect

The positive effect of the derived predicate.

neg_effect

The negative effect of the derived predicate.

effects

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 and expression_false are provided.

__new__(**kwargs)#
compile()[source]#

Compile the expression into a function that takes a state as input and returns a boolean value.

Return type:

Callable[[SState], SState]

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:
  • propositions (Set[str]) – the propositions that should be kept.

  • state (SState | None) – the initial state, default to None.

Returns:

the filtered expression.

Return type:

GStripsDerivedPredicate

iter_propositions()[source]#

Iterate over all propositions that are used in this expression.

Return type:

Iterable[str]

relax()[source]#

Delete relaxation of a derived predicate. Essentially, it removes all delete effects for the inner simple assignment expression.

Return type:

GStripsDerivedPredicate

arguments: Tuple[str, ...]#

The arguments of the derived predicate.

effects: Tuple[GSConditionalAssignExpression, ...]#

A tuple of the positive and negative effects of the derived predicate.

name: str#

The name of the derived predicate.

neg_effect: GSConditionalAssignExpression#

The negative effect of the derived predicate.

neg_name: str#

The name of the negative proposition corresponding to this derived predicate.

pos_effect: GSConditionalAssignExpression#

The positive effect of the derived predicate.

pos_name: str#

The name of the positive proposition corresponding to this derived predicate.