some MO types replacement
This commit is contained in:
parent
97143d65a3
commit
5dc8a1a8fe
3 changed files with 16 additions and 6 deletions
|
|
@ -124,7 +124,7 @@ int main(int ac, char** av)
|
||||||
|
|
||||||
unsigned int popSize = parser.getORcreateParam((unsigned int)20, "popSize", "Population Size", 'P', "Evolution Engine").value();
|
unsigned int popSize = parser.getORcreateParam((unsigned int)20, "popSize", "Population Size", 'P', "Evolution Engine").value();
|
||||||
|
|
||||||
moGenSolContinue< EOT >* sa_continue = new moGenSolContinue< EOT >( popSize );
|
moContinuator< moDummyNeighbor<EOT> >* sa_continue = new moIterContinuator< moDummyNeighbor<EOT> >( popSize );
|
||||||
state.storeFunctor(sa_continue);
|
state.storeFunctor(sa_continue);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -134,10 +134,10 @@ int main(int ac, char** av)
|
||||||
// SA parameters
|
// SA parameters
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
double threshold = parser.createParam((double)0.1, "threshold", "Threshold: temperature threshold stopping criteria", 't', section).value(); // t
|
double threshold_temperature = parser.createParam((double)0.1, "threshold", "Minimal temperature at which stop", 't', section).value(); // t
|
||||||
double alpha = parser.createParam((double)0.1, "alpha", "Alpha: temperature dicrease rate", 'a', section).value(); // a
|
double alpha = parser.createParam((double)0.1, "alpha", "Temperature decrease rate", 'a', section).value(); // a
|
||||||
|
|
||||||
moCoolingSchedule* cooling_schedule = new moGeometricCoolingSchedule(threshold, alpha);
|
moCoolingSchedule<EOT>* cooling_schedule = new moSimpleCoolingSchedule<EOT>(initial_temperature, alpha, 0, threshold_temperature);
|
||||||
state.storeFunctor(cooling_schedule);
|
state.storeFunctor(cooling_schedule);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,9 @@ public:
|
||||||
_sa_continue(sa_continue),
|
_sa_continue(sa_continue),
|
||||||
_cooling_schedule(cooling_schedule),
|
_cooling_schedule(cooling_schedule),
|
||||||
_initial_temperature(initial_temperature),
|
_initial_temperature(initial_temperature),
|
||||||
_replacor(replacor)
|
_replacor(replacor),
|
||||||
|
_dummy_neighbor()
|
||||||
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//! function that launches the EDASA algorithm.
|
//! function that launches the EDASA algorithm.
|
||||||
|
|
@ -124,7 +126,7 @@ public:
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
_sa_continue.init();
|
_sa_continue.init( _dummy_neighbor );
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
|
|
@ -256,6 +258,7 @@ private:
|
||||||
|
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
|
|
||||||
|
moDummyNeighbor<EOT> _dummy_neighbor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !_doEDASA_h
|
#endif // !_doEDASA_h
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#include <eoFunctor.h>
|
#include <eoFunctor.h>
|
||||||
|
|
||||||
#include "doBounder.h"
|
#include "doBounder.h"
|
||||||
|
#include "doBounderNo.h"
|
||||||
|
|
||||||
template < typename D >
|
template < typename D >
|
||||||
class doSampler : public eoUF< D&, typename D::EOType >
|
class doSampler : public eoUF< D&, typename D::EOType >
|
||||||
|
|
@ -22,6 +23,10 @@ public:
|
||||||
: _bounder(bounder)
|
: _bounder(bounder)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
doSampler()
|
||||||
|
: _bounder( _dummy_bounder )
|
||||||
|
{}
|
||||||
|
|
||||||
// virtual EOType operator()( D& ) = 0 (provided by eoUF< A1, R >)
|
// virtual EOType operator()( D& ) = 0 (provided by eoUF< A1, R >)
|
||||||
|
|
||||||
virtual EOType sample( D& ) = 0;
|
virtual EOType sample( D& ) = 0;
|
||||||
|
|
@ -60,6 +65,8 @@ public:
|
||||||
private:
|
private:
|
||||||
//! Bounder functor
|
//! Bounder functor
|
||||||
doBounder< EOType > & _bounder;
|
doBounder< EOType > & _bounder;
|
||||||
|
|
||||||
|
doBounderNo<EOType> _dummy_bounder;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !_doSampler_h
|
#endif // !_doSampler_h
|
||||||
|
|
|
||||||
Reference in a new issue