-
Notifications
You must be signed in to change notification settings - Fork 0
/
Manager.hpp
143 lines (118 loc) · 2.65 KB
/
Manager.hpp
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/** meets domain: returns true if a sample meets a domain
struct model parameters error from training
** currently has support for up to 4 different models
*/
template <typename M1, typename M2 = M1, typename M3 = M1, typename M4 = M1>
class Manager{
private:
//struct edge_null {
// unsigned edge;
//};
//typedef edge_null E;
/**Holds policy and sample information**/
//struct model_info_type;
//typedef model_info_type O;//same as node value type
struct model_info_type;
public:
/** Graph typedefs **/
//typedef Graph<M,E> GraphType;
//typedef typename GraphType::size_type size_type;
typedef unsigned size_type;
//typedef typename GraphType::Node Model;
//typedef typename GraphType::Node model_type;
//ypedef typename GraphType::node_value_type model_info_type;
//typedef typename GraphType::node_iterator model_iterator;
typedef Manager manager_type;
Manager():models_(),used_m1_(0),used_m2_(0),used_m3_(0),used_m4_(0){
}
~Manager() = default;
Manager& operator=(const Manager&) = delete;
size_type num_models(){
return ((size_type) (used_m1_ + used_m2_ + used_m3_ + used_m4_));
}
void add_model(M1 m1 = M1(), M2 m2 = M2(), M3 m3 = M3(), M4 m4=M4()){
if (m1 != M1()){
models_.m1_ = m1;
used_m1_ = 1;
}
if (m2 != M2()){
models_.m2_ = m2;
used_m2_ = 1;
}
if (m3 != M3()){
models_.m3_ = m3;
used_m3_ = 1;
}
if (m4 != M4()){
models_.m4_ = m4;
used_m4_ = 1;
}
}
void clear_model(size_type id){
assert(id < 5 && id > 0);
if (id == 1){
models_.m1_ = M1();
used_m1_ = 0;
}
if (id == 2){
models_.m2_ = M2();
used_m2_ = 0;
}
if (id == 3){
models_.m3_ = M3();
used_m3_ = 0;
}
if (id == 4){
models_.m4_ = M4();
used_m4_ = 0;
}
}
M1 model1(){
return models_.m1_;
}
M2 model2(){
return models_.m2_;
}
M3 model3(){
return models_.m3_;
}
M4 model4(){
return models_.m4_;
}
/* M& model_value(Model m){
return m.value().mv_;
}*/
void clear(){
models_.m1_ = M1();
models_.m2_ = M2();
models_.m3_ = M3();
models_.m4_ = M4();
used_m1_ = 0;
used_m2_ = 0;
used_m3_ = 0;
used_m4_ = 0;
}
private:
/*struct model_info_type{
error_type emp_risk_;//risk
M mv_; //parameters
//user defined domain of model
};*/
/**Policy_info_type must have the same**/
//vector<M> models_;
//vector<size_type> model2uid_; //stores official uids associated with policies_
struct model_info_type{
M1 m1_;
M2 m2_;
M3 m3_;
M4 m4_;
model_info_type():m1_(M1()),m2_(M2()),m3_(M3()),m4_(M4()){
}
};
model_info_type models_;
//GraphType* graph_;
bool used_m1_;
bool used_m2_;
bool used_m3_;
bool used_m4_;
};