Verify if the neighbor fitness is invalid or not before the copy of fitness, if it is, the neighbor will copy an invalid fitness else the neighbor fitness will be set with the fitness of the copied neighbor
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2303 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
64e7860817
commit
1ab2731502
1 changed files with 92 additions and 83 deletions
|
|
@ -44,8 +44,7 @@
|
||||||
* Container of the neighbor informations
|
* Container of the neighbor informations
|
||||||
*/
|
*/
|
||||||
template<class EOType, class Fitness = typename EOType::Fitness>
|
template<class EOType, class Fitness = typename EOType::Fitness>
|
||||||
class moNeighbor : public EO<Fitness>
|
class moNeighbor: public EO<Fitness> {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
typedef EOType EOT;
|
typedef EOType EOT;
|
||||||
using EO<Fitness>::fitness;
|
using EO<Fitness>::fitness;
|
||||||
|
|
@ -53,14 +52,19 @@ public:
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
*/
|
*/
|
||||||
moNeighbor():EO<Fitness>() {}
|
moNeighbor() :
|
||||||
|
EO<Fitness> () {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy Constructor
|
* Copy Constructor
|
||||||
* @param _neighbor to copy
|
* @param _neighbor to copy
|
||||||
*/
|
*/
|
||||||
moNeighbor(const moNeighbor<EOT, Fitness>& _neighbor) {
|
moNeighbor(const moNeighbor<EOT, Fitness>& _neighbor) {
|
||||||
|
if (!(_neighbor.invalid()))
|
||||||
fitness(_neighbor.fitness());
|
fitness(_neighbor.fitness());
|
||||||
|
else
|
||||||
|
(*this).invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -68,8 +72,13 @@ public:
|
||||||
* @param _neighbor the neighbor to assign
|
* @param _neighbor the neighbor to assign
|
||||||
* @return a neighbor equal to the other
|
* @return a neighbor equal to the other
|
||||||
*/
|
*/
|
||||||
virtual moNeighbor<EOT, Fitness>& operator=(const moNeighbor<EOT, Fitness>& _neighbor) {
|
virtual moNeighbor<EOT, Fitness>& operator=(
|
||||||
|
const moNeighbor<EOT, Fitness>& _neighbor) {
|
||||||
|
if (!(_neighbor.invalid()))
|
||||||
fitness(_neighbor.fitness());
|
fitness(_neighbor.fitness());
|
||||||
|
else
|
||||||
|
(*this).invalidate();
|
||||||
|
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue