Scheduler
temperatureDimension.cpp
Go to the documentation of this file.
1 
10 #include "temperatureDimension.h"
11 
12 #include <cmath>
13 #include <stdexcept>
14 
15 #include <scheduler/system.h>
16 #include <scheduler/processor.h>
17 
18 using namespace RlScheduler;
19 
21 {
22  return "TemperatureDimension";
23 }
24 
26 {
27  return nbOfPositions;
28 }
29 
30 
32 {
34  Mdp::statePosition_t ret = discretizePosition(temp);
35  return ret;
36 }
37 
38 Mdp::statePosition_t TemperatureDimension::discretizePosition(double temp) const
39 {
40  if (temp < minTemp)
41  {
42  temp = minTemp;
43  }
44  if (temp > maxTemp)
45  {
46  temp = maxTemp;
47  }
48  double pos = temp - minTemp;
49  pos /= maxTemp;
50  pos *= ((double) nbOfPositions - 1.0);
51 
52  pos = floor(pos);
53  return (Mdp::statePosition_t) pos;
54 }
55 
list temp
Definition: bigtemp.py:9
size_t getNumberOfPositions() override
returns the number of possible positions along that dimension
static System * getInstance()
Definition: system.cpp:28
double getTemperature() const
Definition: processor.cpp:185
Mdp::statePosition_t getPosition() override
gets the position of the state along that dimension
int statePosition_t
std::string getName() override
returns the name of that dimension
Processor * getProc()
return the processor
Definition: system.cpp:76