Logo ROOT   6.07/09
Reference Guide
GeneticRange.h
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Peter Speckmayer
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : GeneticRange *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Range definition for genetic algorithm *
12  * *
13  * Authors (alphabetical): *
14  * Peter Speckmayer <speckmay@mail.cern.ch> - CERN, Switzerland *
15  * *
16  * Copyright (c) 2005: *
17  * CERN, Switzerland *
18  * MPI-K Heidelberg, Germany *
19  * *
20  * Redistribution and use in source and binary forms, with or without *
21  * modification, are permitted according to the terms listed in LICENSE *
22  * (http://tmva.sourceforge.net/LICENSE) *
23  **********************************************************************************/
24 
25 #ifndef ROOT_TMVA_GeneticRange
26 #define ROOT_TMVA_GeneticRange
27 
28 //////////////////////////////////////////////////////////////////////////
29 // //
30 // GeneticRange //
31 // //
32 // Range definition for genetic algorithm //
33 // //
34 //////////////////////////////////////////////////////////////////////////
35 
36 #ifndef ROOT_TMVA_Interval
37 #include "TMVA/Interval.h"
38 #endif
39 
40 class TRandom3;
41 
42 namespace TMVA {
43 
44  class GeneticRange {
45 
46  public:
47 
48  GeneticRange( TRandom3* rnd, Interval *interval );
49  virtual ~GeneticRange();
50 
51  Double_t Random( Bool_t near = kFALSE, Double_t value=0, Double_t spread=0.1, Bool_t mirror=kFALSE );
53 
54  Double_t GetFrom() { return fFrom; }
55  Double_t GetTo() { return fTo; }
57 
58  private:
59 
60  Double_t fFrom, fTo; // the constraints of the coefficient
62 
63  Interval *fInterval; // holds the complete information of the interval
64  Double_t fTotalLength; // the distance between the lower and upper constraints
65 
66  // maps the values thrown outside of the ]from,to] interval back to the interval
67  // the values which leave the range on the from-side, are mapped in to the to-side
68  Double_t ReMap( Double_t val );
69 
70  // same as before, but the values leaving the allowed range, are mirrored into the range.
72 
73  TRandom3* fRandomGenerator; // the randomGenerator for calculating the new values
74 
75  ClassDef(GeneticRange,0); // Range definition for genetic algorithm
76  };
77 
78 } // namespace TMVA
79 
80 #endif
Random number generator class based on M.
Definition: TRandom3.h:29
TRandom3 * fRandomGenerator
Definition: GeneticRange.h:73
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
Double_t GetFrom()
Definition: GeneticRange.h:54
#define ClassDef(name, id)
Definition: Rtypes.h:254
Double_t ReMapMirror(Double_t val)
remapping the value to the allowed space by reflecting on the boundaries
Double_t Random(Bool_t near=kFALSE, Double_t value=0, Double_t spread=0.1, Bool_t mirror=kFALSE)
creates a new random value for the coefficient Parameters: Bool_t near : takes a random value near th...
GeneticRange(TRandom3 *rnd, Interval *interval)
defines the "f" (from) and "t" (to) of the coefficient and takes a randomgenerator ...
Double_t GetTo()
Definition: GeneticRange.h:55
Double_t ReMap(Double_t val)
remapping the value to the allowed space
virtual ~GeneticRange()
destructor
double Double_t
Definition: RtypesCore.h:55
Double_t fTotalLength
Definition: GeneticRange.h:64
Abstract ClassifierFactory template that handles arbitrary types.
Interval * fInterval
Definition: GeneticRange.h:63
Double_t RandomDiscrete()
creates a new random value for the coefficient; returns a discrete value
Double_t GetTotalLength()
Definition: GeneticRange.h:56