added best position updating + printOn

This commit is contained in:
tlegrand 2007-10-08 15:22:25 +00:00
commit c864f2deb5
4 changed files with 24 additions and 29 deletions

View file

@ -135,32 +135,14 @@ public:
bool operator< (const PO & _po2) const { return fitness () < _po2.fitness ();}
bool operator> (const PO & _po2) const { return !(fitness () <= _po2.fitness ());}
/**
/**
* Write object. Called printOn since it prints the object _on_ a stream.
* @param _os A std::ostream.
*/
virtual void printOn(std::ostream& _os) const {
virtual void printOn(std::ostream& _os) const { _os << bestFitness <<' ' ;}
// the latest version of the code. Very similar to the old code
if (invalid()) {
_os << "INVALID ";
}
else
{
_os << repFitness << ' ' ;
}
if (invalidBest()) {
_os << "INVALID BEST";
}
else
{
_os << "best: " << bestFitness ;
}
}
/**
* Read object.\\
* Calls base class, just in case that one had something to do.