GeneticRange.h

Go to the documentation of this file.
00001 // @(#)root/tmva $Id: GeneticRange.h 29122 2009-06-22 06:51:30Z brun $    
00002 // Author: Peter Speckmayer
00003 
00004 /**********************************************************************************
00005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
00006  * Package: TMVA                                                                  *
00007  * Class  : GeneticRange                                                          *
00008  * Web    : http://tmva.sourceforge.net                                           *
00009  *                                                                                *
00010  * Description:                                                                   *
00011  *    Range definition for genetic algorithm                                      *
00012  *                                                                                *
00013  * Authors (alphabetical):                                                        *
00014  *      Peter Speckmayer <speckmay@mail.cern.ch>  - CERN, Switzerland             *
00015  *                                                                                *
00016  * Copyright (c) 2005:                                                            *
00017  *      CERN, Switzerland                                                         * 
00018  *      MPI-K Heidelberg, Germany                                                 * 
00019  *                                                                                *
00020  * Redistribution and use in source and binary forms, with or without             *
00021  * modification, are permitted according to the terms listed in LICENSE           *
00022  * (http://tmva.sourceforge.net/LICENSE)                                          *
00023  **********************************************************************************/
00024 
00025 #ifndef ROOT_TMVA_GeneticRange
00026 #define ROOT_TMVA_GeneticRange
00027 
00028 //////////////////////////////////////////////////////////////////////////
00029 //                                                                      //
00030 // GeneticRange                                                         //
00031 //                                                                      //
00032 // Range definition for genetic algorithm                               //
00033 //                                                                      //
00034 //////////////////////////////////////////////////////////////////////////
00035 
00036 #ifndef ROOT_TMVA_Interval
00037 #include "TMVA/Interval.h"
00038 #endif
00039 
00040 class TRandom3;
00041 
00042 namespace TMVA {
00043 
00044    class GeneticRange {
00045 
00046    public:
00047 
00048       GeneticRange( TRandom3* rnd, Interval *interval );
00049       virtual ~GeneticRange();
00050 
00051       Double_t Random( Bool_t near = kFALSE, Double_t value=0, Double_t spread=0.1, Bool_t mirror=kFALSE );
00052       Double_t RandomDiscrete();
00053 
00054       Double_t GetFrom()        { return fFrom; }
00055       Double_t GetTo()          { return fTo; }
00056       Double_t GetTotalLength() { return fTotalLength; }
00057 
00058    private:
00059 
00060       Double_t fFrom, fTo;    // the constraints of the coefficient
00061       Int_t fNbins;
00062       
00063       Interval *fInterval;     // holds the complete information of the interval
00064       Double_t fTotalLength;  // the distance between the lower and upper constraints
00065 
00066       // maps the values thrown outside of the ]from,to] interval back to the interval
00067       // the values which leave the range on the from-side, are mapped in to the to-side
00068       Double_t ReMap( Double_t val );
00069 
00070       // same as before, but the values leaving the allowed range, are mirrored into the range.
00071       Double_t ReMapMirror( Double_t val );
00072 
00073       TRandom3* fRandomGenerator;  // the randomGenerator for calculating the new values
00074 
00075       ClassDef(GeneticRange,0) // Range definition for genetic algorithm
00076    };
00077 
00078 } // namespace TMVA
00079 
00080 #endif

Generated on Tue Jul 5 14:27:29 2011 for ROOT_528-00b_version by  doxygen 1.5.1