MultiAgentDecisionProcess  Release 0.2.1
ObservationModelMappingSparse.h
Go to the documentation of this file.
1 
28 /* Only include this header file once. */
29 #ifndef _OBSERVATIONMODELMAPPINGSPARSE_H_
30 #define _OBSERVATIONMODELMAPPINGSPARSE_H_ 1
31 
32 /* the include directives */
33 #include "Globals.h"
35 #include <boost/numeric/ublas/matrix_sparse.hpp>
36 class OGet;
38 
40 
43 {
44 public:
45 #if BOOST_1_32_OR_LOWER // they renamed sparse_vector to mapped_vector
46  typedef boost::numeric::ublas::sparse_matrix<double> SparseMatrix;
47 #else
48  typedef boost::numeric::ublas::compressed_matrix<double> SparseMatrix;
49 #endif
50 
51 
52 private:
53 
54  std::vector<SparseMatrix* > _m_O;
55 
56 protected:
57 
58 public:
59  // Constructor, destructor and copy assignment.
61  ObservationModelMappingSparse(int nrS = 1, int nrJA = 1, int nrJO = 1);
62 
67 
69  double Get(Index ja_i, Index suc_s_i, Index jo_i) const
70  { return((*_m_O[ja_i])(suc_s_i,jo_i)); }
71 
72  //data manipulation funtions:
74 
79  void Set(Index ja_i, Index suc_s_i, Index jo_i, double prob)
80  {
81  // make sure probability is not 0
82  if(prob > PROB_PRECISION)
83  (*_m_O[ja_i])(suc_s_i,jo_i)=prob;
84  }
85 
88  { return(_m_O.at(a)); }
89 
92  { return new ObservationModelMappingSparse(*this); }
93 
95 };
96 
97 #endif /* !_OBSERVATIONMODELMAPPINGSPARSE_H_*/
98 
99 // Local Variables: ***
100 // mode:c++ ***
101 // End: ***
102