From cec3f0052c659ef00e2d44972d1c8ccd8d2424ea Mon Sep 17 00:00:00 2001 From: verel Date: Mon, 30 Aug 2010 09:06:33 +0000 Subject: [PATCH] Modification de VNS pour les nouveaux ajouts git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1932 331e1502-861f-0410-8da2-ba01fb791d7f --- trunk/paradiseo-mo/tutorial/Lesson9/VNS.cpp | 33 ++++++++++++++++----- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/trunk/paradiseo-mo/tutorial/Lesson9/VNS.cpp b/trunk/paradiseo-mo/tutorial/Lesson9/VNS.cpp index d0c0107df..eaf68511d 100644 --- a/trunk/paradiseo-mo/tutorial/Lesson9/VNS.cpp +++ b/trunk/paradiseo-mo/tutorial/Lesson9/VNS.cpp @@ -39,14 +39,16 @@ using namespace std; #include #include #include -//#include +#include #include -//#include +#include //Algorithm and its components #include #include #include +#include +#include #include @@ -160,7 +162,7 @@ void main_function(int argc, char **argv) * ========================================================= */ 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 swapMut; eoShiftMutation shiftMut; - moForwardVectorVNSelection selectNH(ls1, shiftMut, true); + // moForwardVectorVNSelection selectNH(ls1, shiftMut, true); + // moBackwardVectorVNSelection selectNH(ls1, shiftMut, true); + moRndVectorVNSelection selectNH(ls1, shiftMut, true); selectNH.add(ls2, swapMut); moAlwaysAcceptCrit acceptCrit; - moVNSexplorer explorer(selectNH, acceptCrit); + // moVNSexplorer explorer(selectNH, acceptCrit); - moTimeContinuator cont(5); + moTimeContinuator cont(3); - moLocalSearch vns(explorer, cont, fullEval); + // moLocalSearch vns(explorer, cont, fullEval); + moVNS vns(selectNH, acceptCrit, fullEval, cont); + moSimpleVNS 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 << "#########################################" << 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; // // // /* =========================================================