concepts.dm.pdsketch.strips.strips_grounding.GStripsOperator#

class GStripsOperator[source]#

Bases: object

A grounded STRIPS operator, the STRIPS version of the OperatorApplier. By grounded we mean that all the preconditions / effects are propositions.

Methods

applicable(state)

Return whether the operator is applicable to the state.

apply(state)

Apply the operator to the state.

compile()

Generate the compiled version of the operator (preconditions and effects).

filter_propositions(propositions[, state])

Filter the propositions in this expression.

iter_propositions()

Iterate over all the propositions used in the operator, including both preconditions and effects.

Attributes

precondition

The precondition for the operator.

effects

The effects for the operator.

implicit_propositions

Implicit preconditions.

raw_operator

The raw operator.

precondition_func

An compiled version of the precondition tester.

effects_func

A list of compiled version of the effect appliers.

__init__(precondition, effects, raw_operator, implicit_propositions=None)[source]#
Parameters:
__new__(**kwargs)#
applicable(state)[source]#

Return whether the operator is applicable to the state.

Parameters:

state (SState | Set[str]) – the current state.

Returns:

True if the operator is applicable, False otherwise. When the FORWARD_DIFF mode is enabled for GSBoolExpression, this function will return a GSBoolForwardDiffReturn object.

Return type:

bool | GSBoolForwardDiffReturn

apply(state)[source]#

Apply the operator to the state. Note that this function does not check the precondition. To do that, use applicable() before calling this function.

Parameters:

state (SState) – the current state.

Returns:

the new state after applying the operator.

Return type:

SState

compile()[source]#

Generate the compiled version of the operator (preconditions and effects).

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. See filter_propositions() for more details.

Parameters:
  • propositions (Set[str]) – the propositions to keep.

  • state (SState | None) – the initial state for filtering the propositions.

Returns:

a new operator with filtered propositions.

Return type:

GStripsOperator

iter_propositions()[source]#

Iterate over all the propositions used in the operator, including both preconditions and effects.

Return type:

Iterable[str]

effects: Tuple[GSVariableAssignmentExpression, ...]#

The effects for the operator.

effects_func: Tuple[Callable[[SState], SState], ...] | None#

A list of compiled version of the effect appliers.

implicit_propositions: Set[str]#

Implicit preconditions.

precondition: GSBoolOutputExpression#

The precondition for the operator.

precondition_func: Callable[[SState], bool] | None#

An compiled version of the precondition tester.

raw_operator: OperatorApplier#

The raw operator. Note that since the strips operator is grounded, the raw operator is the concepts.dm.pdsketch.operator.OperatorApplier instance.