independent ParadisEO-GPU package
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2593 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
0709e8a277
commit
959e9be6e2
15 changed files with 1485 additions and 0 deletions
|
|
@ -0,0 +1,122 @@
|
||||||
|
/*
|
||||||
|
<moGPUBitNeighbor.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Jerémie Humeau, Boufaras Karima, Thé Van LUONG
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can use,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
As a counterpart to the access to the source code and rights to copy,
|
||||||
|
modify and redistribute granted by the license, users are provided only
|
||||||
|
with a limited warranty and the software's author, the holder of the
|
||||||
|
economic rights, and the successive licensors have only limited liability.
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __moGPUBitNeighbor_h
|
||||||
|
#define __moGPUBitNeighbor_h
|
||||||
|
|
||||||
|
#include <neighborhood/moBackableNeighbor.h>
|
||||||
|
#include <neighborhood/moIndexNeighbor.h>
|
||||||
|
#include <GPUType/moGPUBitVector.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Neighbor related to a solution vector of Bit
|
||||||
|
*/
|
||||||
|
|
||||||
|
template<class Fitness>
|
||||||
|
class moGPUBitNeighbor: public moBackableNeighbor<moGPUBitVector<Fitness> > ,
|
||||||
|
public moIndexNeighbor<moGPUBitVector<Fitness> > {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef moGPUBitVector<Fitness> EOT ;
|
||||||
|
using moBackableNeighbor<EOT>::fitness;
|
||||||
|
using moIndexNeighbor<EOT>::key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* move the solution
|
||||||
|
* @param _solution the solution to move
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void move(EOT & _solution) {
|
||||||
|
|
||||||
|
_solution[key] = !_solution[key];
|
||||||
|
_solution.invalidate();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* move back the solution (useful for the evaluation by modif)
|
||||||
|
* @param _solution the solution to move back
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void moveBack(EOT & _solution) {
|
||||||
|
|
||||||
|
move(_solution);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class name.
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moGPUBitNeighbor";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read object.\
|
||||||
|
* Calls base class, just in case that one had something to do.
|
||||||
|
* The read and print methods should be compatible and have the same format.
|
||||||
|
* In principle, format is "plain": they just print a number
|
||||||
|
* @param _is a std::istream.
|
||||||
|
* @throw runtime_std::exception If a valid object can't be read.
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void readFrom(std::istream& _is) {
|
||||||
|
std::string fitness_str;
|
||||||
|
int pos = _is.tellg();
|
||||||
|
_is >> fitness_str;
|
||||||
|
if (fitness_str == "INVALID") {
|
||||||
|
throw std::runtime_error("invalid fitness");
|
||||||
|
} else {
|
||||||
|
Fitness repFit;
|
||||||
|
_is.seekg(pos);
|
||||||
|
_is >> repFit;
|
||||||
|
_is >> key;
|
||||||
|
fitness(repFit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write object. Called printOn since it prints the object _on_ a stream.
|
||||||
|
* @param _os A std::ostream.
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void printOn(std::ostream& _os) const {
|
||||||
|
_os << fitness() << ' ' << key << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,110 @@
|
||||||
|
/*
|
||||||
|
<moGPUMappingNeighborhood.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Karima Boufaras, Thé Van LUONG
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __moGPUMappingNeighborhood_h
|
||||||
|
#define __moGPUMappingNeighborhood_h
|
||||||
|
|
||||||
|
#include <neighborhood/moMappingNeighborhood.h>
|
||||||
|
#include <eval/moGPUEval.h>
|
||||||
|
|
||||||
|
template<class N>
|
||||||
|
class moGPUMappingNeighborhood: public moMappingNeighborhood<N> {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define a Neighbor and type of a solution corresponding
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef N Neighbor;
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
using moMappingNeighborhood<Neighbor>::neighborhoodSize;
|
||||||
|
using moMappingNeighborhood<Neighbor>::currentIndex;
|
||||||
|
using moMappingNeighborhood<Neighbor>::indices;
|
||||||
|
using moMappingNeighborhood<Neighbor>::mapping;
|
||||||
|
using moMappingNeighborhood<Neighbor>::xChange;
|
||||||
|
using moMappingNeighborhood<Neighbor>::mutex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhoodSize the neighborhood size
|
||||||
|
* @param _xChange the number of x-change positions
|
||||||
|
*/
|
||||||
|
|
||||||
|
moGPUMappingNeighborhood(unsigned int _neighborhoodSize,
|
||||||
|
unsigned int _xChange) :
|
||||||
|
moMappingNeighborhood<Neighbor> (_neighborhoodSize, _xChange) {
|
||||||
|
sendMapping = false;
|
||||||
|
cudaMalloc((void**) &device_Mapping, sizeof(unsigned int)
|
||||||
|
* neighborhoodSize * _xChange);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*Destructor
|
||||||
|
*/
|
||||||
|
|
||||||
|
~moGPUMappingNeighborhood() {
|
||||||
|
|
||||||
|
cudaFree(device_Mapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the neighborhood and mapping on device
|
||||||
|
* @param _solution the solution to explore
|
||||||
|
* @param _current the first neighbor
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void init(EOT& _solution, Neighbor& _current) {
|
||||||
|
|
||||||
|
moMappingNeighborhood<Neighbor>::init(_solution, _current);
|
||||||
|
if (!sendMapping) {
|
||||||
|
cudaMemcpy(device_Mapping, mapping,xChange * neighborhoodSize
|
||||||
|
* sizeof(unsigned int), cudaMemcpyHostToDevice);
|
||||||
|
sendMapping = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moGPUMappingNeighborhood";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
bool sendMapping;
|
||||||
|
unsigned int * device_Mapping;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
/*
|
||||||
|
<moGPUMappingNeighborhoodByCpy.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Boufaras Karima, Thé Van Luong
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __moGPUMappingNeighborhoodByCpy_h
|
||||||
|
#define __moGPUMappingNeighborhoodByCpy_h
|
||||||
|
|
||||||
|
#include <neighborhood/moGPUMappingNeighborhood.h>
|
||||||
|
#include <eval/moGPUEval.h>
|
||||||
|
|
||||||
|
template<class N>
|
||||||
|
class moGPUMappingNeighborhoodByCpy: public moGPUMappingNeighborhood<N> {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define a Neighbor and type of a solution corresponding
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef N Neighbor;
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
/*A tester*/
|
||||||
|
using moGPUMappingNeighborhood<Neighbor>::neighborhoodSize;
|
||||||
|
using moGPUMappingNeighborhood<Neighbor>::currentIndex;
|
||||||
|
using moGPUMappingNeighborhood<Neighbor>::indices;
|
||||||
|
using moGPUMappingNeighborhood<Neighbor>::mapping;
|
||||||
|
using moGPUMappingNeighborhood<Neighbor>::xChange;
|
||||||
|
using moGPUMappingNeighborhood<Neighbor>::mutex;
|
||||||
|
using moGPUMappingNeighborhood<Neighbor>::device_Mapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhoodSize the neighborhood size
|
||||||
|
* @param _xChange the number of x-change positions
|
||||||
|
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||||
|
*/
|
||||||
|
|
||||||
|
moGPUMappingNeighborhoodByCpy(unsigned int _neighborhoodSize,
|
||||||
|
unsigned int _xChange,moGPUEval<Neighbor>& _eval) :
|
||||||
|
moGPUMappingNeighborhood<Neighbor> (_neighborhoodSize, _xChange), eval(_eval){
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the neighborhood
|
||||||
|
* @param _solution the solution to explore
|
||||||
|
* @param _current the first neighbor
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void init(EOT& _solution, Neighbor& _current) {
|
||||||
|
|
||||||
|
moGPUMappingNeighborhood<Neighbor>::init(_solution, _current);
|
||||||
|
//Compute all neighbors fitness at one time
|
||||||
|
eval.neighborhoodEval(_solution, device_Mapping,1,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moGPUMappingNeighborhoodByCpy";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
moGPUEval<Neighbor>& eval;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
/*
|
||||||
|
<moGPUMappingNeighborhoodByModif.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Karima Boufaras, Thé Van Luong
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __moGPUMappingNeighborhoodByModif_h
|
||||||
|
#define __moGPUMappingNeighborhoodByModif_h
|
||||||
|
|
||||||
|
#include <neighborhood/moGPUMappingNeighborhood.h>
|
||||||
|
#include <eval/moGPUEval.h>
|
||||||
|
|
||||||
|
template<class N>
|
||||||
|
class moGPUMappingNeighborhoodByModif: public moGPUMappingNeighborhood<N> {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define a Neighbor and type of a solution corresponding
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef N Neighbor;
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
/*A tester*/
|
||||||
|
using moGPUMappingNeighborhood<Neighbor>::neighborhoodSize;
|
||||||
|
using moGPUMappingNeighborhood<Neighbor>::currentIndex;
|
||||||
|
using moGPUMappingNeighborhood<Neighbor>::indices;
|
||||||
|
using moGPUMappingNeighborhood<Neighbor>::mapping;
|
||||||
|
using moGPUMappingNeighborhood<Neighbor>::xChange;
|
||||||
|
using moGPUMappingNeighborhood<Neighbor>::mutex;
|
||||||
|
using moGPUMappingNeighborhood<Neighbor>::device_Mapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhoodSize the neighborhood size
|
||||||
|
* @param _xChange the number of x-change positions
|
||||||
|
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||||
|
*/
|
||||||
|
|
||||||
|
moGPUMappingNeighborhoodByModif(unsigned int _neighborhoodSize,
|
||||||
|
unsigned int _xChange,moGPUEval<Neighbor>& _eval) :
|
||||||
|
moGPUMappingNeighborhood<Neighbor> (_neighborhoodSize, _xChange), eval(_eval){
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the neighborhood
|
||||||
|
* @param _solution the solution to explore
|
||||||
|
* @param _current the first neighbor
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void init(EOT& _solution, Neighbor& _current) {
|
||||||
|
|
||||||
|
moGPUMappingNeighborhood<Neighbor>::init(_solution, _current);
|
||||||
|
//Compute all neighbors fitness at one time
|
||||||
|
eval.neighborhoodEval(_solution, device_Mapping,0,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moGPUMappingNeighborhoodByModif";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
moGPUEval<Neighbor>& eval;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
<moGPUOrderNeighborhoodByCpy.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Karima Boufaras, Thé Van LUONG
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can use,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
As a counterpart to the access to the source code and rights to copy,
|
||||||
|
modify and redistribute granted by the license, users are provided only
|
||||||
|
with a limited warranty and the software's author, the holder of the
|
||||||
|
economic rights, and the successive licensors have only limited liability.
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __moGPUOrderNeighborhoodByCpy_h
|
||||||
|
#define __moGPUOrderNeighborhoodByCpy_h
|
||||||
|
|
||||||
|
#include <neighborhood/moOrderNeighborhood.h>
|
||||||
|
#include <eval/moGPUEval.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An ordered neighborhood with parallel evaluation
|
||||||
|
*/
|
||||||
|
|
||||||
|
template<class N>
|
||||||
|
class moGPUOrderNeighborhoodByCpy: public moOrderNeighborhood<N> {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define type of a solution corresponding to Neighbor
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef N Neighbor;
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
using moOrderNeighborhood<Neighbor>::neighborhoodSize;
|
||||||
|
using moOrderNeighborhood<Neighbor>::currentIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhoodSize the size of the neighborhood
|
||||||
|
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||||
|
*/
|
||||||
|
|
||||||
|
moGPUOrderNeighborhoodByCpy(unsigned int _neighborhoodSize,
|
||||||
|
moGPUEval<Neighbor>& _eval) :
|
||||||
|
moOrderNeighborhood<Neighbor> (_neighborhoodSize), eval(_eval) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the neighborhood
|
||||||
|
*@param _solution the solution to explore
|
||||||
|
*@param _neighbor the first neighbor
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void init(EOT & _solution, Neighbor & _neighbor) {
|
||||||
|
|
||||||
|
moOrderNeighborhood<Neighbor>::init(_solution, _neighbor);
|
||||||
|
//Compute all neighbors fitness at one time
|
||||||
|
eval.neighborhoodEval(_solution,1,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class name.
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moGPUOrderNeighborhoodByCpy";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
moGPUEval<Neighbor>& eval;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
<moGPUOrderNeighborhoodByModif.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Jerémie Humeau, Thé Van LUONG, Karima Boufaras
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can use,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
As a counterpart to the access to the source code and rights to copy,
|
||||||
|
modify and redistribute granted by the license, users are provided only
|
||||||
|
with a limited warranty and the software's author, the holder of the
|
||||||
|
economic rights, and the successive licensors have only limited liability.
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __moGPUOrderNeighborhoodByModif_h
|
||||||
|
#define __moGPUOrderNeighborhoodByModif_h
|
||||||
|
|
||||||
|
#include <neighborhood/moOrderNeighborhood.h>
|
||||||
|
#include <eval/moGPUEvalByModif.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An ordered neighborhood with parallel evaluation
|
||||||
|
*/
|
||||||
|
|
||||||
|
template<class N>
|
||||||
|
class moGPUOrderNeighborhoodByModif: public moOrderNeighborhood<N> {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define type of a solution corresponding to Neighbor
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef N Neighbor;
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
using moOrderNeighborhood<Neighbor>::neighborhoodSize;
|
||||||
|
using moOrderNeighborhood<Neighbor>::currentIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhoodSize the size of the neighborhood
|
||||||
|
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||||
|
*/
|
||||||
|
|
||||||
|
moGPUOrderNeighborhoodByModif(unsigned int _neighborhoodSize,
|
||||||
|
moGPUEval<Neighbor>& _eval) :
|
||||||
|
moOrderNeighborhood<Neighbor> (_neighborhoodSize), eval(_eval) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the neighborhood
|
||||||
|
*@param _solution the solution to explore
|
||||||
|
*@param _neighbor the first neighbor
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void init(EOT & _solution, Neighbor & _neighbor) {
|
||||||
|
|
||||||
|
moOrderNeighborhood<Neighbor>::init(_solution, _neighbor);
|
||||||
|
//Compute all neighbors fitness at one time
|
||||||
|
eval.neighborhoodEval(_solution,0,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class name.
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moGPUOrderNeighborhoodByModif";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
moGPUEval<Neighbor>& eval;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*
|
||||||
|
<moGPURndWithReplNeighborhoodByCpy.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Jerémie Humeau, Karima Boufaras, Thé Van LUONG
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can use,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
As a counterpart to the access to the source code and rights to copy,
|
||||||
|
modify and redistribute granted by the license, users are provided only
|
||||||
|
with a limited warranty and the software's author, the holder of the
|
||||||
|
economic rights, and the successive licensors have only limited liability.
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _moGPURndWithReplNeighborhood_h
|
||||||
|
#define _moGPURndWithReplNeighborhood_h
|
||||||
|
|
||||||
|
#include <neighborhood/moRndWithReplNeighborhood.h>
|
||||||
|
#include <eval/moGPUEvalByCpy.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Random With replacement Neighborhood with parallel evaluation
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moGPURndWithReplNeighborhoodByCpy: public moRndWithReplNeighborhood<Neighbor> {
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define type of a solution corresponding to Neighbor
|
||||||
|
*/
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
using moRndWithReplNeighborhood<Neighbor>::neighborhoodSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhoodSize the size of the neighborhood
|
||||||
|
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||||
|
*/
|
||||||
|
moGPURndWithReplNeighborhoodByCpy(unsigned int _neighborhoodSize, moGPUEvalByCpy<
|
||||||
|
Neighbor>& _eval) :
|
||||||
|
moRndWithReplNeighborhood<Neighbor> (_neighborhoodSize), eval(_eval) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the neighborhood
|
||||||
|
* @param _solution the solution to explore
|
||||||
|
* @param _neighbor the first neighbor
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _solution, Neighbor & _neighbor) {
|
||||||
|
moRndWithReplNeighborhood<Neighbor>::init(_solution, _neighbor);
|
||||||
|
//Compute all neighbors fitness at one time
|
||||||
|
eval.neighborhoodEval(_solution,0,1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moGPURndWithReplNeighborhoodByCpy";
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
moGPUEvalByCpy<Neighbor>& eval;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
<moGPURndWithReplNeighborhoodByModif.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Jerémie Humeau, Karima Boufaras, Thé Van LUONG
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can use,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
As a counterpart to the access to the source code and rights to copy,
|
||||||
|
modify and redistribute granted by the license, users are provided only
|
||||||
|
with a limited warranty and the software's author, the holder of the
|
||||||
|
economic rights, and the successive licensors have only limited liability.
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __moGPURndWithReplNeighborhoodByModif_h
|
||||||
|
#define __moGPURndWithReplNeighborhoodByModif_h
|
||||||
|
|
||||||
|
#include <neighborhood/moRndWithReplNeighborhood.h>
|
||||||
|
#include <eval/moGPUEval.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Random With replacement Neighborhood with parallel evaluation
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moGPURndWithReplNeighborhoodByModif: public moRndWithReplNeighborhood<Neighbor> {
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define type of a solution corresponding to Neighbor
|
||||||
|
*/
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
using moRndWithReplNeighborhood<Neighbor>::neighborhoodSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhoodSize the size of the neighborhood
|
||||||
|
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||||
|
*/
|
||||||
|
moGPURndWithReplNeighborhoodByModif(unsigned int _neighborhoodSize, moGPUEval<Neighbor>& _eval) :
|
||||||
|
moRndWithReplNeighborhood<Neighbor> (_neighborhoodSize), eval(_eval) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the neighborhood
|
||||||
|
* @param _solution the solution to explore
|
||||||
|
* @param _neighbor the first neighbor
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _solution, Neighbor & _neighbor) {
|
||||||
|
moRndWithReplNeighborhood<Neighbor>::init(_solution, _neighbor);
|
||||||
|
//Compute all neighbors fitness at one time
|
||||||
|
eval.neighborhoodEval(_solution,0,1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moGPURndWithReplNeighborhood";
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
moGPUEval<Neighbor>& eval;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
<moGPURndWithoutReplNeighborhood.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Jerémie Humeau, Boufaras Karima, Thé Van LUONG
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can use,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
As a counterpart to the access to the source code and rights to copy,
|
||||||
|
modify and redistribute granted by the license, users are provided only
|
||||||
|
with a limited warranty and the software's author, the holder of the
|
||||||
|
economic rights, and the successive licensors have only limited liability.
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __moGPURndWithoutReplNeighborhood_h
|
||||||
|
#define __moGPURndWithoutReplNeighborhood_h
|
||||||
|
|
||||||
|
#include <neighborhood/moRndWithoutReplNeighborhood.h>
|
||||||
|
#include <eval/moGPUEval.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Random without replacement Neighborhood with parallel evaluation
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moGPURndWithoutReplNeighborhood: public moRndWithoutReplNeighborhood<Neighbor> {
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define type of a solution corresponding to Neighbor
|
||||||
|
*/
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
using moRndWithoutReplNeighborhood<Neighbor>::neighborhoodSize;
|
||||||
|
using moRndWithoutReplNeighborhood<Neighbor>::maxIndex;
|
||||||
|
using moRndWithoutReplNeighborhood<Neighbor>::indexVector;
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhoodSize the size of the neighborhood
|
||||||
|
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||||
|
*/
|
||||||
|
moGPURndWithoutReplNeighborhood(unsigned int _neighborhoodSize,moGPUEval<
|
||||||
|
Neighbor>& _eval) :
|
||||||
|
moRndWithoutReplNeighborhood<Neighbor> (_neighborhoodSize),eval(_eval) {
|
||||||
|
for (unsigned int i = 0; i < neighborhoodSize; i++)
|
||||||
|
indexVector.push_back(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the neighborhood
|
||||||
|
* @param _solution the solution to explore
|
||||||
|
* @param _neighbor the first neighbor
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _solution, Neighbor & _neighbor) {
|
||||||
|
moRndWithoutReplNeighborhood<Neighbor>::init(_solution, _neighbor);
|
||||||
|
//Compute all neighbors fitness at one time
|
||||||
|
eval.neighborhoodEval(_solution,0,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moGPURndWithoutReplNeighborhood";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
moGPUEval<Neighbor>& eval;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
<moGPURndWithoutReplNeighborhood.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Jerémie Humeau, Boufaras Karima, Thé Van LUONG
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can use,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
As a counterpart to the access to the source code and rights to copy,
|
||||||
|
modify and redistribute granted by the license, users are provided only
|
||||||
|
with a limited warranty and the software's author, the holder of the
|
||||||
|
economic rights, and the successive licensors have only limited liability.
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __moGPURndWithoutReplNeighborhood_h
|
||||||
|
#define __moGPURndWithoutReplNeighborhood_h
|
||||||
|
|
||||||
|
#include <neighborhood/moRndWithoutReplNeighborhood.h>
|
||||||
|
#include <eval/moGPUEvalByModif.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Random without replacement Neighborhood with parallel evaluation
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moGPURndWithoutReplNeighborhood: public moRndWithoutReplNeighborhood<Neighbor> {
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define type of a solution corresponding to Neighbor
|
||||||
|
*/
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
using moRndWithoutReplNeighborhood<Neighbor>::neighborhoodSize;
|
||||||
|
using moRndWithoutReplNeighborhood<Neighbor>::maxIndex;
|
||||||
|
using moRndWithoutReplNeighborhood<Neighbor>::indexVector;
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhoodSize the size of the neighborhood
|
||||||
|
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||||
|
*/
|
||||||
|
moGPURndWithoutReplNeighborhood(unsigned int _neighborhoodSize,moGPUEvalByModif<
|
||||||
|
Neighbor>& _eval) :
|
||||||
|
moRndWithoutReplNeighborhood<Neighbor> (_neighborhoodSize),eval(_eval) {
|
||||||
|
for (unsigned int i = 0; i < neighborhoodSize; i++)
|
||||||
|
indexVector.push_back(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the neighborhood
|
||||||
|
* @param _solution the solution to explore
|
||||||
|
* @param _neighbor the first neighbor
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _solution, Neighbor & _neighbor) {
|
||||||
|
moRndWithoutReplNeighborhood<Neighbor>::init(_solution, _neighbor);
|
||||||
|
//Compute all neighbors fitness at one time
|
||||||
|
eval.neighborhoodEval(_solution,0,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moGPURndWithoutReplNeighborhood";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
moGPUEvalByModif<Neighbor>& eval;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
/*
|
||||||
|
<moGPUXBitFlippingNeighbor.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Boufaras Karima, Thé Van Luong
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __moGPUXBitFlippingNeighbor_h
|
||||||
|
#define __moGPUXBitFlippingNeighbor_h
|
||||||
|
|
||||||
|
#include <neighborhood/moBackableNeighbor.h>
|
||||||
|
#include <neighborhood/moXChangeNeighbor.h>
|
||||||
|
#include <GPUType/moGPUBitVector.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A GPU X-BitFlipping Neighbor
|
||||||
|
*/
|
||||||
|
|
||||||
|
template< class Fitness >
|
||||||
|
class moGPUXBitFlippingNeighbor:public moBackableNeighbor< moGPUBitVector<Fitness> > ,
|
||||||
|
public moXChangeNeighbor< moGPUBitVector<Fitness> > {
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef moGPUBitVector<Fitness> EOT ;
|
||||||
|
using moXChangeNeighbor<EOT>::indices;
|
||||||
|
using moXChangeNeighbor<EOT>::xChange;
|
||||||
|
using moXChangeNeighbor<EOT>::key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*Default Constructor
|
||||||
|
*/
|
||||||
|
|
||||||
|
moGPUXBitFlippingNeighbor() :
|
||||||
|
moXChangeNeighbor<EOT> () {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _xFlip the number of bit to flip
|
||||||
|
*/
|
||||||
|
|
||||||
|
moGPUXBitFlippingNeighbor(unsigned int _xFlip) :
|
||||||
|
moXChangeNeighbor<EOT> (_xFlip) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the K-Flip in solution
|
||||||
|
* @param _solution the solution to move
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void move(EOT& _solution) {
|
||||||
|
for (unsigned int i = 0; i < xChange; i++)
|
||||||
|
_solution[indices[i]] = !_solution[indices[i]];
|
||||||
|
_solution.invalidate();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* apply the K-Flip to restore the solution (use by moFullEvalByModif)
|
||||||
|
* @param _solution the solution to move back
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void moveBack(EOT& _solution) {
|
||||||
|
move(_solution);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class name.
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moGPUXBitFlippingNeighbor";
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
@ -0,0 +1,110 @@
|
||||||
|
/*
|
||||||
|
<moGPUXChangeNeighborhood.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Karima Boufaras, Thé Van LUONG
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __moGPUXChangeNeighborhood_h
|
||||||
|
#define __moGPUXChangeNeighborhood_h
|
||||||
|
|
||||||
|
#include <neighborhood/moXChangeNeighborhood.h>
|
||||||
|
#include <eval/moGPUEval.h>
|
||||||
|
|
||||||
|
template<class N>
|
||||||
|
class moGPUXChangeNeighborhood: public moXChangeNeighborhood<N> {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define a Neighbor and type of a solution corresponding
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef N Neighbor;
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
using moXChangeNeighborhood<Neighbor>::neighborhoodSize;
|
||||||
|
using moXChangeNeighborhood<Neighbor>::currentIndex;
|
||||||
|
using moXChangeNeighborhood<Neighbor>::indices;
|
||||||
|
using moXChangeNeighborhood<Neighbor>::mapping;
|
||||||
|
using moXChangeNeighborhood<Neighbor>::xChange;
|
||||||
|
using moXChangeNeighborhood<Neighbor>::mutex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhoodSize the neighborhood size
|
||||||
|
* @param _xChange the number of x-change positions
|
||||||
|
*/
|
||||||
|
|
||||||
|
moGPUXChangeNeighborhood(unsigned int _neighborhoodSize,
|
||||||
|
unsigned int _xChange) :
|
||||||
|
moXChangeNeighborhood<Neighbor> (_neighborhoodSize, _xChange) {
|
||||||
|
sendMapping = false;
|
||||||
|
cudaMalloc((void**) &device_Mapping, sizeof(unsigned int)
|
||||||
|
* neighborhoodSize * _xChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*Destructor
|
||||||
|
*/
|
||||||
|
|
||||||
|
~moGPUXChangeNeighborhood() {
|
||||||
|
|
||||||
|
cudaFree(device_Mapping);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the neighborhood and mapping on device
|
||||||
|
* @param _solution the solution to explore
|
||||||
|
* @param _current the first neighbor
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void init(EOT& _solution, Neighbor& _current) {
|
||||||
|
|
||||||
|
moXChangeNeighborhood<Neighbor>::init(_solution, _current);
|
||||||
|
if (!sendMapping) {
|
||||||
|
cudaMemcpy(device_Mapping, mapping, xChange * neighborhoodSize
|
||||||
|
* sizeof(unsigned int), cudaMemcpyHostToDevice);
|
||||||
|
sendMapping = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moGPUXChangeNeighborhood";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
bool sendMapping;
|
||||||
|
unsigned int * device_Mapping;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
/*
|
||||||
|
<moGPUXChangeNeighborhoodByCpy.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Boufaras Karima, Thé Van Luong
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __moGPUXChangeNeighborhoodByCpy_h
|
||||||
|
#define __moGPUXChangeNeighborhoodByCpy_h
|
||||||
|
|
||||||
|
#include <neighborhood/moGPUXChangeNeighborhood.h>
|
||||||
|
#include <eval/moGPUEval.h>
|
||||||
|
|
||||||
|
template<class N>
|
||||||
|
class moGPUXChangeNeighborhoodByCpy: public moGPUXChangeNeighborhood<N> {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define a Neighbor and type of a solution corresponding
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef N Neighbor;
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
/*A tester*/
|
||||||
|
using moGPUXChangeNeighborhood<Neighbor>::neighborhoodSize;
|
||||||
|
using moGPUXChangeNeighborhood<Neighbor>::currentIndex;
|
||||||
|
using moGPUXChangeNeighborhood<Neighbor>::indices;
|
||||||
|
using moGPUXChangeNeighborhood<Neighbor>::mapping;
|
||||||
|
using moGPUXChangeNeighborhood<Neighbor>::xChange;
|
||||||
|
using moGPUXChangeNeighborhood<Neighbor>::mutex;
|
||||||
|
using moGPUXChangeNeighborhood<Neighbor>::device_Mapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhoodSize the neighborhood size
|
||||||
|
* @param _xChange the number of x-change positions
|
||||||
|
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||||
|
*/
|
||||||
|
|
||||||
|
moGPUXChangeNeighborhoodByCpy(unsigned int _neighborhoodSize,
|
||||||
|
unsigned int _xChange,moGPUEval<Neighbor>& _eval) :
|
||||||
|
moGPUXChangeNeighborhood<Neighbor> (_neighborhoodSize, _xChange), eval(_eval){
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the neighborhood
|
||||||
|
* @param _solution the solution to explore
|
||||||
|
* @param _current the first neighbor
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void init(EOT& _solution, Neighbor& _current) {
|
||||||
|
|
||||||
|
moGPUXChangeNeighborhood<Neighbor>::init(_solution, _current);
|
||||||
|
//Compute all neighbors fitness at one time
|
||||||
|
eval.neighborhoodEval(_solution, device_Mapping,1,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moGPUXChangeNeighborhoodByCpy";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
moGPUEval<Neighbor>& eval;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
<moGPUXChangeNeighborhoodByModif.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Karima Boufaras, Thé Van Luong
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __moGPUXChangeNeighborhoodByModif_h
|
||||||
|
#define __moGPUXChangeNeighborhoodByModif_h
|
||||||
|
|
||||||
|
#include <neighborhood/moGPUXChangeNeighborhood.h>
|
||||||
|
#include <eval/moGPUEval.h>
|
||||||
|
|
||||||
|
template<class N>
|
||||||
|
class moGPUXChangeNeighborhoodByModif: public moGPUXChangeNeighborhood<N> {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define a Neighbor and type of a solution corresponding
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef N Neighbor;
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
using moGPUXChangeNeighborhood<Neighbor>::neighborhoodSize;
|
||||||
|
using moGPUXChangeNeighborhood<Neighbor>::currentIndex;
|
||||||
|
using moGPUXChangeNeighborhood<Neighbor>::indices;
|
||||||
|
using moGPUXChangeNeighborhood<Neighbor>::mapping;
|
||||||
|
using moGPUXChangeNeighborhood<Neighbor>::xChange;
|
||||||
|
using moGPUXChangeNeighborhood<Neighbor>::mutex;
|
||||||
|
using moGPUXChangeNeighborhood<Neighbor>::device_Mapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhoodSize the neighborhood size
|
||||||
|
* @param _xChange the number of x-change positions
|
||||||
|
* @param _eval show how to evaluate neighborhood of a solution at one time
|
||||||
|
*/
|
||||||
|
|
||||||
|
moGPUXChangeNeighborhoodByModif(unsigned int _neighborhoodSize,
|
||||||
|
unsigned int _xChange,moGPUEval<Neighbor>& _eval) :
|
||||||
|
moGPUXChangeNeighborhood<Neighbor> (_neighborhoodSize, _xChange), eval(_eval){
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the neighborhood
|
||||||
|
* @param _solution the solution to explore
|
||||||
|
* @param _current the first neighbor
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void init(EOT& _solution, Neighbor& _current) {
|
||||||
|
|
||||||
|
moGPUXChangeNeighborhood<Neighbor>::init(_solution, _current);
|
||||||
|
//Compute all neighbors fitness at one time
|
||||||
|
eval.neighborhoodEval(_solution, device_Mapping,0,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moGPUXChangeNeighborhoodByModif";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
moGPUEval<Neighbor>& eval;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
/*
|
||||||
|
<moGPUXSwapNeighbor.h.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Boufaras Karima, Thé Van Luong
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __moGPUXSwapNeighbor_h
|
||||||
|
#define __moGPUXSwapNeighbor_h
|
||||||
|
#include <neighborhood/moBackableNeighbor.h>
|
||||||
|
#include <neighborhood/moXChangeNeighbor.h>
|
||||||
|
#include <GPUType/moGPUPermutationVector.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A GPU X-Swap Neighbor
|
||||||
|
*/
|
||||||
|
|
||||||
|
template<class Fitness>
|
||||||
|
class moGPUXSwapNeighbor: public moBackableNeighbor<moGPUPermutationVector<Fitness> > ,
|
||||||
|
public moXChangeNeighbor<moGPUPermutationVector<Fitness> > {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef moGPUPermutationVector<Fitness> EOT ;
|
||||||
|
using moXChangeNeighbor<EOT>::indices;
|
||||||
|
using moXChangeNeighbor<EOT>::xChange;
|
||||||
|
using moXChangeNeighbor<EOT>::key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*Default Constructor
|
||||||
|
*/
|
||||||
|
|
||||||
|
moGPUXSwapNeighbor() :
|
||||||
|
moXChangeNeighbor<EOT> () {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _xSwap the number of swap to do
|
||||||
|
*/
|
||||||
|
|
||||||
|
moGPUXSwapNeighbor(unsigned int _xSwap) :
|
||||||
|
moXChangeNeighbor<EOT> (_xSwap) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the K-swap
|
||||||
|
* @param _solution the solution to move
|
||||||
|
*/
|
||||||
|
virtual void move(EOT& _solution) {
|
||||||
|
EOT tmp(1);
|
||||||
|
for (unsigned int i = 0; i < xChange-1; i++) {
|
||||||
|
tmp[0] = _solution[indices[i]];
|
||||||
|
_solution[indices[i]] = _solution[indices[i + 1]];
|
||||||
|
_solution[indices[i + 1]] = tmp[0];
|
||||||
|
}
|
||||||
|
_solution.invalidate();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* apply the K-swap to restore the solution (use by moFullEvalByModif)
|
||||||
|
* @param _solution the solution to move back
|
||||||
|
*/
|
||||||
|
virtual void moveBack(EOT& _solution) {
|
||||||
|
EOT tmp(1);
|
||||||
|
for (int i = xChange-1; i > 0; i--) {
|
||||||
|
tmp[0] = _solution[indices[i]];
|
||||||
|
_solution[indices[i]] = _solution[indices[i - 1]];
|
||||||
|
_solution[indices[i - 1]] = tmp[0];
|
||||||
|
}
|
||||||
|
_solution.invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class name.
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moGPUXSwapNeighbor";
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue