MultiAgentDecisionProcess  Release 0.2.1
ValueFunctionDecPOMDPDiscrete.h
Go to the documentation of this file.
1 
28 /* Only include this header file once. */
29 #ifndef _VALUEFUNCTIONDECPOMDPDISCRETE_H_
30 #define _VALUEFUNCTIONDECPOMDPDISCRETE_H_ 1
31 
32 /* the include directives */
33 #include <iostream>
34 #include <map>
35 #include "Globals.h"
36 #include "ValueFunction.h"
37 #include "Referrer.h"
40 #include <boost/numeric/ublas/matrix.hpp>
41 
46  public ValueFunction,
47  public Referrer<PlanningUnitDecPOMDPDiscrete>,
48  public Referrer<JointPolicyDiscretePure>
49 {
50  private:
53 
54  //some number we cache for speed:
55  size_t _m_nrJOH;
56  size_t _m_nrJO;
57  size_t _m_nrS;
58  size_t _m_h;
60  typedef boost::numeric::ublas::matrix<double> Matrix;
61 
62  Matrix* _m_p_V; //stores V(sI, JOHistI)
63  std::map<Index, bool> _m_cached; // (s,JOHist)-index -> bool
64 
66  //{ return( sI*GetPU()->GetNrJointObservationHistories() + JOHI ); }
67  { return( sI*_m_nrJOH + JOHI ); }
68  bool IsCached(Index sI, Index JOHI)
69  { return(_m_cached[GetCombinedIndex(sI, JOHI)]); }
70  void SetCached(Index sI, Index JOHI);
71 
73  void DeleteV();
77  void CreateV();
78 
80  { return _m_pu;
81  //return( Referrer<PlanningUnitDecPOMDPDiscrete>::GetReferred() );
82  }
84  { return _m_jpol;
85  //return( Referrer<JointPolicyDiscretePure>::GetReferred() );
86  }
87 
91  double CalculateVsjohRecursivelyNotCached(Index sI, Index johI,Index stage);
95  double CalculateVsjohRecursivelyCached(Index sI, Index johI, Index stage);
98 
99  protected:
100 
101  public:
102  // Constructor, destructor and copy assignment.
113 
115  double CalculateV(bool cache = true);
116 
117 };
118 
119 
120 #endif /* !_VALUEFUNCTIONDECPOMDPDISCRETE_H_ */
121 
122 // Local Variables: ***
123 // mode:c++ ***
124 // End: ***