-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathmoses-ann-pole2-hillclimbing.cc
67 lines (46 loc) · 1.65 KB
/
moses-ann-pole2-hillclimbing.cc
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
#include <iostream>
#include <opencog/util/mt19937ar.h>
#include <opencog/util/Logger.h>
#include <opencog/asmoses/combo/interpreter/eval.h>
#include <opencog/asmoses/moses/deme/deme_expander.h>
#include <opencog/asmoses/moses/metapopulation/metapopulation.h>
#include <opencog/asmoses/moses/moses/moses_main.h>
#include <opencog/asmoses/moses/optimization/optimization.h>
#include <opencog/asmoses/moses/scoring/scoring_base.h>
#include "pole_scoring.h"
using namespace moses;
using namespace reduct;
using namespace boost;
using namespace std;
using namespace opencog;
int main(int argc, char** argv)
{
//set flag to print only cassert and other ERROR level logs on stdout
logger().set_print_error_level_stdout();
combo_tree tr;
cin >> tr;
tree_transform trans;
ann nn = trans.decodify_tree(tr);
cout << tr << endl;
cout << "Network depth: " << nn.feedforward_depth() << endl;
cout << &nn << endl;
randGen().seed(0);
type_tree tt(id::lambda_type);
tt.append_children(tt.begin(), id::ann_type, 1);
// DOUBLE MARKOVIAN POLE TASK`
ann_pole2_bscore p2_bscore;
behave_cscore cscorer(p2_bscore);
hill_climbing hc;
deme_expander dex(tt, clean_reduction(), clean_reduction(), cscorer, hc);
metapopulation metapop_pole2(tr, cscorer);
moses_parameters pa;
moses_statistics st;
run_moses(metapop_pole2, dex, pa, st);
combo_tree best = metapop_pole2.best_tree();
ann bestnet = trans.decodify_tree(best);
cout << "Best network: " << endl;
cout << &bestnet << endl;
bestnet.write_dot("best_nn.dot");
//for parameter sweet
cout << metapop_pole2.best_score() << endl;
}