MultiAgentDecisionProcess  Release 0.2.1
MultiAgentDecisionProcessDiscrete Class Reference

MultiAgentDecisionProcessDiscrete is defines the primary properties of a discrete decision process. More...

#include <MultiAgentDecisionProcessDiscrete.h>

+ Inheritance diagram for MultiAgentDecisionProcessDiscrete:
+ Collaboration diagram for MultiAgentDecisionProcessDiscrete:

Public Member Functions

virtual
MultiAgentDecisionProcessDiscrete
Clone () const
 Returns a pointer to a copy of this class.
void CreateNewObservationModel ()
 Creates a new observation model mapping.
void CreateNewTransitionModel ()
 Creates a new transition model mapping.
const ObservationModelDiscreteGetObservationModelDiscretePtr () const
 Returns a pointer to the underlying observation model.
double GetObservationProbability (Index jaI, Index sucSI, Index joI) const
 Return the probability of joint observation joI: P(joI|jaI,sucSI).
OGetGetOGet () const
bool GetSparse () const
 Are we using sparse transition and observation models?
TGetGetTGet () const
const TransitionModelDiscreteGetTransitionModelDiscretePtr () const
 Returns a pointer to the underlying transition model.
double GetTransitionProbability (Index sI, Index jaI, Index sucSI) const
 Return the probability of successor state sucSI: P(sucSI|sI,jaI).
bool Initialize ()
 A function that can be called by other classes in order to request a MultiAgentDecisionProcessDiscrete to (try to) initialize.
 MultiAgentDecisionProcessDiscrete ()
 Default constructor.
 MultiAgentDecisionProcessDiscrete (std::string name="received unspec. by MultiAgentDecisionProcessDiscrete", std::string descr="received unspec.by MultiAgentDecisionProcessDiscrete", std::string pf="received unspec. by MultiAgentDecisionProcessDiscrete")
 Constructor that sets the.
 MultiAgentDecisionProcessDiscrete (int nrAgents, int nrS, std::string name="received unspec. by MultiAgentDecisionProcessDiscrete", std::string descr="received unspec.by MultiAgentDecisionProcessDiscrete", std::string pf="received unspec. by MultiAgentDecisionProcessDiscrete")
 Constructor that sets the.
void Print () const
 Prints some information on the MultiAgentDecisionProcessDiscrete.
Index SampleJointObservation (Index jaI, Index sucI) const
 Sample an observation.
Index SampleSuccessorState (Index sI, Index jaI) const
 Sample a successor state.
void SetObservationModelPtr (ObservationModelDiscrete *ptr)
 Set the obversation model.
void SetObservationProbability (Index jaI, Index sucSI, Index joI, double p)
 Set the probability of joint observation joI: P(joI|jaI,sucSI).
void SetSparse (bool sparse)
 Indicate whether sparse transition and observation models should be used.
void SetTransitionModelPtr (TransitionModelDiscrete *ptr)
 Set the transition model.
void SetTransitionProbability (Index sI, Index jaI, Index sucSI, double p)
 Set the probability of successor state sucSI: P(sucSI|sI,jaI).
std::string SoftPrint () const
 SoftPrints information on the MultiAgentDecisionProcessDiscrete.
 ~MultiAgentDecisionProcessDiscrete ()
 Destructor.
- Public Member Functions inherited from MultiAgentDecisionProcessDiscreteInterface
virtual ~MultiAgentDecisionProcessDiscreteInterface ()
 Destructor. Can't make a virt.destr. pure abstract!
- Public Member Functions inherited from MultiAgentDecisionProcessInterface
virtual ~MultiAgentDecisionProcessInterface ()
 Destructor.
- Public Member Functions inherited from MultiAgentDecisionProcess
void AddAgent (std::string name)
 Add a new agent with name "name" to the MADP.
size_t GetNrAgents () const
 Returns the number of agents in this MultiAgentDecisionProcess.
std::string GetProblemFile () const
 Returns the name of the problem file.
std::string GetUnixName () const
 Returns a name which can be in unix path, by default the base part of the problem filename.
 MultiAgentDecisionProcess (size_t nrAgents, std::string name="received unspec. by MultiAgentDecisionProcess", std::string description="received unspec. by MultiAgentDecisionProcess", std::string pf="received unspec. by MultiAgentDecisionProcess")
 Constructor.
 MultiAgentDecisionProcess (std::string name="received unspec. by MultiAgentDecisionProcess", std::string description="received unspec. by MultiAgentDecisionProcess", std::string pf="received unspec. by MultiAgentDecisionProcess")
 Default Constructor without specifying the number of agents.
void SetNrAgents (size_t nrAgents)
 Sets the number of agents.
void SetUnixName (std::string unixName)
 Sets the name which can be used inin unix paths.
virtual ~MultiAgentDecisionProcess ()
 Destructor.
- Public Member Functions inherited from MADPComponentDiscreteStates
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.
Index SampleInitialState () const
 Sample a state according to the initial state PDF.
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.
virtual std::string SoftPrintState (Index sI) const
virtual ~MADPComponentDiscreteStates ()
 Destructor.
- Public Member Functions inherited from MADPComponentDiscreteActions
void AddAction (Index AI, std::string name)
 Add a new action with name "name" to the actions of agent AI.
size_t ConstructJointActions ()
 Recursively constructs all the joint actions.
const ActionGetAction (Index agentI, Index a) const
 Return a ref to the a-th action of agent agentI.
const ActionDiscreteGetActionDiscrete (Index agentI, Index a) const
 Return a ref to the a-th action of agent agentI.
Index GetActionIndexByName (std::string s, Index agentI) const
 Returns the action index of the agent I's action s.
std::string GetActionName (Index a, Index i) const
 Returns the name of a particular action a of agent i.
const JointActionGetJointAction (Index i) const
 Return a ref to the i-th joint action.
const JointActionDiscreteGetJointActionDiscrete (Index i) const
 Return a ref to the i-th joint action (a JointActionDiscrete).
std::string GetJointActionName (Index a) const
 Returns the name of a particular joint action a.
const std::vector< size_t > & GetNrActions () const
 Return the number of actions vector.
size_t GetNrActions (Index AgentI) const
 Return the number of actions of agent agentI.
size_t GetNrJointActions () const
 Return the number of joiny actions.
Index IndividualToJointActionIndices (const std::vector< Index > &indivActionIndices) const
 Returns the joint action index that corresponds to the vector of specified individual action indices.
Index IndividualToJointActionIndices (const Index *IndexArray) const
 Returns the joint action index that corresponds to the array of specified individual action indices.
const std::vector< Index > & JointToIndividualActionIndices (Index jaI) const
 Returns a vector of indices to indiv.
 MADPComponentDiscreteActions ()
 Default constructor.
void SetNrActions (Index AI, size_t nrA)
 Sets the number of actions for agent AI.
virtual ~MADPComponentDiscreteActions ()
 Destructor.
- Public Member Functions inherited from MADPComponentDiscreteObservations
void AddObservation (Index AI, std::string name)
 Add a new observation with name "name" to the observ. of agent AI.
size_t ConstructJointObservations ()
 Recursively constructs all the joint observations.
const JointObservationGetJointObservation (Index i) const
 Return a ref to the i-th joint observation.
const JointObservationDiscreteGetJointObservationDiscrete (Index i) const
 Return a ref to the i-th joint observation integer.
std::string GetJointObservationName (Index o) const
 Returns the name of a particular joint observation o.
size_t GetNrJointObservations () const
 Return the number of joiny observations.
const std::vector< size_t > & GetNrObservations () const
 Return the number of observations vector.
size_t GetNrObservations (Index AgentI) const
 Return the number of observations of agent agentI.
const ObservationGetObservation (Index agentI, Index a) const
 Return a ref to the a-th observation of agent agentI.
const ObservationDiscreteGetObservationDiscrete (Index agentI, Index a) const
 Return a ref to the a-th observation of agent agentI.
Index GetObservationIndexByName (std::string s, Index agentI) const
 Returns the observation index of the agent I's observation s.
std::string GetObservationName (Index o, Index i) const
 Returns the name of a particular observation o of agent i.
Index IndividualToJointObservationIndices (const std::vector< Index > &indivObservationIndices) const
 Returns the joint observation index that corresponds to the vector of specified individual observation indices.
const std::vector< Index > & JointToIndividualObservationIndices (Index joI) const
 Returns a vector of indices to indiv.
 MADPComponentDiscreteObservations ()
 (default) Constructor
void SetNrObservations (Index AI, size_t nrO)
 Sets the number of observations for agent AI.
virtual ~MADPComponentDiscreteObservations ()
 Destructor.

Protected Member Functions

bool SetInitialized (bool b)
 Sets _m_initialized to b.

Private Member Functions

bool SanityCheck (void)
 Check whether models appear valid probability distributions.

Private Attributes

bool _m_initialized
 Boolean to indicate whether this MADPDiscrete has been initialized.
ObservationModelDiscrete_m_p_oModel
 Pointer to observation model.
TransitionModelDiscrete_m_p_tModel
 Pointer to transition model.
bool _m_sparse
 Boolean that controls whether sparse transition and observation models are used.

Additional Inherited Members

- Protected Attributes inherited from MultiAgentDecisionProcess
std::vector< Agent_m_agents
 Vector containing Agent objects, which are indexed named entities.
size_t _m_nrAgents
 The number of agents participating in the MADP.
std::string _m_problemFile
 String holding the filename of the problem file to be parsed - if applicable.
std::string _m_unixName
 String for the unix name of the MADP.
- Protected Attributes inherited from MADPComponentDiscreteStates
StateDistributionVector_m_initialStateDistribution
 A StateDistributionVector that represents the initial state distribution.
std::vector< StateDiscrete_m_stateVec
 A vector that contains all the states.
- Protected Attributes inherited from MADPComponentDiscreteActions
std::vector< std::vector
< ActionDiscrete > > 
_m_actionVecs
 The vectors of actions (vectors of ActionDiscrete) for each agent.
std::vector< size_t > _m_nrActions
 The number of actions for each agent.
- Protected Attributes inherited from MADPComponentDiscreteObservations
std::vector< size_t > _m_nrObservations
 The number of observations for each agent.
std::vector< std::vector
< ObservationDiscrete > > 
_m_observationVecs
 The vectors of observations (vectors of ObservationDiscrete) for each agent.

Detailed Description

MultiAgentDecisionProcessDiscrete is defines the primary properties of a discrete decision process.

MultiAgentDecisionProcessDiscrete is defines the primary properties of a discrete decision process.

It extends MultiAgentDecisionProcess, MADPComponentDiscreteActions and MADPComponentDiscreteObservations, such that, for each of the MultiAgentDecisionProcess::GetNrAgents() it stores -the discrete action sets -the discrete observation sets

It also extends MADPComponentDiscreteStates such that a discrete state space is implemented.

Finally, this class itself stores (pointers to) -the transition model -the observation model

Definition at line 62 of file MultiAgentDecisionProcessDiscrete.h.

Constructor & Destructor Documentation

MultiAgentDecisionProcessDiscrete::MultiAgentDecisionProcessDiscrete ( )

Default constructor.

Definition at line 43 of file MultiAgentDecisionProcessDiscrete.cpp.

Referenced by Clone().

MultiAgentDecisionProcessDiscrete::MultiAgentDecisionProcessDiscrete ( std::string  name = "received unspec. by MultiAgentDecisionProcessDiscrete",
std::string  descr = "received unspec.by MultiAgentDecisionProcessDiscrete",
std::string  pf = "received unspec. by MultiAgentDecisionProcessDiscrete" 
)

Constructor that sets the.

  • name
  • description
  • problem file for the MADP.

Definition at line 50 of file MultiAgentDecisionProcessDiscrete.cpp.

References _m_initialized, _m_p_oModel, _m_p_tModel, and _m_sparse.

MultiAgentDecisionProcessDiscrete::MultiAgentDecisionProcessDiscrete ( int  nrAgents,
int  nrS,
std::string  name = "received unspec. by MultiAgentDecisionProcessDiscrete",
std::string  descr = "received unspec.by MultiAgentDecisionProcessDiscrete",
std::string  pf = "received unspec. by MultiAgentDecisionProcessDiscrete" 
)

Constructor that sets the.

  • nrAgents
  • nrStates
  • name
  • description
  • problem file for the MADP.

Definition at line 64 of file MultiAgentDecisionProcessDiscrete.cpp.

References _m_initialized, _m_p_oModel, _m_p_tModel, and _m_sparse.

MultiAgentDecisionProcessDiscrete::~MultiAgentDecisionProcessDiscrete ( )

Destructor.

Definition at line 77 of file MultiAgentDecisionProcessDiscrete.cpp.

References _m_p_oModel, _m_p_tModel, and DEBUG_MADPD.

Member Function Documentation

virtual MultiAgentDecisionProcessDiscrete* MultiAgentDecisionProcessDiscrete::Clone ( ) const
inlinevirtual

Returns a pointer to a copy of this class.

Implements MultiAgentDecisionProcessDiscreteInterface.

Reimplemented in DecPOMDPDiscrete, and POSGDiscrete.

Definition at line 198 of file MultiAgentDecisionProcessDiscrete.h.

References MultiAgentDecisionProcessDiscrete().

void MultiAgentDecisionProcessDiscrete::CreateNewTransitionModel ( )
const ObservationModelDiscrete* MultiAgentDecisionProcessDiscrete::GetObservationModelDiscretePtr ( ) const
inlinevirtual

Returns a pointer to the underlying observation model.

If speed is required (for instance when looping through all states) the pointer can be requested by an algorithm. It can than obtain a pointer to the actual implementation type by runtime type identification. (i.e., using typeid and dynamic_cast).

Implements MultiAgentDecisionProcessDiscreteInterface.

Definition at line 186 of file MultiAgentDecisionProcessDiscrete.h.

References _m_p_oModel.

Referenced by DecPOMDPDiscrete::ExtractMADPDiscrete().

double MultiAgentDecisionProcessDiscrete::GetObservationProbability ( Index  jaI,
Index  sucSI,
Index  joI 
) const
inlinevirtual

Return the probability of joint observation joI: P(joI|jaI,sucSI).

Implements MultiAgentDecisionProcessDiscreteInterface.

Definition at line 217 of file MultiAgentDecisionProcessDiscrete.h.

References _m_p_oModel, and ObservationModelDiscrete::Get().

Referenced by TransitionObservationIndependentMADPDiscrete::GetObservationProbability(), and SanityCheck().

OGet * MultiAgentDecisionProcessDiscrete::GetOGet ( ) const
virtual
bool MultiAgentDecisionProcessDiscrete::GetSparse ( ) const
inline

Are we using sparse transition and observation models?

Definition at line 181 of file MultiAgentDecisionProcessDiscrete.h.

References _m_sparse.

Referenced by DecPOMDPDiscrete::CreateNewRewardModel(), and ParserTOIDecPOMDPDiscrete::ParseAgent().

TGet * MultiAgentDecisionProcessDiscrete::GetTGet ( ) const
virtual
const TransitionModelDiscrete* MultiAgentDecisionProcessDiscrete::GetTransitionModelDiscretePtr ( ) const
inlinevirtual

Returns a pointer to the underlying transition model.

If speed is required (for instance when looping through all states) the pointer can be requested by an algorithm. It can than obtain a pointer to the actual implementation type by runtime type identification. (i.e., using typeid and dynamic_cast).

Implements MultiAgentDecisionProcessDiscreteInterface.

Definition at line 183 of file MultiAgentDecisionProcessDiscrete.h.

References _m_p_tModel.

Referenced by DecPOMDPDiscrete::ExtractMADPDiscrete().

double MultiAgentDecisionProcessDiscrete::GetTransitionProbability ( Index  sI,
Index  jaI,
Index  sucSI 
) const
inlinevirtual
bool MultiAgentDecisionProcessDiscrete::Initialize ( )
inline

A function that can be called by other classes in order to request a MultiAgentDecisionProcessDiscrete to (try to) initialize.

Definition at line 133 of file MultiAgentDecisionProcessDiscrete.h.

References SetInitialized().

Referenced by DecPOMDPDiscrete::ExtractMADPDiscrete().

void MultiAgentDecisionProcessDiscrete::Print ( ) const
inline

Prints some information on the MultiAgentDecisionProcessDiscrete.

Reimplemented from MADPComponentDiscreteActions.

Definition at line 170 of file MultiAgentDecisionProcessDiscrete.h.

References SoftPrint().

Index MultiAgentDecisionProcessDiscrete::SampleJointObservation ( Index  jaI,
Index  sucI 
) const
inlinevirtual
Index MultiAgentDecisionProcessDiscrete::SampleSuccessorState ( Index  sI,
Index  jaI 
) const
inlinevirtual
bool MultiAgentDecisionProcessDiscrete::SanityCheck ( void  )
private

Check whether models appear valid probability distributions.

This is a private function as to avoid doubts as to what is and is not checked. (when called from a derived class, no derived features are checked).

Definition at line 203 of file MultiAgentDecisionProcessDiscrete.cpp.

References MADPComponentDiscreteActions::GetJointActionName(), MADPComponentDiscreteObservations::GetJointObservationName(), MADPComponentDiscreteActions::GetNrJointActions(), MADPComponentDiscreteObservations::GetNrJointObservations(), MADPComponentDiscreteStates::GetNrStates(), GetObservationProbability(), MADPComponentDiscreteStates::GetStateName(), GetTransitionProbability(), and Globals::PROB_PRECISION.

Referenced by SetInitialized().

bool MultiAgentDecisionProcessDiscrete::SetInitialized ( bool  b)
protected

Sets _m_initialized to b.

When setting to true, a verification of member elements is performed. (i.e. a check whether all vectors have the correct size and non-zero entries)

Reimplemented from MADPComponentDiscreteActions.

Reimplemented in DecPOMDPDiscrete, and POSGDiscrete.

Definition at line 137 of file MultiAgentDecisionProcessDiscrete.cpp.

References _m_initialized, _m_p_oModel, _m_p_tModel, SanityCheck(), MADPComponentDiscreteStates::SetInitialized(), MADPComponentDiscreteObservations::SetInitialized(), and MADPComponentDiscreteActions::SetInitialized().

Referenced by Initialize(), POSGDiscrete::SetInitialized(), and DecPOMDPDiscrete::SetInitialized().

void MultiAgentDecisionProcessDiscrete::SetObservationModelPtr ( ObservationModelDiscrete ptr)
inline

Set the obversation model.

Definition at line 194 of file MultiAgentDecisionProcessDiscrete.h.

References _m_p_oModel.

Referenced by DecPOMDPDiscrete::ExtractMADPDiscrete().

void MultiAgentDecisionProcessDiscrete::SetObservationProbability ( Index  jaI,
Index  sucSI,
Index  joI,
double  p 
)
inline

Set the probability of joint observation joI: P(joI|jaI,sucSI).

Definition at line 209 of file MultiAgentDecisionProcessDiscrete.h.

References _m_p_oModel, and ObservationModelDiscrete::Set().

Referenced by TOIDecMDPDiscrete::CreateStateObservations(), ProblemFireFighting::FillObservationModel(), and ProblemDecTiger::FillObservationModel().

void MultiAgentDecisionProcessDiscrete::SetSparse ( bool  sparse)

Indicate whether sparse transition and observation models should be used.

Default is to not use sparse models. Only has effect before the class has been initialized.

Definition at line 317 of file MultiAgentDecisionProcessDiscrete.cpp.

References _m_sparse.

Referenced by TransitionObservationIndependentMADPDiscrete::AddAgent(), ArgumentUtils::GetDecPOMDPDiscreteInterfaceFromArgs(), ParserTOIDecPOMDPDiscrete::ParseAgent(), ProblemFireFighting::ProblemFireFighting(), and TransitionObservationIndependentMADPDiscrete::SetNrAgents().

void MultiAgentDecisionProcessDiscrete::SetTransitionModelPtr ( TransitionModelDiscrete ptr)
inline

Set the transition model.

Definition at line 190 of file MultiAgentDecisionProcessDiscrete.h.

References _m_p_tModel.

Referenced by DecPOMDPDiscrete::ExtractMADPDiscrete().

void MultiAgentDecisionProcessDiscrete::SetTransitionProbability ( Index  sI,
Index  jaI,
Index  sucSI,
double  p 
)
inline

Set the probability of successor state sucSI: P(sucSI|sI,jaI).

Definition at line 206 of file MultiAgentDecisionProcessDiscrete.h.

References _m_p_tModel, and TransitionModelDiscrete::Set().

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

string MultiAgentDecisionProcessDiscrete::SoftPrint ( ) const
virtual

Member Data Documentation

bool MultiAgentDecisionProcessDiscrete::_m_initialized
private

Boolean to indicate whether this MADPDiscrete has been initialized.

Definition at line 72 of file MultiAgentDecisionProcessDiscrete.h.

Referenced by CreateNewObservationModel(), CreateNewTransitionModel(), MultiAgentDecisionProcessDiscrete(), SetInitialized(), and SoftPrint().

bool MultiAgentDecisionProcessDiscrete::_m_sparse
private

Boolean that controls whether sparse transition and observation models are used.

Definition at line 77 of file MultiAgentDecisionProcessDiscrete.h.

Referenced by CreateNewObservationModel(), CreateNewTransitionModel(), GetOGet(), GetSparse(), GetTGet(), MultiAgentDecisionProcessDiscrete(), and SetSparse().


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