MultiAgentDecisionProcess  Release 0.2.1
Belief Class Reference

Belief represents a probability distribution over the state space. More...

#include <Belief.h>

+ Inheritance diagram for Belief:
+ Collaboration diagram for Belief:

Public Member Functions

 Belief (size_t size)
 Constructor which sets the size of the belief.
 Belief (const std::vector< double > &belief)
 Constructor which copies belief in this belief.
 Belief (const BeliefInterface &belief)
 Constructor which copies belief in this belief.
 Belief (const StateDistribution &belief)
void Clear ()
 Clears the belief.
virtual BeliefClone () const
 Returns a pointer to a copy of this class.
double Get (Index sI) const
 Gets the probability of the sI'th state.
std::vector< double > Get () const
 Gets a vector of probabilities representing the belief.
BeliefIteratorGeneric GetIterator () const
double InnerProduct (const std::vector< double > &values) const
 Computes the inner product of a belief with the vector values.
std::vector< double > InnerProduct (const VectorSet &v) const
 Computes the inner product of a belief with the VectorSet v.
std::vector< double > InnerProduct (const VectorSet &v, const std::vector< bool > &mask) const
 Computes the inner product of a belief with the VectorSet v.
Beliefoperator= (const Belief &o)
BeliefInterfaceoperator= (const BeliefInterface &o)
 Copy assignment operator.
double & operator[] (Index &i)
 Gets the probability of the i'th state.
double & operator[] (int &i)
 Gets the probability of the i'th state.
void Print () const
 Prints the belief.
bool SanityCheck () const
 Checks whether the belief is a valid probability distribution.
virtual void Set (const std::vector< double > &belief)
 Copy the belief into this object.
virtual void Set (Index sI, double prob)
 Sets probability of the sI'th state to prob .
virtual void Set (const BeliefInterface &belief)
 Copy the belief into this object.
virtual void Set (const StateDistribution &belief)
 Copy the belief into this object.
unsigned int Size () const
 Returns the size of this belief.
std::string SoftPrint () const
 Prints the belief.
 ~Belief ()
 Destructor.
- Public Member Functions inherited from BeliefInterface
 BeliefInterface ()
 (default) Constructor
virtual ~BeliefInterface ()
 Destructor.

Protected Attributes

StateDistributionVector _m_b
 The vector of probability values.

Friends

class BeliefIterator

Detailed Description

Belief represents a probability distribution over the state space.

It is stored as a full vector.

Definition at line 42 of file Belief.h.

Constructor & Destructor Documentation

Belief::Belief ( size_t  size)

Constructor which sets the size of the belief.

Definition at line 39 of file Belief.cpp.

Referenced by Clone().

Belief::Belief ( const std::vector< double > &  belief)

Constructor which copies belief in this belief.

Definition at line 44 of file Belief.cpp.

Belief::Belief ( const BeliefInterface belief)

Constructor which copies belief in this belief.

Definition at line 53 of file Belief.cpp.

References BeliefInterface::Get(), and BeliefInterface::Size().

Belief::Belief ( const StateDistribution belief)

Definition at line 64 of file Belief.cpp.

Belief::~Belief ( )

Destructor.

Definition at line 71 of file Belief.cpp.

Member Function Documentation

void Belief::Clear ( )
virtual

Clears the belief.

Implements BeliefInterface.

Definition at line 125 of file Belief.cpp.

virtual Belief* Belief::Clone ( ) const
inlinevirtual

Returns a pointer to a copy of this class.

Implements BeliefInterface.

Reimplemented in JointBelief.

Definition at line 117 of file Belief.h.

References Belief().

double Belief::Get ( Index  sI) const
inlinevirtual

Gets the probability of the sI'th state.

Implements BeliefInterface.

Definition at line 93 of file Belief.h.

References _m_b.

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

std::vector<double> Belief::Get ( ) const
inlinevirtual

Gets a vector of probabilities representing the belief.

Implements BeliefInterface.

Definition at line 95 of file Belief.h.

References _m_b.

Referenced by IndividualBeliefJESP::SoftPrint().

BeliefIteratorGeneric Belief::GetIterator ( ) const
virtual

Implements BeliefInterface.

Definition at line 217 of file Belief.cpp.

double Belief::InnerProduct ( const std::vector< double > &  values) const
virtual

Computes the inner product of a belief with the vector values.

Implements BeliefInterface.

Definition at line 167 of file Belief.cpp.

vector< double > Belief::InnerProduct ( const VectorSet v) const
virtual

Computes the inner product of a belief with the VectorSet v.

Returns the inner product with each vector in v.

Implements BeliefInterface.

Definition at line 181 of file Belief.cpp.

vector< double > Belief::InnerProduct ( const VectorSet v,
const std::vector< bool > &  mask 
) const
virtual

Computes the inner product of a belief with the VectorSet v.

Returns the inner product with each vector in v, but only for vectors whose mask is set to true.

Implements BeliefInterface.

Definition at line 197 of file Belief.cpp.

Belief & Belief::operator= ( const Belief o)

Definition at line 76 of file Belief.cpp.

References _m_b.

BeliefInterface & Belief::operator= ( const BeliefInterface o)
virtual

Copy assignment operator.

This must be implemented by the derived class (with this prototype). For an example, see PolicyPoolJPolValPair.

For now, this function is purely abstract. Might there be some members added to this (base) class, then an implementation could be made. This should then be called using PolicyPoolInterface::operator=(o) from the copy assignment operator of the derived class. See also http://www.icu-project.org/docs/papers/cpp_report/the_assignment_operator_revisited.html.

Implements BeliefInterface.

Definition at line 85 of file Belief.cpp.

double& Belief::operator[] ( Index &  i)
inlinevirtual

Gets the probability of the i'th state.

Implements BeliefInterface.

Definition at line 73 of file Belief.h.

References _m_b.

double& Belief::operator[] ( int &  i)
inlinevirtual

Gets the probability of the i'th state.

Implements BeliefInterface.

Definition at line 77 of file Belief.h.

References _m_b.

void Belief::Print ( ) const
inlinevirtual

Prints the belief.

Implements BeliefInterface.

Reimplemented in IndividualBeliefJESP.

Definition at line 101 of file Belief.h.

References SoftPrint().

Referenced by QBG::ComputeRecursivelyNoCache().

bool Belief::SanityCheck ( ) const
virtual

Checks whether the belief is a valid probability distribution.

Implements BeliefInterface.

Definition at line 139 of file Belief.cpp.

References Globals::PROB_PRECISION.

Referenced by JointBelief::Update().

void Belief::Set ( const std::vector< double > &  belief)
virtual

Copy the belief into this object.

Implements BeliefInterface.

Definition at line 92 of file Belief.cpp.

Referenced by JESPDynamicProgrammingPlanner::DynamicProgrammingBestResponse().

virtual void Belief::Set ( Index  sI,
double  prob 
)
inlinevirtual

Sets probability of the sI'th state to prob .

Implements BeliefInterface.

Definition at line 85 of file Belief.h.

References _m_b, and prob.

void Belief::Set ( const BeliefInterface belief)
virtual

Copy the belief into this object.

Implements BeliefInterface.

Definition at line 111 of file Belief.cpp.

References BeliefInterface::Get(), and BeliefInterface::Size().

void Belief::Set ( const StateDistribution belief)
virtual

Copy the belief into this object.

Implements BeliefInterface.

Definition at line 102 of file Belief.cpp.

References StateDistribution::ToVectorOfDoubles().

unsigned int Belief::Size ( ) const
inlinevirtual

Returns the size of this belief.

Implements BeliefInterface.

Definition at line 103 of file Belief.h.

References _m_b.

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

string Belief::SoftPrint ( ) const
virtual

Prints the belief.

Implements BeliefInterface.

Reimplemented in IndividualBeliefJESP.

Definition at line 130 of file Belief.cpp.

References PrintTools::SoftPrintVector().

Referenced by Print().

Friends And Related Function Documentation

friend class BeliefIterator
friend

Definition at line 46 of file Belief.h.

Member Data Documentation


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