MultiAgentDecisionProcess  Release 0.2.1
PolicyPureVector Class Reference

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

#include <PolicyPureVector.h>

+ Inheritance diagram for PolicyPureVector:
+ Collaboration diagram for PolicyPureVector:

Public Member Functions

virtual PolicyPureVectorClone () const
 Returns a pointer to a copy of this class.
Index GetActionIndex (Index oh) const
 Returns the action (index) this policy specifies for a particular domain index.
LIndex GetIndex () const
 Get the index of this policy.
bool Increment ()
 Increments the policy, used to iterate over policies.
bool operator++ ()
 Performs increment. See Increment().
virtual PolicyPureVectoroperator= (const PolicyPureVector &o)
 PolicyPureVector (const Interface_ProblemToPolicyDiscretePure &pu, Index agentI, PolicyGlobals::IndexDomainCategory idc, size_t depth=MAXHORIZON)
 Alternate constructor.
 PolicyPureVector (const PolicyPureVector &a)
 Copy constructor.
void RandomInitialization ()
 Randomly initialize the policy.
void RandomInitialization (Index agentI)
 Randomly initialize the policy for agent agentI.
void SetAction (Index ohI, Index aI)
 Sets the policy to map ohI->aI.
void SetDepth (size_t d)
 Sets the number of time steps for which this policy is valid.
void SetIndex (LIndex i)
 Sets the index of this policy. Updates the policy represented.
std::string SoftPrint () const
 Prints a description of this PolicyPureVector to a string.
void ZeroInitialization ()
 Initialize the policy to the first policy.
virtual ~PolicyPureVector ()
 Destructor.
- 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.
const
Interface_ProblemToPolicyDiscretePure
GetInterfacePTPDiscretePure () const
 Return pointer to the Interface_ProblemToPolicyDiscretePure.
 PolicyDiscretePure (const Interface_ProblemToPolicyDiscretePure &pu, PolicyGlobals::IndexDomainCategory idc, Index agentI)
 (default) Constructor
 PolicyDiscretePure (const PolicyDiscretePure &a)
 Copy constructor.
virtual ~PolicyDiscretePure ()
 Destructor.
- Public Member Functions inherited from PolicyDiscrete
IndexDomainCategory GetIndexDomainCategory () const
 Returns the Category of the domain over which the indices of this policy are specified.
const
Interface_ProblemToPolicyDiscrete
GetInterfacePTPDiscrete () const
 return a pointer to the referred Interface_ProblemToPolicyDiscrete.
 PolicyDiscrete (const Interface_ProblemToPolicyDiscrete &iptpd, PolicyGlobals::IndexDomainCategory idc, Index agentI)
 (default) Constructor
 PolicyDiscrete (const PolicyDiscrete &a)
 Copy constructor.
Index SampleAction (Index i) const
 samples an action for domain index i.
void SetIndexDomainCategory (IndexDomainCategory idc)
 Sets the category of the domain over which the indices of this policy are specified.
virtual ~PolicyDiscrete ()
 Destructor.
- Public Member Functions inherited from Policy
size_t GetDepth () const
 Returns the depth of the policy.
 Policy (Index agentI)
 Constructor, initializes the depth to the maximum horizon.
virtual void Print () const
 Prints a description of a policy to cout.
virtual ~Policy ()
 Destructor.

Protected Attributes

Index _m_agentI
 The index of the agent to which this policy belongs.
std::vector< Index > _m_domainToActionIndices
 The vector that stores the action indices for each observation history.

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

TODO: the class was not designed with partial policies in mind.

Definition at line 52 of file PolicyPureVector.h.

Constructor & Destructor Documentation

PolicyPureVector::PolicyPureVector ( const Interface_ProblemToPolicyDiscretePure pu,
Index  agentI,
PolicyGlobals::IndexDomainCategory  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.

Definition at line 38 of file PolicyPureVector.cpp.

References _m_agentI, _m_domainToActionIndices, DEBUG_PPV, PolicyDiscrete::GetIndexDomainCategory(), and PolicyDiscretePure::GetInterfacePTPDiscretePure().

Referenced by Clone().

PolicyPureVector::PolicyPureVector ( const PolicyPureVector a)

Copy constructor.

Definition at line 58 of file PolicyPureVector.cpp.

References _m_agentI, _m_domainToActionIndices, and DEBUG_PPV.

PolicyPureVector::~PolicyPureVector ( )
virtual

Destructor.

Definition at line 67 of file PolicyPureVector.cpp.

References _m_domainToActionIndices.

Member Function Documentation

virtual PolicyPureVector* PolicyPureVector::Clone ( ) const
inlinevirtual

Returns a pointer to a copy of this class.

Implements PolicyDiscretePure.

Definition at line 127 of file PolicyPureVector.h.

References PolicyPureVector().

Index PolicyPureVector::GetActionIndex ( Index  oh) const
inlinevirtual

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

Implements PolicyDiscretePure.

Definition at line 123 of file PolicyPureVector.h.

References _m_domainToActionIndices.

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

Definition at line 116 of file PolicyPureVector.cpp.

References _m_agentI, _m_domainToActionIndices, Policy::GetDepth(), PolicyDiscrete::GetIndexDomainCategory(), PolicyDiscretePure::GetInterfacePTPDiscretePure(), and Interface_ProblemToPolicyDiscrete::GetNrActions().

Referenced by operator++().

bool PolicyPureVector::operator++ ( )
inline

Performs increment. See Increment().

Definition at line 82 of file PolicyPureVector.h.

References Increment().

PolicyPureVector & PolicyPureVector::operator= ( const PolicyPureVector o)
virtual

Definition at line 72 of file PolicyPureVector.cpp.

References _m_agentI, and _m_domainToActionIndices.

void PolicyPureVector::RandomInitialization ( Index  agentI)
inlinevirtual

Randomly initialize the policy for agent agentI.

Implements PolicyDiscretePure.

Definition at line 98 of file PolicyPureVector.h.

References _m_agentI, and RandomInitialization().

void PolicyPureVector::SetAction ( Index  ohI,
Index  aI 
)
inline

Sets the policy to map ohI->aI.

Definition at line 116 of file PolicyPureVector.h.

References _m_domainToActionIndices.

Referenced by DICEPSPlanner::SampleIndividualPolicy(), and SetIndex().

void PolicyPureVector::SetDepth ( size_t  d)
virtual

Sets the number of time steps for which this policy is valid.

Reimplemented from Policy.

Definition at line 187 of file PolicyPureVector.cpp.

References _m_agentI, _m_domainToActionIndices, PolicyDiscrete::GetIndexDomainCategory(), and PolicyDiscretePure::GetInterfacePTPDiscretePure().

void PolicyPureVector::SetIndex ( LIndex  i)
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.

Definition at line 82 of file PolicyPureVector.cpp.

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.

Definition at line 58 of file PolicyPureVector.h.

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.

Definition at line 61 of file PolicyPureVector.h.

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


The documentation for this class was generated from the following files: