-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrainer_farm.h
More file actions
69 lines (54 loc) · 1.62 KB
/
trainer_farm.h
File metadata and controls
69 lines (54 loc) · 1.62 KB
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
#ifndef TRAINERFARM_H
#define TRAINERFARM_H
#include <boost/serialization/forward_list.hpp>
#include <boost/serialization/deque.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/split_member.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <deque>
#include <forward_list>
#include <memory>
#include <vector>
#include "matrix_branch.h"
#include "shape.h"
#include "trainer.h"
class TrainerFarm
{
public:
TrainerFarm();
TrainerFarm(std::shared_ptr<Trainer> first_seed);
void grow(int cycles, int coef, Shape shape);
void populate(int coef, Shape shape);
void harverst_one(bool normalise, Shape shape);
void harverst_cycle(int depth_increase, bool normalise, Shape shape);
void force_normalise();
boost::numeric::ublas::vector<double> generate_random(Shape shape) const;
void show_trees();
double get_max_volume();
private:
std::deque<std::shared_ptr<Trainer> > seeds;
int total_trues;
int current_depth;
std::forward_list<std::shared_ptr<MatrixBranch> > matrix_stock;
private:
friend class boost::serialization::access;
template<class Archive>
void save(Archive& ar, const unsigned int version) const {
ar & matrix_stock;
ar & seeds;
ar & total_trues;
ar & current_depth;
}
template<class Archive>
void load(Archive& ar, const unsigned int version) {
ar & matrix_stock;
ar & seeds;
ar & total_trues;
ar & current_depth;
for (auto& it : seeds) {
it->give_matrix_stock(&matrix_stock);
}
}
BOOST_SERIALIZATION_SPLIT_MEMBER()
};
#endif // TRAINERFARM_H