add hybrid lesson and test of ILS

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1799 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jhumeau 2010-05-07 12:11:00 +00:00
commit 5f85276ea5
9 changed files with 344 additions and 20 deletions

View file

@ -44,7 +44,7 @@ public:
/**
* @param _maxIter number maximum of iterations
*/
moIterContinuator(unsigned int _maxIter): maxIter(_maxIter){}
moIterContinuator(unsigned int _maxIter, bool _verbose=true): maxIter(_maxIter), verbose(_verbose){}
/**
*@param _solution a solution
@ -54,9 +54,8 @@ public:
bool res;
cpt++;
res = (cpt < maxIter);
if(!res){
if(!res && verbose)
std::cout << "STOP in moIterContinuator: Reached maximum number of iterations [" << cpt << "/" << maxIter << "]" << std::endl;
}
return res;
}
@ -79,6 +78,7 @@ public:
private:
unsigned int maxIter;
unsigned int cpt;
bool verbose;
};
#endif

View file

@ -46,7 +46,7 @@ public:
* Ctor.
* @param _max maximum running time
*/
moTimeContinuator(time_t _max): max(_max){
moTimeContinuator(time_t _max, bool _verbose=true): max(_max), verbose(_verbose){
start = time(NULL);
}
@ -57,13 +57,12 @@ public:
*/
virtual bool operator() (EOT& _sol)
{
bool res;
time_t elapsed = (time_t) difftime(time(NULL), start);
if (elapsed >= max)
{
std::cout << "STOP in moTimeContinuator: Reached maximum time [" << elapsed << "/" << max << "]" << std::endl;
return false;
}
return true;
res = (elapsed < max);
if(!res && verbose)
std::cout << "STOP in moTimeContinuator: Reached maximum time [" << elapsed << "/" << max << "]" << std::endl;
return res;
}
/**
@ -90,6 +89,8 @@ private:
time_t max;
/** starting time */
time_t start;
/** verbose mode */
bool verbose;
};