MultiAgentDecisionProcess  Release 0.2.1
MADPComponentDiscreteStates Class Reference

MADPComponentDiscreteStates is a class that represents a discrete state space. More...

#include <MADPComponentDiscreteStates.h>

+ Inheritance diagram for MADPComponentDiscreteStates:
+ Collaboration diagram for MADPComponentDiscreteStates:

Public Member Functions

void AddState (std::string StateName)
 Adds a new state.
double GetInitialStateProbability (Index sI) const
 Return the initial state distribution.
virtual StateDistributionGetISD ()
 Returns the complete initial state distribution.
virtual const StateDistributionGetISD () const
 Returns the complete initial state distribution.
size_t GetNrStates () const
 Return the number of states.
const StateGetState (Index i) const
 Returns a pointer to state i. */.
Index GetStateIndex (StateDiscrete s) const
 Returns the state index of state s.
Index GetStateIndexByName (std::string s) const
 Returns the state index of state s.
std::string GetStateName (Index i) const
 Returns the name of a particular state i.
 MADPComponentDiscreteStates ()
 (default) Constructor
 MADPComponentDiscreteStates (size_t nrS)
 Constructor that sets the number of states.
void Print () const
Index SampleInitialState () const
 Sample a state according to the initial state PDF.
bool SetInitialized (bool b)
 Sets _m_initialized to b.
void SetISD (StateDistribution *p)
 Sets the initial state distribution to v.
void SetISD (StateDistributionVector *p)
void SetISD (std::vector< double > v)
void SetNrStates (size_t nrS)
 Sets the number of states to nrS.
void SetUniformISD ()
 Sets the initial state distribution to a uniform one.
std::string SoftPrint () const
 Prints some information on the MultiAgentDecisionProcessDiscreteInterface.
virtual std::string SoftPrintState (Index sI) const
virtual ~MADPComponentDiscreteStates ()
 Destructor.
- Public Member Functions inherited from MultiAgentDecisionProcessDiscreteInterface
virtual
MultiAgentDecisionProcessDiscreteInterface
Clone () const =0
 Returns a pointer to a copy of this class.
virtual const ActionGetAction (Index agentI, Index a) const =0
 Return a ref to the a-th action of agent agentI.
virtual const JointActionGetJointAction (Index i) const =0
 Return a ref to the i-th joint action.
virtual const JointObservationGetJointObservation (Index i) const =0
 Return a ref to the i-th joint observation.
virtual const std::vector
< size_t > & 
GetNrActions () const =0
 Return the number of actions vector.
virtual size_t GetNrActions (Index AgentI) const =0
 Return the number of actions of agent agentI.
virtual size_t GetNrJointActions () const =0
 Return the number of joiny actions.
virtual size_t GetNrJointObservations () const =0
 Return the number of joiny observations.
virtual const std::vector
< size_t > & 
GetNrObservations () const =0
 Return the number of observations vector.
virtual size_t GetNrObservations (Index AgentI) const =0
 Return the number of observations of agent agentI.
virtual const ObservationGetObservation (Index agentI, Index a) const =0
 Return a ref to the a-th observation of agent agentI.
virtual const
ObservationModelDiscrete
GetObservationModelDiscretePtr () const =0
 Returns a pointer to the underlying observation model.
virtual double GetObservationProbability (Index jaI, Index sucSI, Index joI) const =0
 Return the probability of joint observation joI: P(joI|jaI,sucSI).
virtual OGetGetOGet () const =0
virtual TGetGetTGet () const =0
virtual const
TransitionModelDiscrete
GetTransitionModelDiscretePtr () const =0
 Returns a pointer to the underlying transition model.
virtual double GetTransitionProbability (Index sI, Index jaI, Index sucSI) const =0
 Return the probability of successor state sucSI: P(sucSI|sI,jaI).
virtual Index IndividualToJointActionIndices (const Index *AI_ar) const =0
 Returns the joint action index that corresponds to the array of specified individual action indices.
virtual Index IndividualToJointActionIndices (const std::vector< Index > &indivActionIndices) const =0
 Returns the joint action index that corresponds to the vector of specified individual action indices.
virtual Index IndividualToJointObservationIndices (const std::vector< Index > &indivObservationIndices) const =0
 Returns the joint observation index that corresponds to the vector of specified individual observation indices.
virtual const std::vector
< Index > & 
JointToIndividualActionIndices (Index jaI) const =0
 Returns a vector of indices to indiv.
virtual const std::vector
< Index > & 
JointToIndividualObservationIndices (Index joI) const =0
 Returns a vector of indices to indiv.
virtual Index SampleJointObservation (Index jaI, Index sucI) const =0
 Sample an observation - needed for simulations.
virtual Index SampleSuccessorState (Index sI, Index jaI) const =0
 Sample a successor state - needed by simulations.
virtual ~MultiAgentDecisionProcessDiscreteInterface ()
 Destructor. Can't make a virt.destr. pure abstract!
- Public Member Functions inherited from MultiAgentDecisionProcessInterface
virtual size_t GetNrAgents () const =0
 Return the number of agents.
virtual std::string GetUnixName () const =0
 Returns the base part of the problem filename.
virtual ~MultiAgentDecisionProcessInterface ()
 Destructor.

Protected Attributes

StateDistributionVector_m_initialStateDistribution
 A StateDistributionVector that represents the initial state distribution.
std::vector< StateDiscrete_m_stateVec
 A vector that contains all the states.

Private Member Functions

std::string SoftPrintInitialStateDistribution () const
 Returns a string with the initial state distribution.
std::string SoftPrintStates () const
 Returns a string with the states.

Private Attributes

bool _m_initialized
size_t _m_nrStates

Detailed Description

MADPComponentDiscreteStates is a class that represents a discrete state space.

It implements a part of the MultiAgentDecisionProcessDiscreteInterface.

Definition at line 48 of file MADPComponentDiscreteStates.h.

Constructor & Destructor Documentation

MADPComponentDiscreteStates::MADPComponentDiscreteStates ( )

(default) Constructor

Definition at line 36 of file MADPComponentDiscreteStates.cpp.

MADPComponentDiscreteStates::MADPComponentDiscreteStates ( size_t  nrS)

Constructor that sets the number of states.

Definition at line 44 of file MADPComponentDiscreteStates.cpp.

References _m_initialized, and SetNrStates().

MADPComponentDiscreteStates::~MADPComponentDiscreteStates ( )
virtual

Destructor.

Definition at line 55 of file MADPComponentDiscreteStates.cpp.

References _m_initialStateDistribution.

Member Function Documentation

void MADPComponentDiscreteStates::AddState ( std::string  StateName)
double MADPComponentDiscreteStates::GetInitialStateProbability ( Index  sI) const
virtual

Return the initial state distribution.

Implements MultiAgentDecisionProcessDiscreteInterface.

Definition at line 202 of file MADPComponentDiscreteStates.cpp.

References _m_initialized, _m_initialStateDistribution, and DEBUG_MADP_DSTATES.

virtual StateDistribution* MADPComponentDiscreteStates::GetISD ( )
inlinevirtual

Returns the complete initial state distribution.

Definition at line 122 of file MADPComponentDiscreteStates.h.

References _m_initialStateDistribution.

Referenced by DecPOMDPDiscrete::ExtractMADPDiscrete().

virtual const StateDistribution* MADPComponentDiscreteStates::GetISD ( ) const
inlinevirtual

Returns the complete initial state distribution.

Implements MultiAgentDecisionProcessDiscreteInterface.

Definition at line 124 of file MADPComponentDiscreteStates.h.

References _m_initialStateDistribution.

const State* MADPComponentDiscreteStates::GetState ( Index  i) const
inlinevirtual

Returns a pointer to state i. */.

Implements MultiAgentDecisionProcessDiscreteInterface.

Definition at line 108 of file MADPComponentDiscreteStates.h.

References _m_stateVec.

Referenced by DecPOMDPDiscrete::ExtractMADPDiscrete(), and ProblemFireFighting::ProblemFireFighting().

Index MADPComponentDiscreteStates::GetStateIndex ( StateDiscrete  s) const

Returns the state index of state s.

Definition at line 171 of file MADPComponentDiscreteStates.cpp.

References DiscreteEntity::GetIndex().

Index MADPComponentDiscreteStates::GetStateIndexByName ( std::string  s) const

Returns the state index of state s.

Throws an exception if there is no state with name s.

Definition at line 177 of file MADPComponentDiscreteStates.cpp.

References _m_initialized, and _m_stateVec.

std::string MADPComponentDiscreteStates::GetStateName ( Index  i) const
inline

Returns the name of a particular state i.

Definition at line 114 of file MADPComponentDiscreteStates.h.

References _m_stateVec.

Referenced by MultiAgentDecisionProcessDiscrete::SanityCheck(), and SoftPrintState().

void MADPComponentDiscreteStates::Print ( ) const
inline

Reimplemented in MultiAgentDecisionProcessDiscrete.

Definition at line 131 of file MADPComponentDiscreteStates.h.

References SoftPrint().

Index MADPComponentDiscreteStates::SampleInitialState ( void  ) const
virtual

Sample a state according to the initial state PDF.

Implements MultiAgentDecisionProcessDiscreteInterface.

Definition at line 267 of file MADPComponentDiscreteStates.cpp.

References _m_initialized, and _m_initialStateDistribution.

bool MADPComponentDiscreteStates::SetInitialized ( bool  b)
void MADPComponentDiscreteStates::SetISD ( StateDistribution p)

Sets the initial state distribution to v.

Definition at line 154 of file MADPComponentDiscreteStates.cpp.

Referenced by DecPOMDPDiscrete::ExtractMADPDiscrete(), and ProblemFireFighting::ProblemFireFighting().

void MADPComponentDiscreteStates::SetISD ( StateDistributionVector p)
inline

Definition at line 93 of file MADPComponentDiscreteStates.h.

References _m_initialStateDistribution.

void MADPComponentDiscreteStates::SetISD ( std::vector< double >  v)

Definition at line 162 of file MADPComponentDiscreteStates.cpp.

References _m_initialStateDistribution, and _m_nrStates.

void MADPComponentDiscreteStates::SetNrStates ( size_t  nrS)

Sets the number of states to nrS.

Definition at line 119 of file MADPComponentDiscreteStates.cpp.

References _m_initialized, _m_initialStateDistribution, _m_nrStates, and _m_stateVec.

Referenced by MADPComponentDiscreteStates(), and ProblemDecTiger::ProblemDecTiger().

void MADPComponentDiscreteStates::SetUniformISD ( )

Sets the initial state distribution to a uniform one.

Definition at line 135 of file MADPComponentDiscreteStates.cpp.

References _m_initialized, _m_initialStateDistribution, and GetNrStates().

Referenced by ProblemDecTiger::ProblemDecTiger(), and ProblemFireFighting::ProblemFireFighting().

string MADPComponentDiscreteStates::SoftPrint ( ) const
virtual
string MADPComponentDiscreteStates::SoftPrintInitialStateDistribution ( ) const
private

Returns a string with the initial state distribution.

Definition at line 224 of file MADPComponentDiscreteStates.cpp.

References _m_initialized, _m_initialStateDistribution, and PrintTools::SoftPrintVector().

Referenced by SoftPrint().

virtual std::string MADPComponentDiscreteStates::SoftPrintState ( Index  sI) const
inlinevirtual
string MADPComponentDiscreteStates::SoftPrintStates ( ) const
private

Returns a string with the states.

Definition at line 236 of file MADPComponentDiscreteStates.cpp.

References _m_stateVec.

Referenced by SoftPrint().

Member Data Documentation

StateDistributionVector* MADPComponentDiscreteStates::_m_initialStateDistribution
protected
size_t MADPComponentDiscreteStates::_m_nrStates
private
std::vector<StateDiscrete> MADPComponentDiscreteStates::_m_stateVec
protected

A vector that contains all the states.

Definition at line 62 of file MADPComponentDiscreteStates.h.

Referenced by AddState(), GetState(), GetStateIndexByName(), GetStateName(), SetNrStates(), and SoftPrintStates().


The documentation for this class was generated from the following files: