typedef EOT -> EOType
This commit is contained in:
parent
546f24295e
commit
defa972e09
3 changed files with 49 additions and 49 deletions
|
|
@ -40,7 +40,7 @@ template < typename D >
|
||||||
class edoAlgo : public eoAlgo< typename D::EOType >
|
class edoAlgo : public eoAlgo< typename D::EOType >
|
||||||
{
|
{
|
||||||
//! Alias for the type
|
//! Alias for the type
|
||||||
typedef typename D::EOType EOT;
|
typedef typename D::EOType EOType;
|
||||||
|
|
||||||
// virtual R operator()(A1) = 0; (defined in eoUF)
|
// virtual R operator()(A1) = 0; (defined in eoUF)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,13 @@ class edoEDA : public edoAlgo< D >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Alias for the type EOT
|
//! Alias for the type EOT
|
||||||
typedef typename D::EOType EOT;
|
typedef typename D::EOType EOType;
|
||||||
|
|
||||||
//! Alias for the atom type
|
//! Alias for the atom type
|
||||||
typedef typename EOT::AtomType AtomType;
|
typedef typename EOType::AtomType AtomType;
|
||||||
|
|
||||||
//! Alias for the fitness
|
//! Alias for the fitness
|
||||||
typedef typename EOT::Fitness Fitness;
|
typedef typename EOType::Fitness Fitness;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
@ -69,12 +69,12 @@ public:
|
||||||
\param distribution_continuator Stopping criterion based on the distribution features
|
\param distribution_continuator Stopping criterion based on the distribution features
|
||||||
*/
|
*/
|
||||||
edoEDA (
|
edoEDA (
|
||||||
eoPopEvalFunc < EOT > & evaluator,
|
eoPopEvalFunc < EOType > & evaluator,
|
||||||
eoSelect< EOT > & selector,
|
eoSelect< EOType > & selector,
|
||||||
edoEstimator< D > & estimator,
|
edoEstimator< D > & estimator,
|
||||||
edoSampler< D > & sampler,
|
edoSampler< D > & sampler,
|
||||||
eoReplacement< EOT > & replacor,
|
eoReplacement< EOType > & replacor,
|
||||||
eoContinue< EOT > & pop_continuator,
|
eoContinue< EOType > & pop_continuator,
|
||||||
edoContinue< D > & distribution_continuator
|
edoContinue< D > & distribution_continuator
|
||||||
) :
|
) :
|
||||||
_evaluator(evaluator),
|
_evaluator(evaluator),
|
||||||
|
|
@ -99,12 +99,12 @@ public:
|
||||||
\param pop_continuator Stopping criterion based on the population features
|
\param pop_continuator Stopping criterion based on the population features
|
||||||
*/
|
*/
|
||||||
edoEDA (
|
edoEDA (
|
||||||
eoPopEvalFunc < EOT > & evaluator,
|
eoPopEvalFunc < EOType > & evaluator,
|
||||||
eoSelect< EOT > & selector,
|
eoSelect< EOType > & selector,
|
||||||
edoEstimator< D > & estimator,
|
edoEstimator< D > & estimator,
|
||||||
edoSampler< D > & sampler,
|
edoSampler< D > & sampler,
|
||||||
eoReplacement< EOT > & replacor,
|
eoReplacement< EOType > & replacor,
|
||||||
eoContinue< EOT > & pop_continuator
|
eoContinue< EOType > & pop_continuator
|
||||||
) :
|
) :
|
||||||
_evaluator(evaluator),
|
_evaluator(evaluator),
|
||||||
_selector(selector),
|
_selector(selector),
|
||||||
|
|
@ -123,12 +123,12 @@ public:
|
||||||
* \param pop the population of candidate solutions
|
* \param pop the population of candidate solutions
|
||||||
* \return void
|
* \return void
|
||||||
*/
|
*/
|
||||||
void operator ()(eoPop< EOT > & pop)
|
void operator ()(eoPop< EOType > & pop)
|
||||||
{
|
{
|
||||||
assert(pop.size() > 0);
|
assert(pop.size() > 0);
|
||||||
|
|
||||||
eoPop< EOT > current_pop;
|
eoPop< EOType > current_pop;
|
||||||
eoPop< EOT > selected_pop;
|
eoPop< EOType > selected_pop;
|
||||||
|
|
||||||
// FIXME one must instanciate a first distrib here because there is no empty constructor, see if it is possible to instanciate Distributions without parameters
|
// FIXME one must instanciate a first distrib here because there is no empty constructor, see if it is possible to instanciate Distributions without parameters
|
||||||
D distrib = _estimator(pop);
|
D distrib = _estimator(pop);
|
||||||
|
|
@ -167,22 +167,22 @@ public:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//! A full evaluation function.
|
//! A full evaluation function.
|
||||||
eoPopEvalFunc < EOT > & _evaluator;
|
eoPopEvalFunc < EOType > & _evaluator;
|
||||||
|
|
||||||
//! A EOT selector
|
//! A EOType selector
|
||||||
eoSelect < EOT > & _selector;
|
eoSelect < EOType > & _selector;
|
||||||
|
|
||||||
//! A EOT estimator. It is going to estimate distribution parameters.
|
//! A EOType estimator. It is going to estimate distribution parameters.
|
||||||
edoEstimator< D > & _estimator;
|
edoEstimator< D > & _estimator;
|
||||||
|
|
||||||
//! A D sampler
|
//! A D sampler
|
||||||
edoSampler< D > & _sampler;
|
edoSampler< D > & _sampler;
|
||||||
|
|
||||||
//! A EOT replacor
|
//! A EOType replacor
|
||||||
eoReplacement < EOT > & _replacor;
|
eoReplacement < EOType > & _replacor;
|
||||||
|
|
||||||
//! A EOT population continuator
|
//! A EOType population continuator
|
||||||
eoContinue < EOT > & _pop_continuator;
|
eoContinue < EOType > & _pop_continuator;
|
||||||
|
|
||||||
//! A D continuator that always return true
|
//! A D continuator that always return true
|
||||||
edoDummyContinue<D> _dummy_continue;
|
edoDummyContinue<D> _dummy_continue;
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,13 @@ class edoEDASA : public edoAlgo< D >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Alias for the type EOT
|
//! Alias for the type EOT
|
||||||
typedef typename D::EOType EOT;
|
typedef typename D::EOType EOType;
|
||||||
|
|
||||||
//! Alias for the atom type
|
//! Alias for the atom type
|
||||||
typedef typename EOT::AtomType AtomType;
|
typedef typename EOType::AtomType AtomType;
|
||||||
|
|
||||||
//! Alias for the fitness
|
//! Alias for the fitness
|
||||||
typedef typename EOT::Fitness Fitness;
|
typedef typename EOType::Fitness Fitness;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
@ -73,18 +73,18 @@ public:
|
||||||
\param initial_temperature The initial temperature.
|
\param initial_temperature The initial temperature.
|
||||||
\param replacor Population replacor
|
\param replacor Population replacor
|
||||||
*/
|
*/
|
||||||
edoEDASA (eoSelect< EOT > & selector,
|
edoEDASA (eoSelect< EOType > & selector,
|
||||||
edoEstimator< D > & estimator,
|
edoEstimator< D > & estimator,
|
||||||
eoSelectOne< EOT > & selectone,
|
eoSelectOne< EOType > & selectone,
|
||||||
edoModifierMass< D > & modifier,
|
edoModifierMass< D > & modifier,
|
||||||
edoSampler< D > & sampler,
|
edoSampler< D > & sampler,
|
||||||
eoContinue< EOT > & pop_continue,
|
eoContinue< EOType > & pop_continue,
|
||||||
edoContinue< D > & distribution_continue,
|
edoContinue< D > & distribution_continue,
|
||||||
eoEvalFunc < EOT > & evaluation,
|
eoEvalFunc < EOType > & evaluation,
|
||||||
moContinuator< moDummyNeighbor<EOT> > & sa_continue,
|
moContinuator< moDummyNeighbor<EOType> > & sa_continue,
|
||||||
moCoolingSchedule<EOT> & cooling_schedule,
|
moCoolingSchedule<EOType> & cooling_schedule,
|
||||||
double initial_temperature,
|
double initial_temperature,
|
||||||
eoReplacement< EOT > & replacor
|
eoReplacement< EOType > & replacor
|
||||||
)
|
)
|
||||||
: _selector(selector),
|
: _selector(selector),
|
||||||
_estimator(estimator),
|
_estimator(estimator),
|
||||||
|
|
@ -108,15 +108,15 @@ public:
|
||||||
\param pop A population to improve.
|
\param pop A population to improve.
|
||||||
\return TRUE.
|
\return TRUE.
|
||||||
*/
|
*/
|
||||||
void operator ()(eoPop< EOT > & pop)
|
void operator ()(eoPop< EOType > & pop)
|
||||||
{
|
{
|
||||||
assert(pop.size() > 0);
|
assert(pop.size() > 0);
|
||||||
|
|
||||||
double temperature = _initial_temperature;
|
double temperature = _initial_temperature;
|
||||||
|
|
||||||
eoPop< EOT > current_pop;
|
eoPop< EOType > current_pop;
|
||||||
|
|
||||||
eoPop< EOT > selected_pop;
|
eoPop< EOType > selected_pop;
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
|
|
@ -165,7 +165,7 @@ public:
|
||||||
// Init of a variable contening a point with the bestest fitnesses
|
// Init of a variable contening a point with the bestest fitnesses
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
|
|
||||||
EOT current_solution = _selectone(selected_pop);
|
EOType current_solution = _selectone(selected_pop);
|
||||||
|
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -200,7 +200,7 @@ public:
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
EOT candidate_solution = _sampler(distrib);
|
EOType candidate_solution = _sampler(distrib);
|
||||||
_evaluation( candidate_solution );
|
_evaluation( candidate_solution );
|
||||||
|
|
||||||
// TODO: verifier le critere d'acceptation
|
// TODO: verifier le critere d'acceptation
|
||||||
|
|
@ -232,14 +232,14 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//! A EOT selector
|
//! A EOType selector
|
||||||
eoSelect < EOT > & _selector;
|
eoSelect < EOType > & _selector;
|
||||||
|
|
||||||
//! A EOT estimator. It is going to estimate distribution parameters.
|
//! A EOType estimator. It is going to estimate distribution parameters.
|
||||||
edoEstimator< D > & _estimator;
|
edoEstimator< D > & _estimator;
|
||||||
|
|
||||||
//! SelectOne
|
//! SelectOne
|
||||||
eoSelectOne< EOT > & _selectone;
|
eoSelectOne< EOType > & _selectone;
|
||||||
|
|
||||||
//! A D modifier
|
//! A D modifier
|
||||||
edoModifierMass< D > & _modifier;
|
edoModifierMass< D > & _modifier;
|
||||||
|
|
@ -247,26 +247,26 @@ private:
|
||||||
//! A D sampler
|
//! A D sampler
|
||||||
edoSampler< D > & _sampler;
|
edoSampler< D > & _sampler;
|
||||||
|
|
||||||
//! A EOT population continuator
|
//! A EOType population continuator
|
||||||
eoContinue < EOT > & _pop_continue;
|
eoContinue < EOType > & _pop_continue;
|
||||||
|
|
||||||
//! A D continuator
|
//! A D continuator
|
||||||
edoContinue < D > & _distribution_continue;
|
edoContinue < D > & _distribution_continue;
|
||||||
|
|
||||||
//! A full evaluation function.
|
//! A full evaluation function.
|
||||||
eoEvalFunc < EOT > & _evaluation;
|
eoEvalFunc < EOType > & _evaluation;
|
||||||
|
|
||||||
//! Stopping criterion before temperature update
|
//! Stopping criterion before temperature update
|
||||||
moContinuator< moDummyNeighbor<EOT> > & _sa_continue;
|
moContinuator< moDummyNeighbor<EOType> > & _sa_continue;
|
||||||
|
|
||||||
//! The cooling schedule
|
//! The cooling schedule
|
||||||
moCoolingSchedule<EOT> & _cooling_schedule;
|
moCoolingSchedule<EOType> & _cooling_schedule;
|
||||||
|
|
||||||
//! Initial temperature
|
//! Initial temperature
|
||||||
double _initial_temperature;
|
double _initial_temperature;
|
||||||
|
|
||||||
//! A EOT replacor
|
//! A EOType replacor
|
||||||
eoReplacement < EOT > & _replacor;
|
eoReplacement < EOType > & _replacor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !_edoEDASA_h
|
#endif // !_edoEDASA_h
|
||||||
|
|
|
||||||
Reference in a new issue