MultiAgentDecisionProcess  Release 0.2.1
Belief.h
Go to the documentation of this file.
1 
28 /* Only include this header file once. */
29 #ifndef _BELIEF_H_
30 #define _BELIEF_H_ 1
31 
32 /* the include directives */
33 #include <iostream>
34 #include "Globals.h"
35 #include "BeliefInterface.h"
37 
38 class BeliefIterator;
39 
41 
42 class Belief : virtual public BeliefInterface
43 {
44 private:
45 
46  friend class BeliefIterator;
47 
48 protected:
49 
51  //std::vector<double> _m_b;
53 
54 public:
55 
57  Belief(size_t size);
58 
60  Belief(const std::vector<double> &belief);
61 
63  Belief(const BeliefInterface &belief);
64 
65  Belief(const StateDistribution& belief);
67  ~Belief();
68 
69  Belief& operator= (const Belief& o);
71 
72  // operators:
73  double& operator[] (Index& i) {
74  return(_m_b[i]);
75  }
76 
77  double& operator[] (int& i) {
78  return(_m_b[i]);
79  }
80 
81  //data manipulation (set) functions:
82 
83  virtual void Set(const std::vector<double> &belief);
84 
85  virtual void Set(Index sI, double prob) { _m_b[sI]=prob; }
86 
87  virtual void Set(const BeliefInterface &belief);
88 
89  virtual void Set(const StateDistribution& belief);
90 
91  //get (data) functions:
92 
93  double Get(Index sI) const { return(_m_b.at(sI)); };
94 
95  std::vector<double> Get() const { return(_m_b); };
96 
97  void Clear();
98 
99  std::string SoftPrint() const;
100 
101  void Print() const { std::cout << SoftPrint(); }
102 
103  unsigned int Size() const { return(_m_b.size()); }
104 
105  bool SanityCheck() const;
106 
107  double InnerProduct(const std::vector<double> &values) const;
108 
109  std::vector<double> InnerProduct(const VectorSet &v) const;
110 
111  std::vector<double> InnerProduct(const VectorSet &v,
112  const std::vector<bool> &mask) const;
113 
115 
117  virtual Belief* Clone() const
118  { return new Belief(*this); }
119 
120 };
121 
122 
123 #endif /* !_BELIEF_H_ */
124 
125 // Local Variables: ***
126 // mode:c++ ***
127 // End: ***