MultiAgentDecisionProcess
Release 0.2.1
|
JointActionObservationHistoryTree is derived from TreeNode, and similar to ObservationHistoryTree: More...
#include <JointActionObservationHistoryTree.h>
Public Member Functions | |
JointActionObservationHistory * | GetJointActionObservationHistory () const |
Returns the contained JointActionObservationHistory*. | |
size_t | GetLength () const |
Returns the length of the containted JointActionObservationHistory. | |
JointActionObservationHistoryTree * | GetPredecessor () const |
Returns the predecessor JointActionObservationHistoryTree*. | |
JointActionObservationHistoryTree * | GetSuccessor (Index jaI, Index joI) |
Returns the successor JointActionObservationHistoryTree* for joint action jaI and joint observation joI. | |
JointActionObservationHistoryTree (aoh_t nt=A_SUC) | |
(default) Constructor | |
JointActionObservationHistoryTree (JointActionObservationHistory *const aoh, aoh_t nt=A_SUC) | |
Create a joint observation history tree for joh. | |
void | Print () const |
Prints the tree starting from this node of the history tree (including the successors). | |
void | SetIndex (Index i) |
Sets the index to i. | |
void | SetSuccessor (Index jaI, Index joI, JointActionObservationHistoryTree *suc) |
Sets the sucI'th successor of this TreeNode to suc. | |
![]() | |
bool | ExistsSuccessor (Index sucI) |
Check whether a particular successor sucI exists. | |
JointActionObservationHistory * | GetContainedElement () const |
Returns a pointer to the contained element (Tcontained) | |
Index | GetIndex () const |
Returns the index of this TreeNode (and thus corresponding to the contained element). | |
TreeNode * | GetSuccessor (Index sucI) |
Get the succesor TreeNode* for the sucI'th successor. | |
void | PrintThisNode () const |
Prints only this node of the history tree (not the successors). | |
void | SetPredeccessor (TreeNode< JointActionObservationHistory > *pred) |
Sets the predecessor of this node to be pred. | |
void | SetSuccessor (Index sucI, TreeNode< JointActionObservationHistory > *suc) |
Sets the sucI'th successor of this TreeNode to suc. | |
TreeNode () | |
(default) Constructor | |
TreeNode (JointActionObservationHistory *const oh) | |
TreeNode (const TreeNode &a) | |
Copy constructor. | |
virtual | ~TreeNode () |
Destructor. |
Private Types | |
enum | aoh_t { A_SUC, O_SUC } |
Private Attributes | |
aoh_t | _m_nodeType |
Additional Inherited Members | |
![]() | |
JointActionObservationHistory * | _m_containedElem |
The contained element. | |
Index | _m_index |
The index of this TreeNode (and thus of the contained Tcontained - typically an observation history). | |
bool | _m_indexValid |
Whether the index is valid. | |
TreeNode < JointActionObservationHistory > * | _m_pred |
A Pointer to the predecessor. | |
std::map< Index, TreeNode < JointActionObservationHistory > * > | _m_successor |
The map that stores the pointers to the successor TreeNodes. |
JointActionObservationHistoryTree is derived from TreeNode, and similar to ObservationHistoryTree:
JointActionObservationHistoryTree is a class that represents a wrapper for the JointActionObservationHistory class. An JointActionObservationHistoryTree actually represents a node in the tree of observation histories. But each node also specifies a (sub-)tree so there is no actual difference between a tree and a node. This implementation assumes that ActionObservationHistories are always contained in exactly 1 JointActionObservationHistoryTree: i.e., deleting an object of JointActionObservationHistoryTree will free the memory of the node and the subtree represented by it as well as the memory of all the contained ActionObservationHistories.
A difference with ObservationHistoryTree is that here a successor is specified by 2 indices. One option would be to combine these into a joint index, but this would add calculation every time we're traversing the tree. Instead this class defines 2 types of nodes: ones that specify the action successor (A_SUC) and ones that specify the observation successor (O_SUC). Only the A_SUC nodes contain actual ActionObservationHistories, O_SUC nodes are 'intermediate nodes' and no operations should be performed on them.
Definition at line 65 of file JointActionObservationHistoryTree.h.
|
private |
Definition at line 68 of file JointActionObservationHistoryTree.h.
(default) Constructor
Definition at line 77 of file JointActionObservationHistoryTree.h.
Referenced by GetSuccessor(), and SetSuccessor().
JointActionObservationHistoryTree::JointActionObservationHistoryTree | ( | JointActionObservationHistory *const | aoh, |
aoh_t | nt = A_SUC |
||
) |
Create a joint observation history tree for joh.
Definition at line 36 of file JointActionObservationHistoryTree.cpp.
References _m_nodeType.
JointActionObservationHistory * JointActionObservationHistoryTree::GetJointActionObservationHistory | ( | ) | const |
Returns the contained JointActionObservationHistory*.
Definition at line 161 of file JointActionObservationHistoryTree.cpp.
References _m_nodeType, TreeNode< JointActionObservationHistory >::GetContainedElement(), and O_SUC.
Referenced by PlanningUnitMADPDiscrete::GetJAOHProbs(), PlanningUnitMADPDiscrete::GetJointActionObservationHistoryVectors(), GetSuccessor(), PlanningUnitMADPDiscrete::JointToIndividualActionObservationHistoryIndicesRef(), and BayesianGameForDecPOMDPStage::ProbRewardForjoahI().
|
inline |
Returns the length of the containted JointActionObservationHistory.
Definition at line 98 of file JointActionObservationHistoryTree.h.
References TreeNode< JointActionObservationHistory >::GetContainedElement(), and GetLength().
Referenced by QMDP::CacheJaohQValues(), GetLength(), and GetPredecessor().
JointActionObservationHistoryTree * JointActionObservationHistoryTree::GetPredecessor | ( | ) | const |
Returns the predecessor JointActionObservationHistoryTree*.
Reimplemented from TreeNode< JointActionObservationHistory >.
Definition at line 142 of file JointActionObservationHistoryTree.cpp.
References _m_nodeType, GetLength(), and O_SUC.
JointActionObservationHistoryTree * JointActionObservationHistoryTree::GetSuccessor | ( | Index | aI, |
Index | oI | ||
) |
Returns the successor JointActionObservationHistoryTree* for joint action jaI and joint observation joI.
Generates a successor if it does not exist yet (in case we did not generate cache the whole tree).
Definition at line 100 of file JointActionObservationHistoryTree.cpp.
References _m_nodeType, TreeNode< JointActionObservationHistory >::GetIndex(), GetJointActionObservationHistory(), Referrer< T >::GetReferred(), JointActionObservationHistoryTree(), O_SUC, SetIndex(), and SetSuccessor().
Referenced by QPOMDP::ComputeRecursively(), QBG::ComputeRecursively(), and BayesianGameForDecPOMDPStage::ProbRewardForjoahI().
void JointActionObservationHistoryTree::Print | ( | ) | const |
Prints the tree starting from this node of the history tree (including the successors).
Reimplemented from TreeNode< JointActionObservationHistory >.
Definition at line 169 of file JointActionObservationHistoryTree.cpp.
References TreeNode< JointActionObservationHistory >::_m_containedElem, TreeNode< JointActionObservationHistory >::_m_index, TreeNode< JointActionObservationHistory >::_m_indexValid, _m_nodeType, TreeNode< JointActionObservationHistory >::_m_successor, A_SUC, JointActionObservationHistory::Print(), and Print().
Referenced by PlanningUnitMADPDiscrete::InitializeJointActionObservationHistories(), and Print().
void JointActionObservationHistoryTree::SetIndex | ( | Index | i | ) |
Sets the index to i.
Reimplemented from TreeNode< JointActionObservationHistory >.
Definition at line 65 of file JointActionObservationHistoryTree.cpp.
References _m_nodeType, and O_SUC.
Referenced by GetSuccessor(), and PlanningUnitMADPDiscrete::InitializeJointActionObservationHistories().
void JointActionObservationHistoryTree::SetSuccessor | ( | Index | jaI, |
Index | joI, | ||
JointActionObservationHistoryTree * | suc | ||
) |
Sets the sucI'th successor of this TreeNode to suc.
For example, the successor for observation number sucI.
Definition at line 75 of file JointActionObservationHistoryTree.cpp.
References _m_nodeType, JointActionObservationHistoryTree(), and O_SUC.
Referenced by GetSuccessor(), and PlanningUnitMADPDiscrete::InitializeJointActionObservationHistories().
|
private |
Definition at line 70 of file JointActionObservationHistoryTree.h.
Referenced by GetJointActionObservationHistory(), GetPredecessor(), GetSuccessor(), JointActionObservationHistoryTree(), Print(), SetIndex(), and SetSuccessor().