-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuct.hh
57 lines (44 loc) · 1.14 KB
/
uct.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
56
57
/*
* Code by Chris Mansley
*/
#ifndef UCT_HH
#define UCT_HH
/* Definition dependencies */
//#include <map>
#include <boost/unordered_map.hpp>
#include <string>
#include <vector>
#include "mcplanner.hh"
#include "chopper.hh"
#include "domain.hh"
class UCT : public MCPlanner
{
public:
/** Constructor */
UCT(Domain *d, Chopper *c, double epsilon);
/** Destructor */
~UCT() { }
/** Initialize the planner */
void initialize(std::string filename);
void print(State s);
private:
/** Local store of domain params */
double gamma;
double rmax;
double rmin;
double vmax;
/** Algorithm Data Structures */
//std::map<std::vector<int>, int> Nsd;
//std::map<std::vector<int>, int> Nsad;
//std::map<std::vector<int>, double> Q;
boost::unordered_map<std::vector<int>, int> Nsd;
boost::unordered_map<std::vector<int>, int> Nsad;
boost::unordered_map<std::vector<int>, double> Q;
/** Update value */
void updateValue(int depth, SARS *sars, double qvalue);
/** Select next action (greedily or not) */
Action selectAction(State s, int depth, bool greedy);
/** Clear out data stuctures */
void reset();
};
#endif // UCT_HH