MultiAgentDecisionProcess
Release 0.2.1
|
MultiAgentDecisionProcessDiscrete is defines the primary properties of a discrete decision process. More...
#include <MultiAgentDecisionProcessDiscrete.h>
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 ObservationModelDiscrete * | GetObservationModelDiscretePtr () 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). | |
OGet * | GetOGet () const |
bool | GetSparse () const |
Are we using sparse transition and observation models? | |
TGet * | GetTGet () const |
const TransitionModelDiscrete * | GetTransitionModelDiscretePtr () 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. | |
![]() | |
virtual | ~MultiAgentDecisionProcessDiscreteInterface () |
Destructor. Can't make a virt.destr. pure abstract! | |
![]() | |
virtual | ~MultiAgentDecisionProcessInterface () |
Destructor. | |
![]() | |
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. | |
![]() | |
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. | |
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. | |
![]() | |
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 Action * | GetAction (Index agentI, Index a) const |
Return a ref to the a-th action of agent agentI. | |
const ActionDiscrete * | GetActionDiscrete (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 JointAction * | GetJointAction (Index i) const |
Return a ref to the i-th joint action. | |
const JointActionDiscrete * | GetJointActionDiscrete (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. | |
![]() | |
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 JointObservation * | GetJointObservation (Index i) const |
Return a ref to the i-th joint observation. | |
const JointObservationDiscrete * | GetJointObservationDiscrete (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 Observation * | GetObservation (Index agentI, Index a) const |
Return a ref to the a-th observation of agent agentI. | |
const ObservationDiscrete * | GetObservationDiscrete (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 | |
![]() | |
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. | |
![]() | |
StateDistributionVector * | _m_initialStateDistribution |
A StateDistributionVector that represents the initial state distribution. | |
std::vector< StateDiscrete > | _m_stateVec |
A vector that contains all the states. | |
![]() | |
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. | |
![]() | |
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. |
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.
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.
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.
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.
|
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::CreateNewObservationModel | ( | ) |
Creates a new observation model mapping.
Definition at line 120 of file MultiAgentDecisionProcessDiscrete.cpp.
References _m_initialized, _m_p_oModel, _m_sparse, MADPComponentDiscreteActions::GetNrJointActions(), MADPComponentDiscreteObservations::GetNrJointObservations(), and MADPComponentDiscreteStates::GetNrStates().
Referenced by TOIDecMDPDiscrete::CreateStateObservations(), ProblemDecTiger::ProblemDecTiger(), and ProblemFireFighting::ProblemFireFighting().
void MultiAgentDecisionProcessDiscrete::CreateNewTransitionModel | ( | ) |
Creates a new transition model mapping.
Definition at line 86 of file MultiAgentDecisionProcessDiscrete.cpp.
References _m_initialized, _m_p_tModel, _m_sparse, MADPComponentDiscreteActions::GetNrJointActions(), and MADPComponentDiscreteStates::GetNrStates().
Referenced by ProblemDecTiger::ProblemDecTiger(), and ProblemFireFighting::ProblemFireFighting().
|
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().
|
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().
|
virtual |
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 110 of file MultiAgentDecisionProcessDiscrete.cpp.
References _m_p_oModel, and _m_sparse.
|
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().
|
virtual |
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 100 of file MultiAgentDecisionProcessDiscrete.cpp.
References _m_p_tModel, and _m_sparse.
|
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().
|
inlinevirtual |
Return the probability of successor state sucSI: P(sucSI|sI,jaI).
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 213 of file MultiAgentDecisionProcessDiscrete.h.
References _m_p_tModel, and TransitionModelDiscrete::Get().
Referenced by ProblemDecTiger::FillTransitionModel(), TransitionObservationIndependentMADPDiscrete::GetTransitionProbability(), SanityCheck(), POSGDiscrete::SetReward(), and DecPOMDPDiscrete::SetReward().
|
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().
|
inline |
Prints some information on the MultiAgentDecisionProcessDiscrete.
Reimplemented from MADPComponentDiscreteActions.
Definition at line 170 of file MultiAgentDecisionProcessDiscrete.h.
References SoftPrint().
|
inlinevirtual |
Sample an observation.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 223 of file MultiAgentDecisionProcessDiscrete.h.
References _m_p_oModel, and ObservationModelDiscrete::SampleJointObservation().
Referenced by TransitionObservationIndependentMADPDiscrete::SampleJointObservation().
|
inlinevirtual |
Sample a successor state.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 220 of file MultiAgentDecisionProcessDiscrete.h.
References _m_p_tModel, and TransitionModelDiscrete::SampleSuccessorState().
Referenced by TransitionObservationIndependentMADPDiscrete::SampleSuccessorState().
|
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().
|
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().
|
inline |
Set the obversation model.
Definition at line 194 of file MultiAgentDecisionProcessDiscrete.h.
References _m_p_oModel.
Referenced by DecPOMDPDiscrete::ExtractMADPDiscrete().
|
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().
|
inline |
Set the transition model.
Definition at line 190 of file MultiAgentDecisionProcessDiscrete.h.
References _m_p_tModel.
Referenced by DecPOMDPDiscrete::ExtractMADPDiscrete().
|
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().
|
virtual |
SoftPrints information on the MultiAgentDecisionProcessDiscrete.
Reimplemented from MADPComponentDiscreteActions.
Reimplemented in DecPOMDPDiscrete, and POSGDiscrete.
Definition at line 184 of file MultiAgentDecisionProcessDiscrete.cpp.
References _m_initialized, _m_p_oModel, _m_p_tModel, TransitionModelDiscrete::SoftPrint(), and ObservationModelDiscrete::SoftPrint().
Referenced by Print(), and TransitionObservationIndependentMADPDiscrete::SoftPrint().
|
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().
|
private |
Pointer to observation model.
Definition at line 91 of file MultiAgentDecisionProcessDiscrete.h.
Referenced by CreateNewObservationModel(), GetObservationModelDiscretePtr(), GetObservationProbability(), GetOGet(), MultiAgentDecisionProcessDiscrete(), SampleJointObservation(), SetInitialized(), SetObservationModelPtr(), SetObservationProbability(), SoftPrint(), and ~MultiAgentDecisionProcessDiscrete().
|
private |
Pointer to transition model.
Definition at line 88 of file MultiAgentDecisionProcessDiscrete.h.
Referenced by CreateNewTransitionModel(), GetTGet(), GetTransitionModelDiscretePtr(), GetTransitionProbability(), MultiAgentDecisionProcessDiscrete(), SampleSuccessorState(), SetInitialized(), SetTransitionModelPtr(), SetTransitionProbability(), SoftPrint(), and ~MultiAgentDecisionProcessDiscrete().
|
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().