Replace Templates NHE and Neighborhood
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1732 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
e3a9101595
commit
5f7d120a6e
48 changed files with 236 additions and 227 deletions
|
|
@ -39,23 +39,23 @@
|
|||
#include <utils/eoMonitor.h>
|
||||
#include <continuator/moStatBase.h>
|
||||
#include <utils/eoUpdater.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
|
||||
/**
|
||||
* Continuator allowing to add others (continuators, stats, monitors or updaters)
|
||||
*/
|
||||
template <class NH>
|
||||
class moCheckpoint : public moContinuator<NH> {
|
||||
template <class Neighbor>
|
||||
class moCheckpoint : public moContinuator<Neighbor> {
|
||||
public :
|
||||
|
||||
typedef NH Neighborhood ;
|
||||
typedef typename Neighborhood::EOT EOT ;
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
/**
|
||||
* Default constructor (moCheckpoint must have at least one continuator)
|
||||
* @param _cont a continuator
|
||||
* @param _interval frequency to compute statistical operators
|
||||
*/
|
||||
moCheckpoint(moContinuator<Neighborhood>& _cont, unsigned int _interval=1):interval(_interval), counter(0) {
|
||||
moCheckpoint(moContinuator<Neighbor>& _cont, unsigned int _interval=1):interval(_interval), counter(0) {
|
||||
continuators.push_back(&_cont);
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ public :
|
|||
* add a continuator to the checkpoint
|
||||
* @param _cont a continuator
|
||||
*/
|
||||
void add(moContinuator<Neighborhood>& _cont) {
|
||||
void add(moContinuator<Neighbor>& _cont) {
|
||||
continuators.push_back(&_cont);
|
||||
}
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ public :
|
|||
|
||||
private :
|
||||
/** continuators vector */
|
||||
std::vector<moContinuator<Neighborhood>*> continuators;
|
||||
std::vector<moContinuator<Neighbor>*> continuators;
|
||||
/** statistic operators vector */
|
||||
std::vector<moStatBase<EOT>*> stats;
|
||||
/** monitors vector */
|
||||
|
|
|
|||
|
|
@ -36,16 +36,17 @@
|
|||
#define _moContinuator_h
|
||||
|
||||
#include <eoFunctor.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
|
||||
/**
|
||||
* To make specific continuator from a solution
|
||||
*/
|
||||
template< class NH >
|
||||
class moContinuator : public eoUF<typename NH::EOT &, bool>
|
||||
template< class Neighbor >
|
||||
class moContinuator : public eoUF<typename Neighbor::EOT &, bool>
|
||||
{
|
||||
public:
|
||||
typedef NH Neighborhood ;
|
||||
typedef typename Neighborhood::EOT EOT ;
|
||||
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
/**
|
||||
* Init Continuator parameters
|
||||
|
|
|
|||
|
|
@ -31,15 +31,15 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#define _moIterContinuator_h
|
||||
|
||||
#include <continuator/moContinuator.h>
|
||||
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
/**
|
||||
* Continue until a maximum fixed number of iterations is reached
|
||||
*/
|
||||
template< class NH >
|
||||
class moIterContinuator : public moContinuator<NH>
|
||||
template< class Neighbor >
|
||||
class moIterContinuator : public moContinuator<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename NH::EOT EOT ;
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
/**
|
||||
* @param _maxIter number maximum of iterations
|
||||
|
|
|
|||
|
|
@ -37,15 +37,15 @@
|
|||
|
||||
#include <continuator/moStat.h>
|
||||
#include <continuator/moNeighborhoodStat.h>
|
||||
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
/**
|
||||
* From moNeighborhoodStat, to compute the max fitness in the neighborhood
|
||||
*/
|
||||
template< class Neighborhood >
|
||||
class moMaxNeighborStat : public moStat<typename Neighborhood::EOT, typename Neighborhood::EOT::Fitness>
|
||||
template< class Neighbor >
|
||||
class moMaxNeighborStat : public moStat<typename Neighbor::EOT, typename Neighbor::EOT::Fitness>
|
||||
{
|
||||
public :
|
||||
typedef typename Neighborhood::EOT EOT ;
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
typedef typename EOT::Fitness Fitness ;
|
||||
|
||||
using moStat< EOT, Fitness >::value;
|
||||
|
|
@ -54,7 +54,7 @@ public :
|
|||
* Default Constructor
|
||||
* @param _nhStat a neighborhoodStat
|
||||
*/
|
||||
moMaxNeighborStat(moNeighborhoodStat<Neighborhood> & _nhStat):
|
||||
moMaxNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||
moStat<EOT, Fitness>(Fitness(), "min"), nhStat(_nhStat) {}
|
||||
|
||||
/**
|
||||
|
|
@ -74,7 +74,7 @@ public :
|
|||
|
||||
private:
|
||||
/** moNeighborhoodStat */
|
||||
moNeighborhoodStat<Neighborhood> & nhStat;
|
||||
moNeighborhoodStat<Neighbor> & nhStat;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -37,15 +37,15 @@
|
|||
|
||||
#include <continuator/moStat.h>
|
||||
#include <continuator/moNeighborhoodStat.h>
|
||||
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
/**
|
||||
* From moNeighborhoodStat, to compute the min fitness in the neighborhood
|
||||
*/
|
||||
template< class Neighborhood >
|
||||
class moMinNeighborStat : public moStat<typename Neighborhood::EOT, typename Neighborhood::EOT::Fitness>
|
||||
template< class Neighbor >
|
||||
class moMinNeighborStat : public moStat<typename Neighbor::EOT, typename Neighbor::EOT::Fitness>
|
||||
{
|
||||
public :
|
||||
typedef typename Neighborhood::EOT EOT ;
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
typedef typename EOT::Fitness Fitness ;
|
||||
|
||||
using moStat< EOT, Fitness >::value;
|
||||
|
|
@ -54,7 +54,7 @@ public :
|
|||
* Default Constructor
|
||||
* @param _nhStat a neighborhoodStat
|
||||
*/
|
||||
moMinNeighborStat(moNeighborhoodStat<Neighborhood> & _nhStat):
|
||||
moMinNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||
moStat<EOT, Fitness>(Fitness(), "min"), nhStat(_nhStat) {}
|
||||
|
||||
/**
|
||||
|
|
@ -74,7 +74,7 @@ public :
|
|||
|
||||
private:
|
||||
/** moNeighborhoodStat */
|
||||
moNeighborhoodStat<Neighborhood> & nhStat;
|
||||
moNeighborhoodStat<Neighbor> & nhStat;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -37,18 +37,18 @@
|
|||
|
||||
#include <continuator/moStat.h>
|
||||
#include <continuator/moNeighborhoodStat.h>
|
||||
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
/**
|
||||
*
|
||||
* From moNeighborhoodStat, to compute the number of solutions in the neighborhood
|
||||
* with (strictly) lower fitness than the current solution
|
||||
*
|
||||
*/
|
||||
template< class Neighborhood >
|
||||
class moNbInfNeighborStat : public moStat<typename Neighborhood::EOT, unsigned>
|
||||
template< class Neighbor >
|
||||
class moNbInfNeighborStat : public moStat<typename Neighbor::EOT, unsigned>
|
||||
{
|
||||
public :
|
||||
typedef typename Neighborhood::EOT EOT ;
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
typedef typename EOT::Fitness Fitness ;
|
||||
|
||||
using moStat< EOT, unsigned >::value;
|
||||
|
|
@ -57,7 +57,7 @@ public :
|
|||
* Default Constructor
|
||||
* @param _nhStat a neighborhoodStat
|
||||
*/
|
||||
moNbInfNeighborStat(moNeighborhoodStat<Neighborhood> & _nhStat):
|
||||
moNbInfNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||
moStat<EOT, unsigned>(0, "nb inf"), nhStat(_nhStat) {}
|
||||
|
||||
/**
|
||||
|
|
@ -77,7 +77,7 @@ public :
|
|||
|
||||
private:
|
||||
/** moNeighborhoodStat */
|
||||
moNeighborhoodStat<Neighborhood> & nhStat;
|
||||
moNeighborhoodStat<Neighbor> & nhStat;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -37,18 +37,18 @@
|
|||
|
||||
#include <continuator/moStat.h>
|
||||
#include <continuator/moNeighborhoodStat.h>
|
||||
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
/**
|
||||
*
|
||||
* From moNeighborhoodStat, to compute the number of solutions in the neighborhood
|
||||
* with higher fitness than the current solution
|
||||
*
|
||||
*/
|
||||
template< class Neighborhood >
|
||||
class moNbSupNeighborStat : public moStat<typename Neighborhood::EOT, unsigned>
|
||||
template< class Neighbor >
|
||||
class moNbSupNeighborStat : public moStat<typename Neighbor::EOT, unsigned>
|
||||
{
|
||||
public :
|
||||
typedef typename Neighborhood::EOT EOT ;
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
typedef typename EOT::Fitness Fitness ;
|
||||
|
||||
using moStat< EOT, unsigned >::value;
|
||||
|
|
@ -57,7 +57,7 @@ public :
|
|||
* Default Constructor
|
||||
* @param _nhStat a neighborhoodStat
|
||||
*/
|
||||
moNbSupNeighborStat(moNeighborhoodStat<Neighborhood> & _nhStat):
|
||||
moNbSupNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||
moStat<EOT, unsigned>(0, "nb sup"), nhStat(_nhStat) {}
|
||||
|
||||
/**
|
||||
|
|
@ -77,7 +77,7 @@ public :
|
|||
|
||||
private:
|
||||
/** moNeighborhoodStat */
|
||||
moNeighborhoodStat<Neighborhood> & nhStat;
|
||||
moNeighborhoodStat<Neighbor> & nhStat;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -40,17 +40,18 @@
|
|||
#include <explorer/moNeighborhoodExplorer.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
|
||||
/**
|
||||
* All possible statitic on the neighborhood fitness
|
||||
* to combine with other specific statistic to print them
|
||||
*/
|
||||
template< class Neighborhood >
|
||||
class moNeighborhoodStat : public moStat<typename Neighborhood::EOT, bool>
|
||||
template< class Neighbor >
|
||||
class moNeighborhoodStat : public moStat<typename Neighbor::EOT, bool>
|
||||
{
|
||||
public :
|
||||
typedef typename Neighborhood::EOT EOT ;
|
||||
typedef typename Neighborhood::Neighbor Neighbor ;
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||
typedef typename EOT::Fitness Fitness ;
|
||||
|
||||
using moStat< EOT, bool >::value;
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@
|
|||
* which is the number of solutions in the neighborhood
|
||||
* with equals fitness
|
||||
*/
|
||||
template< class Neighborhood >
|
||||
class moNeutralDegreeNeighborStat : public moStat<typename Neighborhood::EOT, unsigned>
|
||||
template< class Neighbor >
|
||||
class moNeutralDegreeNeighborStat : public moStat<typename Neighbor::EOT, unsigned>
|
||||
{
|
||||
public :
|
||||
typedef typename Neighborhood::EOT EOT ;
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
typedef typename EOT::Fitness Fitness ;
|
||||
|
||||
using moStat< EOT, unsigned >::value;
|
||||
|
|
@ -56,7 +56,7 @@ public :
|
|||
* Default Constructor
|
||||
* @param _nhStat a neighborhoodStat
|
||||
*/
|
||||
moNeutralDegreeNeighborStat(moNeighborhoodStat<Neighborhood> & _nhStat):
|
||||
moNeutralDegreeNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||
moStat<EOT, unsigned>(0, "neutral degree"), nhStat(_nhStat) {}
|
||||
|
||||
/**
|
||||
|
|
@ -76,7 +76,7 @@ public :
|
|||
|
||||
private:
|
||||
/** moNeighborhoodStat */
|
||||
moNeighborhoodStat<Neighborhood> & nhStat;
|
||||
moNeighborhoodStat<Neighbor> & nhStat;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@
|
|||
/**
|
||||
* From moNeighborhoodStat, to compute the average and the standard deviation of fitness in the neighborhood
|
||||
*/
|
||||
template< class Neighborhood >
|
||||
class moSecondMomentNeighborStat : public moStat<typename Neighborhood::EOT, std::pair<double, double> >
|
||||
template< class Neighbor >
|
||||
class moSecondMomentNeighborStat : public moStat<typename Neighbor::EOT, std::pair<double, double> >
|
||||
{
|
||||
public :
|
||||
typedef typename Neighborhood::EOT EOT ;
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
typedef typename EOT::Fitness Fitness ;
|
||||
|
||||
using moStat< EOT, std::pair<double, double> >::value;
|
||||
|
|
@ -54,7 +54,7 @@ public :
|
|||
* Default Constructor
|
||||
* @param _nhStat a neighborhoodStat
|
||||
*/
|
||||
moSecondMomentNeighborStat(moNeighborhoodStat<Neighborhood> & _nhStat):
|
||||
moSecondMomentNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||
moStat<EOT, std::pair<double, double> >(std::make_pair(0.0,0.0), "average and stdev"), nhStat(_nhStat) {}
|
||||
|
||||
/**
|
||||
|
|
@ -75,7 +75,7 @@ public :
|
|||
|
||||
private:
|
||||
/** moNeighborhoodStat */
|
||||
moNeighborhoodStat<Neighborhood> & nhStat;
|
||||
moNeighborhoodStat<Neighbor> & nhStat;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@
|
|||
* From moNeighborhoodStat, to compute the number of solutions in the neighborhood
|
||||
*
|
||||
*/
|
||||
template< class Neighborhood >
|
||||
class moSizeNeighborStat : public moStat<typename Neighborhood::EOT, unsigned>
|
||||
template< class Neighbor >
|
||||
class moSizeNeighborStat : public moStat<typename Neighbor::EOT, unsigned>
|
||||
{
|
||||
public :
|
||||
typedef typename Neighborhood::EOT EOT ;
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
typedef typename EOT::Fitness Fitness ;
|
||||
|
||||
using moStat< EOT, unsigned >::value;
|
||||
|
|
@ -55,7 +55,7 @@ public :
|
|||
* Default Constructor
|
||||
* @param _nhStat a neighborhoodStat
|
||||
*/
|
||||
moSizeNeighborStat(moNeighborhoodStat<Neighborhood> & _nhStat):
|
||||
moSizeNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||
moStat<EOT, unsigned>(0, "size"), nhStat(_nhStat) {}
|
||||
|
||||
/**
|
||||
|
|
@ -75,7 +75,7 @@ public :
|
|||
|
||||
private:
|
||||
/** moNeighborhoodStat */
|
||||
moNeighborhoodStat<Neighborhood> & nhStat;
|
||||
moNeighborhoodStat<Neighbor> & nhStat;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@
|
|||
/**
|
||||
* Continuator always return True
|
||||
*/
|
||||
template< class NH >
|
||||
class moTrueContinuator : public moContinuator<NH>
|
||||
template< class Neighbor >
|
||||
class moTrueContinuator : public moContinuator<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename NH::EOT EOT ;
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
// empty constructor
|
||||
moTrueContinuator() {} ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue