I am trying to implement the following algorithm:

In a nutshell, we iterate over a set of 'states' to calculate a value for each.

Each state has multiple actions, and each multiple action has a 'transition probability' associated with it, such that if an action a is taken, there is a 0.8 chance it will proceed to a state s', and a 0.2 chance it will proceed to a different state.

When working through the algorithm, I am struggling to make a data structure that allows to locate a state, have a multiple actions available within that state, and for each action of that state, a probability matrix that when a particular action is taken to move to a new state, returns the probabilities of moving into a new state.

Any ideas to help me?

Many thanks.

# Creating a Probability Transition Matrix

Page 1 of 1## 2 Replies - 2063 Views - Last Post: 28 December 2012 - 10:15 PM

##
**Replies To:** Creating a Probability Transition Matrix

### #2

## Re: Creating a Probability Transition Matrix

Posted 28 December 2012 - 09:07 PM

A decision tree or a graph sounds like a good data structure to me. Perhaps a directed graph, specifically. You could also design a probability matrix using a 2D array or a HashMap.

### #3

## Re: Creating a Probability Transition Matrix

Posted 28 December 2012 - 10:15 PM

Thinking about this some more, you should look into Markov Chains with Eigenvalues and Eigenvectors. This is a topic in Linear Algebra.

Page 1 of 1