-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnode.hh
76 lines (53 loc) · 1.25 KB
/
node.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* Code by Chris Mansley
*/
#ifndef NODE_HH
#define NODE_HH
#include "action.hh"
class HOO;
class Node
{
public:
/** Constructor */
Node(HOO *h);
/** Destructor */
~Node() {}
/** Leaf status */
bool inS() { return Sflag; }
/** Leaf status */
bool isLeaf() { return ((left==NULL) && (right==NULL)); }
/** Initialize node range value */
void rangeInit(std::vector<double> min, std::vector<double> max) { minRange = min; maxRange = max; }
/** Split this leaf */
void split();
/** Rebuild the B-values of this node's subtree */
double rebuildSubTree();
/** Return the currently best action */
void bestAction(Action &a, bool greedy);
/** Recursively insert a value at action a */
void insertValue(Action a, double q);
/** Recursively delete subtrees */
void clear();
void print();
private:
/** Parent stucture */
HOO *hoo;
/** Children */
Node *left;
Node *right;
/** HOO Values */
double mu;
int nsamples;
double Bval;
int depth;
/** Tree data */
int splitDim;
double splitValue;
bool Sflag; // Do I need this
/** Split ranges */
std::vector<double> minRange;
std::vector<double> maxRange;
/** Sample an action from the node */
Action sampleAction();
};
#endif // NODE_HH