MultiAgentDecisionProcess
|
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. More... | |
LIndex | GetIndex () const |
Get the index of this joint policy. More... | |
std::vector< PolicyPureVector * > & | GetIndividualPolicies () |
Returns a reference to the vector of pointers to individual policies. More... | |
virtual PolicyDiscrete * | GetIndividualPolicyDiscrete (Index agI) const |
Index | GetJointActionIndex (Index i) const |
Returns the jaI taken by this policy for joint domain index johI. More... | |
Index | GetJointActionIndex (LIndex i) const |
Returns the jaI taken by this policy for joint domain index johI. More... | |
bool | Increment (Index agentI) |
Increments the individual policy of agentI. More... | |
bool | Increment () |
Increments the joint policy, used to iterate over joint policies. More... | |
JPolComponent_VectorImplementation (const Interface_ProblemToPolicyDiscretePure *pu, size_t depth=MAXHORIZON) | |
(default) Constructor More... | |
JPolComponent_VectorImplementation (const Interface_ProblemToPolicyDiscretePure *pu, PolicyGlobals::PolicyDomainCategory idc, size_t depth=MAXHORIZON) | |
JPolComponent_VectorImplementation (const I_PtPDpure_constPtr &pu, size_t depth=MAXHORIZON) | |
JPolComponent_VectorImplementation (const I_PtPDpure_constPtr &pu, PolicyGlobals::PolicyDomainCategory idc, size_t depth=MAXHORIZON) | |
JPolComponent_VectorImplementation (const JPolComponent_VectorImplementation &a) | |
Copy constructor. More... | |
bool | operator++ () |
Performs increment. See Increment(). More... | |
JPolComponent_VectorImplementation & | operator= (const JPolComponent_VectorImplementation &o) |
Copy assignment operator. More... | |
void | RandomInitialization () |
Randomly initialize the joint policy. More... | |
void | RandomInitialization (Index agentI) |
Randomly initialize the policy for agentI. More... | |
void | SetAction (Index agentI, Index domainI, Index aI) |
Sets the policy for agentI to domainI->aI. More... | |
void | SetDepthForIndivPols (size_t d) |
void | SetIndex (LIndex i) |
Sets the index of this joint policy.Updates the policies represented. More... | |
std::string | SoftPrint () const |
Prints a description of this to a string. More... | |
std::string | SoftPrintBrief () const |
void | ZeroInitialization () |
Initialize the joint policy to the first joint policy. More... | |
void | ZeroInitialization (Index agentI) |
Initialize the policy of agentI to the first policy. More... | |
~JPolComponent_VectorImplementation () | |
Destructor. More... | |
Protected Attributes | |
std::vector< PolicyPureVector * > | _m_indivPols_PolicyPureVector |
Private Member Functions | |
void | ClearIndividualPolicies () |
Private function that deletes all the individual policies pointed to. More... | |
void | Construct (const Interface_ProblemToPolicyDiscretePure *pu, PolicyGlobals::PolicyDomainCategory idc, size_t depth) |
void | Construct (const I_PtPDpure_constPtr &pu, PolicyGlobals::PolicyDomainCategory idc, size_t depth) |
const Interface_ProblemToPolicyDiscretePure * | GetInterfacePTPDiscretePure () const |
void | PrivClone (const JPolComponent_VectorImplementation &o) |
Aux. function used by copy constructors. More... | |
Private Attributes | |
PolicyDomainCategory | _m_idc |
Index * | _m_indivActionIndices |
vector for temporarily storing indiv. actions More... | |
const Interface_ProblemToPolicyDiscretePure * | _m_PTPDP |
I_PtPDpure_constPtr | _m_PTPDPshared |
JPolComponent_VectorImplementation implements functionality common to several joint policy implementations.
JPolComponent_VectorImplementation::JPolComponent_VectorImplementation | ( | const Interface_ProblemToPolicyDiscretePure * | pu, |
size_t | depth = MAXHORIZON |
||
) |
(default) Constructor
References Construct(), and Interface_ProblemToPolicyDiscrete::GetDefaultIndexDomCat().
JPolComponent_VectorImplementation::JPolComponent_VectorImplementation | ( | const Interface_ProblemToPolicyDiscretePure * | pu, |
PolicyGlobals::PolicyDomainCategory | idc, | ||
size_t | depth = MAXHORIZON |
||
) |
References Construct().
JPolComponent_VectorImplementation::JPolComponent_VectorImplementation | ( | const I_PtPDpure_constPtr & | pu, |
size_t | depth = MAXHORIZON |
||
) |
References Construct().
JPolComponent_VectorImplementation::JPolComponent_VectorImplementation | ( | const I_PtPDpure_constPtr & | pu, |
PolicyGlobals::PolicyDomainCategory | idc, | ||
size_t | depth = MAXHORIZON |
||
) |
References Construct().
JPolComponent_VectorImplementation::JPolComponent_VectorImplementation | ( | const JPolComponent_VectorImplementation & | a | ) |
Copy constructor.
References PrivClone().
JPolComponent_VectorImplementation::~JPolComponent_VectorImplementation | ( | ) |
Destructor.
References _m_indivActionIndices, and ClearIndividualPolicies().
|
private |
Private function that deletes all the individual policies pointed to.
References _m_indivPols_PolicyPureVector.
Referenced by operator=(), and ~JPolComponent_VectorImplementation().
|
private |
References Interface_ProblemToPolicyDiscrete::GetNrAgents(), and Globals::MAXHORIZON.
Referenced by JPolComponent_VectorImplementation().
|
private |
References Globals::MAXHORIZON.
Returns the action index for domainI for agent aI.
Referenced by PartialJointPolicyPureVector::GetActionIndex(), JointPolicyPureVector::GetActionIndex(), and GetJointActionIndex().
LIndex JPolComponent_VectorImplementation::GetIndex | ( | ) | const |
Get the index of this joint policy.
References _m_idc, _m_indivPols_PolicyPureVector, GetInterfacePTPDiscretePure(), Interface_ProblemToPolicyDiscrete::GetNrAgents(), Interface_ProblemToPolicyDiscretePure::GetNrPolicies(), IndexTools::IndividualToJointIndices(), and PrintTools::SoftPrintVector().
Referenced by PartialJointPolicyPureVector::GetIndex(), JointPolicyPureVector::GetIndex(), SoftPrint(), and SoftPrintBrief().
|
inline |
Returns a reference to the vector of pointers to individual policies.
This function should be used to manipulate individual policies.
References _m_indivPols_PolicyPureVector.
Referenced by PartialJointPolicyPureVector::GetIndividualPolicies(), and JointPolicyPureVector::GetIndividualPolicies().
|
inlinevirtual |
Reimplemented in JointPolicyPureVector, and PartialJointPolicyPureVector.
Referenced by PartialJointPolicyPureVector::GetIndividualPolicyDiscrete(), and JointPolicyPureVector::GetIndividualPolicyDiscrete().
|
inlineprivate |
Referenced by GetIndex(), GetJointActionIndex(), Increment(), PrivClone(), SetIndex(), and SoftPrint().
Returns the jaI taken by this policy for joint domain index johI.
References _m_idc, _m_indivActionIndices, _m_indivPols_PolicyPureVector, GetActionIndex(), GetInterfacePTPDiscretePure(), Interface_ProblemToPolicyDiscrete::GetNrAgents(), and Interface_ProblemToPolicyDiscrete::IndividualToJointActionIndices().
Referenced by PartialJointPolicyPureVector::GetJointActionIndex(), GetJointActionIndex(), and JointPolicyPureVector::GetJointActionIndex().
Returns the jaI taken by this policy for joint domain index johI.
References Globals::CastLIndexToIndex(), and GetJointActionIndex().
|
inline |
Increments the individual policy of agentI.
bool JPolComponent_VectorImplementation::Increment | ( | ) |
Increments the joint policy, used to iterate over joint policies.
References _m_indivPols_PolicyPureVector, GetInterfacePTPDiscretePure(), Interface_ProblemToPolicyDiscrete::GetNrAgents(), and PolicyPureVector::Increment().
Referenced by PartialJointPolicyPureVector::Increment(), JointPolicyPureVector::Increment(), and operator++().
|
inline |
Performs increment. See Increment().
References Increment().
JPolComponent_VectorImplementation & JPolComponent_VectorImplementation::operator= | ( | const JPolComponent_VectorImplementation & | o | ) |
Copy assignment operator.
References _m_indivPols_PolicyPureVector, and ClearIndividualPolicies().
Referenced by PartialJointPolicyPureVector::operator=(), and JointPolicyPureVector::operator=().
|
private |
Aux. function used by copy constructors.
References _m_idc, _m_indivActionIndices, _m_indivPols_PolicyPureVector, _m_PTPDP, _m_PTPDPshared, GetInterfacePTPDiscretePure(), and Interface_ProblemToPolicyDiscrete::GetNrAgents().
Referenced by JPolComponent_VectorImplementation().
void JPolComponent_VectorImplementation::RandomInitialization | ( | ) |
Randomly initialize the joint policy.
References _m_indivPols_PolicyPureVector.
Referenced by PartialJointPolicyPureVector::RandomInitialization(), and JointPolicyPureVector::RandomInitialization().
void JPolComponent_VectorImplementation::RandomInitialization | ( | Index | agentI | ) |
Randomly initialize the policy for agentI.
References _m_indivPols_PolicyPureVector, and PolicyPureVector::RandomInitialization().
Sets the policy for agentI to domainI->aI.
Referenced by PartialJointPolicyPureVector::SetAction(), and JointPolicyPureVector::SetAction().
void JPolComponent_VectorImplementation::SetDepthForIndivPols | ( | size_t | d | ) |
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.
References _m_idc, _m_indivPols_PolicyPureVector, GetInterfacePTPDiscretePure(), Interface_ProblemToPolicyDiscrete::GetNrAgents(), Interface_ProblemToPolicyDiscretePure::GetNrPolicies(), IndexTools::JointToIndividualIndices(), and PrintTools::SoftPrintVector().
Referenced by PartialJointPolicyPureVector::SetIndex(), and JointPolicyPureVector::SetIndex().
string JPolComponent_VectorImplementation::SoftPrint | ( | void | ) | const |
Prints a description of this to a string.
References _m_indivPols_PolicyPureVector, GetIndex(), GetInterfacePTPDiscretePure(), and Interface_ProblemToPolicyDiscrete::GetNrAgents().
Referenced by PartialJointPolicyPureVector::SoftPrint(), and JointPolicyPureVector::SoftPrint().
string JPolComponent_VectorImplementation::SoftPrintBrief | ( | void | ) | const |
References GetIndex().
Referenced by PartialJointPolicyPureVector::SoftPrintBrief(), and 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.
References _m_indivPols_PolicyPureVector.
Referenced by PartialJointPolicyPureVector::ZeroInitialization(), and JointPolicyPureVector::ZeroInitialization().
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.
References _m_indivPols_PolicyPureVector, and PolicyPureVector::ZeroInitialization().
|
private |
Referenced by GetIndex(), GetJointActionIndex(), PrivClone(), and SetIndex().
|
private |
vector for temporarily storing indiv. actions
(used by GetJointActionIndex)
Referenced by GetJointActionIndex(), PrivClone(), and ~JPolComponent_VectorImplementation().
|
protected |
|
private |
Referenced by PrivClone().
|
private |
Referenced by PrivClone().