Start Test TMVAGAexample
========================
EXAMPLE
range: 0 15
range: 0 13
range: 0 5
: fitness: -151.221 f_0: 13.9655 f_1: 11.9022 f_2: 5
---
: fitness: -163.475 f_0: 14.4828 f_1: 12.3233 f_2: 5
---
: fitness: -163.475 f_0: 14.4828 f_1: 12.3233 f_2: 5
---
: fitness: -166.366 f_0: 13.9655 f_1: 12.8077 f_2: 2.5
---
: fitness: -172.349 f_0: 15 f_1: 12.3233 f_2: 2.5
---
: fitness: -174.849 f_0: 15 f_1: 12.3233 f_2: 0
---
: fitness: -179.616 f_0: 15 f_1: 12.8077 f_2: 2.5
---
: fitness: -179.616 f_0: 15 f_1: 12.8077 f_2: 2.5
---
: fitness: -181.901 f_0: 15 f_1: 12.9601 f_2: 2.5
---
: fitness: -182.116 f_0: 15 f_1: 12.8077 f_2: 0
---
: fitness: -183.823 f_0: 15 f_1: 12.9216 f_2: 0
---
: fitness: -184.401 f_0: 15 f_1: 12.9601 f_2: 0
---
: fitness: -184.401 f_0: 15 f_1: 12.9601 f_2: 0
---
: fitness: -184.401 f_0: 15 f_1: 12.9601 f_2: 0
---
: fitness: -184.401 f_0: 15 f_1: 12.9601 f_2: 0
---
: fitness: -184.401 f_0: 15 f_1: 12.9601 f_2: 0
---
: fitness: -184.401 f_0: 15 f_1: 12.9601 f_2: 0
---
: fitness: -184.401 f_0: 15 f_1: 12.9601 f_2: 0
---
: fitness: -184.401 f_0: 15 f_1: 12.9601 f_2: 0
---
: fitness: -184.463 f_0: 15 f_1: 12.9642 f_2: 0
---
: fitness: -184.463 f_0: 15 f_1: 12.9642 f_2: 0
---
: fitness: -184.463 f_0: 15 f_1: 12.9642 f_2: 0
---
: fitness: -184.463 f_0: 15 f_1: 12.9642 f_2: 0
---
: fitness: -184.463 f_0: 15 f_1: 12.9642 f_2: 0
---
: fitness: -184.771 f_0: 15 f_1: 12.9847 f_2: 0
---
: fitness: -184.771 f_0: 15 f_1: 12.9847 f_2: 0
---
: fitness: -184.771 f_0: 15 f_1: 12.9847 f_2: 0
---
: fitness: -184.771 f_0: 15 f_1: 12.9847 f_2: 0
---
: fitness: -184.771 f_0: 15 f_1: 12.9847 f_2: 0
---
: fitness: -184.771 f_0: 15 f_1: 12.9847 f_2: 0
---
: fitness: -184.771 f_0: 15 f_1: 12.9847 f_2: 0
---
: fitness: -184.771 f_0: 15 f_1: 12.9847 f_2: 0
---
: fitness: -184.771 f_0: 15 f_1: 12.9847 f_2: 0
---
: fitness: -184.771 f_0: 15 f_1: 12.9847 f_2: 0
---
: fitness: -184.771 f_0: 15 f_1: 12.9847 f_2: 0
---
: fitness: -184.771 f_0: 15 f_1: 12.9847 f_2: 0
---
: fitness: -184.771 f_0: 15 f_1: 12.9847 f_2: 0
---
: fitness: -184.771 f_0: 15 f_1: 12.9847 f_2: 0
---
: fitness: -184.771 f_0: 15 f_1: 12.9847 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
: fitness: -184.966 f_0: 15 f_1: 12.9977 f_2: 0
---
FACTOR 0 : 15
FACTOR 1 : 12.9977
FACTOR 2 : 0
#include <iostream>
#include <vector>
using namespace std;
public:
}
Double_t EstimatorFunction( std::vector<Double_t> & factors ){
return (10.- factors.at(0) *factors.at(1) + factors.at(2));
}
};
public:
}
};
void TMVAGAexample() {
std::cout << "Start Test TMVAGAexample" << std::endl
<< "========================" << std::endl
<< "\nEXAMPLE" << std::endl;
vector<Interval*> ranges;
ranges.push_back(
new Interval(0,15,30) );
ranges.push_back(
new Interval(0,5,3) );
for( std::vector<Interval*>::iterator it = ranges.begin(); it != ranges.end(); it++ ){
std::cout << " range: " << (*it)->GetMin() << " " << (*it)->GetMax() << std::endl;
}
MyGA2nd mg( *myFitness, 100, ranges );
#define CONVSTEPS 20
#define CONVCRIT 0.0001
#define SCSTEPS 10
#define SCRATE 5
#define SCFACTOR 0.95
do {
mg.Init();
mg.CalculateFitness();
mg.GetGeneticPopulation().Print(0);
std::cout << "---" << std::endl;
mg.GetGeneticPopulation().TrimPopulation();
mg.SpreadControl( SCSTEPS, SCRATE, SCFACTOR );
} while (!mg.HasConverged( CONVSTEPS, CONVCRIT ));
GeneticGenes* genes = mg.GetGeneticPopulation().GetGenes( 0 );
std::vector<Double_t> gvec;
for( std::vector<Double_t>::iterator it = gvec.begin(); it<gvec.end(); it++ ){
std::cout <<
"FACTOR " <<
n <<
" : " << (*it) << std::endl;
}
}
int main(
int argc,
char** argv )
{
TMVAGAexample();
}
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Base definition for genetic algorithm.
Cut optimisation interface class for genetic algorithm.
std::vector< Double_t > & GetFactors()
Interface for a fitter 'target'.
The TMVA::Interval Class.
create variable transformations