ROOT logo
// @(#)root/tmva $Id: GeneticRange.h 29122 2009-06-22 06:51:30Z brun $    
// Author: Peter Speckmayer

/**********************************************************************************
 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
 * Package: TMVA                                                                  *
 * Class  : GeneticRange                                                          *
 * Web    : http://tmva.sourceforge.net                                           *
 *                                                                                *
 * Description:                                                                   *
 *    Range definition for 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_GeneticRange
#define ROOT_TMVA_GeneticRange

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// GeneticRange                                                         //
//                                                                      //
// Range definition for genetic algorithm                               //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TMVA_Interval
#include "TMVA/Interval.h"
#endif

class TRandom3;

namespace TMVA {

   class GeneticRange {

   public:

      GeneticRange( TRandom3* rnd, Interval *interval );
      virtual ~GeneticRange();

      Double_t Random( Bool_t near = kFALSE, Double_t value=0, Double_t spread=0.1, Bool_t mirror=kFALSE );
      Double_t RandomDiscrete();

      Double_t GetFrom()        { return fFrom; }
      Double_t GetTo()          { return fTo; }
      Double_t GetTotalLength() { return fTotalLength; }

   private:

      Double_t fFrom, fTo;    // the constraints of the coefficient
      Int_t fNbins;
      
      Interval *fInterval;     // holds the complete information of the interval
      Double_t fTotalLength;  // the distance between the lower and upper constraints

      // maps the values thrown outside of the ]from,to] interval back to the interval
      // the values which leave the range on the from-side, are mapped in to the to-side
      Double_t ReMap( Double_t val );

      // same as before, but the values leaving the allowed range, are mirrored into the range.
      Double_t ReMapMirror( Double_t val );

      TRandom3* fRandomGenerator;  // the randomGenerator for calculating the new values

      ClassDef(GeneticRange,0) // Range definition for genetic algorithm
   };

} // namespace TMVA

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