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:
parent
539e2f11e6
commit
7abd6697f3
1 changed files with 77 additions and 82 deletions
|
|
@ -32,13 +32,11 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
|
||||
#include <neighborhood/moBackableNeighbor.h>
|
||||
|
||||
|
||||
/**
|
||||
* Swap Neighbor
|
||||
*/
|
||||
template<class EOT, class Fitness = typename EOT::Fitness>
|
||||
class moSwapNeighbor: public moBackableNeighbor<EOT, Fitness>
|
||||
{
|
||||
class moSwapNeighbor: public moBackableNeighbor<EOT, Fitness> {
|
||||
public:
|
||||
|
||||
/**
|
||||
|
|
@ -58,11 +56,7 @@ public:
|
|||
* @param _solution the solution to move back
|
||||
*/
|
||||
virtual void moveBack(EOT& _solution) {
|
||||
unsigned int tmp;
|
||||
tmp=_solution[indices.first];
|
||||
_solution[indices.first]=_solution[indices.second];
|
||||
_solution[indices.second]=tmp;
|
||||
_solution.invalidate();
|
||||
move(_solution);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -89,7 +83,8 @@ public:
|
|||
* Print the Neighbor
|
||||
*/
|
||||
void print() {
|
||||
std::cout << "[" << indices.first << ", " << indices.second << "] -> " << (*this).fitness() << std::endl;
|
||||
std::cout << "[" << indices.first << ", " << indices.second << "] -> "
|
||||
<< (*this).fitness() << std::endl;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue