state_enum

maintains enumerations of states in order to define indexing schemes

class cmepy.state_enum.StateEnum(initial_states)

Maintains bijection between set of n unique states and range(n)

contains(states)

contains(states) -> bool_array

returns a boolean array of flags indicates which of the states stored in the array ‘states’ are contained in the state enumeration.

extend(sigma)

Adds the states in the array ‘sigma’ to the state enumeration.

These states must be disjoint to the existing states in this enumeration.

The indexing of existing states in this enumeration will be unchanged.

indices(states)

indices(states) -> index_array

returns an array of the enumeration indices for the states stored in the array ‘states’.

pack_distribution(p_sparse, p_dense=None)
convenience routine to translate a distribution from a dictionary to a dense array, using this state enumeration
reinitialise(initial_states)
reinitialise the StateEnumeration with the given ‘initial_states’
states(index)
returns an array of the states corresponding to the provided enumeration index array.
unpack_distribution(p_dense, p_sparse=None)
convenience routine to translate a distribution from a dense array to a dictionary, using this state enumeration
update_ordering()
Used to maintain the ordering invariants.
cmepy.state_enum.create(initial_states)

create(initial_states) -> StateEnum instance

instantiates a StateEnum instance using the provided ‘initial_states’.

Previous topic

solver

Next topic

statistics

This Page