MultiAgentDecisionProcess  Release 0.2.1
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:
+ Collaboration diagram for PlanningUnitMADPDiscrete:

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

std::vector< ActionHistoryTree * > _m_actionHistoryTreeRootPointers
 A vector that stores pointers to the roots of the action history trees of each agent.
std::vector< std::vector
< ActionHistoryTree * > > 
_m_actionHistoryTreeVectors
 A vector which, for each agents, stores a vector with all ActionHistoryTree pointers.
std::vector
< ActionObservationHistoryTree * > 
_m_actionObservationHistoryTreeRootPointers
 A vector that stores pointers to the roots of the action-observation history trees of each agent.
std::vector< std::vector
< ActionObservationHistoryTree * > > 
_m_actionObservationHistoryTreeVectors
 A vector which, for each agents, stores a vector with all ActionObservationHistoryTree pointers.
std::vector< std::vector
< LIndex > > 
_m_firstAHIforT
 The _m_firstAHIforT[aI][t] contains the first action history for time-step t of agent aI.
std::vector< std::vector
< LIndex > > 
_m_firstAOHIforT
 The _m_firstAOHIforT[aI][t] contains the first actionObservation history for time-step t of agent aI.
std::vector< LIndex > _m_firstJAHIforT
 The _m_firstJAHIforT[t] contains the first joint action history for time-step t.
std::vector< LIndex > _m_firstJAOHIforT
 _m_firstJAOHIforT[t] contains the first joint actionObservation history for time-step t.
std::vector< LIndex > _m_firstJOHIforT
 The _m_firstJOHIforT[t] contains the first joint observation history for time-step t.
std::vector< std::vector
< LIndex > > 
_m_firstOHIforT
 The _m_firstOHIforT[aI][t] contains the first observation history for time-step t of agent aI.
std::vector< double > _m_jaohConditionalProbs
 Stores the conditional probability of this joint belief.
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).
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)
JointActionHistoryTree_m_jointActionHistoryTreeRoot
 The root node of the joint action histories tree.
std::vector
< JointActionHistoryTree * > 
_m_jointActionHistoryTreeVector
 A vector which stores a JointActionHistoryTree pointer.
std::map< Index,
JointActionObservationHistoryTree * > 
_m_jointActionObservationHistoryTreeMap
 A map which is used instead of _m_jointActionObservationHistoryTreeVector when we don't cache all JointActionObservationHistoryTree's.
JointActionObservationHistoryTree_m_jointActionObservationHistoryTreeRoot
 The root node of the joint actionObservation histories tree.
std::vector
< JointActionObservationHistoryTree * > 
_m_jointActionObservationHistoryTreeVector
 A vector which stores JointActionObservationHistoryTree pointer.
JointObservationHistoryTree_m_jointObservationHistoryTreeRoot
 The root node of the joint observation histories tree.
std::vector
< JointObservationHistoryTree * > 
_m_jointObservationHistoryTreeVector
 A vector which stores a JointObservationHistoryTree pointer.
std::vector< size_t > _m_nrActionHistories
 A vector that keeps track of the number of action histories per agent.
std::vector< std::vector
< size_t > > 
_m_nrActionHistoriesT
 A vector that keeps track of the number of action histories per agent per time step.
std::vector< size_t > _m_nrActionObservationHistories
 A vector that keeps track of the number of action-obs.
std::vector< std::vector
< size_t > > 
_m_nrActionObservationHistoriesT
 Keeps track of the number of action-obs.
size_t _m_nrJointActionHistories
 The number of joint action histories.
std::vector< size_t > _m_nrJointActionHistoriesT
 The number of joint action histories per time-step.
size_t _m_nrJointActionObservationHistories
 The number of joint actionAction histories.
std::vector< size_t > _m_nrJointActionObservationHistoriesT
 The number of joint actionObservation histories per time-step.
size_t _m_nrJointObservationHistories
 The number of joint observation histories.
std::vector< size_t > _m_nrJointObservationHistoriesT
 The number of joint observation histories per time-step.
std::vector< size_t > _m_nrObservationHistories
 A vector that keeps track of the number of observation histories per agent.
std::vector< std::vector
< size_t > > 
_m_nrObservationHistoriesT
 Keeps track of the number of observation histories per agent per time step.
std::vector
< ObservationHistoryTree * > 
_m_observationHistoryTreeRootPointers
 A vector that stores pointers to the roots of the observation history trees of each agent.
std::vector< std::vector
< ObservationHistoryTree * > > 
_m_observationHistoryTreeVectors
 A vector which, for each agents, stores a vector with all ObservationHistoryTree pointers.

Private Member Functions

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

Private Attributes

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

Detailed Description

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

Definition at line 68 of file PlanningUnitMADPDiscrete.h.

Constructor & Destructor Documentation

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

Constructor with specified parameters.

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

Definition at line 74 of file PlanningUnitMADPDiscrete.cpp.

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.

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

Definition at line 91 of file PlanningUnitMADPDiscrete.cpp.

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

PlanningUnitMADPDiscrete::~PlanningUnitMADPDiscrete ( )

Destructor.

Definition at line 106 of file PlanningUnitMADPDiscrete.cpp.

References Deinitialize().

Member Function Documentation

bool PlanningUnitMADPDiscrete::AreCachedJointToIndivIndices ( PolicyGlobals::IndexDomainCategory  pdc) const
virtual

Check whether certain index conversions are cached.

Implements Interface_ProblemToPolicyDiscrete.

Definition at line 2885 of file PlanningUnitMADPDiscrete.cpp.

References PolicyGlobals::AOHIST_INDEX, PolicyGlobals::OHIST_INDEX, and PolicyGlobals::TYPE_INDEX.

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)

Definition at line 1293 of file PlanningUnitMADPDiscrete.cpp.

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)

Definition at line 1566 of file PlanningUnitMADPDiscrete.cpp.

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).

Definition at line 555 of file PlanningUnitMADPDiscrete.cpp.

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

Referenced by InitializeActionHistories().

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

Breadth-first construction of the observation histories and obs.

history tree for agent agentI.

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

Definition at line 255 of file PlanningUnitMADPDiscrete.cpp.

References _m_firstOHIforT, _m_nrObservationHistories, _m_nrObservationHistoriesT, _m_observationHistoryTreeVectors, IndexTools::CalculateNumberOfSequences(), TreeNode< Tcontained >::GetContainedElement(), PlanningUnit::GetHorizon(), History::GetLength(), GetNrObservations(), ObservationHistoryTree::GetObservationHistory(), TreeNode< Tcontained >::SetIndex(), and TreeNode< Tcontained >::SetSuccessor().

Referenced by InitializeObservationHistories().

void PlanningUnitMADPDiscrete::DeInitializeActionHistories ( )
private

Deletes all ActionHistories(Trees) - used on reinitialization.

Definition at line 744 of file PlanningUnitMADPDiscrete.cpp.

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.

Definition at line 781 of file PlanningUnitMADPDiscrete.cpp.

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.

Definition at line 355 of file PlanningUnitMADPDiscrete.cpp.

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

Referenced by Deinitialize().

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

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

Definition at line 395 of file PlanningUnitMADPDiscrete.h.

References GetAction(), and Referrer< MultiAgentDecisionProcessDiscreteInterface >::GetReferred().

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

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

Definition at line 1500 of file PlanningUnitMADPDiscrete.cpp.

Referenced by IndividualToJointActionHistoryIndex().

ActionHistoryTree * PlanningUnitMADPDiscrete::GetActionHistoryTree ( Index  agentI,
Index  ohI 
) const

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

Definition at line 2175 of file PlanningUnitMADPDiscrete.cpp.

References _m_actionHistoryTreeVectors, DEBUG_PUD, GetNrActionHistories(), and GetNrAgents().

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

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

Definition at line 1440 of file PlanningUnitMADPDiscrete.cpp.

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

Referenced by IndividualToJointActionObservationHistoryIndex().

Index PlanningUnitMADPDiscrete::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.

Definition at line 1713 of file PlanningUnitMADPDiscrete.cpp.

References _m_firstAOHIforT, IndexTools::ActionAndObservation_to_ActionObservationIndex(), ComputeHistoryIndex(), GetNrActions(), and GetNrObservations().

Referenced by JointToIndividualActionObservationHistoryIndices().

ActionObservationHistoryTree* PlanningUnitMADPDiscrete::GetActionObservationHistoryTree ( Index  agentI,
Index  aohI 
) const
inline

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

Definition at line 746 of file PlanningUnitMADPDiscrete.h.

References _m_actionObservationHistoryTreeVectors.

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

Return the default IndexDomainCategory for the problem.

Implements Interface_ProblemToPolicyDiscrete.

Definition at line 2960 of file PlanningUnitMADPDiscrete.cpp.

References PolicyGlobals::OHIST_INDEX.

Index PlanningUnitMADPDiscrete::GetFirstJointActionObservationHistoryIndex ( Index  ts) const
inline

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

Definition at line 689 of file PlanningUnitMADPDiscrete.h.

References _m_firstJAOHIforT.

Index PlanningUnitMADPDiscrete::GetFirstJointObservationHistoryIndex ( Index  ts) const
inline

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

Definition at line 535 of file PlanningUnitMADPDiscrete.h.

References _m_firstJOHIforT.

Index PlanningUnitMADPDiscrete::GetFirstObservationHistoryIndex ( Index  agI,
Index  ts 
) const
inline
double PlanningUnitMADPDiscrete::GetInitialStateProbability ( Index  sI) const
inline
double PlanningUnitMADPDiscrete::GetJAOHProb ( Index  jaohI,
Index  p_jaohI = 0,
const JointBeliefInterface p_jb = NULL,
const JointPolicyDiscrete jpol = NULL 
) const

returns the probability of jaohI.

Definition at line 2463 of file PlanningUnitMADPDiscrete.cpp.

References GetJAOHProbs(), and GetNrStates().

double PlanningUnitMADPDiscrete::GetJAOHProbGivenPred ( Index  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)

Definition at line 2480 of file PlanningUnitMADPDiscrete.cpp.

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

double PlanningUnitMADPDiscrete::GetJAOHProbs ( JointBeliefInterface jb,
Index  jaohI,
Index  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.

Definition at line 2286 of file PlanningUnitMADPDiscrete.cpp.

References _m_jaohProbs, _m_jBeliefCache, _m_params, 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,
Index  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.)

Definition at line 2403 of file PlanningUnitMADPDiscrete.cpp.

References PolicyGlobals::AOHIST_INDEX, JointPolicyDiscrete::GetIndexDomainCategory(), JointPolicyDiscrete::GetJointActionProb(), GetJointObservationHistoryIndex(), Referrer< MultiAgentDecisionProcessDiscreteInterface >::GetReferred(), 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.

Definition at line 1671 of file PlanningUnitMADPDiscrete.cpp.

References _m_firstJAHIforT, 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.

Definition at line 1692 of file PlanningUnitMADPDiscrete.cpp.

References _m_firstJAHIforT, ComputeHistoryIndex(), and GetNrJointActions().

Index PlanningUnitMADPDiscrete::GetJointActionHistoryIndex ( JointActionHistoryTree joh) const

Returns the index of a JointActionHistoryTree pointer.

Definition at line 2223 of file PlanningUnitMADPDiscrete.cpp.

References _m_jointActionHistoryTreeVector, and _m_nrJointActionHistories.

JointActionHistoryTree * PlanningUnitMADPDiscrete::GetJointActionHistoryTree ( Index  jahI) const

Returns a pointer to joint action history#.

Definition at line 2210 of file PlanningUnitMADPDiscrete.cpp.

References _m_jointActionHistoryTreeVector, and _m_nrJointActionHistories.

Referenced by QBG::ComputeRecursivelyNoCache().

void PlanningUnitMADPDiscrete::GetJointActionObservationHistoryArrays ( Index  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).

Definition at line 1366 of file PlanningUnitMADPDiscrete.cpp.

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

Referenced by GetJAOHProbs(), and JointAOHIndexToIndividualActionObservationVectors().

Index PlanningUnitMADPDiscrete::GetJointActionObservationHistoryIndex ( JointActionObservationHistoryTree jaoh) const
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.

Definition at line 1752 of file PlanningUnitMADPDiscrete.cpp.

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

JointActionObservationHistoryTree * PlanningUnitMADPDiscrete::GetJointActionObservationHistoryTree ( Index  jaohI) const

Returns a pointer to JointActionObservation history#.

Definition at line 2866 of file PlanningUnitMADPDiscrete.cpp.

Referenced by QMDP::CacheJaohQValues(), GetJAOHProbs(), and BayesianGameForDecPOMDPStage::ProbRewardForjoahI().

void PlanningUnitMADPDiscrete::GetJointActionObservationHistoryVectors ( Index  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.

Definition at line 1338 of file PlanningUnitMADPDiscrete.cpp.

References JointActionObservationHistoryTree::GetJointActionObservationHistory().

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

JointBeliefInterface * PlanningUnitMADPDiscrete::GetJointBeliefInterface ( Index  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).

Definition at line 2244 of file PlanningUnitMADPDiscrete.cpp.

References _m_jBeliefCache, _m_params, PlanningUnitMADPDiscreteParameters::GetComputeJointBeliefs(), GetJointActionObservationHistoryVectors(), GetNewJointBeliefFromISD(), GetNewJointBeliefInterface(), Referrer< MultiAgentDecisionProcessDiscreteInterface >::GetReferred(), BeliefInterface::Print(), BeliefInterface::SanityCheck(), and JointBeliefInterface::Update().

Referenced by QFunctionJointBelief::GetQ(), and QMDP::GetQNoCache().

const JointObservation* PlanningUnitMADPDiscrete::GetJointObservation ( Index  joI) const
inline
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).

Definition at line 1414 of file PlanningUnitMADPDiscrete.cpp.

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.

Definition at line 1628 of file PlanningUnitMADPDiscrete.cpp.

References _m_firstJOHIforT, 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.

Definition at line 1649 of file PlanningUnitMADPDiscrete.cpp.

References _m_firstJOHIforT, ComputeHistoryIndex(), and GetNrJointObservations().

JointObservationHistoryTree * PlanningUnitMADPDiscrete::GetJointObservationHistoryTree ( Index  johI) const

Returns a pointer to joint observation history#.

Definition at line 1271 of file PlanningUnitMADPDiscrete.cpp.

References _m_jointObservationHistoryTreeVector, and _m_nrJointObservationHistories.

Referenced by QBG::ComputeRecursivelyNoCache().

MultiAgentDecisionProcessDiscreteInterface* PlanningUnitMADPDiscrete::GetMADPDI ( )
inline
const MultiAgentDecisionProcessDiscreteInterface* PlanningUnitMADPDiscrete::GetMADPDI ( ) const
inline
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.

Definition at line 2966 of file PlanningUnitMADPDiscrete.cpp.

Referenced by AgentPOMDP::AgentPOMDP(), GetJAOHProbGivenPred(), GetJointBeliefInterface(), InitializeJointActionObservationHistories(), and AlphaVectorPlanning::SampleBeliefs().

JointBeliefInterface * PlanningUnitMADPDiscrete::GetNewJointBeliefInterface ( size_t  size) const
virtual

Definition at line 2974 of file PlanningUnitMADPDiscrete.cpp.

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.

Definition at line 2152 of file PlanningUnitMADPDiscrete.cpp.

References _m_nrActionHistories.

Referenced by GetActionHistoryTree().

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.

Definition at line 743 of file PlanningUnitMADPDiscrete.h.

References _m_nrActionObservationHistories.

Referenced by JESPDynamicProgrammingPlanner::DynamicProgrammingBestResponse().

const std::vector<size_t>& PlanningUnitMADPDiscrete::GetNrActions ( ) const
inline
size_t PlanningUnitMADPDiscrete::GetNrActions ( Index  agentI) const
inlinevirtual

Returns the number of actions of agent agentI.

Implements Interface_ProblemToPolicyDiscrete.

Definition at line 388 of file PlanningUnitMADPDiscrete.h.

References GetNrActions(), and Referrer< MultiAgentDecisionProcessDiscreteInterface >::GetReferred().

Referenced by GetNrActions().

size_t PlanningUnitMADPDiscrete::GetNrAgents ( ) const
inline

Gets the number of agents.

Reimplemented from PlanningUnit.

Definition at line 352 of file PlanningUnitMADPDiscrete.h.

References PlanningUnit::GetNrAgents().

Referenced by AgentBG::AgentBG(), AlphaVectorBG::AlphaVectorBG(), QFunctionJAOHTree::ComputeQ(), GMAA_MAAstar::ConstructAndValuateNextPolicies(), GMAA_kGMAA::ConstructAndValuateNextPolicies(), GeneralizedMAAStarPlannerForDecPOMDPDiscrete::ConstructExtendedJointPolicy(), BGforStageCreation::Fill_FirstOHtsI(), BGforStageCreation::Fill_joI_Array(), GetActionHistoryTree(), GetNrJointPolicies(), GetNrObservationHistoriesVector(), GetObservationHistoryTree(), IndividualBeliefJESP::IndividualBeliefJESP(), IndividualToJointActionHistoryIndex(), IndividualToJointActionObservationHistoryIndex(), IndividualToJointObservationHistoryIndex(), InitializeActionHistories(), InitializeActionObservationHistories(), InitializeJointActionHistories(), InitializeJointActionObservationHistories(), InitializeJointObservationHistories(), InitializeObservationHistories(), JointActionHistory::JointActionHistory(), JointActionObservationHistory::JointActionObservationHistory(), JointAOHIndexToIndividualActionObservationVectors(), JointObservationHistory::JointObservationHistory(), JointToIndividualActionObservationHistoryIndices(), JointToIndividualObservationHistoryIndices(), JESPExhaustivePlanner::Plan(), JESPDynamicProgrammingPlanner::Plan(), PrintActionHistories(), PrintActionObservationHistories(), PrintObservationHistories(), and IndividualBeliefJESP::Update().

size_t PlanningUnitMADPDiscrete::GetNrJointActionHistories ( ) const

Returns the number of joint action histories.

Definition at line 2159 of file PlanningUnitMADPDiscrete.cpp.

References _m_jointActionHistoryTreeVector.

size_t PlanningUnitMADPDiscrete::GetNrJointActionObservationHistories ( ) const
inline

Returns the number of jointActionObservation histories.

Definition at line 751 of file PlanningUnitMADPDiscrete.h.

References _m_nrJointActionObservationHistories.

Referenced by QMDP::CacheJaohQValues().

size_t PlanningUnitMADPDiscrete::GetNrJointActions ( ) const
inline
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.

Definition at line 528 of file PlanningUnitMADPDiscrete.h.

References _m_nrJointObservationHistoriesT.

LIndex PlanningUnitMADPDiscrete::GetNrJointPolicies ( ) const

Returns the number of joint policies.

Definition at line 1199 of file PlanningUnitMADPDiscrete.cpp.

References GetNrAgents(), and GetNrPolicies().

Referenced by BruteForceSearchPlanner::Plan().

size_t PlanningUnitMADPDiscrete::GetNrObservationHistories ( Index  agentI) const

Returns the number of observation histories for agentI.

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

Definition at line 1212 of file PlanningUnitMADPDiscrete.cpp.

References _m_nrObservationHistories.

Referenced by GetNrObservationHistoriesVector(), GetNrPolicies(), GetObservationHistoryTree(), IndividualBeliefJESP::IndividualBeliefJESP(), DICEPSPlanner::Plan(), and DICEPSPlanner::UpdateCEProbDistribution().

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.

Definition at line 519 of file PlanningUnitMADPDiscrete.h.

References _m_nrObservationHistoriesT.

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

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

This calls GetNrObservationHistories(Index agentI)

Definition at line 1220 of file PlanningUnitMADPDiscrete.cpp.

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)

Definition at line 1228 of file PlanningUnitMADPDiscrete.cpp.

References GetNrAgents(), and GetNrObservationHistories().

const std::vector<size_t>& PlanningUnitMADPDiscrete::GetNrObservations ( ) const
inline
size_t PlanningUnitMADPDiscrete::GetNrObservations ( Index  agentI) const
inline

Returns the number of observations of agent agentI.

Definition at line 425 of file PlanningUnitMADPDiscrete.h.

References GetNrObservations(), and Referrer< MultiAgentDecisionProcessDiscreteInterface >::GetReferred().

Referenced by GetNrObservations().

LIndex PlanningUnitMADPDiscrete::GetNrPolicies ( Index  agentI) const

Returns the number of policies for agentI.

Definition at line 1182 of file PlanningUnitMADPDiscrete.cpp.

References GetNrActions(), and GetNrObservationHistories().

Referenced by GetNrJointPolicies().

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

Get the number of elements in the domain of an agent's policy.

Implements Interface_ProblemToPolicyDiscrete.

Definition at line 2933 of file PlanningUnitMADPDiscrete.cpp.

References PolicyGlobals::AOHIST_INDEX, Globals::MAXHORIZON, PolicyGlobals::OHIST_INDEX, and PolicyGlobals::TYPE_INDEX.

size_t PlanningUnitMADPDiscrete::GetNrStates ( ) const
const Observation* PlanningUnitMADPDiscrete::GetObservation ( Index  agentI,
Index  o 
) const
inline
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).

Definition at line 1474 of file PlanningUnitMADPDiscrete.cpp.

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

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.

Definition at line 1596 of file PlanningUnitMADPDiscrete.cpp.

References _m_firstOHIforT, ComputeHistoryIndex(), and GetNrObservations().

Referenced by JointToIndividualObservationHistoryIndices().

ObservationHistoryTree * PlanningUnitMADPDiscrete::GetObservationHistoryTree ( Index  agentI,
Index  ohI 
) const
const ObservationModelDiscrete* PlanningUnitMADPDiscrete::GetObservationModelDiscretePtr ( ) const
inline
double PlanningUnitMADPDiscrete::GetObservationProbability ( Index  jaI,
Index  sucSI,
Index  joI 
) const
inline
const PlanningUnitMADPDiscreteParameters& PlanningUnitMADPDiscrete::GetParams ( ) const
inline

Get the parameters for this planning unit.

Definition at line 375 of file PlanningUnitMADPDiscrete.h.

References _m_params.

Referenced by GeneralizedMAAStarPlannerForDecPOMDPDiscrete::GeneralizedMAAStarPlannerForDecPOMDPDiscrete().

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

Get a pointer to a State by index.

Definition at line 363 of file PlanningUnitMADPDiscrete.h.

References Referrer< MultiAgentDecisionProcessDiscreteInterface >::GetReferred(), and GetState().

Referenced by GetState().

Index PlanningUnitMADPDiscrete::GetSuccessorAHI ( Index  agentI,
Index  ohI,
Index  oI 
) const

Definition at line 2745 of file PlanningUnitMADPDiscrete.cpp.

Index PlanningUnitMADPDiscrete::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.

Definition at line 2805 of file PlanningUnitMADPDiscrete.cpp.

Index PlanningUnitMADPDiscrete::GetSuccessorJAHI ( Index  johI,
Index  joI 
) const

Definition at line 2727 of file PlanningUnitMADPDiscrete.cpp.

Index PlanningUnitMADPDiscrete::GetSuccessorJAOHI ( Index  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.

Definition at line 2823 of file PlanningUnitMADPDiscrete.cpp.

Referenced by GetJAOHProbsRecursively().

Index PlanningUnitMADPDiscrete::GetSuccessorJOHI ( Index  johI,
Index  joI 
) const
Index PlanningUnitMADPDiscrete::GetSuccessorOHI ( Index  agentI,
Index  ohI,
Index  oI 
) const

Returns the index of the successor of observation history ohI of agentI via observation joI.

I.e., johIsuc = (johI, joI).

Definition at line 2668 of file PlanningUnitMADPDiscrete.cpp.

Referenced by IndividualBeliefJESP::Update().

Index PlanningUnitMADPDiscrete::GetTimeStepForAHI ( Index  agentI,
Index  ohI 
) const

Returns the time step of observation history ohI.

Definition at line 2687 of file PlanningUnitMADPDiscrete.cpp.

Index PlanningUnitMADPDiscrete::GetTimeStepForAOHI ( Index  agentI,
Index  aohI 
) const

Returns the time step of joint action-observation historyaohI.

Definition at line 2764 of file PlanningUnitMADPDiscrete.cpp.

Index PlanningUnitMADPDiscrete::GetTimeStepForJAHI ( Index  johI) const

Returns the time step of joint observation history johI.

Definition at line 2707 of file PlanningUnitMADPDiscrete.cpp.

Index PlanningUnitMADPDiscrete::GetTimeStepForJAOHI ( Index  jaohI) const

Returns the time step of joint action-observation historyjaohI.

Definition at line 2784 of file PlanningUnitMADPDiscrete.cpp.

Referenced by GetJAOHProbs(), QMDP::GetQNoCache(), JointAOHIndexToIndividualActionObservationVectors(), and JointToIndividualActionObservationHistoryIndices().

Index PlanningUnitMADPDiscrete::GetTimeStepForJOHI ( Index  johI) const

Returns the time step of joint observation history johI.

Definition at line 2629 of file PlanningUnitMADPDiscrete.cpp.

Referenced by ValueFunctionDecPOMDPDiscrete::CalculateVsjohRecursivelyNotCached(), and JointToIndividualObservationHistoryIndices().

Index PlanningUnitMADPDiscrete::GetTimeStepForOHI ( Index  agentI,
Index  ohI 
) const

Returns the time step of observation history ohI.

Definition at line 2609 of file PlanningUnitMADPDiscrete.cpp.

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.

Definition at line 2049 of file PlanningUnitMADPDiscrete.cpp.

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

Index PlanningUnitMADPDiscrete::IndividualToJointActionIndices ( const Index *  indivActionIndices) const
inlinevirtual
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.

Definition at line 408 of file PlanningUnitMADPDiscrete.h.

References Referrer< MultiAgentDecisionProcessDiscreteInterface >::GetReferred(), and IndividualToJointActionIndices().

Referenced by IndividualToJointActionIndices().

Index 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.

Definition at line 2085 of file PlanningUnitMADPDiscrete.cpp.

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.

Definition at line 2014 of file PlanningUnitMADPDiscrete.cpp.

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

Index PlanningUnitMADPDiscrete::IndividualToJointObservationIndices ( std::vector< Index > &  inObs) const
inline
void PlanningUnitMADPDiscrete::InitializeActionHistories ( )
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.

Definition at line 658 of file PlanningUnitMADPDiscrete.cpp.

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::InitializeJointActionObservationHistories ( )
private
void PlanningUnitMADPDiscrete::InitializeJointObservationHistories ( )
private
void PlanningUnitMADPDiscrete::InitializeObservationHistories ( )
private
void PlanningUnitMADPDiscrete::JointAOHIndexToIndividualActionObservationVectors ( Index  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

Definition at line 1875 of file PlanningUnitMADPDiscrete.cpp.

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

Referenced by JointToIndividualActionObservationHistoryIndices().

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

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

Definition at line 1865 of file PlanningUnitMADPDiscrete.cpp.

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.

Definition at line 1932 of file PlanningUnitMADPDiscrete.cpp.

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.

Definition at line 1939 of file PlanningUnitMADPDiscrete.cpp.

References _m_jointActionHistoryTreeVector, and _m_nrJointActionHistories.

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

Returns a vector containing the indices of the indiv.

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

Definition at line 1911 of file PlanningUnitMADPDiscrete.cpp.

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

Referenced by JointToIndividualPolicyDomainIndices().

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

Returns a vector containing the indices of the indiv.

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

Definition at line 1844 of file PlanningUnitMADPDiscrete.cpp.

References _m_jointActionObservationHistoryTreeVector, _m_nrJointActionObservationHistories, 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.

Definition at line 1791 of file PlanningUnitMADPDiscrete.cpp.

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.

Definition at line 1824 of file PlanningUnitMADPDiscrete.cpp.

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::IndexDomainCategory  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.

Definition at line 1964 of file PlanningUnitMADPDiscrete.cpp.

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

const vector< Index > & PlanningUnitMADPDiscrete::JointToIndividualPolicyDomainIndicesRef ( Index  jdI,
PolicyGlobals::IndexDomainCategory  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.

Definition at line 1984 of file PlanningUnitMADPDiscrete.cpp.

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

void PlanningUnitMADPDiscrete::Print ( )

Prints info regarding the planning unit.

Definition at line 2542 of file PlanningUnitMADPDiscrete.cpp.

References PrintTools::PrintVectorCout().

Referenced by Initialize().

void PlanningUnitMADPDiscrete::PrintActionHistories ( )

Prints the action histories for all agents.

Definition at line 2513 of file PlanningUnitMADPDiscrete.cpp.

References _m_actionHistoryTreeRootPointers, and GetNrAgents().

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

Prints the observation histories for all agents.

Definition at line 2503 of file PlanningUnitMADPDiscrete.cpp.

References _m_observationHistoryTreeRootPointers, and GetNrAgents().

void PlanningUnitMADPDiscrete::RegisterJointActionObservationHistoryTree ( JointActionObservationHistoryTree jaoht)

Register a new jaoht in the vector of indices.

Definition at line 2849 of file PlanningUnitMADPDiscrete.cpp.

References TreeNode< Tcontained >::GetIndex().

bool PlanningUnitMADPDiscrete::SanityCheck ( void  ) const
protectedvirtual

Do some sanity checks, can be overridden.

Reimplemented in PlanningUnitDecPOMDPDiscrete.

Definition at line 139 of file PlanningUnitMADPDiscrete.cpp.

Referenced by Initialize().

void PlanningUnitMADPDiscrete::SetHorizon ( size_t  h)
virtual

Sets the horizon for the planning problem.

Also reinitializes the planning unit.

Reimplemented from PlanningUnit.

Definition at line 123 of file PlanningUnitMADPDiscrete.cpp.

References Deinitialize(), and Initialize().

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

void PlanningUnitMADPDiscrete::SetParams ( const PlanningUnitMADPDiscreteParameters params)

Sets the parameters for this planning unit.

Also reinitializes the planning unit.

Definition at line 132 of file PlanningUnitMADPDiscrete.cpp.

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

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

void PlanningUnitMADPDiscrete::SetProblem ( MultiAgentDecisionProcessDiscreteInterface madp)

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

Also reinitializes the planning unit.

Definition at line 111 of file PlanningUnitMADPDiscrete.cpp.

References DEBUG_PUD, Deinitialize(), Initialize(), Referrer< MultiAgentDecisionProcessDiscreteInterface >::SetReferred(), and MultiAgentDecisionProcessDiscreteInterface::SoftPrint().

string PlanningUnitMADPDiscrete::SoftPrintAction ( Index  agentI,
Index  actionI 
) const
virtual

soft prints action actionI of agent agentI.

Implements Interface_ProblemToPolicyDiscrete.

Definition at line 3012 of file PlanningUnitMADPDiscrete.cpp.

string PlanningUnitMADPDiscrete::SoftPrintObservationHistory ( Index  agentI,
Index  ohIndex 
) const

soft prints ObservationHistory ohIndex of agent agentI.

Definition at line 2983 of file PlanningUnitMADPDiscrete.cpp.

string PlanningUnitMADPDiscrete::SoftPrintPolicyDomainElement ( Index  agentI,
Index  dIndex,
PolicyGlobals::IndexDomainCategory  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.

Definition at line 2906 of file PlanningUnitMADPDiscrete.cpp.

References PolicyGlobals::AOHIST_INDEX, PolicyGlobals::OHIST_INDEX, 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.

Definition at line 250 of file PlanningUnitMADPDiscrete.h.

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.

Definition at line 255 of file PlanningUnitMADPDiscrete.h.

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.

Definition at line 267 of file PlanningUnitMADPDiscrete.h.

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

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

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

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

Definition at line 274 of file PlanningUnitMADPDiscrete.h.

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

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.

Definition at line 209 of file PlanningUnitMADPDiscrete.h.

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

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

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

Definition at line 226 of file PlanningUnitMADPDiscrete.h.

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

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

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

Definition at line 212 of file PlanningUnitMADPDiscrete.h.

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

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

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

Definition at line 229 of file PlanningUnitMADPDiscrete.h.

Referenced by DeInitializeJointActionObservationHistories(), GetFirstJointActionObservationHistoryIndex(), GetJointActionObservationHistoryIndex(), and InitializeJointActionObservationHistories().

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

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

Definition at line 195 of file PlanningUnitMADPDiscrete.h.

Referenced by DeInitializeJointObservationHistories(), GetFirstJointObservationHistoryIndex(), GetJointObservationHistoryIndex(), 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.

Definition at line 192 of file PlanningUnitMADPDiscrete.h.

Referenced by CreateObservationHistoryTree(), DeInitializeObservationHistories(), GetFirstObservationHistoryIndex(), GetObservationHistoryIndex(), and InitializeObservationHistories().

bool PlanningUnitMADPDiscrete::_m_initialized
private

A bool indicating whether this Planning unit has been initialized.

Definition at line 81 of file PlanningUnitMADPDiscrete.h.

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

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

Stores the conditional probability of this joint belief.

Definition at line 300 of file PlanningUnitMADPDiscrete.h.

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 )

Definition at line 307 of file PlanningUnitMADPDiscrete.h.

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)

Definition at line 298 of file PlanningUnitMADPDiscrete.h.

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

JointActionHistoryTree* PlanningUnitMADPDiscrete::_m_jointActionHistoryTreeRoot
protected

The root node of the joint action histories tree.

Definition at line 257 of file PlanningUnitMADPDiscrete.h.

Referenced by DeInitializeJointActionHistories(), and InitializeJointActionHistories().

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

A map which is used instead of _m_jointActionObservationHistoryTreeVector when we don't cache all JointActionObservationHistoryTree's.

Definition at line 290 of file PlanningUnitMADPDiscrete.h.

Referenced by DeInitializeJointActionObservationHistories(), and InitializeJointActionObservationHistories().

JointActionObservationHistoryTree* PlanningUnitMADPDiscrete::_m_jointActionObservationHistoryTreeRoot
protected

The root node of the joint actionObservation histories tree.

Definition at line 278 of file PlanningUnitMADPDiscrete.h.

Referenced by DeInitializeJointActionObservationHistories(), and InitializeJointActionObservationHistories().

std::vector<JointActionObservationHistoryTree*> PlanningUnitMADPDiscrete::_m_jointActionObservationHistoryTreeVector
protected
JointObservationHistoryTree* PlanningUnitMADPDiscrete::_m_jointObservationHistoryTreeRoot
protected

The root node of the joint observation histories tree.

Definition at line 241 of file PlanningUnitMADPDiscrete.h.

Referenced by DeInitializeJointObservationHistories(), and InitializeJointObservationHistories().

std::vector<JointObservationHistoryTree*> PlanningUnitMADPDiscrete::_m_jointObservationHistoryTreeVector
protected
std::vector<size_t> PlanningUnitMADPDiscrete::_m_nrActionHistories
protected

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

Definition at line 199 of file PlanningUnitMADPDiscrete.h.

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

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]

Definition at line 204 of file PlanningUnitMADPDiscrete.h.

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

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

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

histories per agent.

Definition at line 216 of file PlanningUnitMADPDiscrete.h.

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

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]

Definition at line 221 of file PlanningUnitMADPDiscrete.h.

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

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

The number of joint action histories per time-step.

Definition at line 206 of file PlanningUnitMADPDiscrete.h.

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.

Definition at line 223 of file PlanningUnitMADPDiscrete.h.

Referenced by DeInitializeJointActionObservationHistories(), and InitializeJointActionObservationHistories().

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

The number of joint observation histories per time-step.

Definition at line 189 of file PlanningUnitMADPDiscrete.h.

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

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

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

Definition at line 182 of file PlanningUnitMADPDiscrete.h.

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

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]

Definition at line 187 of file PlanningUnitMADPDiscrete.h.

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

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

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

Definition at line 235 of file PlanningUnitMADPDiscrete.h.

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.

Definition at line 239 of file PlanningUnitMADPDiscrete.h.

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


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