MultiAgentDecisionProcess
|
PolicyPureVector is a class that represents a pure (=deterministic) policy. More...
#include <PolicyPureVector.h>
Public Member Functions | |
virtual PolicyPureVector * | Clone () const |
Returns a pointer to a copy of this class. More... | |
Index | GetActionIndex (Index oh) const |
Returns the action (index) this policy specifies for a particular domain index. More... | |
LIndex | GetIndex () const |
Get the index of this policy. More... | |
bool | Increment () |
Increments the policy, used to iterate over policies. More... | |
bool | operator++ () |
Performs increment. See Increment(). More... | |
virtual PolicyPureVector & | operator= (const PolicyPureVector &o) |
PolicyPureVector (const Interface_ProblemToPolicyDiscretePure *pu, Index agentI, PolicyGlobals::PolicyDomainCategory idc, size_t depth=MAXHORIZON) | |
Alternate constructor. More... | |
PolicyPureVector (const I_PtPD_constPtr &pu, Index agentI, PolicyGlobals::PolicyDomainCategory idc, size_t depth=MAXHORIZON) | |
PolicyPureVector (const PolicyPureVector &a) | |
Copy constructor. More... | |
void | RandomInitialization () |
Randomly initialize the policy. More... | |
void | RandomInitialization (Index agentI) |
Randomly initialize the policy for agent agentI. More... | |
void | SetAction (Index ohI, Index aI) |
Sets the policy to map ohI->aI. More... | |
void | SetDepth (size_t d) |
Sets the number of time steps for which this policy is valid. More... | |
void | SetIndex (LIndex i) |
Sets the index of this policy. Updates the policy represented. More... | |
std::string | SoftPrint () const |
Prints a description of this PolicyPureVector to a string. More... | |
void | ZeroInitialization () |
Initialize the policy to the first policy. More... | |
virtual | ~PolicyPureVector () |
Destructor. More... | |
Public Member Functions inherited from PolicyDiscretePure | |
double | GetActionProb (Index i, Index aI) const |
Returns the probability that the policy specifies action aI for domain index i. More... | |
const Interface_ProblemToPolicyDiscretePure * | GetInterfacePTPDiscretePure () const |
Return pointer to the Interface_ProblemToPolicyDiscretePure. More... | |
PolicyDiscretePure (const Interface_ProblemToPolicyDiscretePure *pu, PolicyGlobals::PolicyDomainCategory idc, Index agentI) | |
(default) Constructor More... | |
PolicyDiscretePure (const I_PtPD_constPtr &pu, PolicyGlobals::PolicyDomainCategory idc, Index agentI) | |
PolicyDiscretePure (const PolicyDiscretePure &a) | |
Copy constructor. More... | |
virtual | ~PolicyDiscretePure () |
Destructor. More... | |
Public Member Functions inherited from PolicyDiscrete | |
const Interface_ProblemToPolicyDiscrete * | GetInterfacePTPDiscrete () const |
return a pointer to the referred Interface_ProblemToPolicyDiscrete. More... | |
PolicyDomainCategory | GetPolicyDomainCategory () const |
Returns the Category of the domain over which the indices of this policy are specified. More... | |
PolicyDiscrete (const Interface_ProblemToPolicyDiscrete *iptpd, PolicyGlobals::PolicyDomainCategory idc, Index agentI) | |
(default) Constructor More... | |
PolicyDiscrete (const I_PtPD_constPtr &iptpd, PolicyGlobals::PolicyDomainCategory idc, Index agentI) | |
PolicyDiscrete (const PolicyDiscrete &a) | |
Copy constructor. More... | |
Index | SampleAction (Index i) const |
samples an action for domain index i. More... | |
void | SetPolicyDomainCategory (PolicyDomainCategory idc) |
Sets the category of the domain over which the indices of this policy are specified. More... | |
virtual | ~PolicyDiscrete () |
Destructor. More... | |
Public Member Functions inherited from Policy | |
size_t | GetDepth () const |
Returns the depth of the policy. More... | |
Policy (Index agentI) | |
Constructor, initializes the depth to the maximum horizon. More... | |
virtual void | Print () const |
Prints a description of a policy to cout. More... | |
virtual | ~Policy () |
Destructor. More... | |
Protected Attributes | |
Index | _m_agentI |
The index of the agent to which this policy belongs. More... | |
std::vector< Index > | _m_domainToActionIndices |
The vector that stores the action indices for each observation history. More... | |
Protected Attributes inherited from Policy | |
Index | _m_agentI |
PolicyPureVector is a class that represents a pure (=deterministic) policy.
The implementation of this particular class is based on a vector of length nrObservation-histories, that specifies an action index for each observation history index. Also a policy PolicyPureVector is a #Referrer to an object that implements the functions defined by the Interface_ProblemToPolicyDiscretePure (for example a planning unit or Bayesian game).
PolicyPureVector::PolicyPureVector | ( | const Interface_ProblemToPolicyDiscretePure * | pu, |
Index | agentI, | ||
PolicyGlobals::PolicyDomainCategory | idc, | ||
size_t | depth = MAXHORIZON |
||
) |
Alternate constructor.
Associates a problem and agent with the policy . Information regarding the problem is used to construct a policy of the proper shape.
References _m_agentI, _m_domainToActionIndices, DEBUG_PPV, PolicyDiscretePure::GetInterfacePTPDiscretePure(), and PolicyDiscrete::GetPolicyDomainCategory().
Referenced by Clone().
PolicyPureVector::PolicyPureVector | ( | const I_PtPD_constPtr & | pu, |
Index | agentI, | ||
PolicyGlobals::PolicyDomainCategory | idc, | ||
size_t | depth = MAXHORIZON |
||
) |
PolicyPureVector::PolicyPureVector | ( | const PolicyPureVector & | a | ) |
Copy constructor.
References _m_agentI, _m_domainToActionIndices, and DEBUG_PPV.
|
virtual |
Destructor.
References _m_domainToActionIndices.
|
inlinevirtual |
Returns a pointer to a copy of this class.
Implements PolicyDiscretePure.
References PolicyPureVector().
Returns the action (index) this policy specifies for a particular domain index.
Implements PolicyDiscretePure.
LIndex PolicyPureVector::GetIndex | ( | ) | const |
Get the index of this policy.
References _m_agentI, _m_domainToActionIndices, Policy::GetDepth(), PolicyDiscretePure::GetInterfacePTPDiscretePure(), Interface_ProblemToPolicyDiscrete::GetNrActions(), PolicyDiscrete::GetPolicyDomainCategory(), and IndexTools::IndividualToJointIndices().
bool PolicyPureVector::Increment | ( | ) |
Increments the policy, used to iterate over policies.
Policies are enumerable. This function changes a policy to the one with the next IndexValue. Returns true when increment changes to policy number from nrPolicies-1 to 0 (carry over signal).
References _m_agentI, _m_domainToActionIndices, Policy::GetDepth(), PolicyDiscretePure::GetInterfacePTPDiscretePure(), Interface_ProblemToPolicyDiscrete::GetNrActions(), and PolicyDiscrete::GetPolicyDomainCategory().
Referenced by JPolComponent_VectorImplementation::Increment(), and operator++().
|
inline |
Performs increment. See Increment().
References Increment().
|
virtual |
References _m_agentI, and _m_domainToActionIndices.
void PolicyPureVector::RandomInitialization | ( | ) |
Randomly initialize the policy.
References _m_agentI, _m_domainToActionIndices, DEBUG_PPV, PolicyDiscretePure::GetInterfacePTPDiscretePure(), and Interface_ProblemToPolicyDiscrete::GetNrActions().
Referenced by RandomInitialization(), and JPolComponent_VectorImplementation::RandomInitialization().
|
inlinevirtual |
Randomly initialize the policy for agent agentI.
Implements PolicyDiscretePure.
References RandomInitialization().
Sets the policy to map ohI->aI.
Referenced by BGIP_SolverCE::SampleIndividualPolicy(), DICEPSPlanner::SampleIndividualPolicy(), and SetIndex().
|
virtual |
Sets the number of time steps for which this policy is valid.
Reimplemented from Policy.
References _m_agentI, _m_domainToActionIndices, PolicyDiscretePure::GetInterfacePTPDiscretePure(), PolicyDiscrete::GetPolicyDomainCategory(), and Policy::SetDepth().
void PolicyPureVector::SetIndex | ( | LIndex | i | ) |
Sets the index of this policy. Updates the policy represented.
References _m_agentI, Globals::CastLIndexToIndex(), Policy::GetDepth(), PolicyDiscretePure::GetInterfacePTPDiscretePure(), Interface_ProblemToPolicyDiscrete::GetNrActions(), PolicyDiscrete::GetPolicyDomainCategory(), IndexTools::JointToIndividualIndices(), and SetAction().
Referenced by BGCG_SolverNonserialDynamicProgramming::GetJpolIndexForBestResponses(), and LocalBGValueFunctionBGCGWrapper::GetValue().
|
virtual |
Prints a description of this PolicyPureVector to a string.
Implements Policy.
References _m_agentI, _m_domainToActionIndices, PolicyDiscretePure::GetInterfacePTPDiscretePure(), PolicyDiscrete::GetPolicyDomainCategory(), Interface_ProblemToPolicyDiscrete::SoftPrintAction(), and Interface_ProblemToPolicyDiscrete::SoftPrintPolicyDomainElement().
Referenced by BGCG_SolverNonserialDynamicProgramming::GetJpolIndexForBestResponses().
void PolicyPureVector::ZeroInitialization | ( | ) |
Initialize the policy to the first policy.
This is the policy that specifies action 0 –the first action– for all observation histories.
References _m_agentI, _m_domainToActionIndices, and DEBUG_PPV.
Referenced by JPolComponent_VectorImplementation::ZeroInitialization().
|
protected |
The index of the agent to which this policy belongs.
Referenced by GetIndex(), Increment(), operator=(), PolicyPureVector(), RandomInitialization(), SetDepth(), SetIndex(), SoftPrint(), and ZeroInitialization().
|
protected |
The vector that stores the action indices for each observation history.
Referenced by GetIndex(), Increment(), operator=(), PolicyPureVector(), RandomInitialization(), SetDepth(), SoftPrint(), ZeroInitialization(), and ~PolicyPureVector().