concepts.pdsketch.strips.strips_grounded_expression.GSSASAssignExpression#

class GSSASAssignExpression[source]#

Bases: GSVariableAssignmentExpression

A SAS assignment expression. It is represented as the name for the SAS predicate, the size of the SAS predicate, a list of assignments, and a mapping from Boolean expressions to integers (the value of the SAS assignment).

Methods

compile()

Compile the SAS assignment expression to a function.

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 SAS assignment.

to_conditional_assignments()

Convert the SAS assignment to a list of conditional assignments.

Attributes

sas_name

The name of the SAS predicate.

sas_size

The size of the SAS predicate.

arguments

The arguments of the SAS predicate.

arguments_str

A string format for the arguments of the SAS predicate.

all_bool_predicates

All the Boolean propositions of the SAS predicate.

all_neg_bool_predicates

All the negated Boolean propositions of the SAS predicate.

expression

The expressions for SAS assignments, which is a mapping from integers to Boolean expressions.

__init__(sas_name, sas_size, arguments, expression)[source]#

Initialize the SAS assignment expression.

Parameters:
  • sas_name (str) – the name of the SAS predicate.

  • sas_size (int) – the size of the SAS predicate.

  • arguments (Sequence[str]) – the arguments of the SAS predicate.

  • expression (Dict[int, GSBoolOutputExpression]) – the expressions for SAS assignments.

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

Compile the SAS assignment expression to a function.

Warning

This method is deprecated and will be removed in the future. Use the to_conditional_assignments() or relax() methods instead.

Returns:

the compiled function.

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:

GSSASAssignExpression

iter_propositions()[source]#

Iterate over all propositions that are used in this expression.

Return type:

Iterable[str]

relax()[source]#

Delete relaxation of a SAS assignment. Essentially, it removes all delete effects for the inner simple assignment expression. Note that this method returns a list of conditional assignments, instead of a single SASAssignment.

Returns:

a list of delete-relaxed SAS assignment expression.

Return type:

List[GSConditionalAssignExpression]

to_conditional_assignments()[source]#

Convert the SAS assignment to a list of conditional assignments.

Returns:

a list of conditional assignments.

Return type:

List[GSVariableAssignmentExpression]

all_bool_predicates: FrozenSet[str]#

All the Boolean propositions of the SAS predicate.

all_neg_bool_predicates: FrozenSet[str]#

All the negated Boolean propositions of the SAS predicate.

arguments: Sequence[str]#

The arguments of the SAS predicate.

arguments_str: str#

A string format for the arguments of the SAS predicate.

expression: Dict[int, GSBoolOutputExpression]#

The expressions for SAS assignments, which is a mapping from integers to Boolean expressions.

sas_name: str#

The name of the SAS predicate.

sas_size: int#

The size of the SAS predicate.