MultiAgentDecisionProcess
Release 0.2.1
|
TransitionObservationIndependentMADPDiscrete is an base class that defines the primary properties of a Transition and Observation independent decision process. More...
#include <TransitionObservationIndependentMADPDiscrete.h>
Public Member Functions | |
void | AddAction (Index agentI, std::string name) |
Adds an action with a particular name for the specified agent. | |
void | AddAgent (std::string name="unspec.") |
Adds one agent with an optional name. | |
void | AddObservation (Index agentI, std::string name) |
Adds an Observation with a particular name for the specified agent. | |
void | AddState (Index agentI, std::string name) |
Adds a state with a particular name for the specified agent. | |
void | CreateCentralizedFullModels () |
void | CreateCentralizedSparseModels () |
const Action * | GetAction (Index agentI, Index a) const |
Get a pointer to action a of agentI. | |
MultiAgentDecisionProcessDiscrete * | GetIndividualMADPD (Index agentI) const |
Returns a pointer to agentsI's individual model. | |
double | GetInitialStateProbability (Index sI) const |
returns the prob. | |
virtual const StateDistributionVector * | GetISD () const |
returns the initial state distribution. | |
const JointAction * | GetJointAction (Index i) const |
Returns a pointer to joint action i. | |
const JointActionDiscrete * | GetJointActionDiscrete (Index i) const |
return a ref to the i-th joint action (a JointActionDiscrete). | |
const JointObservation * | GetJointObservation (Index i) const |
Get a pointer to the i-th joint observation. | |
size_t | GetNrActions (Index agentI) const |
return the number of actions of agent agentI | |
const std::vector< size_t > & | GetNrActions () const |
returns a vector with the number of actions for each agent. | |
size_t | GetNrJointActions () const |
return the number of joint actions. | |
size_t | GetNrJointObservations () const |
Get the number of joint observations. | |
size_t | GetNrJointStates () const |
size_t | GetNrObservations (Index agentI) const |
return the number of observations of agent agentI | |
const std::vector< size_t > & | GetNrObservations () const |
Returns a vector with the number of observations for each agent. | |
size_t | GetNrStates (Index agI) const |
Returns the number of local states for agent i. | |
size_t | GetNrStates () const |
returns the number of (joint) states. | |
const Observation * | GetObservation (Index agentI, Index o) const |
Get a pointer to observation o of agentI. | |
ObservationModelDiscrete * | GetObservationModelDiscretePtr () const |
Returns a pointer to the underlying observation model. | |
double | GetObservationProbability (Index jaI, Index sucSI, Index joI) const |
Returns the probability of the joint observation joI (the product of the individual observation probabilities, which depend only on local states). | |
double | GetObservationProbability (const std::vector< Index > &aIs, const std::vector< Index > &sucSIs, const std::vector< Index > &oIs) const |
OGet * | GetOGet () const |
const State * | GetState (Index i) const |
Returns a pointer to state i. | |
const State * | GetState (const std::vector< Index > &sIs) const |
TGet * | GetTGet () const |
TransitionModelDiscrete * | GetTransitionModelDiscretePtr () const |
Returns a pointer to the underlying transition model. | |
double | GetTransitionProbability (Index sI, Index jaI, Index sucSI) const |
returns probability of joint transition (the product of the probabilities of the individual transitions) | |
double | GetTransitionProbability (const std::vector< Index > &sIs, const std::vector< Index > &aIs, const std::vector< Index > &sucSIs) const |
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 *AI_ar) const |
Returns the joint action index that corresponds to the array of specified individual action indices. | |
Index | IndividualToJointActionIndices (Index *IndexArray) const |
converts individual to joint actions. | |
Index | IndividualToJointObservationIndices (const std::vector< Index > &indivObsIndices) const |
returns the joint index for indivObsIndices | |
Index | IndividualToJointStateIndices (const std::vector< Index > &indivStateIndices) const |
returns the joint index for indivStateIndices | |
bool | Initialize () |
const std::vector< Index > & | JointToIndividualActionIndices (Index jaI) const |
Returns the joint action index that corresponds to the array of specified individual action indices. | |
const std::vector< Index > & | JointToIndividualObservationIndices (Index joI) const |
returns the individual indices for joint observation joI. | |
const std::vector< Index > & | JointToIndividualStateIndices (Index jointSI) const |
returns a vector of individual (local) state indices corresponding to joint state index jointSI. | |
void | Print () const |
Prints information regarding this TransitionObservationIndependentMADPDiscrete. | |
void | PrintActionSets () const |
Prints the action set for each agent. | |
void | PrintJointActionSet () const |
Prints the set of joint actions. | |
Index | SampleInitialState (void) const |
Samples an initial state. | |
std::vector< Index > | SampleInitialStates (void) const |
Index | SampleJointObservation (Index jaI, Index sucI) const |
Returns a joint observation, sampled according to the observation probabilities. | |
std::vector< Index > | SampleJointObservation (const std::vector< Index > &aIs, const std::vector< Index > &sucIs) const |
Index | SampleSuccessorState (Index sI, Index jaI) const |
returns a successor state index sampled according to the transition probabilities. | |
std::vector< Index > | SampleSuccessorState (const std::vector< Index > &sIs, const std::vector< Index > &aIs) const |
void | SetISD (const std::vector< double > &v) |
Sets the initial state distribution to v. | |
void | SetNrActions (Index agentI, size_t nr) |
Sets the number of actions for the specified agent. | |
void | SetNrAgents (size_t n) |
Sets the number of agents to n. | |
void | SetNrObservations (Index agentI, size_t nr) |
Sets the number of Observations for the specified agent. | |
void | SetNrStates (Index agentI, size_t nr) |
Sets the number of states for the specified agent. | |
void | SetSparse (bool sparse) |
std::string | SoftPrint () const |
SoftPrints information regarding this TransitionObservationIndependentMADPDiscrete. | |
std::string | SoftPrintActionSets () const |
SoftPrints the action set for each agent. | |
std::string | SoftPrintJointActionSet () const |
SoftPrints the set of joint actions. | |
std::string | SoftPrintState (Index sI) const |
TransitionObservationIndependentMADPDiscrete (std::string name="received unspec. by TransitionObservationIndependentMADPDiscrete", std::string descr="received unspec.by TransitionObservationIndependentMADPDiscrete", std::string pf="received unspec. by TransitionObservationIndependentMADPDiscrete") | |
TransitionObservationIndependentMADPDiscrete (const TransitionObservationIndependentMADPDiscrete &) | |
virtual | ~TransitionObservationIndependentMADPDiscrete () |
Destructor. | |
![]() | |
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 | SetUnixName (std::string unixName) |
Sets the name which can be used inin unix paths. | |
virtual | ~MultiAgentDecisionProcess () |
Destructor. | |
![]() | |
virtual | ~MultiAgentDecisionProcessInterface () |
Destructor. | |
![]() | |
std::string | GetDescription () const |
Get the description of the NamedDescribedEntity. | |
std::string | GetName () const |
Get the name of the NamedDescribedEntity. | |
NamedDescribedEntity (std::string name=std::string("undefined"), std::string description=std::string("undefined")) | |
(default) Constructor | |
NamedDescribedEntity (const NamedDescribedEntity &) | |
copy constructor. | |
void | PrintBrief () const |
Prints the name (by default). | |
void | SetDescription (std::string description) |
Set the description. | |
void | SetName (std::string name) |
Set the name. | |
virtual std::string | SoftPrintBrief () const |
Returns the name (if not reimplemented). | |
virtual | ~NamedDescribedEntity () |
Destructor. | |
![]() | |
virtual MultiAgentDecisionProcessDiscreteInterface * | Clone () const =0 |
Returns a pointer to a copy of this class. | |
virtual | ~MultiAgentDecisionProcessDiscreteInterface () |
Destructor. Can't make a virt.destr. pure abstract! |
Protected Member Functions | |
bool | GetSparse () const |
virtual bool | SetInitialized (bool b) |
Sets _m_initialized to b. |
Private Member Functions | |
size_t | ConstructJointObservationsRecursively (Index curAgentI, JointObservationDiscrete &jo, Index joI) |
void | CreateISD () |
void | CreateJointActions () |
Recursively constructs all the joint actions. | |
size_t | CreateJointActionsRecursively (Index curAgentI, JointActionDiscrete &ja, Index jaI) |
void | CreateJointObservations () |
void | CreateJointStates () |
This function generates the joint -> individual state index cache. | |
std::vector< Index > | JointToIndividualActionIndicesNoCache (Index jaI) const |
std::vector< Index > | JointToIndividualObservationIndicesNoCache (Index joI) const |
Private Attributes | |
size_t * | _m_actionStepSize |
The stepsize array - used for indiv->joint index calculation. | |
std::vector < MultiAgentDecisionProcessDiscrete * > | _m_individualMADPDs |
In a transition-observation independent MADP, each agent has a set of local states and observations together with an individual transition and observation model. | |
std::vector< std::vector < ObservationDiscrete > > | _m_indivObs |
std::vector< std::vector< Index > > | _m_indivStateIndices |
The vector storing the individual state indices for each joint index: _m_indivStateIndices[jointStateIndex] = vector<Index> | |
std::map< Index, std::vector < Index > > * | _m_indivStateIndicesMap |
bool | _m_initialized |
Boolean to indicate whether this MADPDiscrete has been initialized. | |
StateDistributionVector * | _m_initialStateDistribution |
The vector containing the initial state distr over joint states. | |
std::map< Index, JointActionDiscrete * > * | _m_jointActionMap |
std::vector < JointActionDiscrete * > | _m_jointActionVec |
The vector storing the joint actions. | |
std::vector < JointObservationDiscrete * > | _m_jointObs |
std::map< Index, JointObservationDiscrete * > * | _m_jointObsMap |
std::vector< State * > | _m_jointStates |
std::map< std::vector< Index > , State * > * | _m_jointStatesMap |
std::vector< std::vector< Index > > | _m_jointToIndActionCache |
std::vector< std::vector< Index > > | _m_jointToIndObsCache |
bool | _m_noJointModels |
Boolean indicating whether joint models should be generated. | |
size_t | _m_nr_agents |
std::vector< size_t > | _m_nrIndivActions |
std::vector< size_t > | _m_nrIndivObs |
std::vector< size_t > | _m_nrIndivStates |
Vector that stores the number of individual states. | |
size_t | _m_nrJointActions |
the number of joint actions. | |
size_t | _m_nrJointObservations |
size_t | _m_nrJointStates |
ObservationModelDiscrete * | _m_p_oModel |
TransitionModelDiscrete * | _m_p_tModel |
bool | _m_sparse |
Boolean that indicates whether models should be stored sparsely. |
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. |
TransitionObservationIndependentMADPDiscrete is an base class that defines the primary properties of a Transition and Observation independent decision process.
It implements the transition and observation model by assigning a regular (1-agent) MultiAgentDecisionProcessDiscrete for each agent: the agents local model. This class is responsible for constructing the joint actions and observations (upon which rewards will typically be based).
Definition at line 55 of file TransitionObservationIndependentMADPDiscrete.h.
TransitionObservationIndependentMADPDiscrete::TransitionObservationIndependentMADPDiscrete | ( | std::string | name = "received unspec. by TransitionObservationIndependentMADPDiscrete" , |
std::string | descr = "received unspec.by TransitionObservationIndependentMADPDiscrete" , |
||
std::string | pf = "received unspec. by TransitionObservationIndependentMADPDiscrete" |
||
) |
Definition at line 45 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_indivStateIndicesMap, _m_initialized, _m_initialStateDistribution, _m_jointActionMap, _m_jointObsMap, _m_jointStatesMap, _m_noJointModels, _m_nrJointActions, _m_nrJointObservations, _m_nrJointStates, _m_p_oModel, _m_p_tModel, and _m_sparse.
TransitionObservationIndependentMADPDiscrete::TransitionObservationIndependentMADPDiscrete | ( | const TransitionObservationIndependentMADPDiscrete & | ) |
Definition at line 66 of file TransitionObservationIndependentMADPDiscrete.cpp.
|
virtual |
Destructor.
Definition at line 73 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_individualMADPDs, and _m_jointActionVec.
void TransitionObservationIndependentMADPDiscrete::AddAction | ( | Index | agentI, |
std::string | name | ||
) |
Adds an action with a particular name for the specified agent.
Definition at line 173 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_individualMADPDs.
void TransitionObservationIndependentMADPDiscrete::AddAgent | ( | std::string | name = "unspec." | ) |
Adds one agent with an optional name.
Reimplemented from MultiAgentDecisionProcess.
Definition at line 133 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_individualMADPDs, _m_sparse, MultiAgentDecisionProcess::GetNrAgents(), MultiAgentDecisionProcess::GetProblemFile(), SetInitialized(), and MultiAgentDecisionProcessDiscrete::SetSparse().
void TransitionObservationIndependentMADPDiscrete::AddObservation | ( | Index | agentI, |
std::string | name | ||
) |
Adds an Observation with a particular name for the specified agent.
Definition at line 187 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_individualMADPDs.
void TransitionObservationIndependentMADPDiscrete::AddState | ( | Index | agentI, |
std::string | name | ||
) |
Adds a state with a particular name for the specified agent.
Definition at line 159 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_individualMADPDs.
|
private |
Definition at line 499 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_indivObs, _m_jointObs, JointObservationDiscrete::AddIndividualObservation(), DEBUG_CJO, MultiAgentDecisionProcess::GetNrAgents(), JointObservation::Print(), and DiscreteEntity::SetIndex().
Referenced by CreateJointObservations().
void TransitionObservationIndependentMADPDiscrete::CreateCentralizedFullModels | ( | ) |
Definition at line 1122 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_initialized, _m_nrJointActions, _m_nrJointObservations, _m_nrJointStates, _m_p_oModel, _m_p_tModel, GetObservationProbability(), GetTransitionProbability(), TransitionModelDiscrete::Set(), and ObservationModelDiscrete::Set().
Referenced by ArgumentUtils::GetDecPOMDPDiscreteInterfaceFromArgs().
void TransitionObservationIndependentMADPDiscrete::CreateCentralizedSparseModels | ( | ) |
Definition at line 1088 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_initialized, _m_nrJointActions, _m_nrJointObservations, _m_nrJointStates, _m_p_oModel, _m_p_tModel, GetObservationProbability(), GetTransitionProbability(), TransitionModelDiscrete::Set(), and ObservationModelDiscrete::Set().
Referenced by ArgumentUtils::GetDecPOMDPDiscreteInterfaceFromArgs().
|
private |
Definition at line 574 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_indivStateIndices, _m_noJointModels, _m_nrJointStates, GetIndividualMADPD(), GetISD(), MultiAgentDecisionProcess::GetNrAgents(), and SetISD().
Referenced by SetInitialized().
|
private |
Recursively constructs all the joint actions.
Works by calling CreateJointActionsRecursively on a new (empty) joint action.
Definition at line 223 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_jointActionVec, _m_jointToIndActionCache, _m_noJointModels, _m_nrIndivActions, _m_nrJointActions, CreateJointActionsRecursively(), GetIndividualMADPD(), MultiAgentDecisionProcessDiscreteInterface::GetNrActions(), GetNrActions(), MultiAgentDecisionProcess::GetNrAgents(), and JointToIndividualActionIndicesNoCache().
Referenced by SetInitialized().
|
private |
Definition at line 251 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_jointActionVec, MultiAgentDecisionProcess::_m_nrAgents, JointActionDiscrete::AddIndividualAction(), DEBUG_CJA, GetIndividualMADPD(), GetNrActions(), JointAction::Print(), and DiscreteEntity::SetIndex().
Referenced by CreateJointActions().
|
private |
Definition at line 458 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_indivObs, _m_jointObs, _m_jointToIndObsCache, _m_noJointModels, _m_nrIndivObs, _m_nrJointObservations, ConstructJointObservationsRecursively(), GetIndividualMADPD(), MultiAgentDecisionProcess::GetNrAgents(), MultiAgentDecisionProcessDiscreteInterface::GetNrObservations(), GetNrObservations(), and JointToIndividualObservationIndicesNoCache().
Referenced by SetInitialized().
|
private |
This function generates the joint -> individual state index cache.
This function assumes that all the agents and their local states have been added.
Definition at line 322 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_indivStateIndices, _m_jointStates, _m_noJointModels, _m_nrIndivStates, _m_nrJointStates, GetIndividualMADPD(), NamedDescribedEntity::GetName(), MultiAgentDecisionProcess::GetNrAgents(), MultiAgentDecisionProcessDiscreteInterface::GetNrStates(), MultiAgentDecisionProcessDiscreteInterface::GetState(), IndexTools::Increment(), NamedDescribedEntity::SetDescription(), and NamedDescribedEntity::SetName().
Referenced by SetInitialized().
|
inlinevirtual |
Get a pointer to action a of agentI.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 353 of file TransitionObservationIndependentMADPDiscrete.h.
References GetAction(), and GetIndividualMADPD().
Referenced by GetAction().
|
inline |
Returns a pointer to agentsI's individual model.
Definition at line 210 of file TransitionObservationIndependentMADPDiscrete.h.
References _m_individualMADPDs.
Referenced by CreateISD(), CreateJointActions(), CreateJointActionsRecursively(), CreateJointObservations(), CreateJointStates(), TOIDecPOMDPDiscrete::CreateNewRewardModel(), TOIDecMDPDiscrete::CreateStateObservations(), GetAction(), GetJointActionDiscrete(), GetJointObservation(), GetNrActions(), GetNrObservations(), GetObservation(), GetObservationProbability(), TOICompactRewardDecPOMDPDiscrete::GetReward(), GetState(), GetTransitionProbability(), ParserTOIDecPOMDPDiscrete::ParseAgent(), ParserTOICompactRewardDecPOMDPDiscrete::ParseRewards(), ParserTOIDecPOMDPDiscrete::ParseRewards(), SampleInitialStates(), SampleJointObservation(), SampleSuccessorState(), TOICompactRewardDecPOMDPDiscrete::SetInitialized(), SoftPrint(), SoftPrintActionSets(), SoftPrintState(), ParserTOICompactRewardDecPOMDPDiscrete::StoreDecPOMDP(), ParserTOIFactoredRewardDecPOMDPDiscrete::StoreDecPOMDP(), and ParserTOIDecPOMDPDiscrete::StoreDecPOMDP().
|
inlinevirtual |
returns the prob.
of state sI according to the initial state distribution.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 341 of file TransitionObservationIndependentMADPDiscrete.h.
References _m_initialStateDistribution.
|
virtual |
returns the initial state distribution.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 1038 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_initialStateDistribution, and _m_noJointModels.
Referenced by CreateISD().
|
inlinevirtual |
Returns a pointer to joint action i.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 357 of file TransitionObservationIndependentMADPDiscrete.h.
References GetJointActionDiscrete().
const JointActionDiscrete * TransitionObservationIndependentMADPDiscrete::GetJointActionDiscrete | ( | Index | i | ) | const |
return a ref to the i-th joint action (a JointActionDiscrete).
Definition at line 395 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_jointActionMap, _m_jointActionVec, _m_noJointModels, _m_nrIndivActions, JointActionDiscrete::AddIndividualAction(), GetIndividualMADPD(), MultiAgentDecisionProcess::GetNrAgents(), and IndexTools::JointToIndividualIndices().
Referenced by GetJointAction(), and JointToIndividualActionIndicesNoCache().
|
virtual |
Get a pointer to the i-th joint observation.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 418 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_jointObs, _m_jointObsMap, _m_noJointModels, _m_nrIndivObs, JointObservationDiscrete::AddIndividualObservation(), GetIndividualMADPD(), MultiAgentDecisionProcess::GetNrAgents(), and IndexTools::JointToIndividualIndices().
|
inlinevirtual |
return the number of actions of agent agentI
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 224 of file TransitionObservationIndependentMADPDiscrete.h.
References GetIndividualMADPD(), and MultiAgentDecisionProcessDiscreteInterface::GetNrActions().
|
inlinevirtual |
returns a vector with the number of actions for each agent.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 349 of file TransitionObservationIndependentMADPDiscrete.h.
References _m_nrIndivActions.
Referenced by CreateJointActions(), CreateJointActionsRecursively(), TOIDecMDPDiscrete::CreateStateObservations(), and SoftPrintActionSets().
|
virtual |
return the number of joint actions.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 1071 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_initialized, and _m_nrJointActions.
Referenced by SoftPrint().
|
virtual |
Get the number of joint observations.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 1079 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_initialized, and _m_nrJointObservations.
Referenced by SoftPrint().
size_t TransitionObservationIndependentMADPDiscrete::GetNrJointStates | ( | ) | const |
Definition at line 1063 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_initialized, and _m_nrJointStates.
Referenced by GetNrStates(), and SoftPrint().
|
inlinevirtual |
return the number of observations of agent agentI
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 231 of file TransitionObservationIndependentMADPDiscrete.h.
References GetIndividualMADPD(), and MultiAgentDecisionProcessDiscreteInterface::GetNrObservations().
|
inlinevirtual |
Returns a vector with the number of observations for each agent.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 365 of file TransitionObservationIndependentMADPDiscrete.h.
References _m_nrIndivObs.
Referenced by CreateJointObservations(), IndividualToJointObservationIndices(), and JointToIndividualObservationIndicesNoCache().
|
inline |
Returns the number of local states for agent i.
Definition at line 227 of file TransitionObservationIndependentMADPDiscrete.h.
References _m_individualMADPDs.
|
inlinevirtual |
returns the number of (joint) states.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 332 of file TransitionObservationIndependentMADPDiscrete.h.
References GetNrJointStates().
Referenced by TOIDecMDPDiscrete::CreateStateObservations().
|
inlinevirtual |
Get a pointer to observation o of agentI.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 372 of file TransitionObservationIndependentMADPDiscrete.h.
References GetIndividualMADPD(), and GetObservation().
Referenced by GetObservation().
|
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 384 of file TransitionObservationIndependentMADPDiscrete.h.
References _m_p_oModel.
|
virtual |
Returns the probability of the joint observation joI (the product of the individual observation probabilities, which depend only on local states).
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 921 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_indivStateIndices, _m_jointToIndActionCache, _m_jointToIndObsCache, _m_noJointModels, GetIndividualMADPD(), MultiAgentDecisionProcess::GetNrAgents(), MultiAgentDecisionProcessDiscrete::GetObservationProbability(), JointToIndividualActionIndices(), JointToIndividualObservationIndices(), and JointToIndividualStateIndices().
Referenced by CreateCentralizedFullModels(), and CreateCentralizedSparseModels().
double TransitionObservationIndependentMADPDiscrete::GetObservationProbability | ( | const std::vector< Index > & | aIs, |
const std::vector< Index > & | sucSIs, | ||
const std::vector< Index > & | oIs | ||
) | const |
Definition at line 957 of file TransitionObservationIndependentMADPDiscrete.cpp.
References GetIndividualMADPD(), MultiAgentDecisionProcess::GetNrAgents(), and MultiAgentDecisionProcessDiscrete::GetObservationProbability().
|
virtual |
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 1171 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_noJointModels, _m_p_oModel, and _m_sparse.
|
inlineprotected |
Definition at line 160 of file TransitionObservationIndependentMADPDiscrete.h.
References _m_sparse.
Referenced by TOIDecPOMDPDiscrete::CreateNewRewardModel().
|
virtual |
Returns a pointer to state i.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 361 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_jointStates, _m_noJointModels, and JointToIndividualStateIndices().
const State * TransitionObservationIndependentMADPDiscrete::GetState | ( | const std::vector< Index > & | sIs | ) | const |
Definition at line 369 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_jointStatesMap, GetIndividualMADPD(), NamedDescribedEntity::GetName(), MultiAgentDecisionProcess::GetNrAgents(), MultiAgentDecisionProcessDiscreteInterface::GetState(), NamedDescribedEntity::SetDescription(), and NamedDescribedEntity::SetName().
|
virtual |
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 1157 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_noJointModels, _m_p_tModel, _m_sparse, and TGet_TransitionModelMappingSparse::TGet_TransitionModelMappingSparse().
|
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 381 of file TransitionObservationIndependentMADPDiscrete.h.
References _m_p_tModel.
|
virtual |
returns probability of joint transition (the product of the probabilities of the individual transitions)
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 867 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_indivStateIndices, _m_jointToIndActionCache, _m_noJointModels, GetIndividualMADPD(), MultiAgentDecisionProcess::GetNrAgents(), MultiAgentDecisionProcessDiscrete::GetTransitionProbability(), JointToIndividualActionIndices(), and JointToIndividualStateIndices().
Referenced by CreateCentralizedFullModels(), and CreateCentralizedSparseModels().
double TransitionObservationIndependentMADPDiscrete::GetTransitionProbability | ( | const std::vector< Index > & | sIs, |
const std::vector< Index > & | aIs, | ||
const std::vector< Index > & | sucSIs | ||
) | const |
Definition at line 903 of file TransitionObservationIndependentMADPDiscrete.cpp.
References GetIndividualMADPD(), MultiAgentDecisionProcess::GetNrAgents(), and MultiAgentDecisionProcessDiscrete::GetTransitionProbability().
|
virtual |
Returns the joint action index that corresponds to the vector of specified individual action indices.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 661 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_initialized, _m_nrIndivActions, and IndexTools::IndividualToJointIndices().
|
inlinevirtual |
Returns the joint action index that corresponds to the array of specified individual action indices.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 249 of file TransitionObservationIndependentMADPDiscrete.h.
References _m_actionStepSize, _m_nr_agents, and IndexTools::IndividualToJointIndicesArrayStepSize().
Index TransitionObservationIndependentMADPDiscrete::IndividualToJointActionIndices | ( | Index * | IndexArray | ) | const |
converts individual to joint actions.
Definition at line 653 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_nrIndivActions, and IndexTools::IndividualToJointIndicesArray().
|
virtual |
returns the joint index for indivObsIndices
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 715 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_initialized, MultiAgentDecisionProcess::GetNrAgents(), GetNrObservations(), and IndexTools::IndividualToJointIndices().
Referenced by SampleJointObservation().
Index TransitionObservationIndependentMADPDiscrete::IndividualToJointStateIndices | ( | const std::vector< Index > & | indivStateIndices | ) | const |
returns the joint index for indivStateIndices
Definition at line 772 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_nrIndivStates, and IndexTools::IndividualToJointIndices().
Referenced by SampleInitialState(), and SampleSuccessorState().
|
inline |
Definition at line 164 of file TransitionObservationIndependentMADPDiscrete.h.
References SetInitialized().
|
inlinevirtual |
Returns the joint action index that corresponds to the array of specified individual action indices.
returns a vector of indices to indiv. action indicies corr. to joint action index jaI.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 247 of file TransitionObservationIndependentMADPDiscrete.h.
References _m_jointToIndActionCache.
Referenced by GetObservationProbability(), TOIFactoredRewardDecPOMDPDiscrete::GetReward(), TOICompactRewardDecPOMDPDiscrete::GetReward(), TOIDecPOMDPDiscrete::GetReward(), GetTransitionProbability(), SampleJointObservation(), SampleSuccessorState(), and TOIDecPOMDPDiscrete::SetReward().
|
private |
Definition at line 678 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_initialized, _m_nrIndivActions, DEBUG_TOIMADPD, JointActionDiscrete::GetIndividualActionDiscretesIndices(), GetJointActionDiscrete(), and IndexTools::JointToIndividualIndices().
Referenced by CreateJointActions().
|
inlinevirtual |
returns the individual indices for joint observation joI.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 265 of file TransitionObservationIndependentMADPDiscrete.h.
References _m_jointToIndObsCache.
Referenced by GetObservationProbability().
|
private |
Definition at line 737 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_initialized, DEBUG_TOIMADPD, MultiAgentDecisionProcess::GetNrAgents(), GetNrObservations(), and IndexTools::JointToIndividualIndices().
Referenced by CreateJointObservations().
const std::vector< Index > & TransitionObservationIndependentMADPDiscrete::JointToIndividualStateIndices | ( | Index | jointSI | ) | const |
returns a vector of individual (local) state indices corresponding to joint state index jointSI.
Definition at line 442 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_indivStateIndices, _m_indivStateIndicesMap, _m_noJointModels, _m_nrIndivStates, and IndexTools::JointToIndividualIndices().
Referenced by GetObservationProbability(), TOIFactoredRewardDecPOMDPDiscrete::GetReward(), TOICompactRewardDecPOMDPDiscrete::GetReward(), TOIDecPOMDPDiscrete::GetReward(), GetState(), GetTransitionProbability(), SampleJointObservation(), SampleSuccessorState(), TOIDecPOMDPDiscrete::SetReward(), and SoftPrintState().
|
inline |
Prints information regarding this TransitionObservationIndependentMADPDiscrete.
Reimplemented from MultiAgentDecisionProcess.
Reimplemented in TOIDecPOMDPDiscrete.
Definition at line 284 of file TransitionObservationIndependentMADPDiscrete.h.
References SoftPrint().
|
inline |
Prints the action set for each agent.
Definition at line 272 of file TransitionObservationIndependentMADPDiscrete.h.
References SoftPrintActionSets().
|
inline |
Prints the set of joint actions.
Definition at line 277 of file TransitionObservationIndependentMADPDiscrete.h.
References SoftPrintJointActionSet().
|
virtual |
Samples an initial state.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 1021 of file TransitionObservationIndependentMADPDiscrete.cpp.
References IndividualToJointStateIndices(), and SampleInitialStates().
vector< Index > TransitionObservationIndependentMADPDiscrete::SampleInitialStates | ( | void | ) | const |
Definition at line 1027 of file TransitionObservationIndependentMADPDiscrete.cpp.
References GetIndividualMADPD(), MultiAgentDecisionProcess::GetNrAgents(), and MultiAgentDecisionProcessDiscreteInterface::SampleInitialState().
Referenced by SampleInitialState().
|
virtual |
Returns a joint observation, sampled according to the observation probabilities.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 995 of file TransitionObservationIndependentMADPDiscrete.cpp.
References IndividualToJointObservationIndices(), JointToIndividualActionIndices(), and JointToIndividualStateIndices().
vector< Index > TransitionObservationIndependentMADPDiscrete::SampleJointObservation | ( | const std::vector< Index > & | aIs, |
const std::vector< Index > & | sucIs | ||
) | const |
Definition at line 1006 of file TransitionObservationIndependentMADPDiscrete.cpp.
References GetIndividualMADPD(), MultiAgentDecisionProcess::GetNrAgents(), and MultiAgentDecisionProcessDiscrete::SampleJointObservation().
|
virtual |
returns a successor state index sampled according to the transition probabilities.
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 975 of file TransitionObservationIndependentMADPDiscrete.cpp.
References IndividualToJointStateIndices(), JointToIndividualActionIndices(), and JointToIndividualStateIndices().
vector< Index > TransitionObservationIndependentMADPDiscrete::SampleSuccessorState | ( | const std::vector< Index > & | sIs, |
const std::vector< Index > & | aIs | ||
) | const |
Definition at line 983 of file TransitionObservationIndependentMADPDiscrete.cpp.
References GetIndividualMADPD(), MultiAgentDecisionProcess::GetNrAgents(), and MultiAgentDecisionProcessDiscrete::SampleSuccessorState().
|
protectedvirtual |
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 in TOIDecPOMDPDiscrete, TOICompactRewardDecPOMDPDiscrete, TOIFactoredRewardDecPOMDPDiscrete, and TOIDecMDPDiscrete.
Definition at line 598 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_actionStepSize, _m_individualMADPDs, _m_initialized, _m_noJointModels, _m_nr_agents, _m_nrIndivActions, IndexTools::CalculateStepSize(), CreateISD(), CreateJointActions(), CreateJointObservations(), CreateJointStates(), DEBUG_TOIMADPD, and MultiAgentDecisionProcess::GetNrAgents().
Referenced by AddAgent(), Initialize(), TOIDecPOMDPDiscrete::SetInitialized(), and SetNrAgents().
void TransitionObservationIndependentMADPDiscrete::SetISD | ( | const std::vector< double > & | v | ) |
Sets the initial state distribution to v.
Definition at line 211 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_initialStateDistribution, and _m_nrJointStates.
Referenced by CreateISD().
void TransitionObservationIndependentMADPDiscrete::SetNrActions | ( | Index | agentI, |
size_t | nr | ||
) |
Sets the number of actions for the specified agent.
Definition at line 166 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_individualMADPDs.
void TransitionObservationIndependentMADPDiscrete::SetNrAgents | ( | size_t | n | ) |
Sets the number of agents to n.
Reimplemented from MultiAgentDecisionProcess.
Definition at line 101 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_individualMADPDs, _m_sparse, MultiAgentDecisionProcess::GetProblemFile(), SetInitialized(), and MultiAgentDecisionProcessDiscrete::SetSparse().
Referenced by ParserTOIDecPOMDPDiscrete::ParseBase().
void TransitionObservationIndependentMADPDiscrete::SetNrObservations | ( | Index | agentI, |
size_t | nr | ||
) |
Sets the number of Observations for the specified agent.
Definition at line 180 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_individualMADPDs.
Referenced by TOIDecMDPDiscrete::CreateStateObservations().
void TransitionObservationIndependentMADPDiscrete::SetNrStates | ( | Index | agentI, |
size_t | nr | ||
) |
Sets the number of states for the specified agent.
Definition at line 153 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_individualMADPDs.
void TransitionObservationIndependentMADPDiscrete::SetSparse | ( | bool | sparse | ) |
Definition at line 1048 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_individualMADPDs, and _m_sparse.
Referenced by ArgumentUtils::GetDecPOMDPDiscreteInterfaceFromArgs().
|
virtual |
SoftPrints information regarding this TransitionObservationIndependentMADPDiscrete.
Reimplemented from MultiAgentDecisionProcess.
Reimplemented in TOIDecPOMDPDiscrete, TOICompactRewardDecPOMDPDiscrete, and TOIFactoredRewardDecPOMDPDiscrete.
Definition at line 778 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_initialized, GetIndividualMADPD(), MultiAgentDecisionProcess::GetNrAgents(), GetNrJointActions(), GetNrJointObservations(), GetNrJointStates(), MultiAgentDecisionProcessDiscrete::SoftPrint(), SoftPrintActionSets(), and SoftPrintJointActionSet().
Referenced by Print().
string TransitionObservationIndependentMADPDiscrete::SoftPrintActionSets | ( | ) | const |
SoftPrints the action set for each agent.
Definition at line 804 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_initialized, MultiAgentDecisionProcess::_m_nrAgents, GetIndividualMADPD(), GetNrActions(), and NamedDescribedEntity::SoftPrint().
Referenced by PrintActionSets(), and SoftPrint().
string TransitionObservationIndependentMADPDiscrete::SoftPrintJointActionSet | ( | ) | const |
SoftPrints the set of joint actions.
Definition at line 831 of file TransitionObservationIndependentMADPDiscrete.cpp.
References _m_initialized, and _m_jointActionVec.
Referenced by PrintJointActionSet(), and SoftPrint().
|
virtual |
Implements MultiAgentDecisionProcessDiscreteInterface.
Definition at line 856 of file TransitionObservationIndependentMADPDiscrete.cpp.
References GetIndividualMADPD(), JointToIndividualStateIndices(), and MultiAgentDecisionProcessDiscreteInterface::SoftPrintState().
|
private |
The stepsize array - used for indiv->joint index calculation.
Definition at line 86 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by IndividualToJointActionIndices(), and SetInitialized().
|
private |
In a transition-observation independent MADP, each agent has a set of local states and observations together with an individual transition and observation model.
We model this as each agent having its own MultiAgentDecisionProcessDiscrete. This is the vector that contains a pointer to each agent's MultiAgentDecisionProcessDiscrete.
Definition at line 77 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by AddAction(), AddAgent(), AddObservation(), AddState(), GetIndividualMADPD(), GetNrStates(), SetInitialized(), SetNrActions(), SetNrAgents(), SetNrObservations(), SetNrStates(), SetSparse(), and ~TransitionObservationIndependentMADPDiscrete().
|
private |
Definition at line 112 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by ConstructJointObservationsRecursively(), and CreateJointObservations().
|
private |
The vector storing the individual state indices for each joint index: _m_indivStateIndices[jointStateIndex] = vector<Index>
Definition at line 94 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by CreateISD(), CreateJointStates(), GetObservationProbability(), GetTransitionProbability(), and JointToIndividualStateIndices().
|
private |
Definition at line 95 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by JointToIndividualStateIndices(), and TransitionObservationIndependentMADPDiscrete().
|
private |
Boolean to indicate whether this MADPDiscrete has been initialized.
Definition at line 61 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by CreateCentralizedFullModels(), CreateCentralizedSparseModels(), GetNrJointActions(), GetNrJointObservations(), GetNrJointStates(), IndividualToJointActionIndices(), IndividualToJointObservationIndices(), JointToIndividualActionIndicesNoCache(), JointToIndividualObservationIndicesNoCache(), SetInitialized(), SoftPrint(), SoftPrintActionSets(), SoftPrintJointActionSet(), and TransitionObservationIndependentMADPDiscrete().
|
private |
The vector containing the initial state distr over joint states.
Definition at line 104 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by GetInitialStateProbability(), GetISD(), SetISD(), and TransitionObservationIndependentMADPDiscrete().
|
private |
Definition at line 81 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by GetJointActionDiscrete(), and TransitionObservationIndependentMADPDiscrete().
|
private |
The vector storing the joint actions.
Definition at line 80 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by CreateJointActions(), CreateJointActionsRecursively(), GetJointActionDiscrete(), SoftPrintJointActionSet(), and ~TransitionObservationIndependentMADPDiscrete().
|
private |
Definition at line 113 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by ConstructJointObservationsRecursively(), CreateJointObservations(), and GetJointObservation().
|
private |
Definition at line 114 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by GetJointObservation(), and TransitionObservationIndependentMADPDiscrete().
|
private |
Definition at line 97 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by CreateJointStates(), and GetState().
|
private |
Definition at line 98 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by GetState(), and TransitionObservationIndependentMADPDiscrete().
|
private |
Definition at line 83 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by CreateJointActions(), GetObservationProbability(), GetTransitionProbability(), and JointToIndividualActionIndices().
|
private |
Definition at line 118 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by CreateJointObservations(), GetObservationProbability(), and JointToIndividualObservationIndices().
|
private |
Boolean indicating whether joint models should be generated.
Definition at line 66 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by CreateISD(), CreateJointActions(), CreateJointObservations(), CreateJointStates(), GetISD(), GetJointActionDiscrete(), GetJointObservation(), GetObservationProbability(), GetOGet(), GetState(), GetTGet(), GetTransitionProbability(), JointToIndividualStateIndices(), SetInitialized(), and TransitionObservationIndependentMADPDiscrete().
|
private |
Definition at line 69 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by IndividualToJointActionIndices(), and SetInitialized().
|
private |
Definition at line 108 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by CreateJointActions(), GetJointActionDiscrete(), GetNrActions(), IndividualToJointActionIndices(), JointToIndividualActionIndicesNoCache(), and SetInitialized().
|
private |
Definition at line 110 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by CreateJointObservations(), GetJointObservation(), and GetNrObservations().
|
private |
Vector that stores the number of individual states.
(Created by CreateJointStates() )
Definition at line 90 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by CreateJointStates(), IndividualToJointStateIndices(), and JointToIndividualStateIndices().
|
private |
the number of joint actions.
Definition at line 106 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by CreateCentralizedFullModels(), CreateCentralizedSparseModels(), CreateJointActions(), GetNrJointActions(), and TransitionObservationIndependentMADPDiscrete().
|
private |
Definition at line 116 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by CreateCentralizedFullModels(), CreateCentralizedSparseModels(), CreateJointObservations(), GetNrJointObservations(), and TransitionObservationIndependentMADPDiscrete().
|
private |
Definition at line 100 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by CreateCentralizedFullModels(), CreateCentralizedSparseModels(), CreateISD(), CreateJointStates(), GetNrJointStates(), SetISD(), and TransitionObservationIndependentMADPDiscrete().
|
private |
Definition at line 122 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by CreateCentralizedFullModels(), CreateCentralizedSparseModels(), GetObservationModelDiscretePtr(), GetOGet(), and TransitionObservationIndependentMADPDiscrete().
|
private |
Definition at line 120 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by CreateCentralizedFullModels(), CreateCentralizedSparseModels(), GetTGet(), GetTransitionModelDiscretePtr(), and TransitionObservationIndependentMADPDiscrete().
|
private |
Boolean that indicates whether models should be stored sparsely.
Definition at line 63 of file TransitionObservationIndependentMADPDiscrete.h.
Referenced by AddAgent(), GetOGet(), GetSparse(), GetTGet(), SetNrAgents(), SetSparse(), and TransitionObservationIndependentMADPDiscrete().