MultiAgentDecisionProcess
Release 0.2.1
|
JPolComponent_VectorImplementation implements functionality common to several joint policy implementations. More...
#include <JPolComponent_VectorImplementation.h>
Public Member Functions | |
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. |
Protected Attributes | |
std::vector< PolicyPureVector * > | _m_indivPols_PolicyPureVector |
Private Member Functions | |
void | ClearIndividualPolicies () |
Private function that deletes all the individual policies pointed to. | |
void | Construct (const Interface_ProblemToPolicyDiscretePure &pu, PolicyGlobals::IndexDomainCategory idc, size_t depth) |
void | PrivClone (const JPolComponent_VectorImplementation &o) |
Aux. function used by copy constructors. |
Private Attributes | |
IndexDomainCategory | _m_idc |
Index * | _m_indivActionIndices |
vector for temporarily storing indiv. actions | |
const Interface_ProblemToPolicyDiscretePure * | _m_PTPDP |
JPolComponent_VectorImplementation implements functionality common to several joint policy implementations.
Definition at line 40 of file JPolComponent_VectorImplementation.h.
JPolComponent_VectorImplementation::JPolComponent_VectorImplementation | ( | const Interface_ProblemToPolicyDiscretePure & | pu, |
size_t | depth = MAXHORIZON |
||
) |
(default) Constructor
Definition at line 51 of file JPolComponent_VectorImplementation.cpp.
References Construct(), and Interface_ProblemToPolicyDiscrete::GetDefaultIndexDomCat().
JPolComponent_VectorImplementation::JPolComponent_VectorImplementation | ( | const Interface_ProblemToPolicyDiscretePure & | pu, |
PolicyGlobals::IndexDomainCategory | idc, | ||
size_t | depth = MAXHORIZON |
||
) |
Definition at line 61 of file JPolComponent_VectorImplementation.cpp.
References Construct().
JPolComponent_VectorImplementation::JPolComponent_VectorImplementation | ( | const JPolComponent_VectorImplementation & | a | ) |
Copy constructor.
Definition at line 74 of file JPolComponent_VectorImplementation.cpp.
References PrivClone().
JPolComponent_VectorImplementation::~JPolComponent_VectorImplementation | ( | ) |
Destructor.
Definition at line 109 of file JPolComponent_VectorImplementation.cpp.
References _m_indivActionIndices, and ClearIndividualPolicies().
|
private |
Private function that deletes all the individual policies pointed to.
Definition at line 117 of file JPolComponent_VectorImplementation.cpp.
References _m_indivPols_PolicyPureVector.
Referenced by operator=(), and ~JPolComponent_VectorImplementation().
|
private |
Definition at line 33 of file JPolComponent_VectorImplementation.cpp.
References Interface_ProblemToPolicyDiscrete::GetNrAgents().
Referenced by JPolComponent_VectorImplementation().
|
inline |
Returns the action index for domainI for agent aI.
Definition at line 141 of file JPolComponent_VectorImplementation.h.
References _m_indivPols_PolicyPureVector.
Referenced by GetJointActionIndex().
LIndex JPolComponent_VectorImplementation::GetIndex | ( | ) | const |
Get the index of this joint policy.
Definition at line 232 of file JPolComponent_VectorImplementation.cpp.
References _m_idc, _m_indivPols_PolicyPureVector, _m_PTPDP, Interface_ProblemToPolicyDiscrete::GetNrAgents(), Interface_ProblemToPolicyDiscretePure::GetNrPolicies(), IndexTools::IndividualToJointIndices(), and PrintTools::SoftPrintVector().
Referenced by SoftPrint(), and 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 97 of file JPolComponent_VectorImplementation.h.
References _m_indivPols_PolicyPureVector.
|
inlinevirtual |
Definition at line 100 of file JPolComponent_VectorImplementation.h.
References _m_indivPols_PolicyPureVector.
Index JPolComponent_VectorImplementation::GetJointActionIndex | ( | Index | i | ) | const |
Returns the jaI taken by this policy for joint domain index johI.
Definition at line 313 of file JPolComponent_VectorImplementation.cpp.
References _m_idc, _m_indivActionIndices, _m_indivPols_PolicyPureVector, _m_PTPDP, Interface_ProblemToPolicyDiscrete::AreCachedJointToIndivIndices(), GetActionIndex(), Interface_ProblemToPolicyDiscrete::GetNrAgents(), and Interface_ProblemToPolicyDiscrete::IndividualToJointActionIndices().
|
inline |
Increments the individual policy of agentI.
Definition at line 122 of file JPolComponent_VectorImplementation.h.
References _m_indivPols_PolicyPureVector.
bool JPolComponent_VectorImplementation::Increment | ( | ) |
Increments the joint policy, used to iterate over joint policies.
Definition at line 213 of file JPolComponent_VectorImplementation.cpp.
References _m_indivPols_PolicyPureVector, _m_PTPDP, and Interface_ProblemToPolicyDiscrete::GetNrAgents().
Referenced by operator++().
|
inline |
Performs increment. See Increment().
Definition at line 88 of file JPolComponent_VectorImplementation.h.
References Increment().
JPolComponent_VectorImplementation & JPolComponent_VectorImplementation::operator= | ( | const JPolComponent_VectorImplementation & | o | ) |
Copy assignment operator.
Definition at line 140 of file JPolComponent_VectorImplementation.cpp.
References _m_indivPols_PolicyPureVector, and ClearIndividualPolicies().
Referenced by JointPolicyPureVector::operator=().
|
private |
Aux. function used by copy constructors.
Definition at line 82 of file JPolComponent_VectorImplementation.cpp.
References _m_idc, _m_indivActionIndices, _m_indivPols_PolicyPureVector, _m_PTPDP, and Interface_ProblemToPolicyDiscrete::GetNrAgents().
Referenced by JPolComponent_VectorImplementation().
void JPolComponent_VectorImplementation::RandomInitialization | ( | ) |
Randomly initialize the joint policy.
Definition at line 175 of file JPolComponent_VectorImplementation.cpp.
References _m_indivPols_PolicyPureVector.
void JPolComponent_VectorImplementation::RandomInitialization | ( | Index | agentI | ) |
Randomly initialize the policy for agentI.
Definition at line 182 of file JPolComponent_VectorImplementation.cpp.
References _m_indivPols_PolicyPureVector, and PolicyPureVector::RandomInitialization().
|
inline |
Sets the policy for agentI to domainI->aI.
Definition at line 130 of file JPolComponent_VectorImplementation.h.
References _m_indivPols_PolicyPureVector.
void JPolComponent_VectorImplementation::SetDepthForIndivPols | ( | size_t | d | ) |
Definition at line 380 of file JPolComponent_VectorImplementation.cpp.
References _m_indivPols_PolicyPureVector.
Referenced by PartialJointPolicyPureVector::SetDepth(), and JointPolicyPureVector::SetDepth().
void JPolComponent_VectorImplementation::SetIndex | ( | LIndex | i | ) |
Sets the index of this joint policy.Updates the policies represented.
Definition at line 274 of file JPolComponent_VectorImplementation.cpp.
References _m_idc, _m_indivPols_PolicyPureVector, _m_PTPDP, Interface_ProblemToPolicyDiscrete::GetNrAgents(), Interface_ProblemToPolicyDiscretePure::GetNrPolicies(), IndexTools::JointToIndividualIndices(), and PrintTools::SoftPrintVector().
string JPolComponent_VectorImplementation::SoftPrint | ( | void | ) | const |
Prints a description of this to a string.
Definition at line 394 of file JPolComponent_VectorImplementation.cpp.
References _m_indivPols_PolicyPureVector, _m_PTPDP, GetIndex(), and Interface_ProblemToPolicyDiscrete::GetNrAgents().
string JPolComponent_VectorImplementation::SoftPrintBrief | ( | void | ) | const |
Definition at line 417 of file JPolComponent_VectorImplementation.cpp.
References _m_PTPDP, and GetIndex().
Referenced by JointPolicyPureVector::SoftPrintBrief().
void JPolComponent_VectorImplementation::ZeroInitialization | ( | ) |
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 193 of file JPolComponent_VectorImplementation.cpp.
References _m_indivPols_PolicyPureVector.
void JPolComponent_VectorImplementation::ZeroInitialization | ( | Index | agentI | ) |
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 200 of file JPolComponent_VectorImplementation.cpp.
References _m_indivPols_PolicyPureVector, and PolicyPureVector::ZeroInitialization().
|
private |
Definition at line 55 of file JPolComponent_VectorImplementation.h.
Referenced by GetIndex(), GetJointActionIndex(), PrivClone(), and SetIndex().
|
private |
vector for temporarily storing indiv. actions
(used by GetJointActionIndex)
Definition at line 49 of file JPolComponent_VectorImplementation.h.
Referenced by GetJointActionIndex(), PrivClone(), and ~JPolComponent_VectorImplementation().
|
protected |
Definition at line 63 of file JPolComponent_VectorImplementation.h.
Referenced by ClearIndividualPolicies(), GetActionIndex(), GetIndex(), GetIndividualPolicies(), GetIndividualPolicyDiscrete(), GetJointActionIndex(), Increment(), operator=(), PrivClone(), RandomInitialization(), SetAction(), SetDepthForIndivPols(), SetIndex(), SoftPrint(), and ZeroInitialization().
|
private |
Definition at line 54 of file JPolComponent_VectorImplementation.h.
Referenced by GetIndex(), GetJointActionIndex(), Increment(), PrivClone(), SetIndex(), SoftPrint(), and SoftPrintBrief().