MultiAgentDecisionProcess
Release 0.2.1
|
MADPComponentDiscreteStates is a class that represents a discrete state space. More...
#include <MADPComponentDiscreteStates.h>
Public Member Functions | |
void | AddState (std::string StateName) |
Adds a new state. | |
double | GetInitialStateProbability (Index sI) const |
Return the initial state distribution. | |
virtual StateDistribution * | GetISD () |
Returns the complete initial state distribution. | |
virtual const StateDistribution * | GetISD () const |
Returns the complete initial state distribution. | |
size_t | GetNrStates () const |
Return the number of states. | |
const State * | GetState (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. | |
![]() | |
virtual MultiAgentDecisionProcessDiscreteInterface * | Clone () const =0 |
Returns a pointer to a copy of this class. | |
virtual const Action * | GetAction (Index agentI, Index a) const =0 |
Return a ref to the a-th action of agent agentI. | |
virtual const JointAction * | GetJointAction (Index i) const =0 |
Return a ref to the i-th joint action. | |
virtual const JointObservation * | GetJointObservation (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 Observation * | GetObservation (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 OGet * | GetOGet () const =0 |
virtual TGet * | GetTGet () 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! | |
![]() | |
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 |
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.
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().
|
virtual |
Destructor.
Definition at line 55 of file MADPComponentDiscreteStates.cpp.
References _m_initialStateDistribution.
void MADPComponentDiscreteStates::AddState | ( | std::string | StateName | ) |
Adds a new state.
Definition at line 102 of file MADPComponentDiscreteStates.cpp.
References _m_initialized, _m_initialStateDistribution, _m_nrStates, and _m_stateVec.
Referenced by DecPOMDPDiscrete::ExtractMADPDiscrete(), and ProblemFireFighting::ProblemFireFighting().
|
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.
|
inlinevirtual |
Returns the complete initial state distribution.
Definition at line 122 of file MADPComponentDiscreteStates.h.
References _m_initialStateDistribution.
Referenced by DecPOMDPDiscrete::ExtractMADPDiscrete().
|
inlinevirtual |
Returns the complete initial state distribution.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 124 of file MADPComponentDiscreteStates.h.
References _m_initialStateDistribution.
|
inlinevirtual |
Return the number of states.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 99 of file MADPComponentDiscreteStates.h.
References _m_nrStates.
Referenced by MultiAgentDecisionProcessDiscrete::CreateNewObservationModel(), DecPOMDPDiscrete::CreateNewRewardModel(), MultiAgentDecisionProcessDiscrete::CreateNewTransitionModel(), DecPOMDPDiscrete::ExtractMADPDiscrete(), ProblemFireFighting::FillObservationModel(), ProblemFireFighting::FillRewardModel(), ProblemFireFighting::FillTransitionModel(), MultiAgentDecisionProcessDiscrete::SanityCheck(), SetUniformISD(), and SoftPrint().
|
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.
|
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().
|
inline |
Reimplemented in MultiAgentDecisionProcessDiscrete.
Definition at line 131 of file MADPComponentDiscreteStates.h.
References SoftPrint().
|
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 | ) |
Sets _m_initialized to b.
Reimplemented in MultiAgentDecisionProcessDiscrete, DecPOMDPDiscrete, and POSGDiscrete.
Definition at line 60 of file MADPComponentDiscreteStates.cpp.
References _m_initialized, _m_initialStateDistribution, _m_nrStates, and Globals::PROB_PRECISION.
Referenced by MultiAgentDecisionProcessDiscrete::SetInitialized().
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().
|
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().
|
virtual |
Prints some information on the MultiAgentDecisionProcessDiscreteInterface.
Implements MultiAgentDecisionProcessDiscreteInterface.
Reimplemented in MultiAgentDecisionProcessDiscrete, DecPOMDPDiscrete, and POSGDiscrete.
Definition at line 249 of file MADPComponentDiscreteStates.cpp.
References _m_initialized, GetNrStates(), SoftPrintInitialStateDistribution(), and SoftPrintStates().
Referenced by Print().
|
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().
|
inlinevirtual |
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 111 of file MADPComponentDiscreteStates.h.
References GetStateName().
|
private |
Returns a string with the states.
Definition at line 236 of file MADPComponentDiscreteStates.cpp.
References _m_stateVec.
Referenced by SoftPrint().
|
private |
Definition at line 52 of file MADPComponentDiscreteStates.h.
Referenced by AddState(), GetInitialStateProbability(), GetStateIndexByName(), MADPComponentDiscreteStates(), SampleInitialState(), SetInitialized(), SetNrStates(), SetUniformISD(), SoftPrint(), and SoftPrintInitialStateDistribution().
|
protected |
A StateDistributionVector that represents the initial state distribution.
Definition at line 64 of file MADPComponentDiscreteStates.h.
Referenced by AddState(), GetInitialStateProbability(), GetISD(), SampleInitialState(), SetInitialized(), SetISD(), SetNrStates(), SetUniformISD(), SoftPrintInitialStateDistribution(), and ~MADPComponentDiscreteStates().
|
private |
Definition at line 53 of file MADPComponentDiscreteStates.h.
Referenced by AddState(), GetNrStates(), SetInitialized(), SetISD(), and SetNrStates().
|
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().