madupite.createTransitionProbabilityTensor#

madupite.createTransitionProbabilityTensor(*, comm: int = 0, name: str = '', numStates: int, numActions: int, func: collections.abc.Callable[[int, int], tuple[collections.abc.Sequence[float], collections.abc.Sequence[int]]], preallocation: madupite._madupite_impl.MatrixPreallocation = <madupite._madupite_impl.MatrixPreallocation object at 0x7fcc2cc10ed0>) madupite._madupite_impl.Matrix#

Creates a transition probability tensor for a Markov Decision Process (MDP).

This function constructs a madupite.Matrix that represents the probabilities of transitioning from one state to another, given a specific action.

Parameters#

commint, optional

The communicator identifier for parallel computation.

namestr

The name of the transition probability tensor, used for identification within the MDP environment.

numStatesint

The total number of states in the Markov Decision Process.

numActionsint

The total number of possible actions in the Markov Decision Process.

funcCallable[[int, int], Tuple[Sequence[float], Sequence[int]]]

A callable function that takes in two arguments: a state index and an action index. It returns a tuple containing:

  • A list of transition probabilities to other states.

  • A list of corresponding state indices for these probabilities.

preallocationmadupite.MatrixPreallocation, optional

A preallocation structure that defines how the matrix memory is allocated. Defaults to an instance of MatrixPreallocation.

Returns#

madupite.Matrix

A matrix object representing the transition probability tensor.