MultiAgentDecisionProcess
|
MADPComponentDiscreteStates is a class that represents a discrete state space. More...
#include <MADPComponentDiscreteStates.h>
Public Member Functions | |
void | AddState (const std::string &StateName) |
Adds a new state. More... | |
double | GetInitialStateProbability (Index sI) const |
Return the initial state distribution. More... | |
virtual StateDistribution * | GetISD () |
Returns the complete initial state distribution. More... | |
virtual StateDistribution * | GetISD () const |
size_t | GetNrStates () const |
Return the number of states. More... | |
const State * | GetState (Index i) const |
Returns a pointer to state i. */. More... | |
Index | GetStateIndex (StateDiscrete s) const |
Returns the state index of state s. More... | |
Index | GetStateIndexByName (const std::string &s) const |
Returns the state index of state s. More... | |
std::string | GetStateName (Index i) const |
Returns the name of a particular state i. More... | |
MADPComponentDiscreteStates () | |
(default) Constructor More... | |
MADPComponentDiscreteStates (size_t nrS) | |
Constructor that sets the number of states. More... | |
MADPComponentDiscreteStates (const MADPComponentDiscreteStates &a) | |
Copy constructor. More... | |
void | Print () const |
Index | SampleInitialState () const |
Sample a state according to the initial state PDF. More... | |
bool | SetInitialized (bool b) |
Sets _m_initialized to b. More... | |
void | SetISD (StateDistribution *p) |
Sets the initial state distribution to v. More... | |
void | SetISD (StateDistributionVector *p) |
void | SetISD (std::vector< double > v) |
void | SetNrStates (size_t nrS) |
Sets the number of states to nrS. More... | |
void | SetUniformISD () |
Sets the initial state distribution to a uniform one. More... | |
std::string | SoftPrint () const |
virtual std::string | SoftPrintState (Index sI) const |
virtual | ~MADPComponentDiscreteStates () |
Destructor. More... | |
Private Member Functions | |
std::string | SoftPrintInitialStateDistribution () const |
Returns a string with the initial state distribution. More... | |
std::string | SoftPrintStates () const |
Returns a string with the states. More... | |
Private Attributes | |
bool | _m_initialized |
StateDistributionVector * | _m_initialStateDistribution |
A StateDistributionVector that represents the initial state distribution. More... | |
size_t | _m_nrStates |
std::vector< StateDiscrete > | _m_stateVec |
A vector that contains all the states. More... | |
MADPComponentDiscreteStates is a class that represents a discrete state space.
It implements a part of the MultiAgentDecisionProcessDiscreteInterface.
MADPComponentDiscreteStates::MADPComponentDiscreteStates | ( | ) |
(default) Constructor
MADPComponentDiscreteStates::MADPComponentDiscreteStates | ( | size_t | nrS | ) |
Constructor that sets the number of states.
References _m_initialized, and SetNrStates().
MADPComponentDiscreteStates::MADPComponentDiscreteStates | ( | const MADPComponentDiscreteStates & | a | ) |
Copy constructor.
References _m_initialized, _m_initialStateDistribution, _m_nrStates, and _m_stateVec.
|
virtual |
Destructor.
References _m_initialStateDistribution.
void MADPComponentDiscreteStates::AddState | ( | const std::string & | StateName | ) |
Adds a new state.
References _m_initialized, _m_initialStateDistribution, _m_nrStates, and _m_stateVec.
Referenced by MultiAgentDecisionProcessDiscrete::AddState().
double MADPComponentDiscreteStates::GetInitialStateProbability | ( | Index | sI | ) | const |
Return the initial state distribution.
References _m_initialized, _m_initialStateDistribution, DEBUG_MADP_DSTATES, and ArgumentHandlers::size().
Referenced by MultiAgentDecisionProcessDiscrete::GetInitialStateProbability().
|
inlinevirtual |
Returns the complete initial state distribution.
Referenced by MultiAgentDecisionProcessDiscrete::GetISD().
|
inlinevirtual |
|
inline |
Return the number of states.
References _m_nrStates.
Referenced by MultiAgentDecisionProcessDiscrete::GetNrStates(), SetUniformISD(), and SoftPrint().
Returns a pointer to state i. */.
Referenced by MultiAgentDecisionProcessDiscrete::GetState().
Index MADPComponentDiscreteStates::GetStateIndex | ( | StateDiscrete | s | ) | const |
Returns the state index of state s.
References DiscreteEntity::GetIndex().
Index MADPComponentDiscreteStates::GetStateIndexByName | ( | const std::string & | s | ) | const |
Returns the state index of state s.
Throws an exception if there is no state with name s.
References _m_initialized, and _m_stateVec.
Referenced by MultiAgentDecisionProcessDiscrete::GetStateIndexByName().
|
inline |
Returns the name of a particular state i.
Referenced by MultiAgentDecisionProcessDiscrete::SanityCheck(), and SoftPrintState().
|
inline |
References SoftPrint().
Index MADPComponentDiscreteStates::SampleInitialState | ( | ) | const |
Sample a state according to the initial state PDF.
References _m_initialized, and _m_initialStateDistribution.
Referenced by MultiAgentDecisionProcessDiscrete::SampleInitialState().
bool MADPComponentDiscreteStates::SetInitialized | ( | bool | b | ) |
Sets _m_initialized to b.
If no initial state distribution had been set, this function will call SetUniformISD(). (To accomodate .pomdp files where specification of ISD is optional.)
References _m_initialized, _m_initialStateDistribution, _m_nrStates, Globals::PROB_PRECISION, and SetUniformISD().
Referenced by MultiAgentDecisionProcessDiscrete::SetInitialized(), and MultiAgentDecisionProcessDiscrete::SetStatesInitialized().
void MADPComponentDiscreteStates::SetISD | ( | StateDistribution * | p | ) |
Sets the initial state distribution to v.
Referenced by MultiAgentDecisionProcessDiscrete::SetISD().
|
inline |
void MADPComponentDiscreteStates::SetISD | ( | std::vector< double > | v | ) |
References _m_initialStateDistribution, and _m_nrStates.
void MADPComponentDiscreteStates::SetNrStates | ( | size_t | nrS | ) |
Sets the number of states to nrS.
References _m_initialized, _m_initialStateDistribution, _m_nrStates, and _m_stateVec.
Referenced by MADPComponentDiscreteStates(), and MultiAgentDecisionProcessDiscrete::SetNrStates().
void MADPComponentDiscreteStates::SetUniformISD | ( | ) |
Sets the initial state distribution to a uniform one.
References _m_initialized, _m_initialStateDistribution, and GetNrStates().
Referenced by SetInitialized(), and MultiAgentDecisionProcessDiscrete::SetUniformISD().
string MADPComponentDiscreteStates::SoftPrint | ( | ) | const |
References _m_initialized, GetNrStates(), SoftPrintInitialStateDistribution(), and SoftPrintStates().
Referenced by Print(), and MultiAgentDecisionProcessDiscrete::SoftPrint().
|
private |
Returns a string with the initial state distribution.
References _m_initialized, _m_initialStateDistribution, and StateDistributionVector::SoftPrint().
Referenced by SoftPrint().
|
inlinevirtual |
References GetStateName().
Referenced by MultiAgentDecisionProcessDiscrete::SoftPrintState().
|
private |
|
private |
|
private |
A StateDistributionVector that represents the initial state distribution.
Referenced by AddState(), GetInitialStateProbability(), MADPComponentDiscreteStates(), SampleInitialState(), SetInitialized(), SetISD(), SetNrStates(), SetUniformISD(), SoftPrintInitialStateDistribution(), and ~MADPComponentDiscreteStates().
|
private |
Referenced by AddState(), GetNrStates(), MADPComponentDiscreteStates(), SetInitialized(), SetISD(), and SetNrStates().
|
private |
A vector that contains all the states.
Referenced by AddState(), GetStateIndexByName(), MADPComponentDiscreteStates(), SetNrStates(), and SoftPrintStates().