From ae73cb71ff30562dba95433a24c6f9ea2014a03f Mon Sep 17 00:00:00 2001 From: verel Date: Wed, 29 Dec 2010 10:47:22 +0000 Subject: [PATCH] Correction of the invalid fitness in moPopSol* (not in the 1.3beat version) git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2042 331e1502-861f-0410-8da2-ba01fb791d7f --- .../src/problems/bitString/moPopSol.h | 15 ++++++++++++--- .../src/problems/bitString/moPopSolInit.h | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/trunk/paradiseo-mo/src/problems/bitString/moPopSol.h b/trunk/paradiseo-mo/src/problems/bitString/moPopSol.h index 4fa346980..4ffc7bceb 100644 --- a/trunk/paradiseo-mo/src/problems/bitString/moPopSol.h +++ b/trunk/paradiseo-mo/src/problems/bitString/moPopSol.h @@ -41,11 +41,20 @@ public: typedef typename EO::Fitness Fitness; using EO::invalidate; + moPopSol(): EO() { + } + virtual void printOn(std::ostream& _os) const { - _os << (*this).size() << " " << (*this).fitness() << '\n'; - for(unsigned int i=0; i<(*this).size(); i++) - _os << (*this).operator[](i) << std::endl; + if (this->invalid()) { + _os << (*this).size() << " " << "INVALID" << '\n'; + for(unsigned int i=0; i<(*this).size(); i++) + _os << (*this).operator[](i) << std::endl; + } else { + _os << (*this).size() << " " << (*this).fitness() << '\n'; + for(unsigned int i=0; i<(*this).size(); i++) + _os << (*this).operator[](i) << std::endl; + } } }; diff --git a/trunk/paradiseo-mo/src/problems/bitString/moPopSolInit.h b/trunk/paradiseo-mo/src/problems/bitString/moPopSolInit.h index 4b6cdddb6..6e246cba1 100644 --- a/trunk/paradiseo-mo/src/problems/bitString/moPopSolInit.h +++ b/trunk/paradiseo-mo/src/problems/bitString/moPopSolInit.h @@ -55,6 +55,8 @@ public: rnd(tmp); _sol.push_back(tmp); } + + _sol.invalidate(); } private: