MultiAgentDecisionProcess  Release 0.2.1
JointPolicyPureVector Class Reference

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

#include <JointPolicyPureVector.h>

+ Inheritance diagram for JointPolicyPureVector:
+ Collaboration diagram for JointPolicyPureVector:

Public Member Functions

virtual JointPolicyPureVectorClone () const
 Returns a pointer to a copy of this class.
virtual Index GetActionIndex (Index agI, Index domainI) const
 Returns the action index for domainI for agent aI.
LIndex GetIndex () const
 Get the index of this joint policy.
std::vector< PolicyPureVector * > & GetIndividualPolicies ()
 Returns a reference to the vector of pointers to individual policies.
virtual PolicyDiscreteGetIndividualPolicyDiscrete (Index i) const
virtual Index GetJointActionIndex (Index i) const
 Returns the jaI taken by this policy for joint domain index johI.
bool Increment (Index agentI)
bool Increment ()
 JointPolicyPureVector (const Interface_ProblemToPolicyDiscretePure &pu)
 Constructor.
 JointPolicyPureVector (const Interface_ProblemToPolicyDiscretePure &pu, PolicyGlobals::IndexDomainCategory idc)
 Constructor.
 JointPolicyPureVector (const JointPolicyPureVector &a)
 Copy constructor.
 JointPolicyPureVector (const JointPolicyDiscretePure &a)
 Copy constructor from base class a.
 JointPolicyPureVector (const JointPolicyDiscretePure &a1, const JPolComponent_VectorImplementation &a2)
 Copy constructor from base class a.
bool operator++ ()
 Performs increment. See Increment().
virtual JointPolicyPureVectoroperator= (const JointPolicyPureVector &jp)
 The copy assignment operator - makes deep copies using PolicyPureVector::operator= which makes deep copies.
virtual JointPolicyPureVectoroperator= (const JointPolicyDiscretePure &jp)
 The copy assignment operator - makes deep copies using PolicyPureVector::operator= which makes deep copies.
void PrintBrief () const
virtual void RandomInitialization ()
 Randomly initialize the joint policy.
virtual void RandomInitialization (Index i)
 Randomly initialize the policy for agentI.
virtual void SetAction (Index agentI, Index domainI, Index aI)
void SetDepth (size_t d)
 Sets the depth of the joint policy.
void SetIndex (LIndex i)
 Sets the index of this joint policy.Updates the policies represented.
virtual std::string SoftPrint () const
 Prints a description of this JointPolicyPureVector to a string.
virtual std::string SoftPrintBrief () const
 Prints a brief description to a string.
JointPolicyPureVectorToJointPolicyPureVector () const
 Convert this joint policy to a JointPolicyPureVector.
virtual void ZeroInitialization ()
 Initialize the joint policy to the first joint policy.
virtual void ZeroInitialization (Index i)
 Initialize the policy of agentI to the first policy.
virtual ~JointPolicyPureVector ()
 Destructor.
- Public Member Functions inherited from JointPolicyDiscretePure
virtual JointPolicyDiscretePureClone () const =0
 Returns a pointer to a copy of this class.
virtual Index GetActionIndex (Index aI, Index domainI) const =0
 Returns the action index for domainI for agent aI.
double GetActionProb (Index agentI, Index domI, Index aI) const
 Returns the probability that the policy specifies action aI for domain index domI for agentI.
const
Interface_ProblemToPolicyDiscretePure
GetInterfacePTPDiscretePure () const
 Return pointer to the Interface_ProblemToPolicyDiscretePure.
virtual Index GetJointActionIndex (Index i) const =0
 Returns the jaI taken by this policy for joint domain index johI.
double GetJointActionProb (Index i, Index ja) const
 Returns the probability that the policy specifies joint action a for domain index i.
 JointPolicyDiscretePure ()
 default Constructor - constructs empty policy
 JointPolicyDiscretePure (const Interface_ProblemToPolicyDiscretePure &pu, PolicyGlobals::IndexDomainCategory idc)
 (default) Constructor
 JointPolicyDiscretePure (const JointPolicyDiscretePure &a)
 Copy constructor.
virtual JointPolicyDiscretePureoperator= (const JointPolicyDiscretePure &o)
 Copy assignment operator.
virtual void RandomInitialization ()=0
 Randomly initialize the joint policy.
virtual void RandomInitialization (Index agentI)=0
 Randomly initialize the policy for agentI.
virtual void SetAction (Index agentI, Index domainI, Index aI)=0
 Sets the policy for agentI to domainI->aI.
void SetInterfacePTPDiscretePure (Interface_ProblemToPolicyDiscretePure *pu)
 Sets the planning unit for this joint policy.
virtual std::string SoftPrint () const =0
 Prints a description of this JointPolicyPureVector to a string.
virtual std::string SoftPrintBrief () const =0
 Prints a brief description to a string.
virtual JointPolicyPureVectorToJointPolicyPureVector () const =0
virtual ~JointPolicyDiscretePure ()
 Destructor.
- Public Member Functions inherited from JointPolicyDiscrete
IndexDomainCategory GetIndexDomainCategory () const
 returns the Category of the domain over which the indices of this policy are specified.
virtual PolicyDiscreteGetIndividualPolicyDiscrete (Index agI) const =0
 return pointer to individual policy of agent agI
const
Interface_ProblemToPolicyDiscrete
GetInterfacePTPDiscrete () const
 return a pointer to the referred Interface_ProblemToPolicyDiscrete.
size_t GetNrDomainElements (Index agentI) const
 Returns the number of policy domain elements for agent agentI.
 JointPolicyDiscrete ()
 default constructor creates an empty policy
 JointPolicyDiscrete (const Interface_ProblemToPolicyDiscrete &pu, PolicyGlobals::IndexDomainCategory idc)
 (default) Constructor
 JointPolicyDiscrete (const JointPolicyDiscrete &a)
 Copy constructor.
virtual JointPolicyDiscreteoperator= (const JointPolicyDiscrete &o)
 Assignment operator.
Index SampleJointAction (Index i) const
 Returns a sampled joint action.
Index SampleJointAction (const std::vector< Index > &Is) const
 Returns a sampled joint action.
void SampleJointActionVector (Index i, std::vector< Index > &jaVec) const
 Returns a sampled joint action.
void SampleJointActionVector (const std::vector< Index > &Is, std::vector< Index > &jaVec) const
 Returns a sampled joint action.
void SetIndexDomainCategory (IndexDomainCategory idc)
 sets the category of the domain over which the indices of this policy are specified.
void SetInterfacePTPDiscrete (const Interface_ProblemToPolicyDiscrete *p)
 sets the pointer to the Interface_ProblemToPolicyDiscrete.
virtual ~JointPolicyDiscrete ()
 Destructor.
- Public Member Functions inherited from JointPolicy
size_t GetDepth () const
 Returns the depth of the joint policy.
size_t GetNrAgents () const
 Returns the number of agents for which the joint policy is defined.
 JointPolicy (size_t nrAg)
 Constructor, initializes the depth to the maximum horizon.
 JointPolicy (const JointPolicy &o)
 copy constructor:
virtual JointPolicyoperator= (const JointPolicy &o)
 copy assignment operator
virtual void Print () const
 Prints a description of a joint policy to cout.
virtual void SetDepth (size_t d)
 Sets the depth of the joint policy.
virtual ~JointPolicy ()
 Destructor.

Protected Attributes

std::vector< PolicyPureVector * > _m_indivPols_PolicyPureVector

Private Member Functions

void ClearIndividualPolicies ()
 Private function that deletes all the individual policies pointed to.
- Private Member Functions inherited from JPolComponent_VectorImplementation
Index GetActionIndex (Index aI, Index domainI) const
 Returns the action index for domainI for agent aI.
LIndex GetIndex () const
 Get the index of this joint policy.
std::vector< PolicyPureVector * > & GetIndividualPolicies ()
 Returns a reference to the vector of pointers to individual policies.
virtual PolicyDiscreteGetIndividualPolicyDiscrete (Index agI) const
Index GetJointActionIndex (Index i) const
 Returns the jaI taken by this policy for joint domain index johI.
bool Increment (Index agentI)
 Increments the individual policy of agentI.
bool Increment ()
 Increments the joint policy, used to iterate over joint policies.
 JPolComponent_VectorImplementation (const Interface_ProblemToPolicyDiscretePure &pu, size_t depth=MAXHORIZON)
 (default) Constructor
 JPolComponent_VectorImplementation (const Interface_ProblemToPolicyDiscretePure &pu, PolicyGlobals::IndexDomainCategory idc, size_t depth=MAXHORIZON)
 JPolComponent_VectorImplementation (const JPolComponent_VectorImplementation &a)
 Copy constructor.
bool operator++ ()
 Performs increment. See Increment().
JPolComponent_VectorImplementationoperator= (const JPolComponent_VectorImplementation &o)
 Copy assignment operator.
void RandomInitialization ()
 Randomly initialize the joint policy.
void RandomInitialization (Index agentI)
 Randomly initialize the policy for agentI.
void SetAction (Index agentI, Index domainI, Index aI)
 Sets the policy for agentI to domainI->aI.
void SetDepthForIndivPols (size_t d)
void SetIndex (LIndex i)
 Sets the index of this joint policy.Updates the policies represented.
std::string SoftPrint () const
 Prints a description of this to a string.
std::string SoftPrintBrief () const
void ZeroInitialization ()
 Initialize the joint policy to the first joint policy.
void ZeroInitialization (Index agentI)
 Initialize the policy of agentI to the first policy.
 ~JPolComponent_VectorImplementation ()
 Destructor.

Private Attributes

Index * _m_indivActionIndices
 vector for temporarily storing indiv. actions

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!!!

Definition at line 51 of file JointPolicyPureVector.h.

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 IndexDomainCategory defined by pu.

Definition at line 82 of file JointPolicyPureVector.h.

Referenced by Clone().

JointPolicyPureVector::JointPolicyPureVector ( const Interface_ProblemToPolicyDiscretePure pu,
PolicyGlobals::IndexDomainCategory  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 IndexDomainCategory over which the policy is specified.

Definition at line 96 of file JointPolicyPureVector.h.

JointPolicyPureVector::JointPolicyPureVector ( const JointPolicyPureVector a)
inline

Copy constructor.

Definition at line 104 of file JointPolicyPureVector.h.

JointPolicyPureVector::JointPolicyPureVector ( const JointPolicyDiscretePure a)
inline

Copy constructor from base class a.

Definition at line 110 of file JointPolicyPureVector.h.

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

Copy constructor from base class a.

Definition at line 117 of file JointPolicyPureVector.h.

virtual JointPolicyPureVector::~JointPolicyPureVector ( )
inlinevirtual

Destructor.

Definition at line 126 of file JointPolicyPureVector.h.

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.

Definition at line 206 of file JointPolicyPureVector.h.

References JointPolicyPureVector().

virtual Index JointPolicyPureVector::GetActionIndex ( Index  agI,
Index  domainI 
) const
inlinevirtual

Returns the action index for domainI for agent aI.

Definition at line 175 of file JointPolicyPureVector.h.

Referenced by AgentBG::Act(), JESPDynamicProgrammingPlanner::DPBestResponseRecursively(), and IndividualBeliefJESP::Update().

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.

Definition at line 183 of file JointPolicyPureVector.h.

Referenced by DICEPSPlanner::UpdateCEProbDistribution().

virtual PolicyDiscrete* JointPolicyPureVector::GetIndividualPolicyDiscrete ( Index  i) const
inlinevirtual

Definition at line 178 of file JointPolicyPureVector.h.

virtual Index JointPolicyPureVector::GetJointActionIndex ( Index  i) const
inlinevirtual
bool JointPolicyPureVector::Increment ( Index  agentI)
inline

Definition at line 158 of file JointPolicyPureVector.h.

References Increment().

Referenced by JESPExhaustivePlanner::ExhaustiveBestResponse().

bool JointPolicyPureVector::Increment ( )
inline

Definition at line 160 of file JointPolicyPureVector.h.

Referenced by Increment(), and operator++().

bool JointPolicyPureVector::operator++ ( )
inline

Performs increment. See Increment().

Definition at line 156 of file JointPolicyPureVector.h.

References Increment().

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

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

Definition at line 37 of file JointPolicyPureVector.cpp.

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.

Definition at line 49 of file JointPolicyPureVector.cpp.

void JointPolicyPureVector::PrintBrief ( ) const
inline

Definition at line 146 of file JointPolicyPureVector.h.

References SoftPrintBrief().

virtual void JointPolicyPureVector::RandomInitialization ( )
inlinevirtual

Randomly initialize the joint policy.

Definition at line 197 of file JointPolicyPureVector.h.

Referenced by JESPExhaustivePlanner::Plan(), JESPDynamicProgrammingPlanner::Plan(), RandomInitialization(), and BGIP_SolverRandom::Solve().

virtual void JointPolicyPureVector::RandomInitialization ( Index  i)
inlinevirtual

Randomly initialize the policy for agentI.

Definition at line 200 of file JointPolicyPureVector.h.

References RandomInitialization().

virtual void JointPolicyPureVector::SetAction ( Index  agentI,
Index  domainI,
Index  aI 
)
inlinevirtual
void JointPolicyPureVector::SetDepth ( size_t  d)
inline

Sets the depth of the joint policy.

Also sets the depth of each of the invididual policies.

Definition at line 136 of file JointPolicyPureVector.h.

References JPolComponent_VectorImplementation::SetDepthForIndivPols().

Referenced by JPPVIndexValuePair::AllocateJPPV(), and PolicyPoolJPolValPair::Init().

void JointPolicyPureVector::SetIndex ( LIndex  i)
inline

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

Definition at line 167 of file JointPolicyPureVector.h.

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

string JointPolicyPureVector::SoftPrint ( void  ) const
virtual

Prints a description of this JointPolicyPureVector to a string.

Definition at line 61 of file JointPolicyPureVector.cpp.

References PrintTools::SoftPrint().

Referenced by JPPVValuePair::SoftPrint().

string JointPolicyPureVector::SoftPrintBrief ( void  ) const
virtual

Prints a brief description to a string.

Definition at line 69 of file JointPolicyPureVector.cpp.

References JPolComponent_VectorImplementation::SoftPrintBrief().

Referenced by PrintBrief().

JointPolicyPureVector * JointPolicyPureVector::ToJointPolicyPureVector ( ) const

Convert this joint policy to a JointPolicyPureVector.

Definition at line 78 of file JointPolicyPureVector.cpp.

virtual void JointPolicyPureVector::ZeroInitialization ( )
inlinevirtual

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.

Definition at line 189 of file JointPolicyPureVector.h.

Referenced by JESPExhaustivePlanner::ExhaustiveBestResponse(), and ZeroInitialization().

virtual void JointPolicyPureVector::ZeroInitialization ( Index  i)
inlinevirtual

Initialize the policy of agentI to the first policy.

This is the policy that specifies action 0 –the first action– for all observation histories.

Definition at line 194 of file JointPolicyPureVector.h.

References ZeroInitialization().

Member Data Documentation

Index* JointPolicyPureVector::_m_indivActionIndices
private

vector for temporarily storing indiv. actions

(used by GetJointActionIndex)

Definition at line 66 of file JointPolicyPureVector.h.

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

Definition at line 69 of file JointPolicyPureVector.h.


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