redundant code in moveBack()

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1951 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
boufaras 2010-10-04 15:22:23 +00:00
commit 7abd6697f3

View file

@ -32,13 +32,11 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <neighborhood/moBackableNeighbor.h> #include <neighborhood/moBackableNeighbor.h>
/** /**
* Swap Neighbor * Swap Neighbor
*/ */
template<class EOT, class Fitness = typename EOT::Fitness> template<class EOT, class Fitness = typename EOT::Fitness>
class moSwapNeighbor: public moBackableNeighbor<EOT, Fitness> class moSwapNeighbor: public moBackableNeighbor<EOT, Fitness> {
{
public: public:
/** /**
@ -58,11 +56,7 @@ public:
* @param _solution the solution to move back * @param _solution the solution to move back
*/ */
virtual void moveBack(EOT& _solution) { virtual void moveBack(EOT& _solution) {
unsigned int tmp; move(_solution);
tmp=_solution[indices.first];
_solution[indices.first]=_solution[indices.second];
_solution[indices.second]=tmp;
_solution.invalidate();
} }
/** /**
@ -89,7 +83,8 @@ public:
* Print the Neighbor * Print the Neighbor
*/ */
void print() { void print() {
std::cout << "[" << indices.first << ", " << indices.second << "] -> " << (*this).fitness() << std::endl; std::cout << "[" << indices.first << ", " << indices.second << "] -> "
<< (*this).fitness() << std::endl;
} }
private: private: