41 Double_t EstimatorFunction( std::vector<Double_t> & factors ){
43 return (10.- factors.at(0) *factors.at(1) + factors.at(2));
78 void TMVAGAexample() {
80 std::cout <<
"Start Test TMVAGAexample" << std::endl
81 <<
"========================" << std::endl
82 <<
"\nEXAMPLE" << std::endl;
85 vector<Interval*> ranges;
86 ranges.push_back(
new Interval(0,15,30) );
87 ranges.push_back(
new Interval(0,13) );
88 ranges.push_back(
new Interval(0,5,3) );
90 for( std::vector<Interval*>::iterator it = ranges.begin(); it != ranges.end(); it++ ){
91 std::cout <<
" range: " << (*it)->GetMin() <<
" " << (*it)->GetMax() << std::endl;
102 MyGA2nd
mg( *myFitness, 100, ranges );
106 #define CONVCRIT 0.0001 109 #define SCFACTOR 0.95 116 mg.CalculateFitness();
118 mg.GetGeneticPopulation().Print(0);
119 std::cout <<
"---" << std::endl;
122 mg.GetGeneticPopulation().TrimPopulation();
132 mg.SpreadControl( SCSTEPS, SCRATE, SCFACTOR );
134 }
while (!
mg.HasConverged( CONVSTEPS, CONVCRIT ));
137 std::vector<Double_t> gvec;
140 for( std::vector<Double_t>::iterator it = gvec.begin(); it<gvec.end(); it++ ){
141 std::cout <<
"FACTOR " << n <<
" : " << (*it) << std::endl;
147 int main(
int argc,
char** argv )
static constexpr double mg
int main(int argc, char **argv)
Cut optimisation interface class for genetic algorithm.
The TMVA::Interval Class.
Base definition for genetic algorithm.
std::vector< Double_t > & GetFactors()
Abstract ClassifierFactory template that handles arbitrary types.
Interface for a fitter 'target'.