-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsarsa.hh
55 lines (40 loc) · 959 Bytes
/
sarsa.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* Code by Chris Mansley
*/
#ifndef SARSA_HH
#define SARSA_HH
/* Definition dependencies */
#include <fstream>
#include <boost/unordered_map.hpp>
#include "planner.hh"
#include "sars.hh"
class SARSA : public Planner
{
public:
/** Constructor */
SARSA(Domain *d, Chopper *c, double epsilon);
/** Destructor */
~SARSA( ) { }
/** Initialize the planner */
void initialize(std::string filename);
/** Query action */
Action plan(State s);
/** Restrict planner by queries */
void setMaxQueries(int queries) { }
/** Print data structure */
void print(State s) { }
protected:
/** Learning rate */
double alpha;
/** Local domain parameters */
double gamma;
int stateDimension;
int actionDimension;
/** Algorithm Data Structures */
boost::unordered_map<std::vector<int>, double> Q;
/** Logfile */
std::ifstream logfile;
/** Parse logfile */
void parseData(std::string filename);
};
#endif // SARSA_HH