paradiseo/trunk/paradiseo-mo/src/moGenSolContinue.h
jboisson 0693358307 moFitSolContinue, moSteadyFitSolContinue and moNoFitImprSolContinue are added
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@582 331e1502-861f-0410-8da2-ba01fb791d7f
2007-07-31 11:48:12 +00:00

60 lines
1.3 KiB
C++
Executable file

// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
// "moGenSolContinue.h"
// (c) OPAC Team, LIFL, 2003-2006
/* LICENCE TEXT
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef __moGenSolContinue_h
#define __moGenSolContinue_h
#include "moSolContinue.h"
//! One possible stopping criterion for a solution-based heuristic.
/*!
The stopping criterion corresponds to a maximum number of iteration.
*/
template < class EOT > class moGenSolContinue:public moSolContinue < EOT >
{
public:
//! Basic constructor.
/*!
\param __maxNumGen the maximum number of generation.
*/
moGenSolContinue (unsigned int __maxNumGen):maxNumGen (__maxNumGen), numGen (0)
{}
//! Function that activates the stop criterion.
/*!
Increments the counter and returns true if the
current number of iteration is lower than the given
maximum number of iterations.
\param __sol the current solution.
\return true or false according to the current generation number.
*/
bool operator () (const EOT & __sol)
{
return (++numGen < maxNumGen);
}
//! Procedure which allows to initialise all the stuff needed.
void init ()
{}
private:
//! Iteration maximum number.
unsigned int maxNumGen;
//! Iteration current number.
unsigned int numGen;
};
#endif