Modification de VNS pour les nouveaux ajouts
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1932 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
82a329b006
commit
cec3f0052c
1 changed files with 26 additions and 7 deletions
|
|
@ -39,14 +39,16 @@ using namespace std;
|
||||||
#include <neighborhood/moRndWithoutReplNeighborhood.h>
|
#include <neighborhood/moRndWithoutReplNeighborhood.h>
|
||||||
#include <neighborhood/moOrderNeighborhood.h>
|
#include <neighborhood/moOrderNeighborhood.h>
|
||||||
#include <explorer/moVNSexplorer.h>
|
#include <explorer/moVNSexplorer.h>
|
||||||
//#include <neighborhood/moBackwardVectorVNSelection.h>
|
#include <neighborhood/moBackwardVectorVNSelection.h>
|
||||||
#include <neighborhood/moForwardVectorVNSelection.h>
|
#include <neighborhood/moForwardVectorVNSelection.h>
|
||||||
//#include <neighborhood/moRndVectorVNSelection.h>
|
#include <neighborhood/moRndVectorVNSelection.h>
|
||||||
|
|
||||||
//Algorithm and its components
|
//Algorithm and its components
|
||||||
#include <coolingSchedule/moCoolingSchedule.h>
|
#include <coolingSchedule/moCoolingSchedule.h>
|
||||||
#include <algo/moSimpleHC.h>
|
#include <algo/moSimpleHC.h>
|
||||||
#include <algo/moLocalSearch.h>
|
#include <algo/moLocalSearch.h>
|
||||||
|
#include <algo/moVNS.h>
|
||||||
|
#include <algo/moSimpleVNS.h>
|
||||||
|
|
||||||
#include <continuator/moTimeContinuator.h>
|
#include <continuator/moTimeContinuator.h>
|
||||||
|
|
||||||
|
|
@ -160,7 +162,7 @@ void main_function(int argc, char **argv)
|
||||||
* ========================================================= */
|
* ========================================================= */
|
||||||
|
|
||||||
shiftNeighborhood shiftNH((vecSize-1) * (vecSize-1));
|
shiftNeighborhood shiftNH((vecSize-1) * (vecSize-1));
|
||||||
swapNeighborhood swapNH(100);
|
swapNeighborhood swapNH(vecSize * (vecSize-1) / 2);
|
||||||
|
|
||||||
/* =========================================================
|
/* =========================================================
|
||||||
*
|
*
|
||||||
|
|
@ -174,18 +176,23 @@ void main_function(int argc, char **argv)
|
||||||
eoSwapMutation<Queen> swapMut;
|
eoSwapMutation<Queen> swapMut;
|
||||||
eoShiftMutation<Queen> shiftMut;
|
eoShiftMutation<Queen> shiftMut;
|
||||||
|
|
||||||
moForwardVectorVNSelection<Queen> selectNH(ls1, shiftMut, true);
|
// moForwardVectorVNSelection<Queen> selectNH(ls1, shiftMut, true);
|
||||||
|
// moBackwardVectorVNSelection<Queen> selectNH(ls1, shiftMut, true);
|
||||||
|
moRndVectorVNSelection<Queen> selectNH(ls1, shiftMut, true);
|
||||||
|
|
||||||
selectNH.add(ls2, swapMut);
|
selectNH.add(ls2, swapMut);
|
||||||
|
|
||||||
moAlwaysAcceptCrit<shiftNeighbor> acceptCrit;
|
moAlwaysAcceptCrit<shiftNeighbor> acceptCrit;
|
||||||
|
|
||||||
moVNSexplorer<shiftNeighbor> explorer(selectNH, acceptCrit);
|
// moVNSexplorer<shiftNeighbor> explorer(selectNH, acceptCrit);
|
||||||
|
|
||||||
moTimeContinuator<shiftNeighbor> cont(5);
|
moTimeContinuator<shiftNeighbor> cont(3);
|
||||||
|
|
||||||
moLocalSearch<shiftNeighbor> vns(explorer, cont, fullEval);
|
// moLocalSearch<shiftNeighbor> vns(explorer, cont, fullEval);
|
||||||
|
moVNS<shiftNeighbor> vns(selectNH, acceptCrit, fullEval, cont);
|
||||||
|
|
||||||
|
moSimpleVNS<shiftNeighbor> svns(ls1, shiftMut, fullEval, cont);
|
||||||
|
svns.add(ls2, swapMut);
|
||||||
|
|
||||||
/* =========================================================
|
/* =========================================================
|
||||||
*
|
*
|
||||||
|
|
@ -206,6 +213,18 @@ void main_function(int argc, char **argv)
|
||||||
|
|
||||||
std::cout << "final sol: " << sol << std::endl ;
|
std::cout << "final sol: " << sol << std::endl ;
|
||||||
std::cout << "#########################################" << std::endl;
|
std::cout << "#########################################" << std::endl;
|
||||||
|
|
||||||
|
init(sol);
|
||||||
|
|
||||||
|
fullEval(sol);
|
||||||
|
|
||||||
|
std::cout << "#########################################" << std::endl;
|
||||||
|
std::cout << "initial sol: " << sol << std::endl ;
|
||||||
|
|
||||||
|
svns(sol);
|
||||||
|
|
||||||
|
std::cout << "final sol: " << sol << std::endl ;
|
||||||
|
std::cout << "#########################################" << std::endl;
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// /* =========================================================
|
// /* =========================================================
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue