concepts.pdsketch.domain.State#

class State[source]#

Bases: NamedObjectTensorState

Planning domain state.

Methods

clone()

clone_internals()

Clone the internal state of the state.

extra_state_str_after()

Extra state string.

extra_state_str_before()

Extra state string: add the objects.

generate_tuple_description(domain)

Generate a tuple description of the state.

get_nr_objects_by_type(typename)

Get the number of objects with the given type.

get_typed_index(name[, typename])

Get the typed index of the object with the given name.

get_typename(name)

Get the typename of the object with the given name.

init_dirty_feature(function)

Initialize a dirty feature.

simple_quantize(domain[, features])

Make a quantized version of the state.

summary_string()

Get a summary string of the state.

Attributes

batch_dims

The number of batchified dimensions.

features

internals

Additional internal information about the state.

nr_objects

The number of objects in the current state.

__getitem__(name)#
Parameters:

name (str)

__init__(features, object_names, object_types=None, batch_dims=0, internals=None)#

Initialize the state.

Parameters:
__new__(**kwargs)#
clone()#
Return type:

NamedObjectTensorState

clone_internals()[source]#

Clone the internal state of the state.

extra_state_str_after()#

Extra state string.

Return type:

str

extra_state_str_before()#

Extra state string: add the objects.

Return type:

str

generate_tuple_description(domain)[source]#

Generate a tuple description of the state.

Parameters:

domain (Domain) – the planning domain.

Returns:

the tuple description of the state.

Return type:

Tuple[int, …]

get_nr_objects_by_type(typename)#

Get the number of objects with the given type.

Parameters:

typename (str)

Return type:

int

get_typed_index(name, typename=None)#

Get the typed index of the object with the given name. There is an additional typename argument to specify the type of the object. Because the same object can have multiple types (due to inheritence), the object can have multiple typed indices, one for each type. When the typename is not specified, the default type of the object is used (i.e., the most specific type).

Parameters:
  • name – the name of the object.

  • typename (str | None) – the typename of the object. If not specified, the default type of the object is used (i.e. the most specific type).

Returns:

the typed index of the object.

Return type:

int

get_typename(name)#

Get the typename of the object with the given name.

Parameters:

name (str)

Return type:

str

init_dirty_feature(function)[source]#

Initialize a dirty feature. A dirty feature is a cacheable feature but not in the original state representation. The convention for dirty features is that they are initialized with optimistic values being OPTIM_MAGIC_NUMBER_MAGIC.

Parameters:

function (Function) – the feature to initialize.

simple_quantize(domain, features=None)[source]#

Make a quantized version of the state.

Parameters:
  • domain (Domain) – the planning domain.

  • features – the features to use for quantization. If None, use all state variables.

Returns:

the quantized state.

Return type:

State

summary_string()#

Get a summary string of the state. The main difference between this and __str__ is that this function only formats the shape of intermediate tensors.

Return type:

str

property batch_dims: int#

The number of batchified dimensions. For the basic State, it should be 0.

property features: TensorValueDict#
property internals: Dict[str, Any]#

Additional internal information about the state.

property nr_objects: int#

The number of objects in the current state.