MultiAgentDecisionProcess
PolicyPureVector Class Reference

PolicyPureVector is a class that represents a pure (=deterministic) policy. More...

#include <PolicyPureVector.h>

Inheritance diagram for PolicyPureVector:
[legend]

Public Member Functions

virtual PolicyPureVectorClone () 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 PolicyPureVectoroperator= (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
 

Detailed Description

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).

Constructor & Destructor Documentation

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.

PolicyPureVector::~PolicyPureVector ( )
virtual

Destructor.

References _m_domainToActionIndices.

Member Function Documentation

virtual PolicyPureVector* PolicyPureVector::Clone ( ) const
inlinevirtual

Returns a pointer to a copy of this class.

Implements PolicyDiscretePure.

References PolicyPureVector().

Index PolicyPureVector::GetActionIndex ( Index  oh) const
inlinevirtual

Returns the action (index) this policy specifies for a particular domain index.

Implements PolicyDiscretePure.

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++().

bool PolicyPureVector::operator++ ( )
inline

Performs increment. See Increment().

References Increment().

PolicyPureVector & PolicyPureVector::operator= ( const PolicyPureVector o)
virtual
void PolicyPureVector::RandomInitialization ( Index  agentI)
inlinevirtual

Randomly initialize the policy for agent agentI.

Implements PolicyDiscretePure.

References RandomInitialization().

void PolicyPureVector::SetAction ( Index  ohI,
Index  aI 
)
inline
void PolicyPureVector::SetDepth ( size_t  d)
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::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().

Member Data Documentation

Index PolicyPureVector::_m_agentI
protected

The index of the agent to which this policy belongs.

Referenced by GetIndex(), Increment(), operator=(), PolicyPureVector(), RandomInitialization(), SetDepth(), SetIndex(), SoftPrint(), and ZeroInitialization().

std::vector<Index> PolicyPureVector::_m_domainToActionIndices
protected

The vector that stores the action indices for each observation history.

Referenced by GetIndex(), Increment(), operator=(), PolicyPureVector(), RandomInitialization(), SetDepth(), SoftPrint(), ZeroInitialization(), and ~PolicyPureVector().