Class sdm::TabularStateDynamics
Class List > sdm > TabularStateDynamics
Tabular representation for the state dynamics. More...
#include <tabular_state_dynamics.hpp>
Inherits the following classes: sdm::StateDynamicsInterface
Public Types
Type | Name |
---|---|
typedef MappedMatrix< std::shared_ptr< State >, std::shared_ptr< State >, value_type > | matrix_type |
typedef double | value_type |
Public Functions
Type | Name |
---|---|
TabularStateDynamics () | |
TabularStateDynamics (const TabularStateDynamics & copy) | |
virtual std::shared_ptr< Distribution< std::shared_ptr< State > > > | getNextStateDistribution (const std::shared_ptr< State > & state, const std::shared_ptr< Action > & action, number t=0) const Get the distribution over next state (given current state and action) |
virtual std::set< std::shared_ptr< State > > | getReachableStates (const std::shared_ptr< State > & state, const std::shared_ptr< Action > & action, number t=0) const Get the list of all reachable states. |
virtual double | getTransitionProbability (const std::shared_ptr< State > & state, const std::shared_ptr< Action > & action, const std::shared_ptr< State > & next_state, number t=0) const Get the transition probability on one point. |
void | setReachablesStates (const std::shared_ptr< State > & state, const std::shared_ptr< Action > & action, const std::shared_ptr< State > & next_state, number t=0) Create the Reachable State , i.e. a state and an action will be associated with a next_state. |
void | setTransitionProbability (const std::shared_ptr< State > & state, const std::shared_ptr< Action > & action, const std::shared_ptr< State > & next_state, double proba, number t=0, bool cumul=false) Set the transition probability on one point. |
virtual | ~TabularStateDynamics () |
Public Functions inherited from sdm::StateDynamicsInterface
See sdm::StateDynamicsInterface
Type | Name |
---|---|
virtual std::shared_ptr< Distribution< std::shared_ptr< State > > > | getNextStateDistribution (const std::shared_ptr< State > & state, const std::shared_ptr< Action > & action, number t) const = 0 Get the distribution over next states. |
virtual std::set< std::shared_ptr< State > > | getReachableStates (const std::shared_ptr< State > & state, const std::shared_ptr< Action > & action, number t) const = 0 Get reachable states from a state given a specific action. |
virtual double | getTransitionProbability (const std::shared_ptr< State > & state, const std::shared_ptr< Action > & action, const std::shared_ptr< State > & next_state, number t) const = 0 _Get the state transition probability (i.e. p(s' |
Protected Attributes
Type | Name |
---|---|
std::unordered_map< std::shared_ptr< State >, std::unordered_map< std::shared_ptr< Action >, std::shared_ptr< DiscreteDistribution< std::shared_ptr< State > > > > > | next_states_distrib map from state, action pairs to the distribution over next states |
std::unordered_map< std::shared_ptr< State >, std::unordered_map< std::shared_ptr< Action >, std::set< std::shared_ptr< State > > > > | successor_states map from state, action pairs to set of next states |
std::unordered_map< std::shared_ptr< Action >, matrix_type > | t_model transition and observation matrices |
Protected Functions
Type | Name |
---|---|
void | updateNextStateDistribution (const std::shared_ptr< State > & state, const std::shared_ptr< Action > & action, const std::shared_ptr< State > & next_state, double proba) |
Detailed Description
The class is optimized to provide a constant time access to all transition probabilities and reachable states.
Public Types Documentation
typedef matrix_type
using sdm::TabularStateDynamics::matrix_type = MappedMatrix<std::shared_ptr<State>, std::shared_ptr<State>, value_type>;
typedef value_type
using sdm::TabularStateDynamics::value_type = double;
Public Functions Documentation
function TabularStateDynamics [1/2]
sdm::TabularStateDynamics::TabularStateDynamics ()
function TabularStateDynamics [2/2]
sdm::TabularStateDynamics::TabularStateDynamics (
const TabularStateDynamics & copy
)
function getNextStateDistribution
virtual std::shared_ptr< Distribution < std::shared_ptr< State > > > sdm::TabularStateDynamics::getNextStateDistribution (
const std::shared_ptr< State > & state,
const std::shared_ptr< Action > & action,
number t=0
) const
Parameters:
state
the current stateaction
the actiont
the timestep
Returns:
std::shared_ptr<Distribution<std::shared_ptr<State>>>
Implements sdm::StateDynamicsInterface::getNextStateDistribution
function getReachableStates
virtual std::set< std::shared_ptr< State > > sdm::TabularStateDynamics::getReachableStates (
const std::shared_ptr< State > & state,
const std::shared_ptr< Action > & action,
number t=0
) const
Parameters:
state
the current stateaction
the current action
Returns:
the list of accessible states
Implements sdm::StateDynamicsInterface::getReachableStates
function getTransitionProbability
virtual double sdm::TabularStateDynamics::getTransitionProbability (
const std::shared_ptr< State > & state,
const std::shared_ptr< Action > & action,
const std::shared_ptr< State > & next_state,
number t=0
) const
Parameters:
state
A specific state (the state at timestep t)action
A specific (joint) actionnext_state
A specific state (the state at timestep t+1)
Returns:
the transition probability
Implements sdm::StateDynamicsInterface::getTransitionProbability
function setReachablesStates
void sdm::TabularStateDynamics::setReachablesStates (
const std::shared_ptr< State > & state,
const std::shared_ptr< Action > & action,
const std::shared_ptr< State > & next_state,
number t=0
)
Parameters:
state
A specific state (the state at timestep t)action
A specific actionnext_state
A specific state (the state at timestep t+1)t
Timestep t
function setTransitionProbability
void sdm::TabularStateDynamics::setTransitionProbability (
const std::shared_ptr< State > & state,
const std::shared_ptr< Action > & action,
const std::shared_ptr< State > & next_state,
double proba,
number t=0,
bool cumul=false
)
Parameters:
state
A specific state (the state at timestep t)action
A specific (joint) actionnext_state
A specific state (the state at timestep t+1)proba
probability of the transitioncumul
whether or not we cumulate probabilities.
function ~TabularStateDynamics
virtual sdm::TabularStateDynamics::~TabularStateDynamics ()
Protected Attributes Documentation
variable next_states_distrib
std::unordered_map<std::shared_ptr<State>, std::unordered_map<std::shared_ptr<Action>, std::shared_ptr<DiscreteDistribution<std::shared_ptr<State> > > > > sdm::TabularStateDynamics::next_states_distrib;
variable successor_states
std::unordered_map<std::shared_ptr<State>, std::unordered_map<std::shared_ptr<Action>, std::set<std::shared_ptr<State> > > > sdm::TabularStateDynamics::successor_states;
variable t_model
std::unordered_map<std::shared_ptr<Action>, matrix_type> sdm::TabularStateDynamics::t_model;
Protected Functions Documentation
function updateNextStateDistribution
void sdm::TabularStateDynamics::updateNextStateDistribution (
const std::shared_ptr< State > & state,
const std::shared_ptr< Action > & action,
const std::shared_ptr< State > & next_state,
double proba
)
The documentation for this class was generated from the following file src/sdm/core/dynamics/tabular_state_dynamics.hpp