MultiAgentDecisionProcess
Belief Class Reference

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

#include <Belief.h>

Inheritance diagram for Belief:
[legend]

Public Member Functions

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

Protected Attributes

StateDistributionVector _m_b
 The vector of probability values. More...
 

Friends

class BeliefIterator
 

Detailed Description

Belief represents a probability distribution over the state space.

It is stored as a full vector.

Constructor & Destructor Documentation

Belief::Belief ( size_t  size = 0)

Constructor which sets the size of the belief.

Referenced by Clone().

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

Constructor which copies belief in this belief.

Belief::Belief ( const BeliefInterface belief)

Constructor which copies belief in this belief.

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

Belief::Belief ( const StateDistribution belief)
Belief::~Belief ( )

Destructor.

Member Function Documentation

void Belief::Clear ( )
virtual

Clears the belief.

Implements BeliefInterface.

virtual Belief* Belief::Clone ( ) const
inlinevirtual

Returns a pointer to a copy of this class.

Implements BeliefInterface.

Reimplemented in JointBeliefEventDriven, and JointBelief.

References Belief().

double Belief::Get ( Index  sI) const
inlinevirtual

Gets the probability of the sI'th state.

Implements BeliefInterface.

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

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

Gets a vector of probabilities representing the belief.

Implements BeliefInterface.

Referenced by IndividualBeliefJESP::SoftPrint().

BeliefIteratorGeneric Belief::GetIterator ( ) const
virtual

Implements BeliefInterface.

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

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

Implements BeliefInterface.

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.

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.

Belief & Belief::operator= ( const Belief o)
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.

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

Gets the probability of the i'th state.

Implements BeliefInterface.

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

Gets the probability of the i'th state.

Implements BeliefInterface.

void Belief::Print ( ) const
inlinevirtual

Prints the belief.

Implements BeliefInterface.

Reimplemented in IndividualBeliefJESP.

References SoftPrint().

Referenced by QBG::ComputeRecursivelyNoCache().

bool Belief::SanityCheck ( ) const
virtual

Checks whether the belief is a valid probability distribution.

Implements BeliefInterface.

References Globals::PROB_PRECISION.

Referenced by JointBelief::Update(), and JointBeliefEventDriven::Update().

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

Copy the belief into this object.

Implements BeliefInterface.

Referenced by JESPDynamicProgrammingPlanner::DynamicProgrammingBestResponse().

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

Sets probability of the sI'th state to prob .

Implements BeliefInterface.

void Belief::Set ( const BeliefInterface belief)
virtual

Copy the belief into this object.

Implements BeliefInterface.

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

void Belief::Set ( const StateDistribution belief)
virtual

Copy the belief into this object.

Implements BeliefInterface.

References StateDistribution::ToVectorOfDoubles().

unsigned int Belief::Size ( ) const
inlinevirtual
string Belief::SoftPrint ( ) const
virtual

Prints the belief.

Implements BeliefInterface.

Reimplemented in IndividualBeliefJESP.

References PrintTools::SoftPrintVector().

Referenced by Print().

Friends And Related Function Documentation

friend class BeliefIterator
friend

Member Data Documentation