MultiAgentDecisionProcess
JointBeliefSparse Class Reference

JointBeliefSparse represents a sparse joint belief. More...

#include <JointBeliefSparse.h>

Inheritance diagram for JointBeliefSparse:
[legend]

Public Member Functions

virtual JointBeliefSparseClone () const
 Returns a pointer to a copy of this class. More...
 
 JointBeliefSparse ()
 Default Constructor. More...
 
 JointBeliefSparse (size_t size)
 Constructor which sets the size of the joint belief. More...
 
 JointBeliefSparse (const std::vector< double > &belief)
 Constructor which copies belief in this joint belief. More...
 
 JointBeliefSparse (const JointBeliefInterface &belief)
 Constructor which copies belief in this joint belief. More...
 
 JointBeliefSparse (const StateDistribution &belief)
 
JointBeliefSparseoperator= (const JointBeliefSparse &o)
 
JointBeliefInterfaceoperator= (const JointBeliefInterface &o)
 assignment operator. More...
 
double Update (const MultiAgentDecisionProcessDiscreteInterface &pu, Index lastJAI, Index newJOI)
 Performs a joint belief update on this joint belief. More...
 
 ~JointBeliefSparse ()
 Destructor. More...
 
- Public Member Functions inherited from JointBeliefInterface
 JointBeliefInterface ()
 (default) Constructor More...
 
virtual ~JointBeliefInterface ()
 Destructor. More...
 
- Public Member Functions inherited from BeliefInterface
 BeliefInterface ()
 (default) Constructor More...
 
virtual ~BeliefInterface ()
 Destructor. More...
 
- Public Member Functions inherited from BeliefSparse
 BeliefSparse ()
 Default Constructor. More...
 
 BeliefSparse (size_t size)
 Constructor which sets the size of the joint belief. More...
 
 BeliefSparse (const std::vector< double > &belief)
 Constructor which copies belief in this joint belief. More...
 
 BeliefSparse (const BeliefInterface &belief)
 Constructor which copies belief in this joint belief. More...
 
 BeliefSparse (const StateDistribution &belief)
 
void Clear ()
 Clears the belief. 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...
 
unsigned int NumberNonZeros () const
 
BeliefSparseoperator= (const BeliefSparse &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...
 
void Set (const BS &belief)
 
void Set (const std::vector< double > &belief)
 Copy the belief into this object. More...
 
void Set (Index sI, double prob)
 Sets probability of the sI'th state to prob . More...
 
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...
 
 ~BeliefSparse ()
 Destructor. More...
 

Private Member Functions

double UpdateSlow (const MultiAgentDecisionProcessDiscreteInterface &pu, Index lastJAI, Index newJOI)
 Slow version of Update(), if GetTransitionModelDiscretePtr() is 0. More...
 

Additional Inherited Members

- Protected Types inherited from BeliefSparse
typedef
boost::numeric::ublas::compressed_vector
< double > 
BS
 
typedef BS::const_iterator BScit
 
typedef BS::iterator BSit
 
- Protected Attributes inherited from BeliefSparse
BS _m_b
 The sparse vector to store the belief. More...
 

Detailed Description

JointBeliefSparse represents a sparse joint belief.

Constructor & Destructor Documentation

JointBeliefSparse::JointBeliefSparse ( )

Default Constructor.

Referenced by Clone().

JointBeliefSparse::JointBeliefSparse ( size_t  size)

Constructor which sets the size of the joint belief.

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

Constructor which copies belief in this joint belief.

JointBeliefSparse::JointBeliefSparse ( const JointBeliefInterface belief)

Constructor which copies belief in this joint belief.

JointBeliefSparse::JointBeliefSparse ( const StateDistribution belief)
JointBeliefSparse::~JointBeliefSparse ( )

Destructor.

Member Function Documentation

virtual JointBeliefSparse* JointBeliefSparse::Clone ( ) const
inlinevirtual

Returns a pointer to a copy of this class.

Reimplemented from BeliefSparse.

References JointBeliefSparse().

JointBeliefSparse & JointBeliefSparse::operator= ( const JointBeliefSparse o)
JointBeliefInterface & JointBeliefSparse::operator= ( const JointBeliefInterface o)
virtual

assignment operator.

This must be implemented by the derived class (with this prototype).

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

double JointBeliefSparse::Update ( const MultiAgentDecisionProcessDiscreteInterface pu,
Index  lastJAI,
Index  newJOI 
)
virtual

Performs a joint belief update on this joint belief.

Performs the belief update. I.e., given the current joint belief b (which is represented by this), we compute P(s'|b, a, o) for all new states s'. This function updates this belief (alter this object). Returned is the normalization factor P(o|b,a), which is also to probability that this new history (belief) occurs given the previous one.

Implements JointBeliefInterface.

References BeliefSparse::_m_b, TGet::Get(), ObservationModelDiscreteInterface::Get(), MultiAgentDecisionProcessDiscreteInterface::GetEventObservability(), MultiAgentDecisionProcessDiscreteInterface::GetObservationModelDiscretePtr(), MultiAgentDecisionProcessDiscreteInterface::GetTGet(), Globals::PROB_PRECISION, BeliefSparse::SanityCheck(), and UpdateSlow().

Referenced by AgentQMDP::Act(), and AgentBG::Act().