00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef EOSYMINIT_H
00019 #define EOSYMINIT_H
00020
00021 #include <eoInit.h>
00022 #include <gen/TreeBuilder.h>
00023
00025 template <class EoType>
00026 class eoSymInit : public eoInit<EoType> {
00027
00028 TreeBuilder& builder;
00029
00030 double own_grow_prob;
00031 unsigned own_max_depth;
00032
00033
00034 double& grow_prob;
00035 unsigned& max_depth;
00036
00037 public:
00038
00040 eoSymInit(TreeBuilder& _builder)
00041 : builder(_builder),
00042 own_grow_prob(0.5),
00043 own_max_depth(6),
00044 grow_prob(own_grow_prob),
00045 max_depth(own_max_depth)
00046 {}
00047
00049 eoSymInit(TreeBuilder& _builder, double& _grow_prob, unsigned& _max_depth)
00050 : builder(_builder),
00051 grow_prob(_grow_prob),
00052 max_depth(_max_depth)
00053 {}
00054
00056 void operator()(EoType& tree) {
00057 int depth_to_use = rng.random(max_depth-2) + 2;
00058 builder.build_tree(tree, depth_to_use, rng.flip(grow_prob));
00059 }
00060
00061 };
00062
00063 #endif
00064