ROOT logo
// @(#)root/tmva $Id: GeneticFitter.h 39395 2011-05-26 10:05:54Z moneta $ 
// Author: Peter Speckmayer

/**********************************************************************************
 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
 * Package: TMVA                                                                  *
 * Class  : GeneticFitter                                                         *
 * Web    : http://tmva.sourceforge.net                                           *
 *                                                                                *
 * Description:                                                                   *
 *       Fitter using a Genetic Algorithm                                         *
 *                                                                                *
 * Authors (alphabetical):                                                        *
 *      Peter Speckmayer <speckmay@mail.cern.ch>  - CERN, Switzerland             *
 *                                                                                *
 * Copyright (c) 2005:                                                            *
 *      CERN, Switzerland                                                         * 
 *      MPI-K Heidelberg, Germany                                                 * 
 *                                                                                *
 * Redistribution and use in source and binary forms, with or without             *
 * modification, are permitted according to the terms listed in LICENSE           *
 * (http://tmva.sourceforge.net/LICENSE)                                          *
 **********************************************************************************/

#ifndef ROOT_TMVA_GeneticFitter
#define ROOT_TMVA_GeneticFitter

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// GeneticFitter                                                        //
//                                                                      //
// Fitter using a Genetic Algorithm                                     //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TMVA_FitterBase
#include "TMVA/FitterBase.h"
#endif

namespace TMVA {

   class IFitterTarget;
   class Interval;

   class GeneticFitter : public FitterBase {

   public:

      GeneticFitter( IFitterTarget& target, const TString& name, 
                     const std::vector<TMVA::Interval*>& ranges, const TString& theOption );

      virtual ~GeneticFitter() {}

      void SetParameters( Int_t cycles,
                          Int_t nsteps,
                          Int_t popSize,
                          Int_t SC_steps,
                          Int_t SC_rate,
                          Double_t SC_factor,
                          Double_t convCrit );

      Double_t Run( std::vector<Double_t>& pars );

      Double_t NewFitness( Double_t oldF, Double_t newF ) { return oldF + newF; }

   private:

      void DeclareOptions();

      Int_t fCycles;                    // number of (nearly) independent calculation cycles
      Int_t fNsteps;                    // convergence criteria: if no improvements > fConvCrit was achieved within the last fNsteps: cycle has "converged"
      Int_t fPopSize;                   // number of individuals to start with
      Int_t fSC_steps;                  // regulates how strong the mutations for the coordinates are: if within fSC_steps there were more than...
      Int_t fSC_rate;                   // ... fSC_rate improvements, than multiply the sigma of the gaussion which defines how the random numbers are generated ...
      Double_t fSC_factor;              // ... with fSC_factor; if there were less improvements: divide by that factor; if there were exactly fSC_rate improvements, dont change anything
      Double_t fConvCrit;               // improvements bigger than fConvCrit are counted as "improvement"
      Int_t fSaveBestFromGeneration;    // store the best individuals from one generation (these are included as "hints" in the last cycle of GA calculation)
      Int_t fSaveBestFromCycle;         // store the best individuals from one cycle (these are included as "hints" in the last cycle of GA calculation)
      Bool_t fTrim;                     // take care, that the number of individuals is less fPopSize (trimming is done after the fitness of the individuals is assessed)
      UInt_t fSeed;                     // Seed for the random generator (0 takes random seeds)
      
      ClassDef(GeneticFitter,0) // Fitter using a Genetic Algorithm
   };

} // namespace TMVA

#endif


 GeneticFitter.h:1
 GeneticFitter.h:2
 GeneticFitter.h:3
 GeneticFitter.h:4
 GeneticFitter.h:5
 GeneticFitter.h:6
 GeneticFitter.h:7
 GeneticFitter.h:8
 GeneticFitter.h:9
 GeneticFitter.h:10
 GeneticFitter.h:11
 GeneticFitter.h:12
 GeneticFitter.h:13
 GeneticFitter.h:14
 GeneticFitter.h:15
 GeneticFitter.h:16
 GeneticFitter.h:17
 GeneticFitter.h:18
 GeneticFitter.h:19
 GeneticFitter.h:20
 GeneticFitter.h:21
 GeneticFitter.h:22
 GeneticFitter.h:23
 GeneticFitter.h:24
 GeneticFitter.h:25
 GeneticFitter.h:26
 GeneticFitter.h:27
 GeneticFitter.h:28
 GeneticFitter.h:29
 GeneticFitter.h:30
 GeneticFitter.h:31
 GeneticFitter.h:32
 GeneticFitter.h:33
 GeneticFitter.h:34
 GeneticFitter.h:35
 GeneticFitter.h:36
 GeneticFitter.h:37
 GeneticFitter.h:38
 GeneticFitter.h:39
 GeneticFitter.h:40
 GeneticFitter.h:41
 GeneticFitter.h:42
 GeneticFitter.h:43
 GeneticFitter.h:44
 GeneticFitter.h:45
 GeneticFitter.h:46
 GeneticFitter.h:47
 GeneticFitter.h:48
 GeneticFitter.h:49
 GeneticFitter.h:50
 GeneticFitter.h:51
 GeneticFitter.h:52
 GeneticFitter.h:53
 GeneticFitter.h:54
 GeneticFitter.h:55
 GeneticFitter.h:56
 GeneticFitter.h:57
 GeneticFitter.h:58
 GeneticFitter.h:59
 GeneticFitter.h:60
 GeneticFitter.h:61
 GeneticFitter.h:62
 GeneticFitter.h:63
 GeneticFitter.h:64
 GeneticFitter.h:65
 GeneticFitter.h:66
 GeneticFitter.h:67
 GeneticFitter.h:68
 GeneticFitter.h:69
 GeneticFitter.h:70
 GeneticFitter.h:71
 GeneticFitter.h:72
 GeneticFitter.h:73
 GeneticFitter.h:74
 GeneticFitter.h:75
 GeneticFitter.h:76
 GeneticFitter.h:77
 GeneticFitter.h:78
 GeneticFitter.h:79
 GeneticFitter.h:80
 GeneticFitter.h:81
 GeneticFitter.h:82
 GeneticFitter.h:83
 GeneticFitter.h:84
 GeneticFitter.h:85
 GeneticFitter.h:86
 GeneticFitter.h:87
 GeneticFitter.h:88
 GeneticFitter.h:89