MultiAgentDecisionProcess  Release 0.2.1
JointBeliefSparse Class Reference

JointBeliefSparse represents a sparse joint belief. More...

#include <JointBeliefSparse.h>

+ Inheritance diagram for JointBeliefSparse:
+ Collaboration diagram for JointBeliefSparse:

Public Member Functions

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

Private Member Functions

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

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.

Detailed Description

JointBeliefSparse represents a sparse joint belief.

Definition at line 41 of file JointBeliefSparse.h.

Constructor & Destructor Documentation

JointBeliefSparse::JointBeliefSparse ( )

Default Constructor.

Definition at line 41 of file JointBeliefSparse.cpp.

Referenced by Clone().

JointBeliefSparse::JointBeliefSparse ( size_t  size)

Constructor which sets the size of the joint belief.

Definition at line 45 of file JointBeliefSparse.cpp.

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

Constructor which copies belief in this joint belief.

Definition at line 50 of file JointBeliefSparse.cpp.

JointBeliefSparse::JointBeliefSparse ( const JointBeliefInterface belief)

Constructor which copies belief in this joint belief.

Definition at line 55 of file JointBeliefSparse.cpp.

JointBeliefSparse::JointBeliefSparse ( const StateDistribution belief)

Definition at line 60 of file JointBeliefSparse.cpp.

JointBeliefSparse::~JointBeliefSparse ( )

Destructor.

Definition at line 65 of file JointBeliefSparse.cpp.

Member Function Documentation

virtual JointBeliefSparse* JointBeliefSparse::Clone ( ) const
inlinevirtual

Returns a pointer to a copy of this class.

Reimplemented from BeliefSparse.

Definition at line 78 of file JointBeliefSparse.h.

References JointBeliefSparse().

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

Definition at line 70 of file JointBeliefSparse.cpp.

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.

Definition at line 79 of file JointBeliefSparse.cpp.

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.

Definition at line 87 of file JointBeliefSparse.cpp.

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

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

double JointBeliefSparse::UpdateSlow ( const MultiAgentDecisionProcessDiscreteInterface pu,
Index  lastJAI,
Index  newJOI 
)
private

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