Scheduler
twoPhases.cpp
Go to the documentation of this file.
1 
10 #include "twoPhases.h"
11 
12 #include <mdp/context.h>
13 #include <mdp/mdpConfiguration.h>
14 
15 #include "matrixLearning.h"
16 #include "noLearning.h"
17 #include "solver.h"
18 
19 using namespace Mdp;
20 
21 TwoPhases::TwoPhases(std::shared_ptr<Context> c) : LearningStrategy(c)
22 {
23 }
24 
25 
27 {
28  delete learning;
29  delete acting;
30 }
31 
32 
34 {
36  acting = new NoLearning(context);
39 }
40 
41 
43 {
45  {
46  count++;
48  }
50  {
51  Solver *solver = context->conf->getSolverFromFile();
52  /*FIXME: remove the .get()s and use shared pointers everywhere*/
53  solver->solve(context->policy.get(), context->rewards.get(), context->constraintList.get(), context->matrix.get(), context->horizon.get());
54  }
56  {
57  acting->updateModel(); /*this supposedly does nothing*/
58  }
59 }
60 
TwoPhases(std::shared_ptr< Context > context)
Definition: twoPhases.cpp:21
virtual void solve(Policy *policy, Rewards *rewards, ConstraintList *constraintList, TransitionMatrix *matrix, Horizon *horizon)=0
LearningStrategy * learning
Definition: twoPhases.h:33
virtual void updateModel()=0
virtual void initializeModel()=0
LearningStrategy * acting
Definition: twoPhases.h:34
const int learningIterations
Definition: twoPhases.h:32
void updateModel()
Definition: twoPhases.cpp:42
Definition: action.h:18
void initializeModel()
Definition: twoPhases.cpp:33
std::shared_ptr< Context > context