24 class MyFitness :
public IFitterTarget {
26 MyFitness() : IFitterTarget() {
40 Double_t EstimatorFunction( std::vector<Double_t> & factors ){
42 return (10.- factors.at(0) *factors.at(1) + factors.at(2));
49 class MyGA2nd :
public GeneticAlgorithm {
51 MyGA2nd( IFitterTarget& target,
Int_t size, vector<Interval*>& ranges ) : GeneticAlgorithm(target,
78 std::cout <<
"\n2nd EXAMPLE" << std::endl;
81 vector<Interval*> ranges;
82 ranges.push_back(
new Interval(0,15,30) );
83 ranges.push_back(
new Interval(0,13) );
84 ranges.push_back(
new Interval(0,5,3) );
86 for( std::vector<Interval*>::iterator it = ranges.begin(); it != ranges.end(); it++ ){
87 std::cout <<
" range: " << (*it)->GetMin() <<
" " << (*it)->GetMax() << std::endl;
98 MyGA2nd mg( *myFitness, 100, ranges );
102 #define CONVCRIT 0.0001
105 #define SCFACTOR 0.95
112 mg.CalculateFitness();
114 mg.GetGeneticPopulation().Print(0);
118 mg.GetGeneticPopulation().TrimPopulation();
132 GeneticGenes* genes = mg.GetGeneticPopulation().GetGenes( 0 );
133 std::vector<Double_t> gvec;
136 for( std::vector<Double_t>::iterator it = gvec.begin(); it<gvec.end(); it++ ){
137 std::cout <<
"FACTOR " << n <<
" : " << (*it) << std::endl;
148 cout <<
"Start Test TMVAGAexample" << endl
149 <<
"========================" << endl
155 int main(
int argc,
char** argv )
std::vector< Double_t > & GetFactors()
int main(int argc, char **argv)