MultiAgentDecisionProcess
Release 0.2.1
|
JointBeliefSparse represents a sparse joint belief. More...
#include <JointBeliefSparse.h>
Public Member Functions | |
virtual JointBeliefSparse * | Clone () 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) | |
JointBeliefSparse & | operator= (const JointBeliefSparse &o) |
JointBeliefInterface & | operator= (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. | |
![]() | |
JointBeliefInterface () | |
(default) Constructor | |
virtual | ~JointBeliefInterface () |
Destructor. | |
![]() | |
BeliefInterface () | |
(default) Constructor | |
virtual | ~BeliefInterface () |
Destructor. | |
![]() | |
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. | |
BeliefSparse & | operator= (const BeliefSparse &o) |
BeliefInterface & | operator= (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 | |
![]() | |
typedef boost::numeric::ublas::compressed_vector < double > | BS |
typedef BS::const_iterator | BScit |
typedef BS::iterator | BSit |
![]() | |
BS | _m_b |
The sparse vector to store the belief. |
JointBeliefSparse represents a sparse joint belief.
Definition at line 41 of file JointBeliefSparse.h.
JointBeliefSparse::JointBeliefSparse | ( | ) |
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.
|
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.
|
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.
|
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().
|
private |
Slow version of Update(), if GetTransitionModelDiscretePtr() is 0.
Almost literal copy of Update().
Definition at line 146 of file JointBeliefSparse.cpp.
References BeliefSparse::_m_b, MultiAgentDecisionProcessDiscreteInterface::GetObservationProbability(), MultiAgentDecisionProcessDiscreteInterface::GetTransitionProbability(), Globals::PROB_PRECISION, and BeliefSparse::SanityCheck().
Referenced by Update().