From 68a977b054280300ba496ede86ae0dd441d2fbf0 Mon Sep 17 00:00:00 2001 From: jhumeau Date: Thu, 19 Feb 2009 16:31:38 +0000 Subject: [PATCH] git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1452 331e1502-861f-0410-8da2-ba01fb791d7f --- .../branches/MOLS/src/eoTenTimeContinue.h | 96 +++++++++++++++++++ .../MOLS/src/moeoAllSolAllNeighborsExpl.h | 1 + .../MOLS/src/moeoAllSolOneNeighborExpl.h | 1 + .../MOLS/src/moeoOneSolAllNeighborsExpl.h | 1 + .../MOLS/src/moeoOneSolOneNeighborExpl.h | 1 + 5 files changed, 100 insertions(+) create mode 100644 contribution/branches/MOLS/src/eoTenTimeContinue.h diff --git a/contribution/branches/MOLS/src/eoTenTimeContinue.h b/contribution/branches/MOLS/src/eoTenTimeContinue.h new file mode 100644 index 000000000..aa21431f0 --- /dev/null +++ b/contribution/branches/MOLS/src/eoTenTimeContinue.h @@ -0,0 +1,96 @@ +// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- + +//----------------------------------------------------------------------------- +// eoSeconsElapsedContinue.h +// (c) Maarten Keijzer, 2007 +/* + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: todos@geneura.ugr.es, http://geneura.ugr.es + */ +//----------------------------------------------------------------------------- + +#ifndef _eoTenTimeContinue_h +#define _eoTenTimeContinue_h + +#include + +#include +#include +#include +#include +/** + Timed continuator: continues until a number of seconds is used +*/ +template< class EOT> +class eotenTimeContinue: public eoContinue +{ + +public: + + eoTenTimeContinue(int _maxTime, std::string _fileName) : start(time(0)), maxTime(_maxTime), id(1), fileName(_fileName) {} + + virtual bool operator() ( const eoPop& _pop ) { + time_t diff = time(0) - start; + + + if (diff > (id * maxTime/10) ){ + time_t begin=time(0); + //traitement + std::ostringstream os; + os << fileName << "." << id; + ofstream outfile(os.str(), ios::app); + + for(unsigned int i=0 ; i < _pop.size(); i++){ + for(unsigned int j=0 ; j= maxTime) + return false; + return true; + + } + + + virtual std::string className(void) const { return "eoTenTimeContinue"; } + + void readFrom (std :: istream & __is) { + + __is >> start; + } + + void printOn (std :: ostream & __os) const { + + __os << start << ' ' << std :: endl; + } +private: + time_t start; + unsigned int id; + unsigned int maxTime; + std::string fileName; +}; + +#endif + diff --git a/contribution/branches/MOLS/src/moeoAllSolAllNeighborsExpl.h b/contribution/branches/MOLS/src/moeoAllSolAllNeighborsExpl.h index 1087db55a..a061dd2b4 100755 --- a/contribution/branches/MOLS/src/moeoAllSolAllNeighborsExpl.h +++ b/contribution/branches/MOLS/src/moeoAllSolAllNeighborsExpl.h @@ -44,6 +44,7 @@ #include #include #include +#include /** * TODO diff --git a/contribution/branches/MOLS/src/moeoAllSolOneNeighborExpl.h b/contribution/branches/MOLS/src/moeoAllSolOneNeighborExpl.h index ff43e9b2e..2dd719118 100644 --- a/contribution/branches/MOLS/src/moeoAllSolOneNeighborExpl.h +++ b/contribution/branches/MOLS/src/moeoAllSolOneNeighborExpl.h @@ -44,6 +44,7 @@ #include #include #include +#include #include /** diff --git a/contribution/branches/MOLS/src/moeoOneSolAllNeighborsExpl.h b/contribution/branches/MOLS/src/moeoOneSolAllNeighborsExpl.h index a16ea251a..eaf95b13e 100644 --- a/contribution/branches/MOLS/src/moeoOneSolAllNeighborsExpl.h +++ b/contribution/branches/MOLS/src/moeoOneSolAllNeighborsExpl.h @@ -44,6 +44,7 @@ #include #include #include +#include /** * TODO diff --git a/contribution/branches/MOLS/src/moeoOneSolOneNeighborExpl.h b/contribution/branches/MOLS/src/moeoOneSolOneNeighborExpl.h index d695df48a..b4c5e6257 100644 --- a/contribution/branches/MOLS/src/moeoOneSolOneNeighborExpl.h +++ b/contribution/branches/MOLS/src/moeoOneSolOneNeighborExpl.h @@ -44,6 +44,7 @@ #include #include #include +#include /** * TODO