MultiAgentDecisionProcess
JointPolicyPureVector Class Reference

JointPolicyPureVector represents a discrete pure joint policy. More...

#include <JointPolicyPureVector.h>

Inheritance diagram for JointPolicyPureVector:
[legend]

Public Member Functions

virtual JointPolicyPureVectorClone () const
 Returns a pointer to a copy of this class. More...
 
Index GetActionIndex (Index agI, 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...
 
PolicyDiscreteGetIndividualPolicyDiscrete (Index i) 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)
 
bool Increment ()
 
 JointPolicyPureVector (const Interface_ProblemToPolicyDiscretePure *pu)
 Constructor. More...
 
 JointPolicyPureVector (const Interface_ProblemToPolicyDiscretePure *pu, PolicyGlobals::PolicyDomainCategory idc)
 Constructor. More...
 
 JointPolicyPureVector (I_PtPDpure_constPtr pu)
 Constructor. More...
 
 JointPolicyPureVector (I_PtPDpure_constPtr pu, PolicyGlobals::PolicyDomainCategory idc)
 Constructor. More...
 
 JointPolicyPureVector (const JointPolicyPureVector &a)
 Copy constructor. More...
 
 JointPolicyPureVector (const JointPolicyDiscretePure &a1, const JPolComponent_VectorImplementation &a2)
 Copy constructor from base class a. More...
 
bool operator++ ()
 Performs increment. See Increment(). More...
 
bool operator< (const JointPolicy &o) const
 less-than operator. More...
 
bool operator< (const JointPolicyPureVector &o) const
 
JointPolicyPureVectoroperator= (const JointPolicyPureVector &jp)
 The copy assignment operator - makes deep copies using PolicyPureVector::operator= which makes deep copies. More...
 
JointPolicyPureVectoroperator= (const JointPolicyDiscretePure &jp)
 The copy assignment operator - makes deep copies using PolicyPureVector::operator= which makes deep copies. More...
 
void PrintBrief () const
 
void RandomInitialization ()
 Randomly initialize the joint policy. More...
 
void RandomInitialization (Index i)
 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 SetDepth (size_t d)
 Sets the depth of the joint policy. More...
 
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 JointPolicyPureVector to a string. More...
 
std::string SoftPrintBrief () const
 Prints a brief description to a string. More...
 
JPPV_sharedPtr ToJointPolicyPureVector () const
 Convert this joint policy to a JointPolicyPureVector. More...
 
void ZeroInitialization ()
 Initialize the joint policy to the first joint policy. More...
 
void ZeroInitialization (Index i)
 Initialize the policy of agentI to the first policy. More...
 
virtual ~JointPolicyPureVector ()
 Destructor. More...
 
- Public Member Functions inherited from JointPolicyDiscretePure
double GetActionProb (Index agentI, Index domI, Index aI) const
 Returns the probability that the policy specifies action aI for domain index domI for agentI. More...
 
const
Interface_ProblemToPolicyDiscretePure
GetInterfacePTPDiscretePure () const
 Return pointer to the Interface_ProblemToPolicyDiscretePure. More...
 
boost::shared_ptr< const
Interface_ProblemToPolicyDiscretePure
GetInterfacePTPDiscretePureShared () const
 
double GetJointActionProb (Index i, Index ja) const
 Returns the probability that the policy specifies joint action a for domain index i. More...
 
double GetJointActionProb (LIndex i, Index ja) const
 Returns the probability that the policy specifies joint action a for domain index i. More...
 
 JointPolicyDiscretePure ()
 default Constructor - constructs empty policy More...
 
 JointPolicyDiscretePure (const Interface_ProblemToPolicyDiscretePure *pu, PolicyGlobals::PolicyDomainCategory idc)
 (default) Constructor More...
 
 JointPolicyDiscretePure (const I_PtPDpure_constPtr &pu, PolicyGlobals::PolicyDomainCategory idc)
 
 JointPolicyDiscretePure (const JointPolicyDiscretePure &a)
 Copy constructor. More...
 
void SetInterfacePTPDiscretePure (Interface_ProblemToPolicyDiscretePure *pu)
 Sets the planning unit for this joint policy. More...
 
virtual ~JointPolicyDiscretePure ()
 Destructor. More...
 
- Public Member Functions inherited from JointPolicyDiscrete
const
Interface_ProblemToPolicyDiscrete
GetInterfacePTPDiscrete () const
 return a pointer to the referred Interface_ProblemToPolicyDiscrete. More...
 
boost::shared_ptr< const
Interface_ProblemToPolicyDiscrete
GetInterfacePTPDiscreteShared () const
 return a shared pointer to the referred Interface_ProblemToPolicyDiscrete. More...
 
size_t GetNrDomainElements (Index agentI) const
 Returns the number of policy domain elements for agent agentI. More...
 
PolicyDomainCategory GetPolicyDomainCategory () const
 returns the Category of the domain over which the indices of this policy are specified. More...
 
 JointPolicyDiscrete ()
 default constructor creates an empty policy More...
 
 JointPolicyDiscrete (const Interface_ProblemToPolicyDiscrete *pu, PolicyGlobals::PolicyDomainCategory idc)
 (default) Constructor More...
 
 JointPolicyDiscrete (const I_PtPD_constPtr &pu, PolicyGlobals::PolicyDomainCategory idc)
 
 JointPolicyDiscrete (const JointPolicyDiscrete &a)
 Copy constructor. More...
 
virtual JointPolicyDiscreteoperator= (const JointPolicyDiscrete &o)
 Assignment operator. More...
 
Index SampleJointAction (Index i) const
 Returns a sampled joint action. More...
 
Index SampleJointAction (const std::vector< Index > &Is) const
 Returns a sampled joint action. More...
 
void SampleJointActionVector (Index i, std::vector< Index > &jaVec) const
 Returns a sampled joint action. More...
 
void SampleJointActionVector (const std::vector< Index > &Is, std::vector< Index > &jaVec) const
 Returns a sampled joint action. More...
 
void SetInterfacePTPDiscrete (const Interface_ProblemToPolicyDiscrete *p)
 sets the pointer to the Interface_ProblemToPolicyDiscrete. More...
 
void SetInterfacePTPDiscrete (I_PtPD_constPtr p)
 sets the shared pointer to the Interface_ProblemToPolicyDiscrete. More...
 
void SetPolicyDomainCategory (PolicyDomainCategory idc)
 sets the category of the domain over which the indices of this policy are specified. More...
 
virtual ~JointPolicyDiscrete ()
 Destructor. More...
 
- Public Member Functions inherited from JointPolicy
size_t GetDepth () const
 Returns the depth of the joint policy. More...
 
size_t GetNrAgents () const
 Returns the number of agents for which the joint policy is defined. More...
 
 JointPolicy (size_t nrAg)
 Constructor, initializes the depth to the maximum horizon. More...
 
 JointPolicy (const JointPolicy &o)
 copy constructor: More...
 
virtual JointPolicyoperator= (const JointPolicy &o)
 copy assignment operator More...
 
virtual void Print () const
 Prints a description of a joint policy to cout. More...
 
virtual ~JointPolicy ()
 Destructor. More...
 

Protected Attributes

std::vector< PolicyPureVector * > _m_indivPols_PolicyPureVector
 
- Protected Attributes inherited from JointPolicy
size_t _m_nrAgents
 some other numbers we cache: More...
 

Private Member Functions

void ClearIndividualPolicies ()
 Private function that deletes all the individual policies pointed to. More...
 
- Private Member Functions inherited from JPolComponent_VectorImplementation
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...
 
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_VectorImplementationoperator= (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...
 

Additional Inherited Members

- Private Attributes inherited from JPolComponent_VectorImplementation
std::vector< PolicyPureVector * > _m_indivPols_PolicyPureVector
 

Detailed Description

JointPolicyPureVector represents a discrete pure joint policy.

Each of the individual policies is a PolicyPureVector - a deterministic mapping from observations to actions implemented by a tree. This class acts as a wrapper. It contains a vector with pointers to indiv. policies.

we delete the PolicyPureVectors pointed to: this means that we should not be able to add indiv. policies without copying them!!!

Constructor & Destructor Documentation

JointPolicyPureVector::JointPolicyPureVector ( const Interface_ProblemToPolicyDiscretePure pu)
inline

Constructor.

Associates a problem (typically a planning unit) with the joint policy. Information regarding the problem is used to construct a joint policy of the proper shape.

Use the default PolicyDomainCategory defined by pu.

Referenced by Clone().

JointPolicyPureVector::JointPolicyPureVector ( const Interface_ProblemToPolicyDiscretePure pu,
PolicyGlobals::PolicyDomainCategory  idc 
)
inline

Constructor.

Associates a problem (typically a planning unit) with the joint policy. Information regarding the problem is used to construct a joint policy of the proper shape.

idc is the PolicyDomainCategory over which the policy is specified.

JointPolicyPureVector::JointPolicyPureVector ( I_PtPDpure_constPtr  pu)
inline

Constructor.

Associates a problem (typically a planning unit) with the joint policy. Information regarding the problem is used to construct a joint policy of the proper shape.

Use the default PolicyDomainCategory defined by pu.

JointPolicyPureVector::JointPolicyPureVector ( I_PtPDpure_constPtr  pu,
PolicyGlobals::PolicyDomainCategory  idc 
)
inline

Constructor.

Associates a problem (typically a planning unit) with the joint policy. Information regarding the problem is used to construct a joint policy of the proper shape.

idc is the PolicyDomainCategory over which the policy is specified.

JointPolicyPureVector::JointPolicyPureVector ( const JointPolicyPureVector a)
inline

Copy constructor.

JointPolicyPureVector::JointPolicyPureVector ( const JointPolicyDiscretePure a1,
const JPolComponent_VectorImplementation a2 
)
inline

Copy constructor from base class a.

virtual JointPolicyPureVector::~JointPolicyPureVector ( )
inlinevirtual

Destructor.

Member Function Documentation

void JointPolicyPureVector::ClearIndividualPolicies ( )
private

Private function that deletes all the individual policies pointed to.

virtual JointPolicyPureVector* JointPolicyPureVector::Clone ( ) const
inlinevirtual

Returns a pointer to a copy of this class.

Implements JointPolicyDiscretePure.

References JointPolicyPureVector().

Index JointPolicyPureVector::GetActionIndex ( Index  agI,
Index  domainI 
) const
inlinevirtual
LIndex JointPolicyPureVector::GetIndex ( ) const
inline
std::vector<PolicyPureVector*>& JointPolicyPureVector::GetIndividualPolicies ( )
inline

Returns a reference to the vector of pointers to individual policies.

This function should be used to manipulate individual policies.

References JPolComponent_VectorImplementation::GetIndividualPolicies().

Referenced by BG_FactorGraphCreator::Construct_LocalPayoff_Factors().

PolicyDiscrete* JointPolicyPureVector::GetIndividualPolicyDiscrete ( Index  i) const
inlinevirtual
Index JointPolicyPureVector::GetJointActionIndex ( LIndex  i) const
inlinevirtual

Returns the jaI taken by this policy for joint domain index johI.

Implements JointPolicyDiscretePure.

References JPolComponent_VectorImplementation::GetJointActionIndex().

bool JointPolicyPureVector::Increment ( )
inline
bool JointPolicyPureVector::operator++ ( )
inline

Performs increment. See Increment().

References Increment().

bool JointPolicyPureVector::operator< ( const JointPolicy o) const
inlinevirtual

less-than operator.

In many cases, it will be necessary to order Joint Policies)

Implements JointPolicy.

bool JointPolicyPureVector::operator< ( const JointPolicyPureVector o) const
inline

References GetIndex().

JointPolicyPureVector & JointPolicyPureVector::operator= ( const JointPolicyPureVector jp)

The copy assignment operator - makes deep copies using PolicyPureVector::operator= which makes deep copies.

References JointPolicyDiscretePure::operator=(), and JPolComponent_VectorImplementation::operator=().

JointPolicyPureVector & JointPolicyPureVector::operator= ( const JointPolicyDiscretePure jp)
virtual

The copy assignment operator - makes deep copies using PolicyPureVector::operator= which makes deep copies.

Reimplemented from JointPolicyDiscretePure.

void JointPolicyPureVector::PrintBrief ( ) const
inline

References SoftPrintBrief().

void JointPolicyPureVector::RandomInitialization ( )
inlinevirtual
void JointPolicyPureVector::RandomInitialization ( Index  i)
inlinevirtual

Randomly initialize the policy for agentI.

Implements JointPolicyDiscretePure.

References JPolComponent_VectorImplementation::RandomInitialization().

void JointPolicyPureVector::SetAction ( Index  agentI,
Index  domainI,
Index  aI 
)
inlinevirtual

Sets the policy for agentI to domainI->aI.

Implements JointPolicyDiscretePure.

References JPolComponent_VectorImplementation::SetAction().

Referenced by JESPDynamicProgrammingPlanner::ConstructPolicyRecursively().

void JointPolicyPureVector::SetDepth ( size_t  d)
inlinevirtual

Sets the depth of the joint policy.

Also sets the depth of each of the invididual policies.

Reimplemented from JointPolicy.

References Globals::MAXHORIZON, JointPolicy::SetDepth(), and JPolComponent_VectorImplementation::SetDepthForIndivPols().

Referenced by JPPVIndexValuePair::AllocateJPPV().

void JointPolicyPureVector::SetIndex ( LIndex  i)
inline

Sets the index of this joint policy.Updates the policies represented.

References JPolComponent_VectorImplementation::SetIndex().

Referenced by AgentBG::Act(), BGIPSolution::AddSolution(), and JPPVIndexValuePair::AllocateJPPV().

string JointPolicyPureVector::SoftPrint ( void  ) const
virtual

Prints a description of this JointPolicyPureVector to a string.

Implements JointPolicyDiscretePure.

References JPolComponent_VectorImplementation::SoftPrint().

string JointPolicyPureVector::SoftPrintBrief ( void  ) const
virtual

Prints a brief description to a string.

Implements JointPolicyDiscretePure.

References JPolComponent_VectorImplementation::SoftPrintBrief().

Referenced by PrintBrief().

JPPV_sharedPtr JointPolicyPureVector::ToJointPolicyPureVector ( ) const
virtual

Convert this joint policy to a JointPolicyPureVector.

Implements JointPolicyDiscretePure.

void JointPolicyPureVector::ZeroInitialization ( )
inline

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 JPolComponent_VectorImplementation::ZeroInitialization().

Referenced by JESPExhaustivePlanner::ExhaustiveBestResponse().

void JointPolicyPureVector::ZeroInitialization ( Index  i)
inline

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 JPolComponent_VectorImplementation::ZeroInitialization().

Member Data Documentation

std::vector<PolicyPureVector*> JointPolicyPureVector::_m_indivPols_PolicyPureVector
protected