concepts.dm.pdsketch.strips.strips_grounded_expression.GSConditionalAssignExpression#

class GSConditionalAssignExpression[source]#

Bases: GSVariableAssignmentExpression

A conditional assignment expression. Note that the inner expression must be a simple assignment expression. Therefore , a conditional assignment expression is represented by a condition, a set of add effects, and a set of delete effects.

Methods

applicable(state)

Check if the conditional assignment expression is applicable in the given state.

apply(state)

Apply the conditional assignment expression in the given state.

compile()

Compile the assignment expression into a function.

filter_propositions(propositions[, state])

Filter the given propositions from the expression.

iter_propositions()

Iterate over all propositions that are used in this expression.

relax()

Delete relaxation of a conditional assignment.

Attributes

add_effects

The add effects of the conditional assignment expression.

del_effects

The delete effects of the conditional assignment expression.

condition

The condition of the conditional assignment expression.

assignment

The inner (simple) assignment expression of the conditional assignment expression.

condition_func

The compiled condition function.

assignment_func

The compiled assignment function.

__init__(condition, assignment)[source]#

Initialize the conditional assignment expression.

Parameters:
__new__(**kwargs)#
applicable(state)[source]#

Check if the conditional assignment expression is applicable in the given state.

Parameters:

state (SState)

Return type:

bool | GSBoolForwardDiffReturn

apply(state)[source]#

Apply the conditional assignment expression in the given state.

Parameters:

state (SState)

Return type:

SState

compile()[source]#

Compile the assignment expression into a function. By default, the function will return the state with the add and delete effects applied.

Return type:

Callable[[SState], SState]

filter_propositions(propositions, state=None)[source]#

Filter the given propositions from the expression. For conditional assignment expressions, the filtering is done by filtering the inner simple assignment expression and the condition.

Parameters:
  • propositions (Set[str]) – the propositions that should be kept.

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

Returns:

the conditional assignment expression after filtering.

Return type:

GSConditionalAssignExpression

iter_propositions()[source]#

Iterate over all propositions that are used in this expression.

Return type:

Iterable[str]

relax()[source]#

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

Returns:

the delete relaxed conditional assignment expression.

Return type:

GSConditionalAssignExpression

property add_effects: FrozenSet[str]#

The add effects of the conditional assignment expression.

assignment: GSSimpleBoolAssignExpression#

The inner (simple) assignment expression of the conditional assignment expression.

assignment_func: Callable[[SState], SState] | None#

The compiled assignment function.

condition: GSBoolOutputExpression#

The condition of the conditional assignment expression.

condition_func: Callable[[SState], bool | GSBoolForwardDiffReturn] | None#

The compiled condition function.

property del_effects: FrozenSet[str]#

The delete effects of the conditional assignment expression.