Ajout du moHillClimberSampling, et ajout des méthodes init dans les stats ;)
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1786 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
1956bcc85a
commit
26055cda7f
15 changed files with 103 additions and 8 deletions
|
|
@ -76,8 +76,6 @@ public :
|
|||
return "moBestSoFarStat";
|
||||
}
|
||||
|
||||
private:
|
||||
moStat<EOT, T> & stat;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ public :
|
|||
* Default Constructor
|
||||
*/
|
||||
moCounterStat(): moStat<EOT, unsigned int>(0, "counter") {
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -58,7 +57,6 @@ public :
|
|||
* @param _sol a solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
counter = 0;
|
||||
value() = 0;
|
||||
}
|
||||
|
||||
|
|
@ -67,8 +65,7 @@ public :
|
|||
* @param _sol a solution
|
||||
*/
|
||||
virtual void operator()(EOT & _sol) {
|
||||
value() = counter;
|
||||
counter++;
|
||||
value() = value() + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -78,8 +75,6 @@ public :
|
|||
return "moCounterStat";
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int counter;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -56,6 +56,14 @@ public :
|
|||
*/
|
||||
moDistanceStat(eoDistance<EOT> & _dist, EOT & _ref): moStat<EOT, T>(0, "distance"), dist(_dist), refSolution(_ref) {}
|
||||
|
||||
/**
|
||||
* Compute distance between the first solution and the reference solution
|
||||
* @param _sol the first solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
value() = dist(_sol, refSolution);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute distance between a solution and the reference solution
|
||||
* @param _sol a solution
|
||||
|
|
|
|||
|
|
@ -56,6 +56,15 @@ public :
|
|||
moFitnessStat(std::string _description = "fitness"):
|
||||
moStat<EOT, Fitness>(Fitness(), _description) {}
|
||||
|
||||
/**
|
||||
* store the initial fitness value
|
||||
* @param _sol the initial solution
|
||||
*/
|
||||
virtual void init(EOT & _sol)
|
||||
{
|
||||
value() = _sol.fitness();
|
||||
}
|
||||
|
||||
/**
|
||||
* store fitness value
|
||||
* @param _sol the corresponding solution
|
||||
|
|
|
|||
|
|
@ -57,6 +57,14 @@ public :
|
|||
moMaxNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||
moStat<EOT, Fitness>(Fitness(), "min"), nhStat(_nhStat) {}
|
||||
|
||||
/**
|
||||
* Set the max fitness in the neighborhood
|
||||
* @param _sol the first solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
value() = nhStat.getMax();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the max fitness in the neighborhood
|
||||
* @param _sol the corresponding solution
|
||||
|
|
|
|||
|
|
@ -57,6 +57,14 @@ public :
|
|||
moMinNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||
moStat<EOT, Fitness>(Fitness(), "min"), nhStat(_nhStat) {}
|
||||
|
||||
/**
|
||||
* Set the worst fitness in the neighborhood
|
||||
* @param _sol the first solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
value() = nhStat.getMin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the worst fitness in the neighborhood
|
||||
* @param _sol the corresponding solution
|
||||
|
|
|
|||
|
|
@ -60,6 +60,14 @@ public :
|
|||
moNbInfNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||
moStat<EOT, unsigned>(0, "nb inf"), nhStat(_nhStat) {}
|
||||
|
||||
/**
|
||||
* Set the number of solutions in the neighborhood with (strictly) lower fitness than the current solution
|
||||
* @param _sol the first solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
value() = nhStat.getNbInf();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of solutions in the neighborhood with (strictly) lower fitness than the current solution
|
||||
* @param _sol the corresponding solution
|
||||
|
|
|
|||
|
|
@ -60,6 +60,14 @@ public :
|
|||
moNbSupNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||
moStat<EOT, unsigned>(0, "nb sup"), nhStat(_nhStat) {}
|
||||
|
||||
/**
|
||||
* Set the number of solutions in the neighborhood with better fitness than the current solution
|
||||
* @param _sol the first solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
value() = nhStat.getNbSup();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of solutions in the neighborhood with better fitness than the current solution
|
||||
* @param _sol the corresponding solution
|
||||
|
|
|
|||
|
|
@ -70,6 +70,14 @@ public :
|
|||
solNeighborComparator(_solNeighborComparator)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Compute classical statistics of the first solution's neighborhood
|
||||
* @param _solution the first solution
|
||||
*/
|
||||
virtual void init(EOT & _solution) {
|
||||
operator()(_solution);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute classical statistics of a solution's neighborhood
|
||||
* @param _solution the corresponding solution
|
||||
|
|
|
|||
|
|
@ -59,6 +59,14 @@ public :
|
|||
moNeutralDegreeNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||
moStat<EOT, unsigned>(0, "neutral degree"), nhStat(_nhStat) {}
|
||||
|
||||
/**
|
||||
* Set the neutral degree of the solution which is the number of solutions in the neighborhood with equals fitness
|
||||
* @param _sol the first solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
value() = nhStat.getNbEqual();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the neutral degree of the solution which is the number of solutions in the neighborhood with equals fitness
|
||||
* @param _sol the corresponding solution
|
||||
|
|
|
|||
|
|
@ -57,6 +57,15 @@ public :
|
|||
moSecondMomentNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||
moStat<EOT, std::pair<double, double> >(std::make_pair(0.0,0.0), "average and stdev"), nhStat(_nhStat) {}
|
||||
|
||||
/**
|
||||
* Set the average and the standard deviation of fitness in the neighborhood
|
||||
* @param _sol the first solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
value().first = nhStat.getMean();
|
||||
value().second = nhStat.getSD();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the average and the standard deviation of fitness in the neighborhood
|
||||
* @param _sol the corresponding solution
|
||||
|
|
|
|||
|
|
@ -58,6 +58,14 @@ public :
|
|||
moSizeNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||
moStat<EOT, unsigned>(0, "size"), nhStat(_nhStat) {}
|
||||
|
||||
/**
|
||||
* Set the number of solutions in the neighborhood
|
||||
* @param _sol the first solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
value() = nhStat.getSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of solutions in the neighborhood
|
||||
* @param _sol the corresponding solution
|
||||
|
|
|
|||
|
|
@ -55,6 +55,14 @@ public :
|
|||
moSolutionStat(std::string _description = "solution"):
|
||||
moStat<EOT, EOT>(EOT(), _description) {}
|
||||
|
||||
/**
|
||||
* Initialization the solution by copy
|
||||
* @param _sol the intial solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
value() = _sol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the solution by copy
|
||||
* @param _sol the corresponding solution
|
||||
|
|
|
|||
|
|
@ -52,11 +52,21 @@ public :
|
|||
moStatFromStat(moStat<EOT,T> & _stat): moStat<EOT, T>(0, _stat.description()), stat(_stat) {
|
||||
}
|
||||
|
||||
/**
|
||||
* The value of this stat is a copy of the value of the initial stat
|
||||
* @param _sol a solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
std::cout << "copy init" << stat.value() << std::endl;
|
||||
value() = stat.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* The value of this stat is a copy of the value of the initial stat
|
||||
* @param _sol a solution
|
||||
*/
|
||||
virtual void operator()(EOT & _sol) {
|
||||
std::cout << "copy " << stat.value() << std::endl;
|
||||
value() = stat.value();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,8 @@ public:
|
|||
* @return this monitor (sorry I don't why, but it is like this in EO)
|
||||
*/
|
||||
eoMonitor& operator()(void) {
|
||||
std::cout << "je passe vector MOnitor" << std::endl;
|
||||
|
||||
if (doubleParam != NULL)
|
||||
valueVec.push_back(doubleParam->value());
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue