MultiAgentDecisionProcess
PlanningUnitMADPDiscrete Class Reference

PlanningUnitMADPDiscrete represents a Planning unit for a discrete MADP (discrete actions, observations and states). More...

#include <PlanningUnitMADPDiscrete.h>

Inheritance diagram for PlanningUnitMADPDiscrete:
[legend]

Public Member Functions

virtual bool AreCachedJointToIndivIndices (PolicyGlobals::PolicyDomainCategory pdc) const
 Check whether certain index conversions are cached. More...
 
void ComputeHistoryArrays (Index hI, Index t, Index t_offset, Index Indices[], size_t indexDomainSize) const
 This function computes the indices of the sequence corr. More...
 
Index ComputeHistoryIndex (Index t, Index t_offset, const Index indices[], size_t indexDomainSize) const
 This function computes the index of a history. More...
 
void ExportDotGraph (const std::string &filename, const PolicyDiscretePure &policy, Index agentI, bool labelEdges=true) const
 Export a policy in dot format (from the GraphViz tools). More...
 
const ActionGetAction (Index agentI, Index a) const
 Returns a ref to the a-th action of agent agentI. More...
 
void GetActionHistoryArrays (Index agentI, Index ahI, Index t, Index aIs[]) const
 Computes the joint actions for jahI. More...
 
ActionHistoryTreeGetActionHistoryTree (Index agentI, Index ohI) const
 Returns a pointer to action history# ohI of agent# agentI. More...
 
void GetActionObservationHistoryArrays (Index agentI, Index aohI, Index t, Index aIs[], Index oIs[]) const
 Computes the joint actions and observations for aohI. More...
 
Index GetActionObservationHistoryIndex (Index agentI, Index t, const std::vector< Index > &actions, const std::vector< Index > &observations) const
 converts the vectors of actions and observations of length t to a (individual) ObservationHistory Index for agentI. More...
 
ActionObservationHistoryTreeGetActionObservationHistoryTree (Index agentI, Index aohI) const
 Returns a pointer to observation history# ohI of agent# agentI. More...
 
virtual
PolicyGlobals::PolicyDomainCategory 
GetDefaultIndexDomCat () const
 Return the default PolicyDomainCategory for the problem. More...
 
LIndex GetFirstJointActionObservationHistoryIndex (Index ts) const
 Returns the index of the first joint action observation history of time step ts. More...
 
LIndex GetFirstJointObservationHistoryIndex (Index ts) const
 Returns the index of the first joint observation history of time step ts. More...
 
LIndex GetFirstObservationHistoryIndex (Index agI, Index ts) const
 Returns the index of the first ts observation history of agent agI. More...
 
double GetInitialStateProbability (Index sI) const
 Returns the probability of a state in the initial state distribution. More...
 
double GetJAOHProb (LIndex jaohI, Index p_jaohI=0, const JointBeliefInterface *p_jb=NULL, const JointPolicyDiscrete *jpol=NULL) const
 returns the probability of jaohI. More...
 
double GetJAOHProbGivenPred (LIndex jaohI) const
 Gives the conditional probability of the realization of the joint action-observation history jaohI (and thus of the joint belief corresponding to JointActionObservationHistory jaohI). More...
 
double GetJAOHProbs (JointBeliefInterface *jb, LIndex jaohI, LIndex p_jaohI=0, const JointBeliefInterface *p_jb=NULL, const JointPolicyDiscrete *jpol=NULL) const
 returns the probability of jaohI AND the corresponding joint belief given the predecessor p_jaohI (and its corresponding belief) More...
 
double GetJAOHProbsRecursively (JointBeliefInterface *jb, const Index jaIs[], const Index joIs[], Index t_p, Index t, LIndex p_jaohI=0, const JointPolicyDiscrete *jpol=NULL) const
 the function that perfoms most of the work, called by GetJAOHProbs. More...
 
const JointActionGetJointAction (Index jaI) const
 Returns a ref to the i-th joint action. More...
 
Index GetJointActionHistoryIndex (Index t, const std::vector< Index > &jointActions) const
 converts the vector joint observations of length t to a JointObservationHistory Index. More...
 
Index GetJointActionHistoryIndex (Index t, const Index jointActions[]) const
 converts the vector joint observations of length t to a JointObservationHistory Index. More...
 
Index GetJointActionHistoryIndex (JointActionHistoryTree *joh) const
 Returns the index of a JointActionHistoryTree pointer. More...
 
JointActionHistoryTreeGetJointActionHistoryTree (Index jahI) const
 Returns a pointer to joint action history#. More...
 
void GetJointActionObservationHistoryArrays (LIndex jaohI, Index t, Index jaIs[], Index joIs[]) const
 Computes the joint actions and observations for jaohI. More...
 
LIndex GetJointActionObservationHistoryIndex (JointActionObservationHistoryTree *jaoh) const
 Returns the index of a JointActionObservationHistoryTree pointer. More...
 
Index GetJointActionObservationHistoryIndex (Index t, const std::vector< Index > &Jactions, const std::vector< Index > &Jobservations) const
 converts the vectors of actions and observations of length t to a joint ActionObservationHistory Index. More...
 
Index GetJointActionObservationHistoryIndex (Index t, const std::vector< Index > &Jactions, const std::vector< Index > &Jobservations, const Scope &agentSope) const
 like GetJointActionObservationHistoryIndex, but works on a subset of agents. More...
 
JointActionObservationHistoryTreeGetJointActionObservationHistoryTree (LIndex jaohI) const
 Returns a pointer to JointActionObservation history#. More...
 
void GetJointActionObservationHistoryVectors (LIndex jaohI, std::vector< Index > &jaIs, std::vector< Index > &joIs) const
 returns the vectors with joint actions and observations for JointActionObservationHistory jaohi. More...
 
JointBeliefInterfaceGetJointBeliefInterface (LIndex jaohI) const
 brief Returns a pointer to a new joint belief. More...
 
const JointObservationGetJointObservation (Index joI) const
 Returns a ref to the joI-th joint observation. More...
 
void GetJointObservationHistoryArrays (Index johI, Index t, Index joIs[]) const
 Computes the joint observations for johI. More...
 
Index GetJointObservationHistoryIndex (JointObservationHistoryTree *joh) const
 Returns the index of a JointObservationHistoryTree pointer. More...
 
Index GetJointObservationHistoryIndex (Index t, const std::vector< Index > &jointObservations) const
 converts the vector joint observations of length t to a JointObservationHistory Index. More...
 
Index GetJointObservationHistoryIndex (Index t, const Index jointObservations[]) const
 converts the vector joint observations of length t to a JointObservationHistory Index. More...
 
JointObservationHistoryTreeGetJointObservationHistoryTree (Index johI) const
 Returns a pointer to joint observation history#. More...
 
MultiAgentDecisionProcessDiscreteInterfaceGetMADPDI ()
 
const
MultiAgentDecisionProcessDiscreteInterface
GetMADPDI () const
 
JointBeliefInterfaceGetNewJointBeliefFromISD () const
 Returns a new joint belief with the value of the initial state distribution. More...
 
virtual JointBeliefInterfaceGetNewJointBeliefInterface () const
 a function that forces derives classes to specify which types of joint beliefs are used. More...
 
virtual JointBeliefInterfaceGetNewJointBeliefInterface (size_t size) const
 
size_t GetNrActionHistories (Index agentI) const
 Returns the number of action histories for agentI. More...
 
size_t GetNrActionHistories (Index agentI, Index ts) const
 Returns the number of action histories for agentI for time step ts. More...
 
size_t GetNrActionObservationHistories (Index agentI) const
 Returns the number of action observation histories for agentI. More...
 
const std::vector< size_t > & GetNrActions () const
 Returns the number of actions vector. More...
 
size_t GetNrActions (Index agentI) const
 Returns the number of actions of agent agentI. More...
 
size_t GetNrAgents () const
 Gets the number of agents. More...
 
size_t GetNrJointActionHistories () const
 Returns the number of joint action histories. More...
 
size_t GetNrJointActionObservationHistories () const
 Returns the number of jointActionObservation histories. More...
 
size_t GetNrJointActions () const
 return the number of joint actions. More...
 
size_t GetNrJointObservationHistories () const
 Returns the number of joint observation histories. More...
 
size_t GetNrJointObservationHistories (Index ts) const
 Returns the number of joint observation histories for time step ts. More...
 
size_t GetNrJointObservations () const
 Returns the number of joint observations. More...
 
LIndex GetNrJointPolicies () const
 Returns the number of joint policies. More...
 
size_t GetNrObservationHistories (Index agentI) const
 Returns the number of observation histories for agentI. More...
 
size_t GetNrObservationHistories (Index agentI, Index ts) const
 Returns the number of observation histories for agentI for time step ts. More...
 
const std::vector< size_t > GetNrObservationHistoriesVector () const
 Returns a vector with the number of OHs for each agent. More...
 
const std::vector< size_t > GetNrObservationHistoriesVector (Index ts) const
 Returns a vector with the number of OHs in stage ts for each agent. More...
 
const std::vector< size_t > & GetNrObservations () const
 Returns the number of observations vector. More...
 
size_t GetNrObservations (Index agentI) const
 Returns the number of observations of agent agentI. More...
 
LIndex GetNrPolicies (Index agentI) const
 Returns the number of policies for agentI. More...
 
size_t GetNrPolicyDomainElements (Index agentI, PolicyGlobals::PolicyDomainCategory cat, size_t depth=MAXHORIZON) const
 Get the number of elements in the domain of an agent's policy. More...
 
size_t GetNrStates () const
 Returns the number of states. More...
 
const ObservationGetObservation (Index agentI, Index o) const
 Returns a ref to the o-th observation of agent agentI. More...
 
void GetObservationHistoryArrays (Index agentI, Index ohI, Index t, Index oIs[]) const
 Computes the observations for ohI. More...
 
Index GetObservationHistoryIndex (Index agentI, Index t, const std::vector< Index > &observations) const
 converts the vector observations of length t to a (individual) ObservationHistory Index for agentI. More...
 
ObservationHistoryTreeGetObservationHistoryTree (Index agentI, Index ohI) const
 Returns a pointer to observation history# ohI of agent# agentI. More...
 
const ObservationModelDiscreteGetObservationModelDiscretePtr () const
 
double GetObservationProbability (Index jaI, Index sucSI, Index joI) const
 Returns P(joI | jaI, sucSI ). Arguments are time-ordered. More...
 
const
PlanningUnitMADPDiscreteParameters
GetParams () const
 Get the parameters for this planning unit. More...
 
const
MultiAgentDecisionProcessDiscreteInterface
GetProblem () const
 Returns a reference to the problem of the PlanningUnitMADPDiscrete. More...
 
MultiAgentDecisionProcessDiscreteInterfaceGetProblem ()
 
const StateGetState (Index i) const
 Get a pointer to a State by index. More...
 
Index GetSuccessorAHI (Index agentI, Index ohI, Index oI) const
 
Index GetSuccessorAOHI (Index agI, Index aohI, Index aI, Index oI) const
 Returns the index of the successor of joint action-observation history jaohI via joint action jaI and joint observation joI. More...
 
Index GetSuccessorJAHI (Index johI, Index joI) const
 
LIndex GetSuccessorJAOHI (LIndex jaohI, Index jaI, Index joI) const
 Returns the index of the successor of agent agI's action-observation history aohI via action aI and observation oI. More...
 
Index GetSuccessorJOHI (Index johI, Index joI) const
 Returns the index of the successor of observation history johI via joint observation joI. More...
 
Index GetSuccessorOHI (Index agentI, Index ohI, Index oI) const
 Returns the index of the successor of observation history ohI of agentI via observation joI. More...
 
Index GetTimeStepForAHI (Index agentI, Index ohI) const
 Returns the time step of observation history ohI. More...
 
Index GetTimeStepForAOHI (Index agentI, Index aohI) const
 Returns the time step of joint action-observation historyaohI. More...
 
Index GetTimeStepForJAHI (Index johI) const
 Returns the time step of joint observation history johI. More...
 
Index GetTimeStepForJAOHI (LIndex jaohI) const
 Returns the time step of joint action-observation historyjaohI. More...
 
Index GetTimeStepForJOHI (Index johI) const
 Returns the time step of joint observation history johI. More...
 
Index GetTimeStepForOHI (Index agentI, Index ohI) const
 Returns the time step of observation history ohI. More...
 
const TransitionModelDiscreteGetTransitionModelDiscretePtr () const
 
double GetTransitionProbability (Index sI, Index jaI, Index sucSI) const
 Returns the trans. prob for state, joint action, suc state indices. More...
 
Index IndividualToJointActionHistoryIndex (Index t, const std::vector< Index > &indivIs) const
 converts individual history indices to a joint index More...
 
Index IndividualToJointActionIndices (const Index *indivActionIndices) const
 Returns the joint action index that corresponds to the array of specified individual action indices. More...
 
Index IndividualToJointActionIndices (const std::vector< Index > &indivActionIndices) const
 Returns the joint action index that corresponds to the vector of specified individual action indices. More...
 
LIndex IndividualToJointActionObservationHistoryIndex (Index t, const std::vector< Index > &indivIs) const
 converts individual history indices to a joint index More...
 
Index IndividualToJointObservationHistoryIndex (Index t, const std::vector< Index > &indivIs) const
 converts individual history indices to a joint index More...
 
Index IndividualToJointObservationIndices (const std::vector< Index > &inObs) const
 Returns the joint observation index that corresponds to the vector of specified individual observation indices. More...
 
void JointAOHIndexToIndividualActionObservationVectors (LIndex jaohI, std::vector< std::vector< Index > > &indivO_vec, std::vector< std::vector< Index > > &indivA_vec) const
 computes the vectors of actions and obs. More...
 
void JointAOHIndexToIndividualActionObservationVectors (LIndex jaohI, std::vector< std::vector< Index > > &indivAO_vec) const
 computes the vector of action-observations corresponding to jaohI indivAO_vec[agentI][t] = aoI More...
 
std::vector< IndexJointToIndividualActionHistoryIndices (Index JAHistI) const
 Returns a vector containing the indices of the individual ObservationHistory s corresponding to the JointActionHistory index JAHistI. More...
 
const std::vector< Index > & JointToIndividualActionHistoryIndicesRef (Index JAHistI) const
 Returns a reference to a cached vector containing the indices of the indiv. More...
 
std::vector< IndexJointToIndividualActionIndices (Index jaI) const
 Returns a vector containing the indices of the indiv. More...
 
std::vector< IndexJointToIndividualActionObservationHistoryIndices (LIndex jaohI) const
 Returns a vector containing the indices of the indiv. More...
 
const std::vector< Index > & JointToIndividualActionObservationHistoryIndicesRef (LIndex jaohI) const
 Returns a vector containing the indices of the indiv. More...
 
std::vector< IndexJointToIndividualObservationHistoryIndices (Index johI) const
 Returns a vector containing the indices of the indiv. More...
 
const std::vector< Index > & JointToIndividualObservationHistoryIndicesRef (Index johI) const
 Returns a vector containing the indices of the indiv. More...
 
std::vector< IndexJointToIndividualObservationIndices (Index joI) const
 Returns a vector containing the indices of the indiv. More...
 
std::vector< IndexJointToIndividualPolicyDomainIndices (Index jdI, PolicyGlobals::PolicyDomainCategory cat) const
 Converts joint indices to individual policy domain element indices. More...
 
const std::vector< Index > & JointToIndividualPolicyDomainIndicesRef (Index jdI, PolicyGlobals::PolicyDomainCategory cat) const
 Converts individual policy domain element indices to joint indices. More...
 
 PlanningUnitMADPDiscrete (size_t horizon=3, MultiAgentDecisionProcessDiscreteInterface *p=0, const PlanningUnitMADPDiscreteParameters *params=0)
 Constructor with specified parameters. More...
 
 PlanningUnitMADPDiscrete (size_t horizon=3, MultiAgentDecisionProcessDiscreteInterface *p=0)
 Constructor with default parameters. DEPRECATED?: More...
 
std::string PolicyToDotGraph (const PolicyDiscretePure &policy, Index agentI, bool labelEdges=true) const
 Convert a policy to dot format (from the GraphViz tools). More...
 
void Print ()
 Prints info regarding the planning unit. More...
 
void PrintActionHistories ()
 Prints the action histories for all agents. More...
 
void PrintActionObservationHistories ()
 Prints the actionObservation histories for all agents. More...
 
void PrintObservationHistories ()
 Prints the observation histories for all agents. More...
 
void RegisterJointActionObservationHistoryTree (JointActionObservationHistoryTree *jaoht)
 Register a new jaoht in the vector of indices. More...
 
void SetHorizon (size_t h)
 Sets the horizon for the planning problem. More...
 
void SetParams (const PlanningUnitMADPDiscreteParameters &params)
 Sets the parameters for this planning unit. More...
 
void SetProblem (MultiAgentDecisionProcessDiscreteInterface *madp)
 Sets the problem for which to plan, using a pointer. More...
 
std::string SoftPrintAction (Index agentI, Index actionI) const
 soft prints action actionI of agent agentI. More...
 
std::string SoftPrintObservationHistory (Index agentI, Index ohIndex) const
 soft prints ObservationHistory ohIndex of agent agentI. More...
 
std::string SoftPrintPolicyDomainElement (Index agentI, Index dI, PolicyGlobals::PolicyDomainCategory cat) const
 Virtual function that has to be implemented by derived class. More...
 
 ~PlanningUnitMADPDiscrete ()
 Destructor. More...
 
- Public Member Functions inherited from PlanningUnit
size_t GetHorizon () const
 Returns the planning horizon. More...
 
virtual boost::shared_ptr
< JointPolicy
GetJointPolicy ()=0
 Returns a pointer to the computed joint policy. More...
 
Index GetNextAgentIndex ()
 Maintains a agent index and returns the next one on calling */. More...
 
size_t GetNrAgents () const
 Return the number of agents. More...
 
const
MultiAgentDecisionProcessInterface
GetProblem () const
 Get the problem pointer. More...
 
int GetSeed () const
 Returns the random seed stored. More...
 
void InitSeed () const
 Initializes the random number generator (srand) to the stored seed. More...
 
virtual void Plan ()=0
 The function that performs the actual planning. More...
 
 PlanningUnit (size_t horizon, MultiAgentDecisionProcessInterface *p)
 (default) Constructor More...
 
void SetProblem (MultiAgentDecisionProcessInterface *p)
 Updates the problem pointer. More...
 
void SetSeed (int s)
 Stores the random seed and calls InitSeed(). More...
 
virtual ~PlanningUnit ()
 Destructor. More...
 
- Public Member Functions inherited from Interface_ProblemToPolicyDiscretePure
LIndex GetNrJointPolicies (PolicyGlobals::PolicyDomainCategory cat, size_t depth=MAXHORIZON) const
 Get the number of joint policies, given the policy's domain. More...
 
LIndex GetNrPolicies (Index ag, PolicyGlobals::PolicyDomainCategory cat, size_t depth=MAXHORIZON) const
 Get the number of policies for an agent, given the policy's domain. More...
 
virtual ~Interface_ProblemToPolicyDiscretePure ()
 Destructor. More...
 
- Public Member Functions inherited from Interface_ProblemToPolicyDiscrete
size_t GetNrJointActions () const
 Get the number of joint actions. More...
 
 Interface_ProblemToPolicyDiscrete ()
 (default) Constructor More...
 
virtual ~Interface_ProblemToPolicyDiscrete ()
 Destructor. More...
 

Protected Member Functions

virtual bool SanityCheck () const
 Do some sanity checks, can be overridden. More...
 

Protected Attributes

std::vector< ActionHistoryTree * > _m_actionHistoryTreeRootPointers
 A vector that stores pointers to the roots of the action history trees of each agent. More...
 
std::vector< std::vector
< ActionHistoryTree * > > 
_m_actionHistoryTreeVectors
 A vector which, for each agents, stores a vector with all ActionHistoryTree pointers. More...
 
std::vector
< ActionObservationHistoryTree * > 
_m_actionObservationHistoryTreeRootPointers
 A vector that stores pointers to the roots of the action-observation history trees of each agent. More...
 
std::vector< std::vector
< ActionObservationHistoryTree * > > 
_m_actionObservationHistoryTreeVectors
 A vector which, for each agents, stores a vector with all ActionObservationHistoryTree pointers. More...
 
std::vector< std::vector
< LIndex > > 
_m_firstAHIforT
 The _m_firstAHIforT[aI][t] contains the first action history for time-step t of agent aI. More...
 
std::vector< std::vector
< LIndex > > 
_m_firstAOHIforT
 The _m_firstAOHIforT[aI][t] contains the first actionObservation history for time-step t of agent aI. More...
 
std::vector< LIndex_m_firstJAHIforT
 The _m_firstJAHIforT[t] contains the first joint action history for time-step t. More...
 
std::vector< LIndex_m_firstJAOHIforT
 _m_firstJAOHIforT[t] contains the first joint actionObservation history for time-step t. More...
 
std::vector< LIndex_m_firstJOHIforT
 The _m_firstJOHIforT[t] contains the first joint observation history for time-step t. More...
 
std::vector< std::vector
< LIndex > > 
_m_firstOHIforT
 The _m_firstOHIforT[aI][t] contains the first observation history for time-step t of agent aI. More...
 
std::vector< double > _m_jaohConditionalProbs
 Stores the conditional probability of this joint belief. More...
 
std::vector< double > _m_jaohProbs
 Caches the probabilities of JointActionObservationHistory's (assuming b^0 is as specified by the problem and that a pure joint policy consistent with the i-th JointActionObservationHistory is followed). More...
 
std::vector< const
JointBeliefInterface * > 
_m_jBeliefCache
 _m_jBeliefCache[i] stores a pointer to the joint belief corresponding to the i-th JointActionObservationHistory (assuming b^0 is as specified by the problem and that a pure joint policy consistent with the i-th JointActionObservationHistory is followed) More...
 
JointActionHistoryTree_m_jointActionHistoryTreeRoot
 The root node of the joint action histories tree. More...
 
std::vector
< JointActionHistoryTree * > 
_m_jointActionHistoryTreeVector
 A vector which stores a JointActionHistoryTree pointer. More...
 
std::map< LIndex,
JointActionObservationHistoryTree * > 
_m_jointActionObservationHistoryTreeMap
 A map which is used instead of _m_jointActionObservationHistoryTreeVector when we don't cache all JointActionObservationHistoryTree's. More...
 
JointActionObservationHistoryTree_m_jointActionObservationHistoryTreeRoot
 The root node of the joint actionObservation histories tree. More...
 
std::vector
< JointActionObservationHistoryTree * > 
_m_jointActionObservationHistoryTreeVector
 A vector which stores JointActionObservationHistoryTree pointer. More...
 
JointObservationHistoryTree_m_jointObservationHistoryTreeRoot
 The root node of the joint observation histories tree. More...
 
std::vector
< JointObservationHistoryTree * > 
_m_jointObservationHistoryTreeVector
 A vector which stores a JointObservationHistoryTree pointer. More...
 
std::vector< size_t > _m_nrActionHistories
 A vector that keeps track of the number of action histories per agent. More...
 
std::vector< std::vector
< size_t > > 
_m_nrActionHistoriesT
 A vector that keeps track of the number of action histories per agent per time step. More...
 
std::vector< size_t > _m_nrActionObservationHistories
 A vector that keeps track of the number of action-obs. More...
 
std::vector< std::vector
< size_t > > 
_m_nrActionObservationHistoriesT
 Keeps track of the number of action-obs. More...
 
size_t _m_nrJointActionHistories
 The number of joint action histories. More...
 
std::vector< size_t > _m_nrJointActionHistoriesT
 The number of joint action histories per time-step. More...
 
size_t _m_nrJointActionObservationHistories
 The number of joint actionAction histories. More...
 
std::vector< size_t > _m_nrJointActionObservationHistoriesT
 The number of joint actionObservation histories per time-step. More...
 
size_t _m_nrJointObservationHistories
 The number of joint observation histories. More...
 
std::vector< size_t > _m_nrJointObservationHistoriesT
 The number of joint observation histories per time-step. More...
 
std::vector< size_t > _m_nrObservationHistories
 A vector that keeps track of the number of observation histories per agent. More...
 
std::vector< std::vector
< size_t > > 
_m_nrObservationHistoriesT
 Keeps track of the number of observation histories per agent per time step. More...
 
std::vector
< ObservationHistoryTree * > 
_m_observationHistoryTreeRootPointers
 A vector that stores pointers to the roots of the observation history trees of each agent. More...
 
std::vector< std::vector
< ObservationHistoryTree * > > 
_m_observationHistoryTreeVectors
 A vector which, for each agents, stores a vector with all ObservationHistoryTree pointers. More...
 

Private Member Functions

ActionHistoryTreeCreateActionHistoryTree (Index agentI)
 Breadth-first construction of the action histories and action history tree for agent agentI. More...
 
ActionObservationHistoryTreeCreateActionObservationHistoryTree (Index agentI)
 Breadth-first construction of the action-observation histories and action-obs. More...
 
ObservationHistoryTreeCreateObservationHistoryTree (Index agentI)
 Breadth-first construction of the observation histories and obs. More...
 
void Deinitialize ()
 Cleans up and releases allocated memory. More...
 
void DeInitializeActionHistories ()
 Deletes all ActionHistories(Trees) - used on reinitialization. More...
 
void DeInitializeActionObservationHistories ()
 Deletes all ActionObservationHistories(Trees) - used on reinitialization. More...
 
void DeInitializeJointActionHistories ()
 Deletes all joint action histories. More...
 
void DeInitializeJointActionObservationHistories ()
 Deletes all joint action-observation histories. More...
 
void DeInitializeJointObservationHistories ()
 Deletes all joint observation histories. More...
 
void DeInitializeObservationHistories ()
 Deletes all ObservationHistories(Trees) - used on reinitialization. More...
 
void Initialize ()
 Calls functions to initialize the planning unit. More...
 
void InitializeActionHistories ()
 Constructs all possible action histories and puts them in a tree per agent. More...
 
void InitializeActionObservationHistories ()
 Constructs all possible action-observation histories and puts them in a tree per agent. More...
 
void InitializeJointActionHistories ()
 Creates all the joint action histories. More...
 
void InitializeJointActionObservationHistories ()
 Creates all the joint action-observation histories. More...
 
void InitializeJointObservationHistories ()
 Creates all the joint observation histories. More...
 
void InitializeObservationHistories ()
 Constructs all possible observation histories and puts them in a tree per agent. More...
 

Private Attributes

bool _m_initialized
 A bool indicating whether this Planning unit has been initialized. More...
 
MultiAgentDecisionProcessDiscreteInterface_m_madp
 
PlanningUnitMADPDiscreteParameters _m_params
 The parameters for this planning unit. More...
 

Detailed Description

PlanningUnitMADPDiscrete represents a Planning unit for a discrete MADP (discrete actions, observations and states).

Constructor & Destructor Documentation

PlanningUnitMADPDiscrete::PlanningUnitMADPDiscrete ( size_t  horizon = 3,
MultiAgentDecisionProcessDiscreteInterface p = 0,
const PlanningUnitMADPDiscreteParameters params = 0 
)

Constructor with specified parameters.

Allows for specification of the planning horizon and a pointer to the problem instance.

References _m_initialized, _m_params, DEBUG_PU_CONSTRUCTORS, Initialize(), and PlanningUnitMADPDiscreteParameters::SanityCheck().

PlanningUnitMADPDiscrete::PlanningUnitMADPDiscrete ( size_t  horizon = 3,
MultiAgentDecisionProcessDiscreteInterface p = 0 
)

Constructor with default parameters. DEPRECATED?:

DEPRECATED?:

Allows for specification of the planning horizon and a pointer to the problem instance. See PlanningUnitMADPDiscreteParameters for the default settings.

References _m_initialized, _m_params, DEBUG_PU_CONSTRUCTORS, Initialize(), and PlanningUnitMADPDiscreteParameters::SetComputeAll().

PlanningUnitMADPDiscrete::~PlanningUnitMADPDiscrete ( )

Destructor.

References Deinitialize().

Member Function Documentation

void PlanningUnitMADPDiscrete::ComputeHistoryArrays ( Index  hI,
Index  t,
Index  t_offset,
Index  Indices[],
size_t  indexDomainSize 
) const

This function computes the indices of the sequence corr.

to a history. I.e., it is the reverse of ComputeHistoryIndex.

It can be a joint or individual history of actions, observations or actions-observations.

  • Index hI - index of the history
  • Index t - the stage
  • Index t_offset - for each stage t, there is an offset
  • const Index indices[] - array of size t. The function will write the indices of the (J)(A/O)s corresponding to hI to this array.
  • size_t indexDomainSize - the number of indices. I.e., the indices range from 0...(indexDomainSize-1)
Index PlanningUnitMADPDiscrete::ComputeHistoryIndex ( Index  t,
Index  t_offset,
const Index  indices[],
size_t  indexDomainSize 
) const

This function computes the index of a history.

It can be a joint or individual history of actions, observations or actions-observations.

  • Index t - the stage
  • Index t_offset - for each stage t, there is an offset
  • const Index indices[] - array of size t containing the actual indices of the (J)(A/O)s. E.g., a vector with joint observation indices.
  • size_t indexDomainSize - the number of indices. I.e., the indices range from 0...(indexDomainSize-1)

Referenced by GetActionObservationHistoryIndex(), GetJointActionHistoryIndex(), GetJointActionObservationHistoryIndex(), GetJointObservationHistoryIndex(), and GetObservationHistoryIndex().

ActionHistoryTree * PlanningUnitMADPDiscrete::CreateActionHistoryTree ( Index  agentI)
private

Breadth-first construction of the action histories and action history tree for agent agentI.

Returns a pointer to the root of the tree. The function should only be called from InitializeActionHistories()! (should be called in the order of the agents).

References _m_actionHistoryTreeVectors, _m_firstAHIforT, _m_nrActionHistories, _m_nrActionHistoriesT, IndexTools::CalculateNumberOfSequences(), Globals::CastLIndexToIndex(), PlanningUnit::GetHorizon(), GetNrActions(), and ArgumentHandlers::size().

Referenced by InitializeActionHistories().

ActionObservationHistoryTree * PlanningUnitMADPDiscrete::CreateActionObservationHistoryTree ( Index  agentI)
private
ObservationHistoryTree * PlanningUnitMADPDiscrete::CreateObservationHistoryTree ( Index  agentI)
private
void PlanningUnitMADPDiscrete::DeInitializeActionHistories ( )
private

Deletes all ActionHistories(Trees) - used on reinitialization.

References _m_actionHistoryTreeRootPointers, _m_actionHistoryTreeVectors, _m_firstAHIforT, _m_nrActionHistories, and _m_nrActionHistoriesT.

Referenced by Deinitialize().

void PlanningUnitMADPDiscrete::DeInitializeActionObservationHistories ( )
private

Deletes all ActionObservationHistories(Trees) - used on reinitialization.

References _m_actionObservationHistoryTreeRootPointers, _m_actionObservationHistoryTreeVectors, _m_firstAOHIforT, _m_nrActionObservationHistories, and _m_nrActionObservationHistoriesT.

Referenced by Deinitialize().

void PlanningUnitMADPDiscrete::DeInitializeJointActionHistories ( )
private
void PlanningUnitMADPDiscrete::DeInitializeJointObservationHistories ( )
private
void PlanningUnitMADPDiscrete::DeInitializeObservationHistories ( )
private

Deletes all ObservationHistories(Trees) - used on reinitialization.

References _m_firstOHIforT, _m_nrObservationHistories, _m_nrObservationHistoriesT, _m_observationHistoryTreeRootPointers, and _m_observationHistoryTreeVectors.

Referenced by Deinitialize().

void PlanningUnitMADPDiscrete::ExportDotGraph ( const std::string &  filename,
const PolicyDiscretePure policy,
Index  agentI,
bool  labelEdges = true 
) const

Export a policy in dot format (from the GraphViz tools).

References PolicyToDotGraph().

const Action* PlanningUnitMADPDiscrete::GetAction ( Index  agentI,
Index  a 
) const
inline

Returns a ref to the a-th action of agent agentI.

References GetMADPDI().

Referenced by ActionHistory::SoftPrint(), ActionObservationHistory::SoftPrint(), and SoftPrintAction().

void PlanningUnitMADPDiscrete::GetActionHistoryArrays ( Index  agentI,
Index  ahI,
Index  t,
Index  aIs[] 
) const

Computes the joint actions for jahI.

This function computes (i.e., does no look up).

  • jahI - the JointActionHistory index
  • t - the stage of jaohI
  • jaIs - an array of size t, which will be filled with actions a^1,...,a^t

References Globals::CastLIndexToIndex().

Referenced by IndividualToJointActionHistoryIndex().

ActionHistoryTree * PlanningUnitMADPDiscrete::GetActionHistoryTree ( Index  agentI,
Index  ohI 
) const
void PlanningUnitMADPDiscrete::GetActionObservationHistoryArrays ( Index  agentI,
Index  aohI,
Index  t,
Index  aIs[],
Index  oIs[] 
) const

Computes the joint actions and observations for aohI.

This function computes (i.e., does no look up).

  • agentI - the agent index
  • aohI - the JointActionObservationHistory index
  • t - the stage of jaohI
  • aIs - an array of size t, which will be filled with actions a^0,...,a^(t-1)
  • oIs - an array of size t, which will be filled with observ. o^1,...,o^t

References IndexTools::ActionObservation_to_ActionIndex(), IndexTools::ActionObservation_to_ObservationIndex(), and Globals::CastLIndexToIndex().

Referenced by IndividualToJointActionObservationHistoryIndex(), JointPolicyPureVectorForClusteredBG::StartRecursiveConstructionPerAgent(), and JointPolicyPureVectorForClusteredBG::StartRecursiveSoftPrintPerAgent().

Index PlanningUnitMADPDiscrete::GetActionObservationHistoryIndex ( Index  agentI,
Index  t,
const std::vector< Index > &  actions,
const std::vector< Index > &  observations 
) const
ActionObservationHistoryTree* PlanningUnitMADPDiscrete::GetActionObservationHistoryTree ( Index  agentI,
Index  aohI 
) const
inline

Returns a pointer to observation history# ohI of agent# agentI.

References _m_actionObservationHistoryTreeVectors.

Referenced by GetSuccessorAOHI(), GetTimeStepForAOHI(), and SoftPrintPolicyDomainElement().

PolicyGlobals::PolicyDomainCategory PlanningUnitMADPDiscrete::GetDefaultIndexDomCat ( ) const
virtual

Return the default PolicyDomainCategory for the problem.

Implements Interface_ProblemToPolicyDiscrete.

References PolicyGlobals::OHIST_INDEX.

LIndex PlanningUnitMADPDiscrete::GetFirstJointActionObservationHistoryIndex ( Index  ts) const
inline

Returns the index of the first joint action observation history of time step ts.

LIndex PlanningUnitMADPDiscrete::GetFirstJointObservationHistoryIndex ( Index  ts) const
inline

Returns the index of the first joint observation history of time step ts.

double PlanningUnitMADPDiscrete::GetInitialStateProbability ( Index  sI) const
inline

Returns the probability of a state in the initial state distribution.

References GetMADPDI().

Referenced by ValueFunctionDecPOMDPDiscrete::CalculateV().

double PlanningUnitMADPDiscrete::GetJAOHProb ( LIndex  jaohI,
Index  p_jaohI = 0,
const JointBeliefInterface p_jb = NULL,
const JointPolicyDiscrete jpol = NULL 
) const

returns the probability of jaohI.

References GetJAOHProbs(), and GetNewJointBeliefInterface().

Referenced by QHybrid::GetQ().

double PlanningUnitMADPDiscrete::GetJAOHProbGivenPred ( LIndex  jaohI) const

Gives the conditional probability of the realization of the joint action-observation history jaohI (and thus of the joint belief corresponding to JointActionObservationHistory jaohI).

This probability is conditional GIVEN the previous joint action-observation history (joint belief) AND joint action. I.e. P(h'|h,a) = P(h,a,h') / P(h,a)

References _m_jaohConditionalProbs, _m_params, Globals::CastLIndexToIndex(), PlanningUnitMADPDiscreteParameters::GetComputeJointActionObservationHistories(), GetJAOHProbs(), GetJointActionObservationHistoryIndex(), GetJointActionObservationHistoryVectors(), and GetNewJointBeliefInterface().

Referenced by QHybrid::ComputeRecursively().

double PlanningUnitMADPDiscrete::GetJAOHProbs ( JointBeliefInterface jb,
LIndex  jaohI,
LIndex  p_jaohI = 0,
const JointBeliefInterface p_jb = NULL,
const JointPolicyDiscrete jpol = NULL 
) const

returns the probability of jaohI AND the corresponding joint belief given the predecessor p_jaohI (and its corresponding belief)

-output args: JointBeliefInterface jb -the joint belief at jaohI -input args: Index jaohI -the jaohI for which we want to know the probs. Index p_jaohI = 0 -the GIVEN predecessor, when none is specified, the initial (empty) jaoh is assumed. JointBelief* p_jb = NULL-the corresponding GIVEN jb of p JointPolicyDiscrete * jpol = NULL -the policy followed starting from p_jaohI. (see remark below) -returns the probability of jaohI, given p_jaohI.

jpol is the joint policy that is followed for the stages between p_jaohI and jaohI. It doesn't matter if given jpol, the prob. of p_jaohI is 0; this function returns P(jaohI) GIVEN p_jaohI and following jpol consequently.

See also
the manual documentation.

References _m_jaohProbs, _m_jBeliefCache, _m_params, Globals::CastLIndexToIndex(), PlanningUnitMADPDiscreteParameters::GetComputeJointBeliefs(), GetJAOHProbsRecursively(), JointActionObservationHistoryTree::GetJointActionObservationHistory(), GetJointActionObservationHistoryArrays(), GetJointActionObservationHistoryTree(), GetJointActionObservationHistoryVectors(), GetMADPDI(), GetTimeStepForJAOHI(), Globals::INITIAL_JAOHI, BeliefInterface::Set(), JointActionObservationHistory::SoftPrint(), and PrintTools::SoftPrintVector().

Referenced by GetJAOHProb(), and GetJAOHProbGivenPred().

double PlanningUnitMADPDiscrete::GetJAOHProbsRecursively ( JointBeliefInterface jb,
const Index  jaIs[],
const Index  joIs[],
Index  t_p,
Index  t,
LIndex  p_jaohI = 0,
const JointPolicyDiscrete jpol = NULL 
) const

the function that perfoms most of the work, called by GetJAOHProbs.

given the joint belief jb, held for joint action observation history p_joahI, this function performs the joint belief updates corresponding to the sequence

jaIs[t_p], joIs[t_p], ..., jaIs[t], joIs[t]

the returned value is the probability of this sequence, given the start p_jaohI, and given the policy followed jpol.

The joint belief corresponding to this sequence is returned through jb (the belief jb is simply updated.)

References PolicyGlobals::AOHIST_INDEX, JointPolicyDiscrete::GetJointActionProb(), GetJointObservationHistoryIndex(), GetMADPDI(), JointPolicyDiscrete::GetPolicyDomainCategory(), GetSuccessorJAOHI(), PolicyGlobals::OHIST_INDEX, and JointBeliefInterface::Update().

Referenced by GetJAOHProbs(), and BayesianGameForDecPOMDPStage::Initialize().

const JointAction* PlanningUnitMADPDiscrete::GetJointAction ( Index  jaI) const
inline
Index PlanningUnitMADPDiscrete::GetJointActionHistoryIndex ( Index  t,
const std::vector< Index > &  jointActions 
) const

converts the vector joint observations of length t to a JointObservationHistory Index.

jointObservation needs to be a vector of length > t. The index of the history formed by the first t joint observations is returned.

References _m_firstJAHIforT, Globals::CastLIndexToIndex(), ComputeHistoryIndex(), and GetNrJointActions().

Referenced by IndividualToJointActionHistoryIndex().

Index PlanningUnitMADPDiscrete::GetJointActionHistoryIndex ( Index  t,
const Index  jointActions[] 
) const

converts the vector joint observations of length t to a JointObservationHistory Index.

jointObservation needs to be a vector of length > t. The index of the history formed by the first t joint observations is returned.

References _m_firstJAHIforT, Globals::CastLIndexToIndex(), ComputeHistoryIndex(), and GetNrJointActions().

Index PlanningUnitMADPDiscrete::GetJointActionHistoryIndex ( JointActionHistoryTree joh) const

Returns the index of a JointActionHistoryTree pointer.

References _m_jointActionHistoryTreeVector, and _m_nrJointActionHistories.

JointActionHistoryTree * PlanningUnitMADPDiscrete::GetJointActionHistoryTree ( Index  jahI) const

Returns a pointer to joint action history#.

References _m_jointActionHistoryTreeVector, and _m_nrJointActionHistories.

Referenced by QBG::ComputeRecursivelyNoCache(), GetSuccessorJAHI(), and GetTimeStepForJAHI().

void PlanningUnitMADPDiscrete::GetJointActionObservationHistoryArrays ( LIndex  jaohI,
Index  t,
Index  jaIs[],
Index  joIs[] 
) const

Computes the joint actions and observations for jaohI.

This function computes (i.e., does no look up).

  • jaohI - the JointActionObservationHistory index
  • t - the stage of jaohI
  • jaIs - an array of size t, which will be filled with joint actions a^0,...,a^(t-1)
  • joIs - an array of size t, which will be filled with joint observ. o^1,...,o^t

This function is called by GetJAOHProbs() and JointToIndividualActionObservationHistoryIndices() (when the aoh's are not cached).

References IndexTools::ActionObservation_to_ActionIndex(), IndexTools::ActionObservation_to_ObservationIndex(), and Globals::CastLIndexToIndex().

Referenced by GetJAOHProbs(), and JointAOHIndexToIndividualActionObservationVectors().

Index PlanningUnitMADPDiscrete::GetJointActionObservationHistoryIndex ( Index  t,
const std::vector< Index > &  Jactions,
const std::vector< Index > &  Jobservations 
) const

converts the vectors of actions and observations of length t to a joint ActionObservationHistory Index.

Jactions and Jobservation needs to be a vector of length > t.

References _m_firstJAOHIforT, IndexTools::ActionAndObservation_to_ActionObservationIndex(), Globals::CastLIndexToIndex(), ComputeHistoryIndex(), GetNrJointActions(), and GetNrJointObservations().

Index PlanningUnitMADPDiscrete::GetJointActionObservationHistoryIndex ( Index  t,
const std::vector< Index > &  Jactions,
const std::vector< Index > &  Jobservations,
const Scope agentSope 
) const
void PlanningUnitMADPDiscrete::GetJointActionObservationHistoryVectors ( LIndex  jaohI,
std::vector< Index > &  jaIs,
std::vector< Index > &  joIs 
) const

returns the vectors with joint actions and observations for JointActionObservationHistory jaohi.

This function first tries to find jaohI in the cache. If it doesn't find it there, it computes the desired result using GetJointActionObservationHistoryArrays.

References JointActionObservationHistoryTree::GetJointActionObservationHistory().

Referenced by GetJAOHProbGivenPred(), GetJAOHProbs(), and GetJointBeliefInterface().

JointBeliefInterface * PlanningUnitMADPDiscrete::GetJointBeliefInterface ( LIndex  jaohI) const

brief Returns a pointer to a new joint belief.

When joint beliefs are cached, this function returns a new joint belief, which is a copy of the one stored in the joint belief cache.

When joint beliefs are not cached, this function simple calculates and returns a new belief.

In all cases, the programming is responsible to clean up! (i.e., 'delete' the ptr).

References _m_jBeliefCache, _m_params, Globals::CastLIndexToIndex(), PlanningUnitMADPDiscreteParameters::GetComputeJointBeliefs(), GetJointActionObservationHistoryVectors(), GetMADPDI(), GetNewJointBeliefFromISD(), GetNewJointBeliefInterface(), BeliefInterface::Print(), BeliefInterface::SanityCheck(), and JointBeliefInterface::Update().

Referenced by QHybrid::ComputeRecursively(), QFunctionJointBelief::GetQ(), MonahanPlanner::GetQ(), QHybrid::GetQ(), QAlphaVector::GetQ(), QAV< PerseusPOMDPPlanner >::GetQ(), and QMDP::GetQNoCache().

void PlanningUnitMADPDiscrete::GetJointObservationHistoryArrays ( Index  johI,
Index  t,
Index  joIs[] 
) const

Computes the joint observations for johI.

This function computes (i.e., does no look up).

  • johI - the JointObservationHistory index
  • t - the stage of jaohI
  • joIs - an array of size t, which will be filled with observ. o^1,...,o^t

This function is called by JointToIndividualObservationHistoryIndices (used when obs-histories are not cached).

References Globals::CastLIndexToIndex().

Referenced by JointToIndividualObservationHistoryIndices().

Index PlanningUnitMADPDiscrete::GetJointObservationHistoryIndex ( JointObservationHistoryTree joh) const
Index PlanningUnitMADPDiscrete::GetJointObservationHistoryIndex ( Index  t,
const std::vector< Index > &  jointObservations 
) const

converts the vector joint observations of length t to a JointObservationHistory Index.

jointObservation needs to be a vector of length > t. The index of the history formed by the first t joint observations is returned.

References _m_firstJOHIforT, Globals::CastLIndexToIndex(), ComputeHistoryIndex(), and GetNrJointObservations().

Index PlanningUnitMADPDiscrete::GetJointObservationHistoryIndex ( Index  t,
const Index  jointObservations[] 
) const

converts the vector joint observations of length t to a JointObservationHistory Index.

jointObservation needs to be a vector of length > t. The index of the history formed by the first t joint observations is returned.

References _m_firstJOHIforT, Globals::CastLIndexToIndex(), ComputeHistoryIndex(), and GetNrJointObservations().

JointObservationHistoryTree * PlanningUnitMADPDiscrete::GetJointObservationHistoryTree ( Index  johI) const
const MultiAgentDecisionProcessDiscreteInterface* PlanningUnitMADPDiscrete::GetMADPDI ( ) const
inline

References _m_madp.

JointBeliefInterface * PlanningUnitMADPDiscrete::GetNewJointBeliefInterface ( ) const
virtual

a function that forces derives classes to specify which types of joint beliefs are used.

The function returns a pointer to a joint belief that is allocated with new. Therefore it should also be *delete*d.

The function is virtual, so it can be overriden in derived classes. The behavior implemented here is as follows:

When _m_params._m_useSparseBeliefs -> return a JointBeliefSparse otherwise return a JointBelief.

References _m_params, GetNrStates(), and PlanningUnitMADPDiscreteParameters::GetUseSparseJointBeliefs().

Referenced by AgentPOMDP::AgentPOMDP(), BayesianGameWithClusterInfo::Extend(), GetJAOHProb(), GetJAOHProbGivenPred(), GetJointBeliefInterface(), GetNewJointBeliefFromISD(), InitializeJointActionObservationHistories(), AlphaVectorPlanning::SampleBeliefs(), and AlphaVectorPlanning::SampleBeliefsNonStationary().

JointBeliefInterface * PlanningUnitMADPDiscrete::GetNewJointBeliefInterface ( size_t  size) const
virtual
size_t PlanningUnitMADPDiscrete::GetNrActionHistories ( Index  agentI) const

Returns the number of action histories for agentI.

The planning unit (specifically _m_nrActionHistories) must be initialized when calling this function.

References _m_nrActionHistories.

Referenced by GetActionHistoryTree(), ArgumentUtils::GetHybridQheuristicFromArgs(), and QHybrid::Initialize().

size_t PlanningUnitMADPDiscrete::GetNrActionHistories ( Index  agentI,
Index  ts 
) const
inline

Returns the number of action histories for agentI for time step ts.

The planning unit (specifically _m_nrActionHistories) must be initialized when calling this function.

size_t PlanningUnitMADPDiscrete::GetNrActionObservationHistories ( Index  agentI) const
inline

Returns the number of action observation histories for agentI.

The planning unit (specifically _m_nrObservationHistories) must be initialized and action-observation histories must have been created when calling this function.

Referenced by JESPDynamicProgrammingPlanner::DynamicProgrammingBestResponse(), and GetNrPolicyDomainElements().

size_t PlanningUnitMADPDiscrete::GetNrActions ( Index  agentI) const
inlinevirtual

Returns the number of actions of agent agentI.

Implements Interface_ProblemToPolicyDiscrete.

References GetMADPDI(), and GetNrActions().

size_t PlanningUnitMADPDiscrete::GetNrAgents ( ) const
inlinevirtual

Gets the number of agents.

Implements Interface_ProblemToPolicyDiscrete.

References PlanningUnit::GetNrAgents().

Referenced by AgentBG::AgentBG(), AlphaVectorBG::AlphaVectorBG(), TreeIncPruneBGPlanner::BackupStage(), QBGPlanner_TreeIncPruneBnB::BackupStage(), BayesianGameWithClusterInfo::BayesianGameWithClusterInfo(), GMAA_MAA_ELSI::CAVNP_quick_n_dirty2(), TreeIncPruneBGPlanner::ComputeKey(), QFunctionJAOHTree::ComputeQ(), GMAA_MAAstarClassic::ConstructAndValuateNextPolicies(), GMAA_kGMAA::ConstructAndValuateNextPolicies(), GMAA_MAAstar::ConstructAndValuateNextPolicies(), GMAA_MAA_ELSI::ConstructBayesianGame(), GeneralizedMAAStarPlannerForDecPOMDPDiscrete::ConstructExtendedJointPolicy(), GeneralizedMAAStarPlannerForFactoredDecPOMDPDiscrete::ConstructExtendedJointPolicy(), BGforStageCreation::Fill_FirstOHtsI(), GMAA_MAA_ELSI::Fill_FirstOHtsI(), BGforStageCreation::Fill_joI_Array(), GMAA_MAA_ELSI::Fill_joI_Array(), FSAOHDist_NECOF::FSAOHDist_NECOF(), GetActionHistoryTree(), ArgumentUtils::GetHybridQheuristicFromArgs(), GetNrJointPolicies(), GetNrObservationHistoriesVector(), GetObservationHistoryTree(), IndividualBeliefJESP::IndividualBeliefJESP(), IndividualToJointActionHistoryIndex(), IndividualToJointActionObservationHistoryIndex(), IndividualToJointObservationHistoryIndex(), QHybrid::Initialize(), InitializeActionHistories(), InitializeActionObservationHistories(), InitializeJointActionHistories(), InitializeJointActionObservationHistories(), InitializeJointObservationHistories(), InitializeObservationHistories(), JointActionHistory::JointActionHistory(), JointActionObservationHistory::JointActionObservationHistory(), JointAOHIndexToIndividualActionObservationVectors(), JointObservationHistory::JointObservationHistory(), JointToIndividualActionObservationHistoryIndices(), JointToIndividualObservationHistoryIndices(), JESPExhaustivePlanner::Plan(), JESPDynamicProgrammingPlanner::Plan(), PrintActionHistories(), PrintActionObservationHistories(), PrintObservationHistories(), SimulationFactoredDecPOMDPDiscrete::RunSimulation(), SimulationDecPOMDPDiscrete::RunSimulationClusteredBG(), SimulationFactoredDecPOMDPDiscrete::RunSimulationsRandomActions(), TreeIncPruneBGPlanner::SaveStats(), GMAA_MAAstarCluster::SoftPrintClusteringStats(), GMAA_kGMAACluster::SoftPrintClusteringStats(), TreeIncPruneBGPlanner::SoftPrintStats(), JointPolicyPureVectorForClusteredBG::StartRecursiveConstructionPerAgent(), JointPolicyPureVectorForClusteredBG::StartRecursiveSoftPrintPerAgent(), TreeIncPruneBGPlanner::UnionNode(), IndividualBeliefJESP::Update(), and FSAOHDist_NECOF::Update().

size_t PlanningUnitMADPDiscrete::GetNrJointActionHistories ( ) const

Returns the number of joint action histories.

References _m_jointActionHistoryTreeVector.

size_t PlanningUnitMADPDiscrete::GetNrJointActionObservationHistories ( ) const
inline

Returns the number of jointActionObservation histories.

References _m_nrJointActionObservationHistories.

Referenced by QMDP::CacheJaohQValues().

size_t PlanningUnitMADPDiscrete::GetNrJointActions ( ) const
inline

return the number of joint actions.

References GetMADPDI().

Referenced by AgentPOMDP::Act(), AgentQMDP::Act(), AgentMDP::Act(), AlphaVectorPlanning::BackProject(), AlphaVectorPlanning::BackProjectFull(), MonahanBGPlanner::BackProjectMonahanBG(), AlphaVectorPlanning::BackProjectSparse(), AlphaVectorWeighted::BackProjectWeights(), MonahanBGPlanner::BackupStage(), MonahanPOMDPPlanner::BackupStage(), PerseusConstrainedPOMDPPlanner::BackupStage(), TreeIncPruneBGPlanner::BackupStage(), QBGPlanner_TreeIncPruneBnB::BackupStage(), PerseusBGPOMDPPlanner::BackupStageAll(), PerseusBGNSPlanner::BackupStageAll(), PerseusBGPlanner::BackupStageAll(), Perseus::BackupStageLeadOut(), PerseusBGNSPlanner::BackupStageSampling(), PerseusBGPlanner::BackupStageSampling(), PerseusBGPOMDPPlanner::BackupStageSamplingAlt(), PerseusBGPlanner::BackupStageSamplingAlt(), MonahanBGPlanner::BackupStageSlow(), AlphaVectorPOMDP::BeliefBackup(), AlphaVectorConstrainedPOMDP::BeliefBackup(), AlphaVectorBG::BeliefBackupBGIP_Solver(), AlphaVectorBG::BeliefBackupExhaustiveOnlyKeepMax(), AlphaVectorBG::BeliefBackupExhaustiveStoreAll(), AlphaVectorConstrainedPOMDP::BeliefBackupQ(), QMDP::CacheJaohQValues(), MonahanBGPlanner::ComputeAllGaoa(), QFunctionJAOHTree::ComputeQ(), QHybrid::ComputeQ(), QHybrid::ComputeRecursively(), QBG::ComputeRecursivelyNoCache(), GMAA_MAA_ELSI::ConstructBayesianGame(), ArgumentUtils::GetHybridQheuristicFromArgs(), AlphaVectorPlanning::GetImmediateRewardValueFunction(), Perseus::GetInitialQFunctions(), Perseus::GetInitialValueFunction(), GetJointActionHistoryIndex(), GetJointActionObservationHistoryIndex(), AlphaVectorBG::GetMask(), AgentBG::GetMaximizingActionIndex(), AgentBG::GetMaximizingBGIndex(), GetSuccessorJAHI(), GetSuccessorJAOHI(), MDPPolicyIteration::Initialize(), MDPPolicyIterationGPU::Initialize(), MDPValueIteration::Initialize(), QBGPlanner_TreeIncPruneBnB::Initialize(), SimulationDecPOMDPDiscrete::Initialize(), AlphaVectorPlanning::Initialize(), InitializeJointActionHistories(), InitializeJointActionObservationHistories(), QHybrid::Load(), MDPValueIteration::Plan(), MonahanPlanner::Plan(), MDPValueIteration::PlanSlow(), MDPPolicyIterationGPU::PlanSlow(), MDPPolicyIteration::PlanSlow(), AlphaVectorPlanning::SampleBeliefs(), AlphaVectorPlanning::SampleBeliefsNonStationary(), TreeIncPruneBGPlanner::SaveStats(), JointActionObservationHistory::SoftPrintJointIndices(), and TreeIncPruneBGPlanner::SoftPrintStats().

size_t PlanningUnitMADPDiscrete::GetNrJointObservationHistories ( ) const
inline
size_t PlanningUnitMADPDiscrete::GetNrJointObservationHistories ( Index  ts) const
inline

Returns the number of joint observation histories for time step ts.

LIndex PlanningUnitMADPDiscrete::GetNrJointPolicies ( ) const

Returns the number of joint policies.

References GetNrAgents(), and GetNrPolicies().

Referenced by BruteForceSearchPlanner::Plan().

size_t PlanningUnitMADPDiscrete::GetNrObservationHistories ( Index  agentI) const
size_t PlanningUnitMADPDiscrete::GetNrObservationHistories ( Index  agentI,
Index  ts 
) const
inline

Returns the number of observation histories for agentI for time step ts.

The planning unit (specifically _m_nrObservationHistories) must be initialized when calling this function.

const vector< size_t > PlanningUnitMADPDiscrete::GetNrObservationHistoriesVector ( ) const

Returns a vector with the number of OHs for each agent.

This calls GetNrObservationHistories(Index agentI)

References GetNrAgents(), and GetNrObservationHistories().

const vector< size_t > PlanningUnitMADPDiscrete::GetNrObservationHistoriesVector ( Index  ts) const

Returns a vector with the number of OHs in stage ts for each agent.

This calls GetNrObservationHistories(Index agentI, Index ts)

References GetNrAgents(), and GetNrObservationHistories().

size_t PlanningUnitMADPDiscrete::GetNrObservations ( Index  agentI) const
inline

Returns the number of observations of agent agentI.

References GetMADPDI(), and GetNrObservations().

LIndex PlanningUnitMADPDiscrete::GetNrPolicies ( Index  agentI) const

Returns the number of policies for agentI.

References GetNrActions(), and GetNrObservationHistories().

Referenced by GetNrJointPolicies().

size_t PlanningUnitMADPDiscrete::GetNrPolicyDomainElements ( Index  agentI,
PolicyGlobals::PolicyDomainCategory  cat,
size_t  depth = MAXHORIZON 
) const
virtual
size_t PlanningUnitMADPDiscrete::GetNrStates ( ) const

Returns the number of states.

References GetMADPDI(), and MultiAgentDecisionProcessDiscreteInterface::GetNrStates().

Referenced by AgentQMDP::Act(), AlphaVectorWeighted::AlphaVectorWeighted(), AlphaVectorPlanning::BackProject(), AlphaVectorPlanning::BackProjectFull(), MonahanBGPlanner::BackProjectMonahanBG(), AlphaVectorPlanning::BackProjectSparse(), AlphaVectorWeighted::BackProjectWeights(), PerseusPOMDPPlanner::BackupStage(), MonahanBGPlanner::BackupStage(), PerseusConstrainedPOMDPPlanner::BackupStage(), TreeIncPruneBGPlanner::BackupStage(), QBGPlanner_TreeIncPruneBnB::BackupStage(), PerseusBGPOMDPPlanner::BackupStageAll(), PerseusBGNSPlanner::BackupStageAll(), PerseusBGPlanner::BackupStageAll(), PerseusBGNSPlanner::BackupStageSampling(), PerseusBGPlanner::BackupStageSampling(), PerseusBGPOMDPPlanner::BackupStageSamplingAlt(), PerseusBGPlanner::BackupStageSamplingAlt(), AlphaVectorPOMDP::BeliefBackup(), AlphaVectorConstrainedPOMDP::BeliefBackup(), AlphaVectorBG::BeliefBackupBGIP_Solver(), AlphaVectorBG::BeliefBackupExhaustiveOnlyKeepMax(), AlphaVectorBG::BeliefBackupExhaustiveStoreAll(), AlphaVectorConstrainedPOMDP::BeliefBackupQ(), GMAA_MAA_ELSI::CAVNP_quick_n_dirty2(), QBGPlanner_TreeIncPruneBnB::CheckDominationPointWise(), MonahanBGPlanner::ComputeGaoa(), QFunctionJAOHTree::ComputeQ(), QBG::ComputeRecursivelyNoCache(), ArgumentUtils::GetHybridQheuristicFromArgs(), AlphaVectorPlanning::GetImmediateRewardValueFunction(), Perseus::GetInitialQFunctions(), Perseus::GetInitialValueFunction(), GetNewJointBeliefInterface(), IndividualBeliefJESP::IndividualBeliefJESP(), MDPPolicyIterationGPU::Initialize(), MDPPolicyIteration::Initialize(), MDPValueIteration::Initialize(), SimulationDecPOMDPDiscrete::Initialize(), AlphaVectorPlanning::Initialize(), MonahanPOMDPPlanner::MonahanCrossSum(), MonahanBGPlanner::MonahanCrossSum(), MDPValueIteration::Plan(), MonahanPlanner::Plan(), DICEPSPlanner::Plan(), MDPValueIteration::PlanSlow(), MDPPolicyIterationGPU::PlanSlow(), MDPPolicyIteration::PlanSlow(), BayesianGameForDecPOMDPStage::ProbRewardForjoahI(), GMAA_MAA_ELSI::ProbRewardForjoahI(), AlphaVectorPlanning::SampleBeliefs(), AlphaVectorPlanning::SampleBeliefsNonStationary(), IndividualBeliefJESP::Update(), and ValueFunctionDecPOMDPDiscrete::ValueFunctionDecPOMDPDiscrete().

const Observation* PlanningUnitMADPDiscrete::GetObservation ( Index  agentI,
Index  o 
) const
inline

Returns a ref to the o-th observation of agent agentI.

References GetMADPDI().

Referenced by PolicyToDotGraph(), ActionObservationHistory::SoftPrint(), ObservationHistory::SoftPrint(), and SoftPrintObservationHistory().

void PlanningUnitMADPDiscrete::GetObservationHistoryArrays ( Index  agentI,
Index  ohI,
Index  t,
Index  oIs[] 
) const

Computes the observations for ohI.

This function computes (i.e., does no look up).

  • agentI - the index of the relevant agent
  • ohI - the ObservationHistory index
  • t - the stage of jaohI
  • oIs - an array of size t, which will be filled with observations o^1,...,o^t

This function is called by JointToIndividualObservationHistoryIndices (used when obs-histories are not cached).

References Globals::CastLIndexToIndex().

Referenced by BayesianGameWithClusterInfo::BayesianGameWithClusterInfo(), BGforStageCreation::Fill_joI_Array(), BayesianGameForDecPOMDPStage::Fill_joI_Array(), IndividualToJointObservationHistoryIndex(), and SoftPrintObservationHistory().

Index PlanningUnitMADPDiscrete::GetObservationHistoryIndex ( Index  agentI,
Index  t,
const std::vector< Index > &  observations 
) const

converts the vector observations of length t to a (individual) ObservationHistory Index for agentI.

observation needs to be a vector of length > t. The index of the history formed by the first t observations is returned.

References _m_firstOHIforT, Globals::CastLIndexToIndex(), ComputeHistoryIndex(), and GetNrObservations().

Referenced by JointToIndividualObservationHistoryIndices(), JointPolicyPureVectorForClusteredBG::StartRecursiveConstructionPerAgent(), and JointPolicyPureVectorForClusteredBG::StartRecursiveSoftPrintPerAgent().

const ObservationModelDiscrete* PlanningUnitMADPDiscrete::GetObservationModelDiscretePtr ( ) const
inline

References GetMADPDI().

Referenced by AlphaVectorPlanning::Initialize().

double PlanningUnitMADPDiscrete::GetObservationProbability ( Index  jaI,
Index  sucSI,
Index  joI 
) const
inline

Returns P(joI | jaI, sucSI ). Arguments are time-ordered.

References GetMADPDI().

Referenced by ValueFunctionDecPOMDPDiscrete::CalculateVsjohRecursively(), and IndividualBeliefJESP::Update().

const MultiAgentDecisionProcessDiscreteInterface* PlanningUnitMADPDiscrete::GetProblem ( ) const
inline

Returns a reference to the problem of the PlanningUnitMADPDiscrete.

References GetMADPDI().

Referenced by JESPDynamicProgrammingPlanner::DynamicProgrammingBestResponse().

MultiAgentDecisionProcessDiscreteInterface* PlanningUnitMADPDiscrete::GetProblem ( )
inline

References GetMADPDI().

const State* PlanningUnitMADPDiscrete::GetState ( Index  i) const
inline

Get a pointer to a State by index.

References GetMADPDI().

LIndex PlanningUnitMADPDiscrete::GetSuccessorJAOHI ( LIndex  jaohI,
Index  jaI,
Index  joI 
) const
Index PlanningUnitMADPDiscrete::GetTimeStepForAHI ( Index  agentI,
Index  ohI 
) const
Index PlanningUnitMADPDiscrete::GetTimeStepForAOHI ( Index  agentI,
Index  aohI 
) const
Index PlanningUnitMADPDiscrete::GetTimeStepForJAHI ( Index  johI) const
const TransitionModelDiscrete* PlanningUnitMADPDiscrete::GetTransitionModelDiscretePtr ( ) const
inline
double PlanningUnitMADPDiscrete::GetTransitionProbability ( Index  sI,
Index  jaI,
Index  sucSI 
) const
inline
Index PlanningUnitMADPDiscrete::IndividualToJointActionHistoryIndex ( Index  t,
const std::vector< Index > &  indivIs 
) const

converts individual history indices to a joint index

This converts a vector of individual observation history indices to a joint observation history index.

  • t - the stage of the individual histories (must be the same, otherwise there is no corresponding joint index!)
  • indivIs - the vector containing the individual indices.

References GetActionHistoryArrays(), GetJointActionHistoryIndex(), GetNrAgents(), and IndividualToJointActionIndices().

Index PlanningUnitMADPDiscrete::IndividualToJointActionIndices ( const std::vector< Index > &  indivActionIndices) const
inlinevirtual

Returns the joint action index that corresponds to the vector of specified individual action indices.

Implements Interface_ProblemToPolicyDiscrete.

References GetMADPDI(), and IndividualToJointActionIndices().

LIndex PlanningUnitMADPDiscrete::IndividualToJointActionObservationHistoryIndex ( Index  t,
const std::vector< Index > &  indivIs 
) const

converts individual history indices to a joint index

This converts a vector of individual observation history indices to a joint observation history index.

  • t - the stage of the individual histories (must be the same, otherwise there is no corresponding joint index!)
  • indivIs - the vector containing the individual indices.

References GetActionObservationHistoryArrays(), GetJointActionObservationHistoryIndex(), GetNrAgents(), IndividualToJointActionIndices(), and IndividualToJointObservationIndices().

Index PlanningUnitMADPDiscrete::IndividualToJointObservationHistoryIndex ( Index  t,
const std::vector< Index > &  indivIs 
) const

converts individual history indices to a joint index

This converts a vector of individual observation history indices to a joint observation history index.

  • t - the stage of the individual histories (must be the same, otherwise there is no corresponding joint index!)
  • indivIs - the vector containing the individual indices.

References GetJointObservationHistoryIndex(), GetNrAgents(), GetObservationHistoryArrays(), and IndividualToJointObservationIndices().

void PlanningUnitMADPDiscrete::InitializeActionHistories ( )
private
void PlanningUnitMADPDiscrete::InitializeActionObservationHistories ( )
private
void PlanningUnitMADPDiscrete::InitializeJointActionHistories ( )
private

Creates all the joint action histories.

The root is stored as _m_jointActionHistoryTreeRoot and all joint action histories are accessible by index through _m_jointActionHistoryTreeVector.

References _m_firstJAHIforT, _m_jointActionHistoryTreeRoot, _m_jointActionHistoryTreeVector, _m_nrActionHistoriesT, _m_nrJointActionHistories, _m_nrJointActionHistoriesT, _m_params, PlanningUnitMADPDiscreteParameters::GetComputeJointActionHistories(), PlanningUnit::GetHorizon(), GetJointActionHistory, GetNrAgents(), GetNrJointActions(), and JointActionHistory::Print().

Referenced by Initialize().

void PlanningUnitMADPDiscrete::InitializeObservationHistories ( )
private
void PlanningUnitMADPDiscrete::JointAOHIndexToIndividualActionObservationVectors ( LIndex  jaohI,
std::vector< std::vector< Index > > &  indivO_vec,
std::vector< std::vector< Index > > &  indivA_vec 
) const

computes the vectors of actions and obs.

corresponding to jaohI indivO_vec[agentI][t] = oI

References GetJointActionObservationHistoryArrays(), GetNrAgents(), GetTimeStepForJAOHI(), JointToIndividualActionIndices(), and JointToIndividualObservationIndices().

Referenced by JointToIndividualActionObservationHistoryIndices().

void PlanningUnitMADPDiscrete::JointAOHIndexToIndividualActionObservationVectors ( LIndex  jaohI,
std::vector< std::vector< Index > > &  indivAO_vec 
) const

computes the vector of action-observations corresponding to jaohI indivAO_vec[agentI][t] = aoI

vector< Index > PlanningUnitMADPDiscrete::JointToIndividualActionHistoryIndices ( Index  JAHistI) const

Returns a vector containing the indices of the individual ObservationHistory s corresponding to the JointActionHistory index JAHistI.

This method does not depend on a cached vector. (and thus also works if JointActionHistory s are not generated.

const vector< Index > & PlanningUnitMADPDiscrete::JointToIndividualActionHistoryIndicesRef ( Index  JAHistI) const

Returns a reference to a cached vector containing the indices of the indiv.

action histories corresponding to the joint action history index JAHistI. NOTE: The cached vector (of which the reference is returned) is stored in the generated JointActionHistory. If joint action histories are not generated (see PlanningUnitMADPDiscrete constructor), this method will fail.

References _m_jointActionHistoryTreeVector, and _m_nrJointActionHistories.

vector< Index > PlanningUnitMADPDiscrete::JointToIndividualActionIndices ( Index  jaI) const
vector< Index > PlanningUnitMADPDiscrete::JointToIndividualActionObservationHistoryIndices ( LIndex  jaohI) const

Returns a vector containing the indices of the indiv.

act.-obs.history indices corresponding to the joint observation hist. joI.

References GetActionObservationHistoryIndex(), GetNrAgents(), GetTimeStepForJAOHI(), and JointAOHIndexToIndividualActionObservationVectors().

Referenced by GMAA_MAA_ELSI::CAVNP_quick_n_dirty2(), and JointToIndividualPolicyDomainIndices().

const vector< Index > & PlanningUnitMADPDiscrete::JointToIndividualActionObservationHistoryIndicesRef ( LIndex  jaohI) const

Returns a vector containing the indices of the indiv.

act.-obs.histories corresponding to the joint observation hist. joI.

References _m_jointActionObservationHistoryTreeVector, _m_nrJointActionObservationHistories, Globals::CastLIndexToIndex(), and JointActionObservationHistoryTree::GetJointActionObservationHistory().

Referenced by JointToIndividualPolicyDomainIndicesRef().

vector< Index > PlanningUnitMADPDiscrete::JointToIndividualObservationHistoryIndices ( Index  johI) const

Returns a vector containing the indices of the indiv.

obs. histories corresponding to the joint observation hist. joI.

References GetJointObservationHistoryArrays(), GetNrAgents(), GetObservationHistoryIndex(), GetTimeStepForJOHI(), and JointToIndividualObservationIndices().

Referenced by JointToIndividualPolicyDomainIndices().

const vector< Index > & PlanningUnitMADPDiscrete::JointToIndividualObservationHistoryIndicesRef ( Index  johI) const

Returns a vector containing the indices of the indiv.

obs.histories corresponding to the joint observation hist. joI.

References _m_jointObservationHistoryTreeVector, _m_nrJointObservationHistories, and JointObservationHistoryTree::GetJointObservationHistory().

Referenced by JointToIndividualPolicyDomainIndicesRef().

std::vector<Index> PlanningUnitMADPDiscrete::JointToIndividualObservationIndices ( Index  joI) const
inline
vector< Index > PlanningUnitMADPDiscrete::JointToIndividualPolicyDomainIndices ( Index  jdI,
PolicyGlobals::PolicyDomainCategory  cat 
) const
virtual

Converts joint indices to individual policy domain element indices.

A function that should be implemented by a derived class, if this derived class caches index vectors of the policy domains elements corresponding to a joint index. See AreCachedJointToIndivIndices()

Implements Interface_ProblemToPolicyDiscrete.

References PolicyGlobals::AOHIST_INDEX, JointToIndividualActionObservationHistoryIndices(), JointToIndividualObservationHistoryIndices(), PolicyGlobals::OHIST_INDEX, and PolicyGlobals::TYPE_INDEX.

const vector< Index > & PlanningUnitMADPDiscrete::JointToIndividualPolicyDomainIndicesRef ( Index  jdI,
PolicyGlobals::PolicyDomainCategory  cat 
) const
virtual

Converts individual policy domain element indices to joint indices.

A function that should be implemented by a derived class, if this derived class caches index vectors of the policy domains elements corresponding to a joint index. See AreCachedJointToIndivIndices()

Implements Interface_ProblemToPolicyDiscrete.

References PolicyGlobals::AOHIST_INDEX, JointToIndividualActionObservationHistoryIndicesRef(), JointToIndividualObservationHistoryIndicesRef(), PolicyGlobals::OHIST_INDEX, and PolicyGlobals::TYPE_INDEX.

string PlanningUnitMADPDiscrete::PolicyToDotGraph ( const PolicyDiscretePure policy,
Index  agentI,
bool  labelEdges = true 
) const
void PlanningUnitMADPDiscrete::PrintActionHistories ( )

Prints the action histories for all agents.

References _m_actionHistoryTreeRootPointers, and GetNrAgents().

Referenced by Print().

void PlanningUnitMADPDiscrete::PrintActionObservationHistories ( )
void PlanningUnitMADPDiscrete::PrintObservationHistories ( )

Prints the observation histories for all agents.

References _m_observationHistoryTreeRootPointers, and GetNrAgents().

Referenced by Print().

void PlanningUnitMADPDiscrete::RegisterJointActionObservationHistoryTree ( JointActionObservationHistoryTree jaoht)

Register a new jaoht in the vector of indices.

References _m_jointActionObservationHistoryTreeMap, Globals::CastLIndexToIndex(), and TreeNode< Tcontained >::GetIndex().

bool PlanningUnitMADPDiscrete::SanityCheck ( void  ) const
protectedvirtual

Do some sanity checks, can be overridden.

Reimplemented in PlanningUnitDecPOMDPDiscrete, and PlanningUnitTOIDecPOMDPDiscrete.

Referenced by Initialize(), and PlanningUnitDecPOMDPDiscrete::SanityCheck().

void PlanningUnitMADPDiscrete::SetHorizon ( size_t  h)
virtual

Sets the horizon for the planning problem.

Also reinitializes the planning unit.

Reimplemented from PlanningUnit.

References Deinitialize(), Initialize(), and PlanningUnit::SetHorizon().

void PlanningUnitMADPDiscrete::SetParams ( const PlanningUnitMADPDiscreteParameters params)

Sets the parameters for this planning unit.

Also reinitializes the planning unit.

References _m_params, Deinitialize(), and Initialize().

Referenced by NullPlanner::NullPlanner(), NullPlannerFactored::NullPlannerFactored(), and NullPlannerTOI::NullPlannerTOI().

void PlanningUnitMADPDiscrete::SetProblem ( MultiAgentDecisionProcessDiscreteInterface madp)

Sets the problem for which to plan, using a pointer.

Also reinitializes the planning unit.

References _m_madp, DEBUG_PUD, Deinitialize(), Initialize(), PlanningUnit::SetProblem(), and MultiAgentDecisionProcessDiscreteInterface::SoftPrint().

Referenced by PlanningUnitDecPOMDPDiscrete::SetProblem().

string PlanningUnitMADPDiscrete::SoftPrintAction ( Index  agentI,
Index  actionI 
) const
virtual
string PlanningUnitMADPDiscrete::SoftPrintPolicyDomainElement ( Index  agentI,
Index  dIndex,
PolicyGlobals::PolicyDomainCategory  cat 
) const
virtual

Virtual function that has to be implemented by derived class.

This should return a string describing element dIndex of the domain (e.g. an observation history) of agent agentI.

Implements Interface_ProblemToPolicyDiscrete.

References PolicyGlobals::AOHIST_INDEX, GetActionObservationHistoryTree(), PolicyGlobals::OHIST_INDEX, SoftPrintObservationHistory(), and PolicyGlobals::TYPE_INDEX.

Member Data Documentation

std::vector<ActionHistoryTree *> PlanningUnitMADPDiscrete::_m_actionHistoryTreeRootPointers
protected

A vector that stores pointers to the roots of the action history trees of each agent.

Referenced by DeInitializeActionHistories(), InitializeActionHistories(), and PrintActionHistories().

std::vector<std::vector<ActionHistoryTree*> > PlanningUnitMADPDiscrete::_m_actionHistoryTreeVectors
protected

A vector which, for each agents, stores a vector with all ActionHistoryTree pointers.

Used to give access to each ActionHistory(Tree) by index.

Referenced by CreateActionHistoryTree(), DeInitializeActionHistories(), GetActionHistoryTree(), and InitializeActionHistories().

std::vector< ActionObservationHistoryTree *> PlanningUnitMADPDiscrete::_m_actionObservationHistoryTreeRootPointers
protected

A vector that stores pointers to the roots of the action-observation history trees of each agent.

Referenced by DeInitializeActionObservationHistories(), InitializeActionObservationHistories(), and PrintActionObservationHistories().

std::vector<std::vector<ActionObservationHistoryTree*> > PlanningUnitMADPDiscrete::_m_actionObservationHistoryTreeVectors
protected
std::vector<std::vector<LIndex> > PlanningUnitMADPDiscrete::_m_firstAHIforT
protected

The _m_firstAHIforT[aI][t] contains the first action history for time-step t of agent aI.

Referenced by CreateActionHistoryTree(), DeInitializeActionHistories(), GetSuccessorAHI(), GetTimeStepForAHI(), InitializeActionHistories(), and Print().

std::vector<std::vector<LIndex> > PlanningUnitMADPDiscrete::_m_firstAOHIforT
protected
std::vector<LIndex> PlanningUnitMADPDiscrete::_m_firstJAHIforT
protected

The _m_firstJAHIforT[t] contains the first joint action history for time-step t.

Referenced by DeInitializeJointActionHistories(), GetJointActionHistoryIndex(), GetSuccessorJAHI(), GetTimeStepForJAHI(), and InitializeJointActionHistories().

std::vector<LIndex> PlanningUnitMADPDiscrete::_m_firstJAOHIforT
protected

_m_firstJAOHIforT[t] contains the first joint actionObservation history for time-step t.

Referenced by DeInitializeJointActionObservationHistories(), GetJointActionObservationHistoryIndex(), GetSuccessorJAOHI(), GetTimeStepForJAOHI(), and InitializeJointActionObservationHistories().

std::vector<LIndex> PlanningUnitMADPDiscrete::_m_firstJOHIforT
protected

The _m_firstJOHIforT[t] contains the first joint observation history for time-step t.

Referenced by DeInitializeJointObservationHistories(), GetJointObservationHistoryIndex(), GetSuccessorJOHI(), GetTimeStepForJOHI(), and InitializeJointObservationHistories().

std::vector<std::vector<LIndex> > PlanningUnitMADPDiscrete::_m_firstOHIforT
protected

The _m_firstOHIforT[aI][t] contains the first observation history for time-step t of agent aI.

Referenced by CreateObservationHistoryTree(), DeInitializeObservationHistories(), GetNrPolicyDomainElements(), GetObservationHistoryIndex(), GetSuccessorOHI(), GetTimeStepForOHI(), InitializeObservationHistories(), and Print().

bool PlanningUnitMADPDiscrete::_m_initialized
private

A bool indicating whether this Planning unit has been initialized.

Referenced by Deinitialize(), Initialize(), PlanningUnitMADPDiscrete(), and Print().

std::vector<double> PlanningUnitMADPDiscrete::_m_jaohConditionalProbs
protected

Stores the conditional probability of this joint belief.

Referenced by DeInitializeJointActionObservationHistories(), GetJAOHProbGivenPred(), and InitializeJointActionObservationHistories().

std::vector<double> PlanningUnitMADPDiscrete::_m_jaohProbs
protected

Caches the probabilities of JointActionObservationHistory's (assuming b^0 is as specified by the problem and that a pure joint policy consistent with the i-th JointActionObservationHistory is followed).

I.e., _m_jaohProbsCache[k] = P( jaohI=k | prevJPol, b^0 )

Referenced by GetJAOHProbs(), and InitializeJointActionObservationHistories().

std::vector<const JointBeliefInterface*> PlanningUnitMADPDiscrete::_m_jBeliefCache
protected

_m_jBeliefCache[i] stores a pointer to the joint belief corresponding to the i-th JointActionObservationHistory (assuming b^0 is as specified by the problem and that a pure joint policy consistent with the i-th JointActionObservationHistory is followed)

Referenced by DeInitializeJointActionObservationHistories(), GetJAOHProbs(), GetJointBeliefInterface(), and InitializeJointActionObservationHistories().

JointActionHistoryTree* PlanningUnitMADPDiscrete::_m_jointActionHistoryTreeRoot
protected

The root node of the joint action histories tree.

Referenced by DeInitializeJointActionHistories(), InitializeJointActionHistories(), and Print().

std::vector<JointActionHistoryTree*> PlanningUnitMADPDiscrete::_m_jointActionHistoryTreeVector
protected
std::map< LIndex, JointActionObservationHistoryTree*> PlanningUnitMADPDiscrete::_m_jointActionObservationHistoryTreeMap
protected
JointActionObservationHistoryTree* PlanningUnitMADPDiscrete::_m_jointActionObservationHistoryTreeRoot
protected

The root node of the joint actionObservation histories tree.

Referenced by DeInitializeJointActionObservationHistories(), InitializeJointActionObservationHistories(), and Print().

JointObservationHistoryTree* PlanningUnitMADPDiscrete::_m_jointObservationHistoryTreeRoot
protected

The root node of the joint observation histories tree.

Referenced by DeInitializeJointObservationHistories(), InitializeJointObservationHistories(), and Print().

std::vector<JointObservationHistoryTree*> PlanningUnitMADPDiscrete::_m_jointObservationHistoryTreeVector
protected
MultiAgentDecisionProcessDiscreteInterface* PlanningUnitMADPDiscrete::_m_madp
private

Referenced by GetMADPDI(), Initialize(), and SetProblem().

std::vector<size_t> PlanningUnitMADPDiscrete::_m_nrActionHistories
protected

A vector that keeps track of the number of action histories per agent.

Referenced by CreateActionHistoryTree(), DeInitializeActionHistories(), GetNrActionHistories(), InitializeActionHistories(), and Print().

std::vector< std::vector<size_t> > PlanningUnitMADPDiscrete::_m_nrActionHistoriesT
protected

A vector that keeps track of the number of action histories per agent per time step.

_m_nrActionHistoriesT[agentI][t]

Referenced by CreateActionHistoryTree(), CreateActionObservationHistoryTree(), DeInitializeActionHistories(), InitializeActionHistories(), InitializeJointActionHistories(), InitializeJointActionObservationHistories(), and Print().

std::vector<size_t> PlanningUnitMADPDiscrete::_m_nrActionObservationHistories
protected

A vector that keeps track of the number of action-obs.

histories per agent.

Referenced by CreateActionObservationHistoryTree(), DeInitializeActionObservationHistories(), InitializeActionObservationHistories(), and Print().

std::vector< std::vector<size_t> > PlanningUnitMADPDiscrete::_m_nrActionObservationHistoriesT
protected

Keeps track of the number of action-obs.

histories per agent per time step. _m_nrActionObservationHistoriesT[agentI][t]

Referenced by CreateActionObservationHistoryTree(), DeInitializeActionObservationHistories(), InitializeActionObservationHistories(), and Print().

size_t PlanningUnitMADPDiscrete::_m_nrJointActionHistories
protected
std::vector<size_t> PlanningUnitMADPDiscrete::_m_nrJointActionHistoriesT
protected

The number of joint action histories per time-step.

Referenced by DeInitializeJointActionHistories(), and InitializeJointActionHistories().

size_t PlanningUnitMADPDiscrete::_m_nrJointActionObservationHistories
protected
std::vector<size_t> PlanningUnitMADPDiscrete::_m_nrJointActionObservationHistoriesT
protected

The number of joint actionObservation histories per time-step.

Referenced by DeInitializeJointActionObservationHistories(), and InitializeJointActionObservationHistories().

std::vector<size_t> PlanningUnitMADPDiscrete::_m_nrJointObservationHistoriesT
protected

The number of joint observation histories per time-step.

Referenced by DeInitializeJointObservationHistories(), and InitializeJointObservationHistories().

std::vector<size_t> PlanningUnitMADPDiscrete::_m_nrObservationHistories
protected

A vector that keeps track of the number of observation histories per agent.

Referenced by CreateObservationHistoryTree(), DeInitializeObservationHistories(), GetNrObservationHistories(), InitializeObservationHistories(), and Print().

std::vector< std::vector<size_t> > PlanningUnitMADPDiscrete::_m_nrObservationHistoriesT
protected

Keeps track of the number of observation histories per agent per time step.

_m_nrObservationHistoriesT[agentI][t]

Referenced by CreateObservationHistoryTree(), DeInitializeObservationHistories(), InitializeJointActionObservationHistories(), InitializeJointObservationHistories(), InitializeObservationHistories(), and Print().

std::vector<ObservationHistoryTree *> PlanningUnitMADPDiscrete::_m_observationHistoryTreeRootPointers
protected

A vector that stores pointers to the roots of the observation history trees of each agent.

Referenced by DeInitializeObservationHistories(), InitializeObservationHistories(), and PrintObservationHistories().

std::vector<std::vector<ObservationHistoryTree*> > PlanningUnitMADPDiscrete::_m_observationHistoryTreeVectors
protected

A vector which, for each agents, stores a vector with all ObservationHistoryTree pointers.

Used to give access to each ObservationHistory(Tree) by index.

Referenced by CreateObservationHistoryTree(), DeInitializeObservationHistories(), GetObservationHistoryTree(), and InitializeObservationHistories().