MultiAgentDecisionProcess
Release 0.2.1
|
JointPolicyPureVector represents a discrete pure joint policy. More...
#include <JointPolicyPureVector.h>
Public Member Functions | |
virtual JointPolicyPureVector * | Clone () const |
Returns a pointer to a copy of this class. | |
virtual Index | GetActionIndex (Index agI, Index domainI) const |
Returns the action index for domainI for agent aI. | |
LIndex | GetIndex () const |
Get the index of this joint policy. | |
std::vector< PolicyPureVector * > & | GetIndividualPolicies () |
Returns a reference to the vector of pointers to individual policies. | |
virtual PolicyDiscrete * | GetIndividualPolicyDiscrete (Index i) const |
virtual Index | GetJointActionIndex (Index i) const |
Returns the jaI taken by this policy for joint domain index johI. | |
bool | Increment (Index agentI) |
bool | Increment () |
JointPolicyPureVector (const Interface_ProblemToPolicyDiscretePure &pu) | |
Constructor. | |
JointPolicyPureVector (const Interface_ProblemToPolicyDiscretePure &pu, PolicyGlobals::IndexDomainCategory idc) | |
Constructor. | |
JointPolicyPureVector (const JointPolicyPureVector &a) | |
Copy constructor. | |
JointPolicyPureVector (const JointPolicyDiscretePure &a) | |
Copy constructor from base class a. | |
JointPolicyPureVector (const JointPolicyDiscretePure &a1, const JPolComponent_VectorImplementation &a2) | |
Copy constructor from base class a. | |
bool | operator++ () |
Performs increment. See Increment(). | |
virtual JointPolicyPureVector & | operator= (const JointPolicyPureVector &jp) |
The copy assignment operator - makes deep copies using PolicyPureVector::operator= which makes deep copies. | |
virtual JointPolicyPureVector & | operator= (const JointPolicyDiscretePure &jp) |
The copy assignment operator - makes deep copies using PolicyPureVector::operator= which makes deep copies. | |
void | PrintBrief () const |
virtual void | RandomInitialization () |
Randomly initialize the joint policy. | |
virtual void | RandomInitialization (Index i) |
Randomly initialize the policy for agentI. | |
virtual void | SetAction (Index agentI, Index domainI, Index aI) |
void | SetDepth (size_t d) |
Sets the depth of the joint policy. | |
void | SetIndex (LIndex i) |
Sets the index of this joint policy.Updates the policies represented. | |
virtual std::string | SoftPrint () const |
Prints a description of this JointPolicyPureVector to a string. | |
virtual std::string | SoftPrintBrief () const |
Prints a brief description to a string. | |
JointPolicyPureVector * | ToJointPolicyPureVector () const |
Convert this joint policy to a JointPolicyPureVector. | |
virtual void | ZeroInitialization () |
Initialize the joint policy to the first joint policy. | |
virtual void | ZeroInitialization (Index i) |
Initialize the policy of agentI to the first policy. | |
virtual | ~JointPolicyPureVector () |
Destructor. | |
![]() | |
virtual JointPolicyDiscretePure * | Clone () const =0 |
Returns a pointer to a copy of this class. | |
virtual Index | GetActionIndex (Index aI, Index domainI) const =0 |
Returns the action index for domainI for agent aI. | |
double | GetActionProb (Index agentI, Index domI, Index aI) const |
Returns the probability that the policy specifies action aI for domain index domI for agentI. | |
const Interface_ProblemToPolicyDiscretePure * | GetInterfacePTPDiscretePure () const |
Return pointer to the Interface_ProblemToPolicyDiscretePure. | |
virtual Index | GetJointActionIndex (Index i) const =0 |
Returns the jaI taken by this policy for joint domain index johI. | |
double | GetJointActionProb (Index i, Index ja) const |
Returns the probability that the policy specifies joint action a for domain index i. | |
JointPolicyDiscretePure () | |
default Constructor - constructs empty policy | |
JointPolicyDiscretePure (const Interface_ProblemToPolicyDiscretePure &pu, PolicyGlobals::IndexDomainCategory idc) | |
(default) Constructor | |
JointPolicyDiscretePure (const JointPolicyDiscretePure &a) | |
Copy constructor. | |
virtual JointPolicyDiscretePure & | operator= (const JointPolicyDiscretePure &o) |
Copy assignment operator. | |
virtual void | RandomInitialization ()=0 |
Randomly initialize the joint policy. | |
virtual void | RandomInitialization (Index agentI)=0 |
Randomly initialize the policy for agentI. | |
virtual void | SetAction (Index agentI, Index domainI, Index aI)=0 |
Sets the policy for agentI to domainI->aI. | |
void | SetInterfacePTPDiscretePure (Interface_ProblemToPolicyDiscretePure *pu) |
Sets the planning unit for this joint policy. | |
virtual std::string | SoftPrint () const =0 |
Prints a description of this JointPolicyPureVector to a string. | |
virtual std::string | SoftPrintBrief () const =0 |
Prints a brief description to a string. | |
virtual JointPolicyPureVector * | ToJointPolicyPureVector () const =0 |
virtual | ~JointPolicyDiscretePure () |
Destructor. | |
![]() | |
IndexDomainCategory | GetIndexDomainCategory () const |
returns the Category of the domain over which the indices of this policy are specified. | |
virtual PolicyDiscrete * | GetIndividualPolicyDiscrete (Index agI) const =0 |
return pointer to individual policy of agent agI | |
const Interface_ProblemToPolicyDiscrete * | GetInterfacePTPDiscrete () const |
return a pointer to the referred Interface_ProblemToPolicyDiscrete. | |
size_t | GetNrDomainElements (Index agentI) const |
Returns the number of policy domain elements for agent agentI. | |
JointPolicyDiscrete () | |
default constructor creates an empty policy | |
JointPolicyDiscrete (const Interface_ProblemToPolicyDiscrete &pu, PolicyGlobals::IndexDomainCategory idc) | |
(default) Constructor | |
JointPolicyDiscrete (const JointPolicyDiscrete &a) | |
Copy constructor. | |
virtual JointPolicyDiscrete & | operator= (const JointPolicyDiscrete &o) |
Assignment operator. | |
Index | SampleJointAction (Index i) const |
Returns a sampled joint action. | |
Index | SampleJointAction (const std::vector< Index > &Is) const |
Returns a sampled joint action. | |
void | SampleJointActionVector (Index i, std::vector< Index > &jaVec) const |
Returns a sampled joint action. | |
void | SampleJointActionVector (const std::vector< Index > &Is, std::vector< Index > &jaVec) const |
Returns a sampled joint action. | |
void | SetIndexDomainCategory (IndexDomainCategory idc) |
sets the category of the domain over which the indices of this policy are specified. | |
void | SetInterfacePTPDiscrete (const Interface_ProblemToPolicyDiscrete *p) |
sets the pointer to the Interface_ProblemToPolicyDiscrete. | |
virtual | ~JointPolicyDiscrete () |
Destructor. | |
![]() | |
size_t | GetDepth () const |
Returns the depth of the joint policy. | |
size_t | GetNrAgents () const |
Returns the number of agents for which the joint policy is defined. | |
JointPolicy (size_t nrAg) | |
Constructor, initializes the depth to the maximum horizon. | |
JointPolicy (const JointPolicy &o) | |
copy constructor: | |
virtual JointPolicy & | operator= (const JointPolicy &o) |
copy assignment operator | |
virtual void | Print () const |
Prints a description of a joint policy to cout. | |
virtual void | SetDepth (size_t d) |
Sets the depth of the joint policy. | |
virtual | ~JointPolicy () |
Destructor. |
Protected Attributes | |
std::vector< PolicyPureVector * > | _m_indivPols_PolicyPureVector |
Private Member Functions | |
void | ClearIndividualPolicies () |
Private function that deletes all the individual policies pointed to. | |
![]() | |
Index | GetActionIndex (Index aI, Index domainI) const |
Returns the action index for domainI for agent aI. | |
LIndex | GetIndex () const |
Get the index of this joint policy. | |
std::vector< PolicyPureVector * > & | GetIndividualPolicies () |
Returns a reference to the vector of pointers to individual policies. | |
virtual PolicyDiscrete * | GetIndividualPolicyDiscrete (Index agI) const |
Index | GetJointActionIndex (Index i) const |
Returns the jaI taken by this policy for joint domain index johI. | |
bool | Increment (Index agentI) |
Increments the individual policy of agentI. | |
bool | Increment () |
Increments the joint policy, used to iterate over joint policies. | |
JPolComponent_VectorImplementation (const Interface_ProblemToPolicyDiscretePure &pu, size_t depth=MAXHORIZON) | |
(default) Constructor | |
JPolComponent_VectorImplementation (const Interface_ProblemToPolicyDiscretePure &pu, PolicyGlobals::IndexDomainCategory idc, size_t depth=MAXHORIZON) | |
JPolComponent_VectorImplementation (const JPolComponent_VectorImplementation &a) | |
Copy constructor. | |
bool | operator++ () |
Performs increment. See Increment(). | |
JPolComponent_VectorImplementation & | operator= (const JPolComponent_VectorImplementation &o) |
Copy assignment operator. | |
void | RandomInitialization () |
Randomly initialize the joint policy. | |
void | RandomInitialization (Index agentI) |
Randomly initialize the policy for agentI. | |
void | SetAction (Index agentI, Index domainI, Index aI) |
Sets the policy for agentI to domainI->aI. | |
void | SetDepthForIndivPols (size_t d) |
void | SetIndex (LIndex i) |
Sets the index of this joint policy.Updates the policies represented. | |
std::string | SoftPrint () const |
Prints a description of this to a string. | |
std::string | SoftPrintBrief () const |
void | ZeroInitialization () |
Initialize the joint policy to the first joint policy. | |
void | ZeroInitialization (Index agentI) |
Initialize the policy of agentI to the first policy. | |
~JPolComponent_VectorImplementation () | |
Destructor. |
Private Attributes | |
Index * | _m_indivActionIndices |
vector for temporarily storing indiv. actions |
JointPolicyPureVector represents a discrete pure joint policy.
Each of the individual policies is a PolicyPureVector - a deterministic mapping from observations to actions implemented by a tree. This class acts as a wrapper. It contains a vector with pointers to indiv. policies.
we delete the PolicyPureVectors pointed to: this means that we should not be able to add indiv. policies without copying them!!!
Definition at line 51 of file JointPolicyPureVector.h.
|
inline |
Constructor.
Associates a problem (typically a planning unit) with the joint policy. Information regarding the problem is used to construct a joint policy of the proper shape.
Use the default IndexDomainCategory defined by pu.
Definition at line 82 of file JointPolicyPureVector.h.
Referenced by Clone().
|
inline |
Constructor.
Associates a problem (typically a planning unit) with the joint policy. Information regarding the problem is used to construct a joint policy of the proper shape.
idc is the IndexDomainCategory over which the policy is specified.
Definition at line 96 of file JointPolicyPureVector.h.
|
inline |
Copy constructor.
Definition at line 104 of file JointPolicyPureVector.h.
|
inline |
Copy constructor from base class a.
Definition at line 110 of file JointPolicyPureVector.h.
|
inline |
Copy constructor from base class a.
Definition at line 117 of file JointPolicyPureVector.h.
|
inlinevirtual |
Destructor.
Definition at line 126 of file JointPolicyPureVector.h.
|
private |
Private function that deletes all the individual policies pointed to.
|
inlinevirtual |
Returns a pointer to a copy of this class.
Definition at line 206 of file JointPolicyPureVector.h.
References JointPolicyPureVector().
|
inlinevirtual |
Returns the action index for domainI for agent aI.
Definition at line 175 of file JointPolicyPureVector.h.
Referenced by AgentBG::Act(), JESPDynamicProgrammingPlanner::DPBestResponseRecursively(), and IndividualBeliefJESP::Update().
|
inline |
Get the index of this joint policy.
Definition at line 164 of file JointPolicyPureVector.h.
Referenced by BGIPSolution::AddSolution(), AlphaVectorBG::BeliefBackupBGIP_Solver(), JPPVIndexValuePair::JPPVIndexValuePair(), DICEPSPlanner::Plan(), and JPPVValuePair::SoftPrintBrief().
|
inline |
Returns a reference to the vector of pointers to individual policies.
This function should be used to manipulate individual policies.
Definition at line 183 of file JointPolicyPureVector.h.
Referenced by DICEPSPlanner::UpdateCEProbDistribution().
|
inlinevirtual |
Definition at line 178 of file JointPolicyPureVector.h.
|
inlinevirtual |
Returns the jaI taken by this policy for joint domain index johI.
Definition at line 172 of file JointPolicyPureVector.h.
Referenced by AgentBG::Act(), AlphaVectorBG::BeliefBackupBGIP_Solver(), AlphaVectorBG::BeliefBackupExhaustiveOnlyKeepMax(), AlphaVectorBG::BeliefBackupExhaustiveStoreAll(), GMAA_MAAstar::ConstructAndValuateNextPolicies(), and BGIP_SolverRandom::Solve().
|
inline |
Definition at line 158 of file JointPolicyPureVector.h.
References Increment().
Referenced by JESPExhaustivePlanner::ExhaustiveBestResponse().
|
inline |
Definition at line 160 of file JointPolicyPureVector.h.
Referenced by Increment(), and operator++().
|
inline |
Performs increment. See Increment().
Definition at line 156 of file JointPolicyPureVector.h.
References Increment().
|
virtual |
The copy assignment operator - makes deep copies using PolicyPureVector::operator= which makes deep copies.
Definition at line 37 of file JointPolicyPureVector.cpp.
References JointPolicyDiscretePure::operator=(), and JPolComponent_VectorImplementation::operator=().
|
virtual |
The copy assignment operator - makes deep copies using PolicyPureVector::operator= which makes deep copies.
Definition at line 49 of file JointPolicyPureVector.cpp.
|
inline |
Definition at line 146 of file JointPolicyPureVector.h.
References SoftPrintBrief().
|
inlinevirtual |
Randomly initialize the joint policy.
Definition at line 197 of file JointPolicyPureVector.h.
Referenced by JESPExhaustivePlanner::Plan(), JESPDynamicProgrammingPlanner::Plan(), RandomInitialization(), and BGIP_SolverRandom::Solve().
|
inlinevirtual |
Randomly initialize the policy for agentI.
Definition at line 200 of file JointPolicyPureVector.h.
References RandomInitialization().
|
inlinevirtual |
Definition at line 202 of file JointPolicyPureVector.h.
Referenced by JESPDynamicProgrammingPlanner::ConstructPolicyRecursively().
|
inline |
Sets the depth of the joint policy.
Also sets the depth of each of the invididual policies.
Definition at line 136 of file JointPolicyPureVector.h.
References JPolComponent_VectorImplementation::SetDepthForIndivPols().
Referenced by JPPVIndexValuePair::AllocateJPPV(), and PolicyPoolJPolValPair::Init().
|
inline |
Sets the index of this joint policy.Updates the policies represented.
Definition at line 167 of file JointPolicyPureVector.h.
Referenced by AgentBG::Act(), JPPVIndexValuePair::AllocateJPPV(), and BGIPSolution::SetPolicy().
|
virtual |
Prints a description of this JointPolicyPureVector to a string.
Definition at line 61 of file JointPolicyPureVector.cpp.
References PrintTools::SoftPrint().
Referenced by JPPVValuePair::SoftPrint().
|
virtual |
Prints a brief description to a string.
Definition at line 69 of file JointPolicyPureVector.cpp.
References JPolComponent_VectorImplementation::SoftPrintBrief().
Referenced by PrintBrief().
JointPolicyPureVector * JointPolicyPureVector::ToJointPolicyPureVector | ( | ) | const |
Convert this joint policy to a JointPolicyPureVector.
Definition at line 78 of file JointPolicyPureVector.cpp.
|
inlinevirtual |
Initialize the joint policy to the first joint policy.
This is the joint policy that specifies action 0 –the first action– for all observation histories.
Definition at line 189 of file JointPolicyPureVector.h.
Referenced by JESPExhaustivePlanner::ExhaustiveBestResponse(), and ZeroInitialization().
|
inlinevirtual |
Initialize the policy of agentI to the first policy.
This is the policy that specifies action 0 –the first action– for all observation histories.
Definition at line 194 of file JointPolicyPureVector.h.
References ZeroInitialization().
|
private |
vector for temporarily storing indiv. actions
(used by GetJointActionIndex)
Definition at line 66 of file JointPolicyPureVector.h.
|
protected |
Definition at line 69 of file JointPolicyPureVector.h.