ROOT logo
// @(#)root/mathcore:$Id

/**********************************************************************
 *                                                                    *
 * Copyright (c) 2006  LCG ROOT Math Team, CERN/PH-SFT                *
 *                                                                    *
 *                                                                    *
 **********************************************************************/

// Header file for class GeneticMinimizer

#ifndef ROOT_Math_GeneticMinimizer
#define ROOT_Math_GeneticMinimizer

#include <vector>

#include "Math/Minimizer.h"

#include "TMVA/IFitterTarget.h"
#include "TMVA/Interval.h"

namespace ROOT { 
   namespace Math { 


//_______________________________________________________________________________
/*
  structure containing the parameters of the genetic minimizer 
 */ 
struct GeneticMinimizerParameters { 

   Int_t fPopSize;
   Int_t fNsteps;
   Int_t fCycles; 
   Int_t fSC_steps;
   Int_t fSC_rate;
   Double_t fSC_factor;
   Double_t fConvCrit;
   Int_t fSeed; 
   

   // constructor with default value
   GeneticMinimizerParameters(); 
};



//_______________________________________________________________________________
/** 
   GeneticMinimizer

   @ingroup MultiMin
*/
class GeneticMinimizer: public ROOT::Math::Minimizer {

public: 

   //GeneticMinimizer (int = 0);
   GeneticMinimizer (int i = 0);
   virtual ~GeneticMinimizer ();

   virtual void Clear();
   using ROOT::Math::Minimizer::SetFunction;
   virtual void SetFunction(const ROOT::Math::IMultiGenFunction & func); 

   virtual bool SetLimitedVariable(unsigned int , const std::string& , double , double , double, double);
   virtual bool SetVariable(unsigned int ivar, const std::string & name, double val, double step); 
   virtual bool SetFixedVariable(unsigned int ivar  , const std::string & name , double val); 

   virtual  bool Minimize(); 
   virtual double MinValue() const; 
   virtual double Edm() const; 
   virtual const double *  X() const; 
   virtual const double *  MinGradient() const;  
   virtual unsigned int NCalls() const;    

   virtual unsigned int NDim() const;  
   virtual unsigned int NFree() const;  

   virtual bool ProvidesError() const; 
   virtual const double * Errors() const;

   virtual double CovMatrix(unsigned int i, unsigned int j) const;  

   void SetParameters(const GeneticMinimizerParameters & params );

   void SetRandomSeed(int seed) { fParameters.fSeed = seed; }

   const GeneticMinimizerParameters & MinimizerParameters() const { return fParameters; }

   virtual ROOT::Math::MinimizerOptions Options() const; 

   virtual void SetOptions(const ROOT::Math::MinimizerOptions & opt);

protected:

   void GetGeneticOptions(ROOT::Math::MinimizerOptions & opt) const; 

   std::vector<TMVA::Interval*> fRanges;
   TMVA::IFitterTarget* fFitness;
   double fMinValue;
   std::vector<double> fResult;

   GeneticMinimizerParameters fParameters; 

}; 


   } // end namespace Math
} // end namespace ROOT

#endif /* ROOT_Math_GeneticMinimizer */
 GeneticMinimizer.h:1
 GeneticMinimizer.h:2
 GeneticMinimizer.h:3
 GeneticMinimizer.h:4
 GeneticMinimizer.h:5
 GeneticMinimizer.h:6
 GeneticMinimizer.h:7
 GeneticMinimizer.h:8
 GeneticMinimizer.h:9
 GeneticMinimizer.h:10
 GeneticMinimizer.h:11
 GeneticMinimizer.h:12
 GeneticMinimizer.h:13
 GeneticMinimizer.h:14
 GeneticMinimizer.h:15
 GeneticMinimizer.h:16
 GeneticMinimizer.h:17
 GeneticMinimizer.h:18
 GeneticMinimizer.h:19
 GeneticMinimizer.h:20
 GeneticMinimizer.h:21
 GeneticMinimizer.h:22
 GeneticMinimizer.h:23
 GeneticMinimizer.h:24
 GeneticMinimizer.h:25
 GeneticMinimizer.h:26
 GeneticMinimizer.h:27
 GeneticMinimizer.h:28
 GeneticMinimizer.h:29
 GeneticMinimizer.h:30
 GeneticMinimizer.h:31
 GeneticMinimizer.h:32
 GeneticMinimizer.h:33
 GeneticMinimizer.h:34
 GeneticMinimizer.h:35
 GeneticMinimizer.h:36
 GeneticMinimizer.h:37
 GeneticMinimizer.h:38
 GeneticMinimizer.h:39
 GeneticMinimizer.h:40
 GeneticMinimizer.h:41
 GeneticMinimizer.h:42
 GeneticMinimizer.h:43
 GeneticMinimizer.h:44
 GeneticMinimizer.h:45
 GeneticMinimizer.h:46
 GeneticMinimizer.h:47
 GeneticMinimizer.h:48
 GeneticMinimizer.h:49
 GeneticMinimizer.h:50
 GeneticMinimizer.h:51
 GeneticMinimizer.h:52
 GeneticMinimizer.h:53
 GeneticMinimizer.h:54
 GeneticMinimizer.h:55
 GeneticMinimizer.h:56
 GeneticMinimizer.h:57
 GeneticMinimizer.h:58
 GeneticMinimizer.h:59
 GeneticMinimizer.h:60
 GeneticMinimizer.h:61
 GeneticMinimizer.h:62
 GeneticMinimizer.h:63
 GeneticMinimizer.h:64
 GeneticMinimizer.h:65
 GeneticMinimizer.h:66
 GeneticMinimizer.h:67
 GeneticMinimizer.h:68
 GeneticMinimizer.h:69
 GeneticMinimizer.h:70
 GeneticMinimizer.h:71
 GeneticMinimizer.h:72
 GeneticMinimizer.h:73
 GeneticMinimizer.h:74
 GeneticMinimizer.h:75
 GeneticMinimizer.h:76
 GeneticMinimizer.h:77
 GeneticMinimizer.h:78
 GeneticMinimizer.h:79
 GeneticMinimizer.h:80
 GeneticMinimizer.h:81
 GeneticMinimizer.h:82
 GeneticMinimizer.h:83
 GeneticMinimizer.h:84
 GeneticMinimizer.h:85
 GeneticMinimizer.h:86
 GeneticMinimizer.h:87
 GeneticMinimizer.h:88
 GeneticMinimizer.h:89
 GeneticMinimizer.h:90
 GeneticMinimizer.h:91
 GeneticMinimizer.h:92
 GeneticMinimizer.h:93
 GeneticMinimizer.h:94
 GeneticMinimizer.h:95
 GeneticMinimizer.h:96
 GeneticMinimizer.h:97
 GeneticMinimizer.h:98
 GeneticMinimizer.h:99
 GeneticMinimizer.h:100
 GeneticMinimizer.h:101
 GeneticMinimizer.h:102
 GeneticMinimizer.h:103
 GeneticMinimizer.h:104
 GeneticMinimizer.h:105
 GeneticMinimizer.h:106
 GeneticMinimizer.h:107
 GeneticMinimizer.h:108
 GeneticMinimizer.h:109
 GeneticMinimizer.h:110
 GeneticMinimizer.h:111
 GeneticMinimizer.h:112