CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Attributes
DeterministicAnnealing Class Reference

#include <DeterministicAnnealing.h>

Inheritance diagram for DeterministicAnnealing:
AnnealingSchedule

Classes

class  A
 

Public Member Functions

void anneal ()
 
DeterministicAnnealingclone () const
 
double currentTemp () const
 
double cutoff () const
 
void debug () const
 
 DeterministicAnnealing (float cutoff=3.0)
 
 DeterministicAnnealing (const std::vector< float > &sched, float cutoff=3.0)
 
double initialTemp () const
 
bool isAnnealed () const
 
double phi (double chi2) const
 
void resetAnnealing ()
 
double weight (double chi2) const
 
- Public Member Functions inherited from AnnealingSchedule
virtual ~AnnealingSchedule ()
 

Private Attributes

double theChi2cut
 
unsigned int theIndex
 
bool theIsAnnealed
 
std::vector< float > theTemperatures
 

Detailed Description

Definition at line 7 of file DeterministicAnnealing.h.

Constructor & Destructor Documentation

DeterministicAnnealing::DeterministicAnnealing ( float  cutoff = 3.0)

Definition at line 10 of file DeterministicAnnealing.cc.

Referenced by clone().

10  :
11  theTemperatures({256,64,16,4,2,1}),
std::vector< float > theTemperatures
DeterministicAnnealing::DeterministicAnnealing ( const std::vector< float > &  sched,
float  cutoff = 3.0 
)

Definition at line 16 of file DeterministicAnnealing.cc.

Member Function Documentation

void DeterministicAnnealing::anneal ( )
virtual

Implements AnnealingSchedule.

Definition at line 21 of file DeterministicAnnealing.cc.

References theIndex, theIsAnnealed, and theTemperatures.

22 {
23  if ( theIndex < ( theTemperatures.size() - 1 ) )
24  {
25  theIndex++;
26  } else {
27  theIsAnnealed = true;
28  };
29 }
std::vector< float > theTemperatures
DeterministicAnnealing* DeterministicAnnealing::clone ( void  ) const
inlinevirtual

Implements AnnealingSchedule.

Definition at line 51 of file DeterministicAnnealing.h.

References DeterministicAnnealing().

52  {
53  return new DeterministicAnnealing ( * this );
54  };
DeterministicAnnealing(float cutoff=3.0)
double DeterministicAnnealing::currentTemp ( ) const
virtual

Implements AnnealingSchedule.

Definition at line 64 of file DeterministicAnnealing.cc.

References theIndex, and theTemperatures.

65 {
66  return theTemperatures[theIndex];
67 }
std::vector< float > theTemperatures
double DeterministicAnnealing::cutoff ( ) const
virtual

Returns phi(chi2) / ( phi(cutoff^2) + sum_i { phi(chi2s[i]) } )

Implements AnnealingSchedule.

Definition at line 59 of file DeterministicAnnealing.cc.

References mathSSE::sqrt(), and theChi2cut.

60 {
61  return sqrt(theChi2cut);
62 }
T sqrt(T t)
Definition: SSEVec.h:18
void DeterministicAnnealing::debug ( ) const
virtual

Implements AnnealingSchedule.

Definition at line 79 of file DeterministicAnnealing.cc.

References gather_cfg::cout, i, and theTemperatures.

80 {
81  cout << "[DeterministicAnnealing] schedule=";
82  for ( vector< float >::const_iterator i=theTemperatures.begin();
83  i!=theTemperatures.end() ; ++i )
84  {
85  cout << *i << " ";
86  };
87  cout << endl;
88 }
int i
Definition: DBlmapReader.cc:9
tuple cout
Definition: gather_cfg.py:145
std::vector< float > theTemperatures
double DeterministicAnnealing::initialTemp ( ) const
virtual

Implements AnnealingSchedule.

Definition at line 69 of file DeterministicAnnealing.cc.

References theTemperatures.

70 {
71  return theTemperatures[0];
72 }
std::vector< float > theTemperatures
bool DeterministicAnnealing::isAnnealed ( ) const
virtual

is it annealed yet?

Implements AnnealingSchedule.

Definition at line 74 of file DeterministicAnnealing.cc.

References theIsAnnealed.

75 {
76  return theIsAnnealed;
77 }
double DeterministicAnnealing::phi ( double  chi2) const
inlinevirtual

phi ( chi2 ) = e^( -.5*chi2 / T )

Implements AnnealingSchedule.

Definition at line 54 of file DeterministicAnnealing.cc.

References create_public_lumi_plots::exp, theIndex, and theTemperatures.

Referenced by Particle.Particle::__str__(), and weight().

void DeterministicAnnealing::resetAnnealing ( )
virtual

Implements AnnealingSchedule.

Definition at line 48 of file DeterministicAnnealing.cc.

References theIndex, and theIsAnnealed.

49 {
50  theIndex=0;
51  theIsAnnealed = false;
52 }
double DeterministicAnnealing::weight ( double  chi2) const
virtual

Returns phi(chi2) / ( phi(cutoff^2) + phi(chi2) ),

Implements AnnealingSchedule.

Definition at line 31 of file DeterministicAnnealing.cc.

References edm::isNotFinite(), phi(), and theChi2cut.

Referenced by cuy.ValElement::__init__(), cuy.additionElement::__init__(), cuy.superimposeElement::__init__(), and cuy.graphElement::__init__().

32 {
33  long double mphi = phi ( chi2 );
34  /*
35  if ( mphi < std::numeric_limits<double>::epsilon() ) return 0.;
36  return 1. / ( 1. + phi ( theChi2cut * theChi2cut ) / mphi );
37  */
38  // return mphi / ( mphi + phi ( theChi2cut ) );
39  long double newtmp = mphi / ( mphi + phi ( theChi2cut ) );
40  if ( edm::isNotFinite(newtmp ) )
41  {
42  if ( chi2 < theChi2cut ) newtmp=1.;
43  else newtmp=0.;
44  }
45  return newtmp;
46 }
bool isNotFinite(T x)
Definition: isFinite.h:10
double phi(double chi2) const

Member Data Documentation

double DeterministicAnnealing::theChi2cut
private

Definition at line 59 of file DeterministicAnnealing.h.

Referenced by cutoff(), and weight().

unsigned int DeterministicAnnealing::theIndex
private

Definition at line 58 of file DeterministicAnnealing.h.

Referenced by anneal(), currentTemp(), phi(), and resetAnnealing().

bool DeterministicAnnealing::theIsAnnealed
private

Definition at line 60 of file DeterministicAnnealing.h.

Referenced by anneal(), isAnnealed(), and resetAnnealing().

std::vector<float> DeterministicAnnealing::theTemperatures
private

Definition at line 54 of file DeterministicAnnealing.h.

Referenced by anneal(), currentTemp(), debug(), initialTemp(), and phi().