Modification de vsn, encore à compiler...
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1927 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
7631f6e040
commit
1cf50233ee
4 changed files with 305 additions and 272 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
<moVNSexplorer.h>
|
<moVNSexplorer.h>
|
||||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
This software is governed by the CeCILL license under French law and
|
This software is governed by the CeCILL license under French law and
|
||||||
abiding by the rules of distribution of free software. You can ue,
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
|
@ -37,7 +37,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
#include <algo/moDummyLS.h>
|
#include <algo/moDummyLS.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Explorer for Variiable Neighborhood Search
|
* Explorer for the "Variable Neighborhood Search" metaheuristic
|
||||||
*/
|
*/
|
||||||
template< class Neighbor>
|
template< class Neighbor>
|
||||||
class moVNSexplorer : public moNeighborhoodExplorer< Neighbor >
|
class moVNSexplorer : public moNeighborhoodExplorer< Neighbor >
|
||||||
|
|
@ -53,10 +53,9 @@ public:
|
||||||
* @param _neighborComparator a neighbor comparator
|
* @param _neighborComparator a neighbor comparator
|
||||||
* @param _solNeighborComparator solution vs neighbor comparator
|
* @param _solNeighborComparator solution vs neighbor comparator
|
||||||
*/
|
*/
|
||||||
moVNSexplorer(
|
moVNSexplorer(moVariableNeighborhoodSelection<EOT> & _selection,
|
||||||
moVariableNeighborhoodSelection<EOT> & _selection,
|
|
||||||
moAcceptanceCriterion<Neighbor>& _acceptCrit):
|
moAcceptanceCriterion<Neighbor>& _acceptCrit):
|
||||||
moNeighborhoodExplorer<Neighbor>(),dummyLS(dummyEval), selection(_selection), acceptCrit(_acceptCrit), ls(&dummyLS), shake(dummyLS), stop(false)
|
moNeighborhoodExplorer<Neighbor>(), selection(_selection), acceptCrit(_acceptCrit), stop(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -66,25 +65,26 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initParam: NOTHING TO DO
|
* Initialization on the initial search opeartors based on the "first" neighborhood
|
||||||
|
* @param _solution the current solution
|
||||||
*/
|
*/
|
||||||
virtual void initParam(EOT& _solution) {
|
virtual void initParam(EOT& _solution) {
|
||||||
selection.init(current, shake, ls);
|
selection.init(_solution);
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* updateParam: NOTHING TO DO
|
* Change the search operators on the next neighborhood search.
|
||||||
|
* @param _solution the current solution
|
||||||
*/
|
*/
|
||||||
virtual void updateParam(EOT & _solution) {
|
virtual void updateParam(EOT & _solution) {
|
||||||
if ((*this).moveApplied()) {
|
if ((*this).moveApplied()) {
|
||||||
selection.init(current, shake, ls);
|
selection.init(_solution);
|
||||||
}
|
} else
|
||||||
else if (selection.cont(current, shake, ls)){
|
if (selection.cont(current)) {
|
||||||
selection.next(current, shake, ls);
|
selection.next(_solution);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
stop = true;
|
stop = true;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* terminate: NOTHING TO DO
|
* terminate: NOTHING TO DO
|
||||||
|
|
@ -93,16 +93,19 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Explore the neighborhood of a solution
|
* Explore the neighborhood of a solution
|
||||||
* @param _solution
|
* @param _solution the current solution
|
||||||
*/
|
*/
|
||||||
virtual void operator()(EOT & _solution) {
|
virtual void operator()(EOT & _solution) {
|
||||||
|
eoMonOp<EOT> & shake = selection.getShake();
|
||||||
|
eoMonOp<EOT> & ls = selection.getLocalSearch();
|
||||||
|
|
||||||
current = _solution;
|
current = _solution;
|
||||||
std::cout << "current avec shake: "<< current << std::endl;
|
std::cout << "current avec shake: "<< current << std::endl;
|
||||||
shake(current);
|
shake(current);
|
||||||
std::cout << "current apres shake: "<< current << std::endl;
|
std::cout << "current apres shake: "<< current << std::endl;
|
||||||
(*ls)(current);
|
ls(current);
|
||||||
std::cout << "current apres ls: "<< ls->className() << " " << current << std::endl;
|
std::cout << "current apres ls: "<< ls.className() << " " << current << std::endl;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* continue if a move is accepted
|
* continue if a move is accepted
|
||||||
|
|
@ -122,7 +125,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* accept test if an amelirated neighbor was be found
|
* accept test if an amelirated neighbor was be found according to acceptance criteria
|
||||||
* @param _solution the solution
|
* @param _solution the solution
|
||||||
* @return true if the best neighbor ameliorate the fitness
|
* @return true if the best neighbor ameliorate the fitness
|
||||||
*/
|
*/
|
||||||
|
|
@ -139,19 +142,21 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
moDummyLS<Neighbor> dummyLS;
|
//moDummyLS<Neighbor> dummyLS;
|
||||||
moVariableNeighborhoodSelection<EOT>& selection;
|
moVariableNeighborhoodSelection<EOT>& selection;
|
||||||
moAcceptanceCriterion<Neighbor>& acceptCrit;
|
moAcceptanceCriterion<Neighbor>& acceptCrit;
|
||||||
eoMonOp<EOT>* ls;
|
//eoMonOp<EOT>* ls;
|
||||||
eoMonOp<EOT>& shake;
|
//eoMonOp<EOT>& shake;
|
||||||
bool stop;
|
bool stop;
|
||||||
|
|
||||||
EOT current;
|
EOT current;
|
||||||
|
|
||||||
|
/*
|
||||||
class moDummyEval: public eoEvalFunc<EOT>{
|
class moDummyEval: public eoEvalFunc<EOT>{
|
||||||
public:
|
public:
|
||||||
void operator()(EOT& hop){}
|
void operator()(EOT& hop){}
|
||||||
}dummyEval;
|
}dummyEval;
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<moForwardVectorVNSelection.h>
|
<moForwardVectorVNSelection.h>
|
||||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
This software is governed by the CeCILL license under French law and
|
This software is governed by the CeCILL license under French law and
|
||||||
abiding by the rules of distribution of free software. You can ue,
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
|
@ -55,7 +55,7 @@ public:
|
||||||
* test if there is still some neighborhood to explore
|
* test if there is still some neighborhood to explore
|
||||||
* @return true if there is some neighborhood to explore
|
* @return true if there is some neighborhood to explore
|
||||||
*/
|
*/
|
||||||
virtual bool cont(EOT& _solution, eoMonOp<EOT>& _shake, eoMonOp<EOT>*& _ls){
|
virtual bool cont(EOT& _solution){
|
||||||
return (cycle || (current <= (LSvector.size()-2)));
|
return (cycle || (current <= (LSvector.size()-2)));
|
||||||
std::cout << "current LS: " << current << std::endl;
|
std::cout << "current LS: " << current << std::endl;
|
||||||
std::cout << _solution << std::endl;
|
std::cout << _solution << std::endl;
|
||||||
|
|
@ -65,22 +65,18 @@ public:
|
||||||
/**
|
/**
|
||||||
* put the current neighborhood on the first one
|
* put the current neighborhood on the first one
|
||||||
*/
|
*/
|
||||||
virtual void init(EOT& _solution, eoMonOp<EOT>& _shake, eoMonOp<EOT>*& _ls){
|
virtual void init(EOT& _solution){
|
||||||
current = 0;
|
current = 0;
|
||||||
_ls = LSvector[current];
|
// std::cout << "current LS: " << _ls->className() << " " << current << std::endl;
|
||||||
_shake = *(shakeVector[current]);
|
// std::cout << _solution << std::endl;
|
||||||
std::cout << "current LS: " << _ls->className() << " " << current << std::endl;
|
|
||||||
std::cout << _solution << std::endl;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* put the current neighborhood on the next one
|
* put the current neighborhood on the next one
|
||||||
*/
|
*/
|
||||||
virtual void next(EOT& _solution, eoMonOp<EOT>& _shake, eoMonOp<EOT>*& _ls){
|
virtual void next(EOT& _solution){
|
||||||
current = (current + 1) % LSvector.size();
|
current = (current + 1) % LSvector.size();
|
||||||
_ls = LSvector[current];
|
|
||||||
_shake = *(shakeVector[current]);
|
|
||||||
std::cout << "current LS: " << current << std::endl;
|
std::cout << "current LS: " << current << std::endl;
|
||||||
std::cout << _solution << std::endl;
|
std::cout << _solution << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<moVariableNeighborhoodSelection.h>
|
<moVariableNeighborhoodSelection.h>
|
||||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
This software is governed by the CeCILL license under French law and
|
This software is governed by the CeCILL license under French law and
|
||||||
abiding by the rules of distribution of free software. You can ue,
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
|
@ -50,17 +50,31 @@ public:
|
||||||
* test if there is still some neighborhood to explore
|
* test if there is still some neighborhood to explore
|
||||||
* @return true if there is some neighborhood to explore
|
* @return true if there is some neighborhood to explore
|
||||||
*/
|
*/
|
||||||
virtual bool cont(EOT& _solution, eoMonOp<EOT>& _skake, eoMonOp<EOT>*& _ls) = 0;
|
virtual bool cont(EOT& _solution) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* put the current neighborhood on the first one
|
* put the current neighborhood on the first one
|
||||||
*/
|
*/
|
||||||
virtual void init(EOT& _solution, eoMonOp<EOT>& _skake, eoMonOp<EOT>*& _ls) = 0;
|
virtual void init(EOT& _solution) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* put the current neighborhood on the next one
|
* put the current neighborhood on the next one
|
||||||
*/
|
*/
|
||||||
virtual void next(EOT& _solution, eoMonOp<EOT>& _skake, eoMonOp<EOT>*& _ls) = 0;
|
virtual void next(EOT& _solution) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current "shake" operator based on the current neighborhood
|
||||||
|
*
|
||||||
|
* @return current shake operator
|
||||||
|
*/
|
||||||
|
virtual const eoMon<EOT> & getShake() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current local search based on the current neighborhood
|
||||||
|
*
|
||||||
|
* @return current local search
|
||||||
|
*/
|
||||||
|
virtual const eoMon<EOT> & getLocalSearch() = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<moVectorVNSelection.h>
|
<moVectorVNSelection.h>
|
||||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
This software is governed by the CeCILL license under French law and
|
This software is governed by the CeCILL license under French law and
|
||||||
abiding by the rules of distribution of free software. You can ue,
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
|
@ -57,21 +57,39 @@ public:
|
||||||
return "moVectorVNSelection";
|
return "moVectorVNSelection";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current "shake" operator based on the current neighborhood
|
||||||
|
*
|
||||||
|
* @return current shake operator
|
||||||
|
*/
|
||||||
|
virtual const eoMon<EOT> & getShake() {
|
||||||
|
return *(shakeVector[current]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current local search based on the current neighborhood
|
||||||
|
*
|
||||||
|
* @return current local search
|
||||||
|
*/
|
||||||
|
virtual const eoMon<EOT> & getLocalSearch() {
|
||||||
|
return *(LSvector[current]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test if there is still some neighborhood to explore
|
* test if there is still some neighborhood to explore
|
||||||
* @return true if there is some neighborhood to explore
|
* @return true if there is some neighborhood to explore
|
||||||
*/
|
*/
|
||||||
virtual bool cont(EOT& _solution, eoMonOp<EOT>& _shake, eoMonOp<EOT>*& _ls) = 0;
|
virtual bool cont(EOT& _solution) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* put the current neighborhood on the first one
|
* put the current neighborhood on the first one
|
||||||
*/
|
*/
|
||||||
virtual void init(EOT& _solution, eoMonOp<EOT>& _shake, eoMonOp<EOT>*& _ls) = 0;
|
virtual void init(EOT& _solution) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* put the current neighborhood on the next one
|
* put the current neighborhood on the next one
|
||||||
*/
|
*/
|
||||||
virtual void next(EOT& _solution, eoMonOp<EOT>& _shake, eoMonOp<EOT>*& _ls) = 0;
|
virtual void next(EOT& _solution) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<eoMonOp<EOT>* > LSvector;
|
std::vector<eoMonOp<EOT>* > LSvector;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue