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