Class sdm::SerializedMMDP

Class List > sdm > SerializedMMDP

  • #include <serialized_mmdp.hpp>

Inherits the following classes: sdm::SerialMMDPInterface

Inherited by the following classes: sdm::SerializedMPOMDP

Public Functions

Type Name
SerializedMMDP (const std::shared_ptr< MMDPInterface > & mmdp)
virtual std::shared_ptr< Space > getActionSpace (number t=0) const
Get all actions at a specific time step.
virtual std::shared_ptr< Space > getActionSpace (number agent_id, number t) const
Get the Action Space at a specific time step and a precise agent.
virtual std::shared_ptr< Space > getActionSpaceAt (const std::shared_ptr< Observation > & observation, number t)
Get the action space.
virtual number getAgentId (number t) const
Get the identifier of the current agent.
virtual double getDiscount (number t=0) const
Get the discount factor at timestep t.
virtual number getHorizon () const
Get the number of agents.
virtual std::shared_ptr< State > getInternalState () const
virtual double getMaxReward (number t=0) const
virtual double getMinReward (number t=0) const
virtual number getNumAgents () const
Get the number of agents.
virtual std::shared_ptr< Action > getRandomAction (const std::shared_ptr< Observation > & observation, number t)
Get random 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 reachable next states.
virtual double getReward (const std::shared_ptr< State > & state, const std::shared_ptr< Action > & action, number t=0) const
Get the reward.
virtual std::shared_ptr< Distribution< std::shared_ptr< State > > > getStartDistribution () const
Get the initial distribution over states.
virtual std::shared_ptr< Space > getStateSpace (number t=0) const
Get all 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 object.
virtual bool isLastAgent (number t) const
virtual std::shared_ptr< Observation > reset ()
Reset the environment and return initial observation.
virtual void setInternalState (std::shared_ptr< State > state)
virtual std::tuple< std::shared_ptr< Observation >, std::vector< double >, bool > step (std::shared_ptr< Action > action)
Do a step on the environment.
virtual std::tuple< std::shared_ptr< Observation >, std::vector< double >, bool > step (std::shared_ptr< Action > action, bool increment_timestep)
virtual ~SerializedMMDP ()

Public Functions inherited from sdm::MMDPInterface

See sdm::MMDPInterface

Type Name
virtual std::shared_ptr< Space > getActionSpace (number agent_id, number t) const = 0
Get ths action space of agent i at timestep t.
virtual std::shared_ptr< Space > getActionSpace (number t) const = 0
Get ths action space at timestep t.

Public Functions inherited from sdm::MDPInterface

See sdm::MDPInterface

Type Name
virtual std::shared_ptr< Space > getActionSpace (number t) const = 0
Get ths action space at timestep t.
virtual double getDiscount (number t) const = 0
Get the discount factor at timestep t.
virtual number getHorizon () const = 0
Get the number of agents.
virtual std::shared_ptr< State > getInternalState () const = 0
virtual double getMaxReward (number t) const = 0
virtual double getMinReward (number t) const = 0
virtual number getNumAgents () const = 0
Get the number of agents.
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.
virtual double getReward (const std::shared_ptr< State > & state, const std::shared_ptr< Action > & action, number t) const = 0
Get the reward at timestep t when executing an action in a specific state.
virtual std::shared_ptr< Distribution< std::shared_ptr< State > > > getStartDistribution () const = 0
Get the initial distribution over states.
virtual std::shared_ptr< Space > getStateSpace (number t) const = 0
Get ths state space at timestep t.
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 transition probability, i.e. p(s'
virtual void setInternalState (std::shared_ptr< State > state) = 0
virtual std::tuple< std::shared_ptr< Observation >, std::vector< double >, bool > step (std::shared_ptr< Action > action) = 0
Do a step on the environment.
virtual std::tuple< std::shared_ptr< Observation >, std::vector< double >, bool > step (std::shared_ptr< Action > action, bool increment_timestep) = 0

Public Functions inherited from sdm::GymInterface

See sdm::GymInterface

Type Name
virtual std::shared_ptr< Space > getActionSpaceAt (const std::shared_ptr< Observation > & observation, number t) = 0
Get the action space.
virtual std::shared_ptr< Action > getRandomAction (const std::shared_ptr< Observation > & observation, number t) = 0
Get random action.
virtual std::shared_ptr< Observation > reset () = 0
Reset the environment and return initial observation.
virtual std::tuple< std::shared_ptr< Observation >, std::vector< double >, bool > step (std::shared_ptr< Action > action) = 0
Do a step on the environment.

Public Functions inherited from sdm::SerialProblemInterface

See sdm::SerialProblemInterface

Type Name
virtual number getAgentId (number t) const = 0
Get the identifier of the current agent.
virtual bool isLastAgent (number t) const = 0

Protected Attributes

Type Name
std::shared_ptr< Distribution< std::shared_ptr< State > > > distribution_serial
std::unordered_map< Joint< std::shared_ptr< Action > >, std::shared_ptr< Action > > map_joint_action_to_pointeur
Map the joint_action to a precise pointeur of Action.
std::unordered_map< SerializedState, std::shared_ptr< State > > map_serialized_state_to_pointeur
Map the serialState to a precise pointeur of State .
std::shared_ptr< MMDPInterface > mmdp_
The mmpdp associated to the problem.
Joint< std::shared_ptr< DiscreteSpace > > serialized_state_space_
Refer to the Serialized State __Space .
std::shared_ptr< StateDynamicsInterface > state_dynamics_
Map (serial state, seial action) to Set of reachable seial states.

Protected Functions

Type Name
Joint< std::shared_ptr< Action > > addNewAction (const std::shared_ptr< State > & state, const std::shared_ptr< Action > & new_action) const
A serial state is composed by a vector of action, in this function, we add a new action to the current vector of action/.
void createDistribution ()
void createInitReachableStateSpace ()
Initialize "serialized_state_space_".
void createInitSerializedStateSpace ()
Initialize Serial State __Space .
const std::shared_ptr< Action > getPointeurJointAction (Joint< std::shared_ptr< Action >> &) const
Get the Pointeur object of a precise Joint Action.
const std::shared_ptr< State > getPointeurState (SerializedState &) const
Get the Pointeur object of a precise Joint Action.
void setJointActionToPointeur (std::vector< Joint< std::shared_ptr< Action >>>)

Public Functions Documentation

function SerializedMMDP

sdm::SerializedMMDP::SerializedMMDP (
    const std::shared_ptr< MMDPInterface > & mmdp
) 

function getActionSpace [1/2]

virtual std::shared_ptr< Space > sdm::SerializedMMDP::getActionSpace (
    number t=0
) const

Returns:

the set of actions

Implements sdm::MMDPInterface::getActionSpace

function getActionSpace [2/2]

virtual std::shared_ptr< Space > sdm::SerializedMMDP::getActionSpace (
    number agent_id,
    number t
) const

Parameters:

  • agent_id
  • t

Returns:

std::shared_ptr<Space>

Implements sdm::MMDPInterface::getActionSpace

function getActionSpaceAt

virtual std::shared_ptr< Space > sdm::SerializedMMDP::getActionSpaceAt (
    const std::shared_ptr< Observation > & observation,
    number t
) 

Parameters:

  • observation the observation in consideration
  • t time step

Returns:

the action space.

Implements sdm::GymInterface::getActionSpaceAt

function getAgentId

virtual number sdm::SerializedMMDP::getAgentId (
    number t
) const

Parameters:

  • t the timestep

Returns:

number the agent id

Implements sdm::SerialProblemInterface::getAgentId

function getDiscount

virtual double sdm::SerializedMMDP::getDiscount (
    number t=0
) const

Parameters:

  • t the timestep

Returns:

the discount factor

Implements sdm::MDPInterface::getDiscount

function getHorizon

virtual number sdm::SerializedMMDP::getHorizon () const

Returns:

the number of agents

Implements sdm::MDPInterface::getHorizon

function getInternalState

virtual std::shared_ptr< State > sdm::SerializedMMDP::getInternalState () const

Implements sdm::MDPInterface::getInternalState

function getMaxReward

virtual double sdm::SerializedMMDP::getMaxReward (
    number t=0
) const

Implements sdm::MDPInterface::getMaxReward

function getMinReward

virtual double sdm::SerializedMMDP::getMinReward (
    number t=0
) const

Implements sdm::MDPInterface::getMinReward

function getNumAgents

virtual number sdm::SerializedMMDP::getNumAgents () const

Returns:

the number of agents

Implements sdm::MDPInterface::getNumAgents

function getRandomAction

virtual std::shared_ptr< Action > sdm::SerializedMMDP::getRandomAction (
    const std::shared_ptr< Observation > & observation,
    number t
) 

Parameters:

  • observation the observation in consideration.
  • t time step.

Returns:

the random action.

Implements sdm::GymInterface::getRandomAction

function getReachableStates

virtual std::set< std::shared_ptr< State > > sdm::SerializedMMDP::getReachableStates (
    const std::shared_ptr< State > & state,
    const std::shared_ptr< Action > & action,
    number t=0
) const

Parameters:

  • state the state
  • action the action

Returns:

the set of reachable states

Implements sdm::MDPInterface::getReachableStates

function getReward

virtual double sdm::SerializedMMDP::getReward (
    const std::shared_ptr< State > & state,
    const std::shared_ptr< Action > & action,
    number t=0
) const

Parameters:

  • state
  • action
  • t

Returns:

double

Implements sdm::MDPInterface::getReward

function getStartDistribution

virtual std::shared_ptr< Distribution < std::shared_ptr< State > > > sdm::SerializedMMDP::getStartDistribution () const

Returns:

the initial distribution over states

Implements sdm::MDPInterface::getStartDistribution

function getStateSpace

virtual std::shared_ptr< Space > sdm::SerializedMMDP::getStateSpace (
    number t=0
) const

Returns:

the set of states

Implements sdm::MDPInterface::getStateSpace

function getTransitionProbability

virtual double sdm::SerializedMMDP::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
  • action
  • next_state
  • t

Returns:

double

Implements sdm::MDPInterface::getTransitionProbability

function isLastAgent

virtual bool sdm::SerializedMMDP::isLastAgent (
    number t
) const

Parameters:

  • t

Returns:

true

Returns:

false

Implements sdm::SerialProblemInterface::isLastAgent

function reset

virtual std::shared_ptr< Observation > sdm::SerializedMMDP::reset () 

Returns:

the initial observation

Implements sdm::GymInterface::reset

function setInternalState

virtual void sdm::SerializedMMDP::setInternalState (
    std::shared_ptr< State > state
) 

Implements sdm::MDPInterface::setInternalState

function step [1/2]

virtual std::tuple< std::shared_ptr< Observation >, std::vector< double >, bool > sdm::SerializedMMDP::step (
    std::shared_ptr< Action > action
) 

Parameters:

  • action the action to execute

Returns:

the information produced. Include : next observation, rewards, episode done

Implements sdm::MDPInterface::step

function step [2/2]

virtual std::tuple< std::shared_ptr< Observation >, std::vector< double >, bool > sdm::SerializedMMDP::step (
    std::shared_ptr< Action > action,
    bool increment_timestep
) 

Implements sdm::MDPInterface::step

function ~SerializedMMDP

virtual sdm::SerializedMMDP::~SerializedMMDP () 

Protected Attributes Documentation

variable distribution_serial

std::shared_ptr<Distribution<std::shared_ptr<State> > > sdm::SerializedMMDP::distribution_serial;

variable map_joint_action_to_pointeur

std::unordered_map<Joint<std::shared_ptr<Action> >, std::shared_ptr<Action> > sdm::SerializedMMDP::map_joint_action_to_pointeur;

variable map_serialized_state_to_pointeur

std::unordered_map<SerializedState, std::shared_ptr<State> > sdm::SerializedMMDP::map_serialized_state_to_pointeur;

variable mmdp_

std::shared_ptr<MMDPInterface> sdm::SerializedMMDP::mmdp_;

variable serialized_state_space_

Joint<std::shared_ptr<DiscreteSpace> > sdm::SerializedMMDP::serialized_state_space_;

variable state_dynamics_

std::shared_ptr<StateDynamicsInterface> sdm::SerializedMMDP::state_dynamics_;

Protected Functions Documentation

function addNewAction

Joint < std::shared_ptr< Action > > sdm::SerializedMMDP::addNewAction (
    const std::shared_ptr< State > & state,
    const std::shared_ptr< Action > & new_action
) const

Parameters:

  • const std::shared_ptr<State>& : current serial state
  • const std::shared_ptr<Action>& : action to add

Returns:

Joint<std::shared_ptr<Action>> : vector of action of the current serial state + the action to add

function createDistribution

void sdm::SerializedMMDP::createDistribution () 

function createInitReachableStateSpace

void sdm::SerializedMMDP::createInitReachableStateSpace () 

function createInitSerializedStateSpace

void sdm::SerializedMMDP::createInitSerializedStateSpace () 

function getPointeurJointAction

const std::shared_ptr< Action > sdm::SerializedMMDP::getPointeurJointAction (
    Joint < std::shared_ptr< Action >> &
) const

Returns:

std::shared_ptr<Joint<std::shared_ptr<Action>>>

function getPointeurState

const std::shared_ptr< State > sdm::SerializedMMDP::getPointeurState (
    SerializedState &
) const

Returns:

std::shared_ptr<Joint<std::shared_ptr<Action>>>

function setJointActionToPointeur

void sdm::SerializedMMDP::setJointActionToPointeur (
    std::vector< Joint < std::shared_ptr< Action >>>
) 

The documentation for this class was generated from the following file src/sdm/world/serialized_mmdp.hpp