#include <DeterministicAnnealing.h>
Classes | |
class | A |
Public Member Functions | |
void | anneal () |
DeterministicAnnealing * | clone () const |
double | currentTemp () const |
double | cutoff () const |
void | debug () const |
DeterministicAnnealing (const std::vector< float > &sched, float cutoff=3.0) | |
DeterministicAnnealing (float cutoff=3.0) | |
double | initialTemp () const |
bool | isAnnealed () const |
double | phi (double chi2) const |
void | resetAnnealing () |
double | weight (double chi2) const |
Private Attributes | |
double | theChi2cut |
unsigned int | theIndex |
bool | theIsAnnealed |
Definition at line 7 of file DeterministicAnnealing.h.
DeterministicAnnealing::DeterministicAnnealing | ( | float | cutoff = 3.0 | ) |
Definition at line 13 of file DeterministicAnnealing.cc.
Referenced by clone().
: theIndex(0), theChi2cut ( cutoff*cutoff ), theIsAnnealed ( false ) { temperatures.push_back(256); temperatures.push_back(64); temperatures.push_back(16); temperatures.push_back(4); temperatures.push_back(2); temperatures.push_back(1); }
DeterministicAnnealing::DeterministicAnnealing | ( | const std::vector< float > & | sched, |
float | cutoff = 3.0 |
||
) |
void DeterministicAnnealing::anneal | ( | ) | [virtual] |
Implements AnnealingSchedule.
Definition at line 30 of file DeterministicAnnealing.cc.
References theIndex, and theIsAnnealed.
{ if ( theIndex < ( temperatures.size() - 1 ) ) { theIndex++; } else { theIsAnnealed = true; }; }
DeterministicAnnealing* DeterministicAnnealing::clone | ( | void | ) | const [inline, virtual] |
Implements AnnealingSchedule.
Definition at line 51 of file DeterministicAnnealing.h.
References DeterministicAnnealing().
{ return new DeterministicAnnealing ( * this ); };
double DeterministicAnnealing::currentTemp | ( | ) | const [virtual] |
Implements AnnealingSchedule.
Definition at line 73 of file DeterministicAnnealing.cc.
References theIndex.
{ return temperatures[theIndex]; }
double DeterministicAnnealing::cutoff | ( | ) | const [virtual] |
Returns phi(chi2) / ( phi(cutoff^2) + sum_i { phi(chi2s[i]) } )
Implements AnnealingSchedule.
Definition at line 68 of file DeterministicAnnealing.cc.
References mathSSE::sqrt(), and theChi2cut.
{ return sqrt(theChi2cut); }
void DeterministicAnnealing::debug | ( | ) | const [virtual] |
Implements AnnealingSchedule.
Definition at line 88 of file DeterministicAnnealing.cc.
References gather_cfg::cout, and i.
double DeterministicAnnealing::initialTemp | ( | ) | const [virtual] |
Implements AnnealingSchedule.
Definition at line 78 of file DeterministicAnnealing.cc.
{
return temperatures[0];
}
bool DeterministicAnnealing::isAnnealed | ( | ) | const [virtual] |
is it annealed yet?
Implements AnnealingSchedule.
Definition at line 83 of file DeterministicAnnealing.cc.
References theIsAnnealed.
{ return theIsAnnealed; }
double DeterministicAnnealing::phi | ( | double | chi2 | ) | const [inline, virtual] |
phi ( chi2 ) = e^( -.5*chi2 / T )
Implements AnnealingSchedule.
Definition at line 63 of file DeterministicAnnealing.cc.
References funct::exp(), and theIndex.
Referenced by weight().
void DeterministicAnnealing::resetAnnealing | ( | ) | [virtual] |
Implements AnnealingSchedule.
Definition at line 57 of file DeterministicAnnealing.cc.
References theIndex, and theIsAnnealed.
{ theIndex=0; theIsAnnealed = false; }
double DeterministicAnnealing::weight | ( | double | chi2 | ) | const [virtual] |
Returns phi(chi2) / ( phi(cutoff^2) + phi(chi2) ),
Implements AnnealingSchedule.
Definition at line 40 of file DeterministicAnnealing.cc.
References phi(), and theChi2cut.
{ long double mphi = phi ( chi2 ); /* if ( mphi < std::numeric_limits<double>::epsilon() ) return 0.; return 1. / ( 1. + phi ( theChi2cut * theChi2cut ) / mphi ); */ // return mphi / ( mphi + phi ( theChi2cut ) ); long double newtmp = mphi / ( mphi + phi ( theChi2cut ) ); if ( std::isinf(newtmp ) ) { if ( chi2 < theChi2cut ) newtmp=1.; else newtmp=0.; } return newtmp; }
double DeterministicAnnealing::theChi2cut [private] |
Definition at line 58 of file DeterministicAnnealing.h.
unsigned int DeterministicAnnealing::theIndex [private] |
Definition at line 54 of file DeterministicAnnealing.h.
Referenced by anneal(), currentTemp(), phi(), and resetAnnealing().
bool DeterministicAnnealing::theIsAnnealed [private] |
Definition at line 59 of file DeterministicAnnealing.h.
Referenced by anneal(), isAnnealed(), and resetAnnealing().