MultiAgentDecisionProcess
|
BeliefSparse represents a probability distribution over the state space. More...
#include <BeliefSparse.h>
Public Member Functions | |
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... | |
virtual BeliefSparse * | Clone () 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... | |
unsigned int | NumberNonZeros () const |
BeliefSparse & | operator= (const BeliefSparse &o) |
BeliefInterface & | operator= (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... | |
Public Member Functions inherited from BeliefInterface | |
BeliefInterface () | |
(default) Constructor More... | |
virtual | ~BeliefInterface () |
Destructor. More... | |
Protected Types | |
typedef boost::numeric::ublas::compressed_vector < double > | BS |
typedef BS::const_iterator | BScit |
typedef BS::iterator | BSit |
Protected Attributes | |
BS | _m_b |
The sparse vector to store the belief. More... | |
Friends | |
class | BeliefIteratorSparse |
BeliefSparse represents a probability distribution over the state space.
It is stored as a sparse vector.
|
protected |
|
protected |
|
protected |
BeliefSparse::BeliefSparse | ( | ) |
Default Constructor.
Referenced by Clone().
BeliefSparse::BeliefSparse | ( | size_t | size | ) |
Constructor which sets the size of the joint belief.
BeliefSparse::BeliefSparse | ( | const std::vector< double > & | belief | ) |
Constructor which copies belief in this joint belief.
BeliefSparse::BeliefSparse | ( | const BeliefInterface & | belief | ) |
Constructor which copies belief in this joint belief.
BeliefSparse::BeliefSparse | ( | const StateDistribution & | belief | ) |
BeliefSparse::~BeliefSparse | ( | ) |
Destructor.
|
virtual |
Clears the belief.
Implements BeliefInterface.
|
inlinevirtual |
Returns a pointer to a copy of this class.
Implements BeliefInterface.
Reimplemented in JointBeliefSparse.
References BeliefSparse().
|
inlinevirtual |
Gets the probability of the sI'th state.
Implements BeliefInterface.
Referenced by AgentQMDP::Act().
|
inlinevirtual |
Gets a vector of probabilities representing the belief.
Implements BeliefInterface.
|
virtual |
Implements BeliefInterface.
|
virtual |
Computes the inner product of a belief with the vector values.
Implements BeliefInterface.
|
virtual |
Computes the inner product of a belief with the VectorSet v.
Returns the inner product with each vector in v.
Implements BeliefInterface.
|
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.
|
inline |
Referenced by BeliefIteratorSparse::BeliefIteratorSparse().
BeliefSparse & BeliefSparse::operator= | ( | const BeliefSparse & | o | ) |
References _m_b.
Referenced by JointBeliefSparse::operator=().
|
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.
|
inlinevirtual |
Gets the probability of the i'th state.
Implements BeliefInterface.
|
inlinevirtual |
Gets the probability of the i'th state.
Implements BeliefInterface.
|
inlinevirtual |
Prints the belief.
Implements BeliefInterface.
References SoftPrint().
Referenced by AgentQMDP::Act().
|
virtual |
Checks whether the belief is a valid probability distribution.
Implements BeliefInterface.
References Globals::PROB_PRECISION.
Referenced by JointBeliefSparse::Update(), and JointBeliefSparse::UpdateSlow().
void BeliefSparse::Set | ( | const BS & | belief | ) |
Referenced by AgentQMDP::ResetEpisode(), and AgentBG::ResetEpisode().
|
virtual |
Copy the belief into this object.
Implements BeliefInterface.
|
inlinevirtual |
Sets probability of the sI'th state to prob .
Implements BeliefInterface.
|
virtual |
Copy the belief into this object.
Implements BeliefInterface.
References BeliefInterface::Get(), and BeliefInterface::Size().
|
virtual |
Copy the belief into this object.
Implements BeliefInterface.
References StateDistribution::GetNrStates(), and StateDistribution::GetProbability().
|
inlinevirtual |
Returns the size of this belief.
Implements BeliefInterface.
Referenced by BeliefIteratorSparse::BeliefIteratorSparse().
|
virtual |
|
friend |
|
protected |
The sparse vector to store the belief.
Referenced by BeliefIteratorSparse::BeliefIteratorSparse(), BeliefIteratorSparse::Next(), operator=(), JointBeliefSparse::Update(), and JointBeliefSparse::UpdateSlow().