MultiAgentDecisionProcess  Release 0.2.1
Interface_ProblemToPolicyDiscretePure.h
Go to the documentation of this file.
1 
28 /* Only include this header file once. */
29 #ifndef _INTERFACE_PROBLEMTOPOLICYDISCRETEPURE_H_
30 #define _INTERFACE_PROBLEMTOPOLICYDISCRETEPURE_H_ 1
31 
32 /* the include directives */
33 #include <iostream>
34 #include <vector>
35 #include <cmath>
36 #include "Globals.h"
38 #include "EOverflow.h"
39 
50 {
51  private:
52 
53  protected:
54 
55  public:
58 
62  size_t depth=MAXHORIZON) const
63  {
64 #if 0 // don't use powl(), we want to detect overflow
65  LIndex nr_pols =
66  static_cast<LIndex>(
67  powl( GetNrActions(ag),
68  GetNrPolicyDomainElements(ag,cat,depth) ));
69 #endif
70  LIndex nrPols=1;
71  for(size_t k=0;k!=GetNrPolicyDomainElements(ag,cat,depth);++k)
72  {
73  LIndex nrPolsOld=nrPols;
74  nrPols*=GetNrActions(ag);
75  if(nrPols<nrPolsOld)
76  throw(EOverflow("Interface_ProblemToPolicyDiscretePure::GetNrPolicies() overflow detected"));
77  }
78  return(nrPols);
79  }
80 
83  size_t depth=MAXHORIZON) const
84  {
85  LIndex n=1;
86  for(Index ag=0; ag < GetNrAgents(); ag++)
87  {
88  LIndex nOld=n;
89  n *= GetNrPolicies(ag,cat,depth);
90  if(n<nOld)
91  throw(EOverflow("Interface_ProblemToPolicyDiscretePure::GetNrJointPolicies() overflow detected"));
92  }
93 
94  return(n);
95  }
96 
97 };
98 
99 
100 #endif /* !_INTERFACE_PROBLEMTOPOLICYDISCRETEPURE_H_ */
101 
102 // Local Variables: ***
103 // mode:c++ ***
104 // End: ***