Début du dev de newMo
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1639 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
25c45dd1fa
commit
e13fd250d1
34 changed files with 1946 additions and 48 deletions
107
branches/newMo/src/neighborhood/moBitNeighbor.h
Normal file
107
branches/newMo/src/neighborhood/moBitNeighbor.h
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
#ifndef _bitNeighbor_h
|
||||
#define _bitNeighbor_h
|
||||
|
||||
#include <ga/eoBit.h>
|
||||
#include <neighborhood/moNeighbor.h>
|
||||
|
||||
/*
|
||||
contener of the neighbor information
|
||||
*/
|
||||
template< class Fitness >
|
||||
class moBitNeighbor : public moNeighbor< eoBit<Fitness> , Fitness>
|
||||
{
|
||||
public:
|
||||
typedef eoBit<Fitness> EOType ;
|
||||
|
||||
using moNeighbor< eoBit<Fitness> , Fitness>::fitness;
|
||||
|
||||
// describe the neighbor
|
||||
unsigned bit ;
|
||||
|
||||
// empty constructor needed
|
||||
moBitNeighbor() : moNeighbor<eoBit<Fitness> , Fitness>() { } ;
|
||||
|
||||
// copy constructor
|
||||
moBitNeighbor(const moBitNeighbor & n) : moNeighbor<eoBit<Fitness> , Fitness>(n) {
|
||||
this->bit = n.bit ;
|
||||
} ;
|
||||
|
||||
moBitNeighbor(unsigned b) : moNeighbor<eoBit<Fitness> , Fitness>() , bit(b) { } ;
|
||||
|
||||
/*
|
||||
* operator of assignment
|
||||
*/
|
||||
virtual moBitNeighbor<Fitness> & operator=(const moBitNeighbor<Fitness> & source) {
|
||||
moNeighbor<EOType, Fitness>::operator=(source);
|
||||
|
||||
this->bit = source.bit ;
|
||||
|
||||
return *this ;
|
||||
}
|
||||
|
||||
/*
|
||||
move the solution
|
||||
*/
|
||||
virtual void move(EOType & solution) {
|
||||
solution[bit] = solution[bit]?false:true ;
|
||||
}
|
||||
|
||||
// by default: if the fitness of the current solution is stricly higher than the other neighbor
|
||||
virtual bool betterThan(const moNeighbor<EOType, Fitness> & __neighbor) {
|
||||
return (this->fitness() > __neighbor.fitness()) ;
|
||||
};
|
||||
|
||||
/** Return the class id.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const { return "moBitNeighbor"; }
|
||||
|
||||
/**
|
||||
* 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); // rewind
|
||||
_is >> repFit;
|
||||
_is >> bit;
|
||||
|
||||
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() << ' ' << bit << ' ' ;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Local Variables:
|
||||
// coding: iso-8859-1
|
||||
// mode: C++
|
||||
// c-file-offsets: ((c . 0))
|
||||
// c-file-style: "Stroustrup"
|
||||
// fill-column: 80
|
||||
// End:
|
||||
60
branches/newMo/src/neighborhood/moBitNeighborhood.h
Normal file
60
branches/newMo/src/neighborhood/moBitNeighborhood.h
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
#ifndef _bitNeighborhood_h
|
||||
#define _bitNeighborhood_h
|
||||
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
|
||||
template< class N >
|
||||
class moBitNeighborhood : public moNeighborhood<N>
|
||||
{
|
||||
public:
|
||||
typedef N Neighbor ;
|
||||
typedef typename Neighbor::EOType EOT ;
|
||||
|
||||
moBitNeighborhood() : moNeighborhood<Neighbor>() { }
|
||||
|
||||
virtual bool hasNeighbor(EOT & solution) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
initialisation of the neighborhood
|
||||
*/
|
||||
virtual void init(EOT & solution, Neighbor & _neighbor) {
|
||||
currentBit = 0 ;
|
||||
|
||||
_neighbor.bit = currentBit ;
|
||||
}
|
||||
|
||||
/*
|
||||
Give the next neighbor
|
||||
*/
|
||||
virtual void next(EOT & solution, Neighbor & neighbor) {
|
||||
currentBit++ ;
|
||||
|
||||
neighbor.bit = currentBit ;
|
||||
}
|
||||
|
||||
/*
|
||||
if false, there is no neighbor left to explore
|
||||
*/
|
||||
virtual bool cont(EOT & solution) {
|
||||
return (currentBit < solution.size()) ;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned currentBit;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Local Variables:
|
||||
// coding: iso-8859-1
|
||||
// mode: C++
|
||||
// c-file-offsets: ((c . 0))
|
||||
// c-file-style: "Stroustrup"
|
||||
// fill-column: 80
|
||||
// End:
|
||||
41
branches/newMo/src/neighborhood/moEmptyNeighbor.h
Normal file
41
branches/newMo/src/neighborhood/moEmptyNeighbor.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef _emptyNeighbor_h
|
||||
#define _emptyNeighbor_h
|
||||
|
||||
#include <neighborhood/moNeighbor.h>
|
||||
|
||||
/*
|
||||
contener of the neighbor information
|
||||
*/
|
||||
template< class EOT , class Fitness >
|
||||
class moEmptyNeighbor : public moNeighbor<EOT,Fitness>
|
||||
{
|
||||
public:
|
||||
typedef EOT EOType ;
|
||||
|
||||
// empty constructor
|
||||
moEmptyNeighbor() : moNeighbor<EOType, Fitness>() { } ;
|
||||
|
||||
/*
|
||||
make the evaluation of the current neighbor and update the information on this neighbor
|
||||
*/
|
||||
virtual void eval(EOT & solution) { }
|
||||
|
||||
/*
|
||||
move the solution
|
||||
*/
|
||||
virtual void move(EOT & solution) { }
|
||||
|
||||
// true if the this is better than the neighbor __neighbor
|
||||
virtual bool betterThan(moNeighbor<EOT,Fitness> & __neighbor) { return true; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Local Variables:
|
||||
// coding: iso-8859-1
|
||||
// mode: C++
|
||||
// c-file-offsets: ((c . 0))
|
||||
// c-file-style: "Stroustrup"
|
||||
// fill-column: 80
|
||||
// End:
|
||||
64
branches/newMo/src/neighborhood/moFullEvalBitNeighbor.h
Normal file
64
branches/newMo/src/neighborhood/moFullEvalBitNeighbor.h
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
#ifndef _fullEvalBitNeighbor_h
|
||||
#define _fullEvalBitNeighbor_h
|
||||
|
||||
#include <neighborhood/moBitNeighbor.h>
|
||||
#include <ga.h>
|
||||
|
||||
/*
|
||||
contener of the neighbor information
|
||||
*/
|
||||
template< class Fitness >
|
||||
class moFullEvalBitNeighbor : public moBitNeighbor<Fitness>
|
||||
{
|
||||
public:
|
||||
typedef eoBit<Fitness> EOType ;
|
||||
|
||||
using moBitNeighbor<Fitness>::bit ;
|
||||
|
||||
// empty constructor needed
|
||||
moFullEvalBitNeighbor() : moBitNeighbor<Fitness>() { } ;
|
||||
|
||||
moFullEvalBitNeighbor(unsigned b) : moBitNeighbor<Fitness>(bit) { } ;
|
||||
|
||||
/*
|
||||
make the evaluation of the current neighbor and update the information on this neighbor
|
||||
*/
|
||||
virtual void eval(EOType & solution) {
|
||||
Fitness fit = solution.fitness();
|
||||
|
||||
solution[bit] = solution[bit]?false:true ;
|
||||
|
||||
(*fullEval)(solution);
|
||||
|
||||
fitness(solution.fitness());
|
||||
|
||||
solution[bit] = solution[bit]?false:true ;
|
||||
|
||||
solution.fitness(fit);
|
||||
};
|
||||
|
||||
static void setFullEvalFunc(eoEvalFunc<EOType> & eval) {
|
||||
fullEval = & eval ;
|
||||
}
|
||||
|
||||
static eoEvalFunc<EOType> * fullEval ;
|
||||
|
||||
/** Return the class id.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const { return "moFullEvalBitNeighbor"; }
|
||||
};
|
||||
|
||||
template<class Fitness>
|
||||
eoEvalFunc< eoBit<Fitness> > * moFullEvalBitNeighbor<Fitness>::fullEval = NULL ;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Local Variables:
|
||||
// coding: iso-8859-1
|
||||
// mode: C++
|
||||
// c-file-offsets: ((c . 0))
|
||||
// c-file-style: "Stroustrup"
|
||||
// fill-column: 80
|
||||
// End:
|
||||
46
branches/newMo/src/neighborhood/moFullEvalNeighbor.h
Normal file
46
branches/newMo/src/neighborhood/moFullEvalNeighbor.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#ifndef _fullEvalNeighbor_h
|
||||
#define _fullEvalNeighbor_h
|
||||
|
||||
/*
|
||||
neighbor with full evaluation
|
||||
*/
|
||||
template< class EOT , class Fitness >
|
||||
class moFullEvalNeighbor : moNeighbor<EOT, Fitness>
|
||||
{
|
||||
public:
|
||||
// empty constructor
|
||||
moFullEvalNeighbor(eoEvalFunc<EOT> & _eval) : fulleval(_eval) { } ;
|
||||
|
||||
/*
|
||||
make the evaluation of the current neighbor and update the information on this neighbor
|
||||
*/
|
||||
virtual void eval(EOT & solution) {
|
||||
Fitness fit = solution.fitness();
|
||||
|
||||
move(solution);
|
||||
|
||||
fulleval(solution);
|
||||
|
||||
moveBack(solution);
|
||||
|
||||
fitness = solution.fitness();
|
||||
|
||||
solution.fitness(fit);
|
||||
};
|
||||
|
||||
virtual moveBack(EOT & solution) ;
|
||||
|
||||
private:
|
||||
eoEvalFunc<EOT> & fulleval ;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Local Variables:
|
||||
// coding: iso-8859-1
|
||||
// mode: C++
|
||||
// c-file-offsets: ((c . 0))
|
||||
// c-file-style: "Stroustrup"
|
||||
// fill-column: 80
|
||||
// End:
|
||||
108
branches/newMo/src/neighborhood/moMoveNeighbor.h
Normal file
108
branches/newMo/src/neighborhood/moMoveNeighbor.h
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
#ifndef _moMoveNeighbor_h
|
||||
#define _moMoveNeighbor_h
|
||||
|
||||
#include <eo>
|
||||
|
||||
#include <neighborhood/moNeighbor.h>
|
||||
#include <move/moMoveIncrEval.h>
|
||||
#include <move/moMove.h>
|
||||
|
||||
|
||||
/*
|
||||
contener of the neighbor informations
|
||||
*/
|
||||
template< class M , class Fitness >
|
||||
class moMoveNeighbor : public moNeighbor <typename M::EOType, Fitness>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename M::EOType EOT;
|
||||
|
||||
// empty constructor
|
||||
moMoveNeighbor() {_move=new M();};
|
||||
|
||||
~moMoveNeighbor() {delete _move;};
|
||||
|
||||
// copy constructeur
|
||||
moMoveNeighbor(const moMoveNeighbor<M, Fitness> & _n) {
|
||||
moNeighbor<EOT, Fitness>::operator=(_n);
|
||||
(*_move) = *(_n._move);
|
||||
}
|
||||
|
||||
// assignment operator
|
||||
virtual moMoveNeighbor<M, Fitness> & operator=(const moMoveNeighbor<M, Fitness> & _n) {
|
||||
moNeighbor <EOT, Fitness>::operator=(_n);
|
||||
(*_move) = *(_n._move);
|
||||
|
||||
std::cout << moNeighbor<EOT, Fitness>::fitness() << " , " << _n.fitness() << std::endl;
|
||||
return *this ;
|
||||
}
|
||||
|
||||
/*
|
||||
* make the evaluation of the current neighbor and update the information on this neighbor
|
||||
* the evaluation could be increamental
|
||||
*/
|
||||
virtual void eval(EOT & solution){
|
||||
fitness((*_incrEval)(*_move, solution));
|
||||
}
|
||||
|
||||
/*
|
||||
* move the solution
|
||||
*/
|
||||
virtual void move(EOT & solution){
|
||||
(*_move)(solution);
|
||||
}
|
||||
|
||||
/** Return the class id.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const { return "moMoveNeighbor"; }
|
||||
|
||||
static void setIncrEval(moMoveIncrEval<M, Fitness>& increm) {
|
||||
_incrEval = & increm ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
_is.seekg(pos); // rewind
|
||||
_is >> repFitness;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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 << repFitness << ' ' ;
|
||||
}*/
|
||||
|
||||
M* _move;
|
||||
|
||||
private:
|
||||
|
||||
static moMoveIncrEval<M, Fitness>* _incrEval;
|
||||
|
||||
};
|
||||
|
||||
template< class M , class Fitness >
|
||||
moMoveIncrEval<M, Fitness> * moMoveNeighbor<M, Fitness>::_incrEval = NULL;
|
||||
#endif
|
||||
59
branches/newMo/src/neighborhood/moMoveNeighborhood.h
Normal file
59
branches/newMo/src/neighborhood/moMoveNeighborhood.h
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
#ifndef _moMoveNeighborhood_h
|
||||
#define _moMoveNeighborhood_h
|
||||
|
||||
#include <neighborhood/moMoveNeighbor.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
|
||||
#include <move/moMoveInit.h>
|
||||
#include <move/moNextMove.h>
|
||||
|
||||
template< class M, class Fitness >
|
||||
class moMoveNeighborhood : public moNeighborhood <moMoveNeighbor<M, Fitness> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef moMoveNeighbor<M, Fitness> Neighbor;
|
||||
typedef typename M::EOType EOT;
|
||||
|
||||
moMoveNeighborhood(moMoveInit<M>& i, moNextMove<M>& n):_init(i), _next(n), isContinue(true) {}
|
||||
|
||||
virtual bool hasNeighbor(EOT & solution){
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
initialisation of the neighborhood
|
||||
*/
|
||||
virtual void init(EOT & solution, Neighbor & current){
|
||||
_init(*(current._move), solution);
|
||||
isContinue=true;
|
||||
}
|
||||
|
||||
/*
|
||||
Give the next neighbor
|
||||
*/
|
||||
virtual void next(EOT & solution, Neighbor & current){
|
||||
isContinue=_next(*(current._move), solution);
|
||||
}
|
||||
|
||||
/*
|
||||
if false, there is no neighbor left to explore
|
||||
*/
|
||||
virtual bool cont(EOT & solution){
|
||||
return isContinue;
|
||||
}
|
||||
|
||||
/** Return the class id.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const { return "moMoveNeighborhood"; }
|
||||
|
||||
private:
|
||||
moMoveInit<M>& _init;
|
||||
moNextMove<M>& _next;
|
||||
bool isContinue;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
135
branches/newMo/src/neighborhood/moNeighbor.h
Normal file
135
branches/newMo/src/neighborhood/moNeighbor.h
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
#ifndef _moNeighbor_h
|
||||
#define _moNeighbor_h
|
||||
|
||||
#include <eo>
|
||||
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
|
||||
/*
|
||||
contener of the neighbor informations
|
||||
*/
|
||||
template< class EOT , class Fitness >
|
||||
class moNeighbor : public eoObject, public eoPersistent
|
||||
{
|
||||
public:
|
||||
typedef EOT EOType ;
|
||||
|
||||
// empty constructor
|
||||
moNeighbor() { } ;
|
||||
|
||||
// copy constructeur
|
||||
moNeighbor(const moNeighbor<EOType, Fitness> & _n) {
|
||||
repFitness = _n.fitness();
|
||||
}
|
||||
|
||||
// assignment operator
|
||||
virtual moNeighbor<EOType, Fitness> & operator=(const moNeighbor<EOType, Fitness> & _n) {
|
||||
repFitness = _n.fitness();
|
||||
|
||||
return *this ;
|
||||
}
|
||||
|
||||
/*
|
||||
* make the evaluation of the current neighbor and update the information on this neighbor
|
||||
* the evaluation could be increamental
|
||||
*/
|
||||
virtual void eval(EOT & solution) = 0 ;
|
||||
|
||||
/*
|
||||
* move the solution
|
||||
*/
|
||||
virtual void move(EOT & solution) = 0 ;
|
||||
|
||||
// true if the this is better than the neighbor __neighbor
|
||||
// virtual bool betterThan(const moNeighbor<EOT,Fitness> & __neighbor) = 0 ;
|
||||
virtual bool betterThan(const moNeighbor<EOT,Fitness> & __neighbor) {
|
||||
return (*neighborComparator)(*this, __neighbor) ;
|
||||
} ;
|
||||
|
||||
/// Return fitness value.
|
||||
const Fitness& fitness() const {
|
||||
return repFitness;
|
||||
}
|
||||
|
||||
/// Get fitness as reference, useful when fitness is set in a multi-stage way, e.g., MOFitness gets performance information, is subsequently ranked
|
||||
Fitness& fitnessReference() {
|
||||
return repFitness;
|
||||
}
|
||||
|
||||
/** Set fitness. At the same time, validates it.
|
||||
* @param _fitness New fitness value.
|
||||
*/
|
||||
void fitness(const Fitness& _fitness)
|
||||
{
|
||||
repFitness = _fitness;
|
||||
}
|
||||
|
||||
/** Return the class id.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const { return "moNeighbor"; }
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
_is.seekg(pos); // rewind
|
||||
_is >> repFitness;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 << repFitness << ' ' ;
|
||||
}
|
||||
|
||||
static void setNeighborComparator(const moNeighborComparator< moNeighbor<EOType, Fitness> > & comparator) {
|
||||
neighborComparator = & comparator ;
|
||||
}
|
||||
|
||||
static const moNeighborComparator< moNeighbor<EOType, Fitness> > & getNeighborComparator() {
|
||||
return *neighborComparator ;
|
||||
}
|
||||
|
||||
private:
|
||||
// minimal information on the neighbor : fitness
|
||||
Fitness repFitness ;
|
||||
|
||||
// the comparator of neighbors
|
||||
static moNeighborComparator<moNeighbor<EOType, Fitness> > * neighborComparator ;
|
||||
|
||||
};
|
||||
|
||||
// static default comparor
|
||||
template<class EOT, class Fitness>
|
||||
moNeighborComparator<moNeighbor<EOT, Fitness> > * moNeighbor<EOT, Fitness>::neighborComparator = new moNeighborComparator<moNeighbor<EOT, Fitness> >();
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Local Variables:
|
||||
// coding: iso-8859-1
|
||||
// mode: C++
|
||||
// c-file-offsets: ((c . 0))
|
||||
// c-file-style: "Stroustrup"
|
||||
// fill-column: 80
|
||||
// End:
|
||||
46
branches/newMo/src/neighborhood/moNeighborhood.h
Normal file
46
branches/newMo/src/neighborhood/moNeighborhood.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#ifndef _moNeighborhood_h
|
||||
#define _moNeighborhood_h
|
||||
|
||||
template< class Neigh >
|
||||
class moNeighborhood : public eoObject
|
||||
{
|
||||
public:
|
||||
typedef Neigh Neighbor;
|
||||
typedef typename Neighbor::EOType EOT;
|
||||
|
||||
moNeighborhood() { }
|
||||
|
||||
virtual bool hasNeighbor(EOT & solution) = 0 ;
|
||||
|
||||
/*
|
||||
initialisation of the neighborhood
|
||||
*/
|
||||
virtual void init(EOT & solution, Neighbor & current) = 0 ;
|
||||
|
||||
/*
|
||||
Give the next neighbor
|
||||
*/
|
||||
virtual void next(EOT & solution, Neighbor & current) = 0 ;
|
||||
|
||||
/*
|
||||
if false, there is no neighbor left to explore
|
||||
*/
|
||||
virtual bool cont(EOT & solution) = 0 ;
|
||||
|
||||
/** Return the class id.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const { return "moNeighborhood"; }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Local Variables:
|
||||
// coding: iso-8859-1
|
||||
// mode: C++
|
||||
// c-file-offsets: ((c . 0))
|
||||
// c-file-style: "Stroustrup"
|
||||
// fill-column: 80
|
||||
// End:
|
||||
Loading…
Reference in a new issue