UPState

class unified_planning.model.UPState(values: Dict[FNode, FNode], problems_fluent_set: FluentsSetMixin, _father: UPState | None = None)[source]

Bases: State

unified_planning implementation of the State interface.

It uses problems_fluent_set to be aware of problem’s fluents’ defaults, so that default values need not be stored, which saves space.

This class has an optional field MAX_ANCESTORS set to 20.

The higher this number is, the less memory the data structure will use. The lower this number is, the less time the data structure will need to retrieve a value.

To set your own number just extend this class and re-define the MAX_ANCESTORS value. It must be > 0

MAX_ANCESTORS: int | None = 20
get_value(fluent: FNode) FNode[source]

This method retrieves the value of the given fluent in the State. NOTE that the searched fluent must be set in the state otherwise an exception is raised.

Params fluent:

The fluent searched for in the UPState.

Returns:

The value set for the given fluent.

Raises:

UPStateMissingFluentError – If the fluent is not present in the state.

make_child(updated_values: Dict[FNode, FNode]) UPState[source]

Returns a different UPState in which every value in updated_values.keys() is evaluated as this mapping in new the updated_values dict and every other value is evaluated as in self.

Parameters:

updated_values – The dictionary that contains the values that need to be updated in the new UPState.

Returns:

The new UPState created.