Scheduler
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
mdp
learning
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
26
TwoPhases::~TwoPhases
()
27
{
28
delete
learning
;
29
delete
acting
;
30
}
31
32
33
void
TwoPhases::initializeModel
()
34
{
35
learning
=
new
MatrixLearning
(
context
);
36
acting
=
new
NoLearning
(
context
);
37
learning
->
initializeModel
();
38
acting
->
initializeModel
();
39
}
40
41
42
void
TwoPhases::updateModel
()
43
{
44
if
(
count
<
learningIterations
)
45
{
46
count
++;
47
learning
->
updateModel
();
48
}
49
if
(
count
==
learningIterations
)
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
}
55
if
(
count
>
learningIterations
)
56
{
57
acting
->
updateModel
();
/*this supposedly does nothing*/
58
}
59
}
60
Mdp::TwoPhases::TwoPhases
TwoPhases(std::shared_ptr< Context > context)
Definition:
twoPhases.cpp:21
context.h
Mdp::Solver::solve
virtual void solve(Policy *policy, Rewards *rewards, ConstraintList *constraintList, TransitionMatrix *matrix, Horizon *horizon)=0
Mdp::TwoPhases::learning
LearningStrategy * learning
Definition:
twoPhases.h:33
Mdp::LearningStrategy::updateModel
virtual void updateModel()=0
Mdp::MatrixLearning
Definition:
matrixLearning.h:23
Mdp::LearningStrategy::initializeModel
virtual void initializeModel()=0
Mdp::TwoPhases::acting
LearningStrategy * acting
Definition:
twoPhases.h:34
Mdp::TwoPhases::learningIterations
const int learningIterations
Definition:
twoPhases.h:32
Mdp::TwoPhases::~TwoPhases
~TwoPhases()
Definition:
twoPhases.cpp:26
Mdp::Solver
Definition:
solver.h:21
Mdp::NoLearning
Definition:
noLearning.h:20
Mdp::TwoPhases::updateModel
void updateModel()
Definition:
twoPhases.cpp:42
Mdp::LearningStrategy
Definition:
learningStrategy.h:21
Mdp
Definition:
action.h:18
noLearning.h
solver.h
mdpConfiguration.h
Mdp::TwoPhases::count
int count
Definition:
twoPhases.h:31
twoPhases.h
Mdp::TwoPhases::initializeModel
void initializeModel()
Definition:
twoPhases.cpp:33
Mdp::LearningStrategy::context
std::shared_ptr< Context > context
Definition:
learningStrategy.h:28
matrixLearning.h
Generated on Sun Nov 26 2017 17:01:36 for Scheduler by
1.8.11