MultiAgentDecisionProcess  Release 0.2.1
PlanningUnitDecPOMDPDiscrete.cpp
Go to the documentation of this file.
1 
29 
30 using namespace std;
31 
32 //Default constructor
35  size_t horizon,
37  ) :
39  PlanningUnitMADPDiscrete(params,horizon,p)
40 {
41  if(DEBUG_PU_CONSTRUCTORS) cout << "PlanningUnitDecPOMDPDiscrete(PlanningUnitMADPDiscreteParameters params, size_t horizon, DecPOMDPDiscreteInterface* p) called" << endl;
42  if(p!=0)
43  SanityCheck();
44 }
45 
47  size_t horizon,
49  ) :
51  PlanningUnitMADPDiscrete(horizon,p)
52 {
53  if(DEBUG_PU_CONSTRUCTORS) cout << "PlanningUnitDecPOMDPDiscrete(size_t horizon, DecPOMDPDiscreteInterface* p) called" << endl;
54  if(p!=0)
55  SanityCheck();
56 }
57 
59 {
60  if(p == GetReferred())
61  return;
62  SetReferred(p);
63 
64  //set (and initialize) the problem at PlanningUnitMADPDiscrete level:
68 
69  SanityCheck();
70 }
71 
73 {
75 
76  // we cannot check anything check
77  if(GetReferred()==0)
78  return(sane);
79 
80  if(GetDiscount() < 0 || GetDiscount() > 1)
81  {
82  sane=false;
83  throw(E("PlanningUnitDecPOMDPDiscrete::SanityCheck() failed, discount should be between 0 and 1"));
84  }
85 
86  if(GetHorizon() == MAXHORIZON &&
87  abs(GetDiscount()-1) < PROB_PRECISION)
88  {
89  sane=false;
90  throw(E("PlanningUnitDecPOMDPDiscrete::SanityCheck() failed, in the infinite-horizon case the discount should be less than one"));
91  }
92 
93  return(sane);
94 }
95