From a9e75b18f4aa22b9e4f54180165b9792f4105e08 Mon Sep 17 00:00:00 2001 From: boufaras Date: Mon, 30 Jan 2012 13:26:03 +0000 Subject: [PATCH] git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2705 331e1502-861f-0410-8da2-ba01fb791d7f --- tags/ParadisEO-GPU-1.1/paradiseo-mo1/AUTHORS | 4 + .../paradiseo-mo1/CMakeLists.txt | 46 + .../paradiseo-mo1/CTestConfig.cmake | 7 + .../paradiseo-mo1/CTestCustom.cmake | 7 + tags/ParadisEO-GPU-1.1/paradiseo-mo1/README | 79 + .../paradiseo-mo1/doc/CMakeLists.txt | 26 + .../paradiseo-mo1/doc/index.h | 52 + .../paradiseo-mo1/doc/mo.doxyfile.cmake | 1523 +++++++++++++++++ .../paradiseo-mo1/install.cmake | 130 ++ .../paradiseo-mo1/src/CMakeLists.txt | 3 + .../src/acceptCrit/moAcceptanceCriterion.h | 44 + .../src/acceptCrit/moAlwaysAcceptCrit.h | 57 + .../src/acceptCrit/moBetterAcceptCrit.h | 76 + .../paradiseo-mo1/src/algo/eoDummyMonOp.h | 56 + .../paradiseo-mo1/src/algo/moDummyLS.h | 71 + .../paradiseo-mo1/src/algo/moFirstImprHC.h | 112 ++ .../paradiseo-mo1/src/algo/moILS.h | 118 ++ .../paradiseo-mo1/src/algo/moLocalSearch.h | 146 ++ .../src/algo/moMetropolisHasting.h | 110 ++ .../paradiseo-mo1/src/algo/moNeutralHC.h | 106 ++ .../paradiseo-mo1/src/algo/moRandomBestHC.h | 104 ++ .../src/algo/moRandomNeutralWalk.h | 102 ++ .../paradiseo-mo1/src/algo/moRandomSearch.h | 90 + .../paradiseo-mo1/src/algo/moRandomWalk.h | 87 + .../paradiseo-mo1/src/algo/moSA.h | 120 ++ .../paradiseo-mo1/src/algo/moSimpleHC.h | 104 ++ .../paradiseo-mo1/src/algo/moTS.h | 164 ++ .../paradiseo-mo1/src/algo/moVNS.h | 75 + .../src/comparator/moComparator.h | 60 + .../comparator/moEqualNeighborComparator.h | 69 + .../src/comparator/moEqualSolComparator.h | 68 + .../comparator/moEqualSolNeighborComparator.h | 74 + .../src/comparator/moNeighborComparator.h | 79 + .../src/comparator/moSolComparator.h | 72 + .../src/comparator/moSolNeighborComparator.h | 84 + .../moAverageFitnessNeighborStat.h | 88 + .../src/continuator/moBestFitnessStat.h | 95 + .../continuator/moBestNoImproveContinuator.h | 118 ++ .../src/continuator/moBestSoFarStat.h | 94 + .../src/continuator/moBooleanStat.h | 82 + .../src/continuator/moCheckpoint.h | 197 +++ .../src/continuator/moCombinedContinuator.h | 93 + .../src/continuator/moContinuator.h | 64 + .../src/continuator/moCounterMonitorSaver.h | 97 ++ .../src/continuator/moCounterStat.h | 80 + .../src/continuator/moDistanceStat.h | 93 + .../src/continuator/moEvalsContinuator.h | 99 ++ .../src/continuator/moFitContinuator.h | 63 + .../src/continuator/moFitnessStat.h | 83 + .../src/continuator/moFullEvalContinuator.h | 96 ++ .../src/continuator/moIterContinuator.h | 86 + .../src/continuator/moMaxNeighborStat.h | 89 + .../src/continuator/moMinNeighborStat.h | 89 + .../src/continuator/moMinusOneCounterStat.h | 90 + .../src/continuator/moNbInfNeighborStat.h | 90 + .../src/continuator/moNbSupNeighborStat.h | 90 + .../src/continuator/moNeighborBestStat.h | 167 ++ .../continuator/moNeighborEvalContinuator.h | 94 + .../src/continuator/moNeighborFitnessStat.h | 113 ++ .../src/continuator/moNeighborhoodStat.h | 264 +++ .../continuator/moNeutralDegreeNeighborStat.h | 90 + .../continuator/moSecondMomentNeighborStat.h | 90 + .../src/continuator/moSizeNeighborStat.h | 89 + .../src/continuator/moSolutionStat.h | 82 + .../paradiseo-mo1/src/continuator/moStat.h | 61 + .../src/continuator/moStatBase.h | 61 + .../src/continuator/moStatFromStat.h | 83 + .../continuator/moStdFitnessNeighborStat.h | 88 + .../src/continuator/moTimeContinuator.h | 131 ++ .../src/continuator/moTrueContinuator.h | 68 + .../src/continuator/moUnsignedStat.h | 82 + .../paradiseo-mo1/src/continuator/moUpdater.h | 67 + .../src/continuator/moValueStat.h | 84 + .../src/continuator/moVectorMonitor.h | 241 +++ .../src/coolingSchedule/moCoolingSchedule.h | 64 + .../moDynSpanCoolingSchedule.h | 140 ++ .../coolingSchedule/moSimpleCoolingSchedule.h | 105 ++ .../src/eval/moDoubleIncrEvaluation.h | 104 ++ .../src/eval/moDoubleIncrNeighborhoodEval.h | 76 + .../paradiseo-mo1/src/eval/moDummyEval.h | 53 + .../paradiseo-mo1/src/eval/moEval.h | 51 + .../paradiseo-mo1/src/eval/moEvalCounter.h | 66 + .../paradiseo-mo1/src/eval/moFullEvalByCopy.h | 82 + .../src/eval/moFullEvalByModif.h | 96 ++ .../src/eval/moNeighborhoodEvaluation.h | 56 + .../src/explorer/moDummyExplorer.h | 111 ++ .../src/explorer/moFirstImprHCexplorer.h | 155 ++ .../src/explorer/moILSexplorer.h | 179 ++ .../explorer/moMetropolisHastingExplorer.h | 180 ++ .../src/explorer/moNeighborhoodExplorer.h | 178 ++ .../src/explorer/moNeutralHCexplorer.h | 133 ++ .../src/explorer/moRandomBestHCexplorer.h | 204 +++ .../explorer/moRandomNeutralWalkExplorer.h | 175 ++ .../src/explorer/moRandomSearchExplorer.h | 150 ++ .../src/explorer/moRandomWalkExplorer.h | 151 ++ .../paradiseo-mo1/src/explorer/moSAexplorer.h | 182 ++ .../src/explorer/moSimpleHCexplorer.h | 167 ++ .../paradiseo-mo1/src/explorer/moTSexplorer.h | 247 +++ .../src/explorer/moVNSexplorer.h | 172 ++ .../paradiseo-mo1/src/memory/moAspiration.h | 59 + .../src/memory/moBestImprAspiration.h | 87 + .../src/memory/moCountMoveMemory.h | 119 ++ .../src/memory/moDiversification.h | 42 + .../src/memory/moDummyDiversification.h | 53 + .../src/memory/moDummyIntensification.h | 53 + .../paradiseo-mo1/src/memory/moDummyMemory.h | 67 + .../src/memory/moIndexedVectorTabuList.h | 121 ++ .../src/memory/moIntensification.h | 42 + .../paradiseo-mo1/src/memory/moMemory.h | 40 + .../src/memory/moMonOpDiversification.h | 72 + .../src/memory/moNeighborVectorTabuList.h | 138 ++ .../src/memory/moRndIndexedVectorTabuList.h | 81 + .../src/memory/moSolVectorTabuList.h | 134 ++ .../paradiseo-mo1/src/memory/moTabuList.h | 53 + tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/mo | 40 + tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/mo.h | 212 +++ .../src/neighborhood/moBackableNeighbor.h | 56 + .../moBackwardVectorVNSelection.h | 100 ++ .../src/neighborhood/moDummyNeighbor.h | 48 + .../src/neighborhood/moDummyNeighborhood.h | 78 + .../neighborhood/moEvaluatedNeighborhood.h | 128 ++ .../neighborhood/moForwardVectorVNSelection.h | 100 ++ .../src/neighborhood/moIndexNeighbor.h | 115 ++ .../src/neighborhood/moIndexNeighborhood.h | 89 + .../src/neighborhood/moNeighbor.h | 110 ++ .../src/neighborhood/moNeighborhood.h | 101 ++ .../src/neighborhood/moOrderNeighborhood.h | 130 ++ .../src/neighborhood/moRndNeighborhood.h | 51 + .../src/neighborhood/moRndVectorVNSelection.h | 118 ++ .../neighborhood/moRndWithReplNeighborhood.h | 109 ++ .../moRndWithoutReplNeighborhood.h | 138 ++ .../moVariableNeighborhoodSelection.h | 88 + .../src/neighborhood/moVectorVNSelection.h | 108 ++ .../src/perturb/moLocalSearchInit.h | 66 + .../src/perturb/moMonOpPerturb.h | 72 + .../src/perturb/moNeighborhoodPerturb.h | 109 ++ .../src/perturb/moPerturbation.h | 42 + .../src/perturb/moRestartPerturb.h | 77 + .../paradiseo-mo1/src/perturb/moSolInit.h | 60 + .../src/problems/bitString/moBitNeighbor.h | 111 ++ .../src/problems/bitString/moBitsNeighbor.h | 149 ++ .../problems/bitString/moBitsNeighborhood.h | 125 ++ .../bitString/moBitsWithReplNeighborhood.h | 199 +++ .../bitString/moBitsWithoutReplNeighborhood.h | 229 +++ .../src/problems/eval/moMaxSATincrEval.h | 121 ++ .../src/problems/eval/moOneMaxIncrEval.h | 58 + .../src/problems/eval/moQAPIncrEval.h | 92 + .../src/problems/eval/moRoyalRoadIncrEval.h | 88 + .../src/problems/eval/moUBQPBitsIncrEval.h | 124 ++ .../src/problems/eval/moUBQPSimpleIncrEval.h | 108 ++ .../eval/moUBQPdoubleIncrEvaluation.h | 161 ++ .../permutation/moIndexedSwapNeighbor.h | 99 ++ .../problems/permutation/moShiftNeighbor.h | 115 ++ .../src/problems/permutation/moSwapNeighbor.h | 105 ++ .../problems/permutation/moSwapNeighborhood.h | 100 ++ .../problems/permutation/moTwoOptExNeighbor.h | 104 ++ .../permutation/moTwoOptExNeighborhood.h | 103 ++ .../src/sampling/moAdaptiveWalkSampling.h | 110 ++ .../src/sampling/moAutocorrelationSampling.h | 89 + .../src/sampling/moDensityOfStatesSampling.h | 83 + .../src/sampling/moFDCsampling.h | 95 + .../src/sampling/moFitnessCloudSampling.h | 100 ++ .../src/sampling/moHillClimberSampling.h | 110 ++ .../sampling/moMHBestFitnessCloudSampling.h | 113 ++ .../sampling/moMHRndFitnessCloudSampling.h | 113 ++ .../src/sampling/moNeutralDegreeSampling.h | 125 ++ .../src/sampling/moNeutralWalkSampling.h | 148 ++ .../sampling/moRndBestFitnessCloudSampling.h | 111 ++ .../sampling/moRndRndFitnessCloudSampling.h | 111 ++ .../paradiseo-mo1/src/sampling/moSampling.h | 239 +++ .../paradiseo-mo1/src/sampling/moStatistics.h | 226 +++ .../paradiseo-mo1/test/CMakeLists.txt | 141 ++ .../paradiseo-mo1/test/moTestClass.h | 251 +++ .../test/t-moAdaptiveWalkSampling.cpp | 77 + .../test/t-moAlwaysAcceptCrit.cpp | 51 + .../test/t-moAutocorrelationSampling.cpp | 58 + .../test/t-moBestImprAspiration.cpp | 78 + .../test/t-moBetterAcceptCrit.cpp | 61 + .../paradiseo-mo1/test/t-moBitNeighbor.cpp | 85 + .../paradiseo-mo1/test/t-moCheckpoint.cpp | 122 ++ .../test/t-moCombinedContinuator.cpp | 65 + .../test/t-moCountMoveMemory.cpp | 91 + .../test/t-moCounterMonitorSaver.cpp | 71 + .../paradiseo-mo1/test/t-moCounterStat.cpp | 62 + .../test/t-moDensityOfStatesSampling.cpp | 54 + .../paradiseo-mo1/test/t-moDistanceStat.cpp | 73 + .../paradiseo-mo1/test/t-moDummyEval.cpp | 46 + .../paradiseo-mo1/test/t-moDummyExplorer.cpp | 49 + .../paradiseo-mo1/test/t-moDummyLS.cpp | 51 + .../paradiseo-mo1/test/t-moDummyMemory.cpp | 63 + .../paradiseo-mo1/test/t-moDummyNeighbor.cpp | 46 + .../test/t-moDummyNeighborhood.cpp | 56 + .../test/t-moDynSpanCoolingSchedule.cpp | 91 + .../paradiseo-mo1/test/t-moEvalCounter.cpp | 66 + .../paradiseo-mo1/test/t-moFDCsampling.cpp | 61 + .../paradiseo-mo1/test/t-moFirstImprHC.cpp | 64 + .../test/t-moFirstImprHCexplorer.cpp | 93 + .../paradiseo-mo1/test/t-moFitContinuator.cpp | 61 + .../test/t-moFitnessCloudSampling.cpp | 75 + .../paradiseo-mo1/test/t-moFitnessStat.cpp | 57 + .../paradiseo-mo1/test/t-moFullEvalByCopy.cpp | 63 + .../test/t-moFullEvalByModif.cpp | 63 + .../test/t-moFullEvalContinuator.cpp | 70 + .../test/t-moHillClimberSampling.cpp | 57 + .../paradiseo-mo1/test/t-moILS.cpp | 79 + .../paradiseo-mo1/test/t-moILSexplorer.cpp | 98 ++ .../test/t-moIndexedVectorTabuList.cpp | 95 + .../test/t-moIterContinuator.cpp | 61 + .../paradiseo-mo1/test/t-moLocalSearch.cpp | 70 + .../test/t-moLocalSearchInit.cpp | 58 + .../test/t-moMetropolisHasting.cpp | 65 + .../test/t-moMetropolisHastingExplorer.cpp | 97 ++ .../test/t-moMinusOneCounterStat.cpp | 64 + .../test/t-moMonOpDiversification.cpp | 74 + .../paradiseo-mo1/test/t-moMonOpPerturb.cpp | 74 + .../paradiseo-mo1/test/t-moNeighbor.cpp | 64 + .../test/t-moNeighborBestStat.cpp | 74 + .../test/t-moNeighborComparator.cpp | 68 + .../test/t-moNeighborEvalContinuator.cpp | 69 + .../test/t-moNeighborFitnessStat.cpp | 66 + .../test/t-moNeighborVectorTabuList.cpp | 104 ++ .../test/t-moNeighborhoodPerturb.cpp | 91 + .../test/t-moNeighborhoodStat.cpp | 172 ++ .../test/t-moNeutralDegreeSampling.cpp | 64 + .../paradiseo-mo1/test/t-moNeutralHC.cpp | 65 + .../test/t-moNeutralHCexplorer.cpp | 92 + .../test/t-moNeutralWalkSampling.cpp | 62 + .../test/t-moOrderNeighborhood.cpp | 80 + .../paradiseo-mo1/test/t-moRandomBestHC.cpp | 64 + .../test/t-moRandomBestHCexplorer.cpp | 101 ++ .../test/t-moRandomNeutralWalk.cpp | 63 + .../test/t-moRandomNeutralWalkExplorer.cpp | 88 + .../paradiseo-mo1/test/t-moRandomSearch.cpp | 57 + .../test/t-moRandomSearchExplorer.cpp | 65 + .../paradiseo-mo1/test/t-moRandomWalk.cpp | 63 + .../test/t-moRandomWalkExplorer.cpp | 79 + .../paradiseo-mo1/test/t-moRestartPerturb.cpp | 117 ++ .../test/t-moRndIndexedVectorTabuList.cpp | 77 + .../test/t-moRndWithReplNeighborhood.cpp | 74 + .../test/t-moRndWithoutReplNeighborhood.cpp | 75 + .../paradiseo-mo1/test/t-moSA.cpp | 65 + .../paradiseo-mo1/test/t-moSAexplorer.cpp | 87 + .../paradiseo-mo1/test/t-moSampling.cpp | 81 + .../test/t-moSimpleCoolingSchedule.cpp | 91 + .../paradiseo-mo1/test/t-moSimpleHC.cpp | 65 + .../test/t-moSimpleHCexplorer.cpp | 93 + .../paradiseo-mo1/test/t-moSolComparator.cpp | 61 + .../paradiseo-mo1/test/t-moSolInit.cpp | 56 + .../test/t-moSolNeighborComparator.cpp | 72 + .../test/t-moSolVectorTabuList.cpp | 154 ++ .../paradiseo-mo1/test/t-moSolutionStat.cpp | 64 + .../paradiseo-mo1/test/t-moStatistics.cpp | 112 ++ .../paradiseo-mo1/test/t-moTS.cpp | 72 + .../paradiseo-mo1/test/t-moTSexplorer.cpp | 165 ++ .../test/t-moTimeContinuator.cpp | 71 + .../test/t-moTrueContinuator.cpp | 53 + .../paradiseo-mo1/test/t-moVectorMonitor.cpp | 112 ++ .../paradiseo-mo1/tutorial/CMakeLists.txt | 405 +++++ .../tutorial/Lesson1/CMakeLists.txt | 113 ++ .../tutorial/Lesson1/firstImprHC_maxSAT.cpp | 222 +++ .../tutorial/Lesson1/firstImprHC_maxSAT.param | 14 + .../Lesson1/lesson1_combinedContinuator.cpp | 251 +++ .../Lesson1/lesson1_combinedContinuator.param | 15 + .../Lesson1/lesson1_evalContinuator.cpp | 218 +++ .../Lesson1/lesson1_evalContinuator.param | 12 + .../tutorial/Lesson1/lesson1_firstImprHC.cpp | 196 +++ .../Lesson1/lesson1_firstImprHC.param | 11 + .../Lesson1/lesson1_fitContinuator.cpp | 213 +++ .../Lesson1/lesson1_fitContinuator.param | 12 + .../Lesson1/lesson1_fullEvalContinuator.cpp | 218 +++ .../Lesson1/lesson1_fullEvalContinuator.param | 12 + .../Lesson1/lesson1_iterContinuator.cpp | 215 +++ .../Lesson1/lesson1_iterContinuator.param | 12 + .../tutorial/Lesson1/lesson1_neutralHC.cpp | 200 +++ .../tutorial/Lesson1/lesson1_neutralHC.param | 12 + .../tutorial/Lesson1/lesson1_randomBestHC.cpp | 196 +++ .../Lesson1/lesson1_randomBestHC.param | 11 + .../tutorial/Lesson1/lesson1_simpleHC.cpp | 196 +++ .../tutorial/Lesson1/lesson1_simpleHC.param | 11 + .../tutorial/Lesson2/CMakeLists.txt | 41 + .../tutorial/Lesson2/testNeighborhood.cpp | 241 +++ .../tutorial/Lesson2/testNeighborhood.param | 11 + .../tutorial/Lesson3/CMakeLists.txt | 41 + .../Lesson3/testSimulatedAnnealing.cpp | 232 +++ .../Lesson3/testSimulatedAnnealing.param | 11 + .../tutorial/Lesson4/CMakeLists.txt | 42 + .../tutorial/Lesson4/testSimpleTS.cpp | 266 +++ .../tutorial/Lesson4/testSimpleTS.param | 15 + .../tutorial/Lesson5/CMakeLists.txt | 42 + .../tutorial/Lesson5/testILS.cpp | 230 +++ .../tutorial/Lesson5/testILS.param | 11 + .../tutorial/Lesson6/CMakeLists.txt | 122 ++ .../tutorial/Lesson6/adaptiveWalks.cpp | 210 +++ .../tutorial/Lesson6/adaptiveWalks.param | 13 + .../tutorial/Lesson6/autocorrelation.cpp | 225 +++ .../tutorial/Lesson6/autocorrelation.param | 13 + .../tutorial/Lesson6/densityOfStates.cpp | 193 +++ .../tutorial/Lesson6/densityOfStates.param | 13 + .../paradiseo-mo1/tutorial/Lesson6/fdc.cpp | 192 +++ .../paradiseo-mo1/tutorial/Lesson6/fdc.param | 13 + .../tutorial/Lesson6/fitnessCloud.cpp | 217 +++ .../tutorial/Lesson6/fitnessCloud.param | 13 + .../tutorial/Lesson6/neutralDegree.cpp | 215 +++ .../tutorial/Lesson6/neutralDegree.param | 14 + .../tutorial/Lesson6/neutralWalk.cpp | 251 +++ .../tutorial/Lesson6/neutralWalk.param | 14 + .../tutorial/Lesson6/sampling.cpp | 256 +++ .../tutorial/Lesson6/sampling.param | 13 + .../Lesson6/testMetropolisHasting.cpp | 201 +++ .../Lesson6/testMetropolisHasting.param | 12 + .../Lesson6/testRandomNeutralWalk.cpp | 278 +++ .../Lesson6/testRandomNeutralWalk.param | 13 + .../tutorial/Lesson6/testRandomWalk.cpp | 243 +++ .../tutorial/Lesson6/testRandomWalk.param | 12 + .../tutorial/Lesson7/CMakeLists.txt | 42 + .../tutorial/Lesson7/hybridAlgo.cpp | 222 +++ .../tutorial/Lesson7/hybridAlgo.param | 11 + 317 files changed, 32547 insertions(+) create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/AUTHORS create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/CMakeLists.txt create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/CTestConfig.cmake create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/CTestCustom.cmake create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/README create mode 100755 tags/ParadisEO-GPU-1.1/paradiseo-mo1/doc/CMakeLists.txt create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/doc/index.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/doc/mo.doxyfile.cmake create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/install.cmake create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/CMakeLists.txt create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/acceptCrit/moAcceptanceCriterion.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/acceptCrit/moAlwaysAcceptCrit.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/acceptCrit/moBetterAcceptCrit.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/eoDummyMonOp.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moDummyLS.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moFirstImprHC.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moILS.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moLocalSearch.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moMetropolisHasting.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moNeutralHC.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moRandomBestHC.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moRandomNeutralWalk.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moRandomSearch.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moRandomWalk.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moSA.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moSimpleHC.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moTS.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moVNS.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moComparator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moEqualNeighborComparator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moEqualSolComparator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moEqualSolNeighborComparator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moNeighborComparator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moSolComparator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moSolNeighborComparator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moAverageFitnessNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moBestFitnessStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moBestNoImproveContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moBestSoFarStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moBooleanStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moCheckpoint.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moCombinedContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moCounterMonitorSaver.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moCounterStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moDistanceStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moEvalsContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moFitContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moFitnessStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moFullEvalContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moIterContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moMaxNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moMinNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moMinusOneCounterStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNbInfNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNbSupNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeighborBestStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeighborEvalContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeighborFitnessStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeighborhoodStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeutralDegreeNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moSecondMomentNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moSizeNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moSolutionStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moStatBase.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moStatFromStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moStdFitnessNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moTimeContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moTrueContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moUnsignedStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moUpdater.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moValueStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moVectorMonitor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/coolingSchedule/moCoolingSchedule.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/coolingSchedule/moDynSpanCoolingSchedule.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/coolingSchedule/moSimpleCoolingSchedule.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moDoubleIncrEvaluation.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moDoubleIncrNeighborhoodEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moDummyEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moEvalCounter.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moFullEvalByCopy.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moFullEvalByModif.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moNeighborhoodEvaluation.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moDummyExplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moFirstImprHCexplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moILSexplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moMetropolisHastingExplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moNeighborhoodExplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moNeutralHCexplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moRandomBestHCexplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moRandomNeutralWalkExplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moRandomSearchExplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moRandomWalkExplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moSAexplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moSimpleHCexplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moTSexplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moVNSexplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moAspiration.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moBestImprAspiration.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moCountMoveMemory.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moDiversification.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moDummyDiversification.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moDummyIntensification.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moDummyMemory.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moIndexedVectorTabuList.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moIntensification.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moMemory.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moMonOpDiversification.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moNeighborVectorTabuList.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moRndIndexedVectorTabuList.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moSolVectorTabuList.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moTabuList.h create mode 100755 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/mo create mode 100755 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/mo.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moBackableNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moBackwardVectorVNSelection.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moDummyNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moDummyNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moEvaluatedNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moForwardVectorVNSelection.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moIndexNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moIndexNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moOrderNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moRndNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moRndVectorVNSelection.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moRndWithReplNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moRndWithoutReplNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moVariableNeighborhoodSelection.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moVectorVNSelection.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moLocalSearchInit.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moMonOpPerturb.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moNeighborhoodPerturb.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moPerturbation.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moRestartPerturb.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moSolInit.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitsNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitsNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitsWithReplNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitsWithoutReplNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moMaxSATincrEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moOneMaxIncrEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moQAPIncrEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moRoyalRoadIncrEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moUBQPBitsIncrEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moUBQPSimpleIncrEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moUBQPdoubleIncrEvaluation.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moIndexedSwapNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moShiftNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moSwapNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moSwapNeighborhood.h create mode 100755 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moTwoOptExNeighbor.h create mode 100755 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moTwoOptExNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moAdaptiveWalkSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moAutocorrelationSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moDensityOfStatesSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moFDCsampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moFitnessCloudSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moHillClimberSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moMHBestFitnessCloudSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moMHRndFitnessCloudSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moNeutralDegreeSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moNeutralWalkSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moRndBestFitnessCloudSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moRndRndFitnessCloudSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moStatistics.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/CMakeLists.txt create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/moTestClass.h create mode 100755 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moAdaptiveWalkSampling.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moAlwaysAcceptCrit.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moAutocorrelationSampling.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moBestImprAspiration.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moBetterAcceptCrit.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moBitNeighbor.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCheckpoint.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCombinedContinuator.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCountMoveMemory.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCounterMonitorSaver.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCounterStat.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDensityOfStatesSampling.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDistanceStat.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyEval.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyExplorer.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyLS.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyMemory.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyNeighbor.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyNeighborhood.cpp create mode 100755 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDynSpanCoolingSchedule.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moEvalCounter.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFDCsampling.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFirstImprHC.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFirstImprHCexplorer.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFitContinuator.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFitnessCloudSampling.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFitnessStat.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFullEvalByCopy.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFullEvalByModif.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFullEvalContinuator.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moHillClimberSampling.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moILS.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moILSexplorer.cpp create mode 100755 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moIndexedVectorTabuList.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moIterContinuator.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moLocalSearch.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moLocalSearchInit.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMetropolisHasting.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMetropolisHastingExplorer.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMinusOneCounterStat.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMonOpDiversification.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMonOpPerturb.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighbor.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborBestStat.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborComparator.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborEvalContinuator.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborFitnessStat.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborVectorTabuList.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborhoodPerturb.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborhoodStat.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeutralDegreeSampling.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeutralHC.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeutralHCexplorer.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeutralWalkSampling.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moOrderNeighborhood.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomBestHC.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomBestHCexplorer.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomNeutralWalk.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomNeutralWalkExplorer.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomSearch.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomSearchExplorer.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomWalk.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomWalkExplorer.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRestartPerturb.cpp create mode 100755 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRndIndexedVectorTabuList.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRndWithReplNeighborhood.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRndWithoutReplNeighborhood.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSA.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSAexplorer.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSampling.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSimpleCoolingSchedule.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSimpleHC.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSimpleHCexplorer.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolComparator.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolInit.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolNeighborComparator.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolVectorTabuList.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolutionStat.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moStatistics.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moTS.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moTSexplorer.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moTimeContinuator.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moTrueContinuator.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moVectorMonitor.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/CMakeLists.txt create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/CMakeLists.txt create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/firstImprHC_maxSAT.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/firstImprHC_maxSAT.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_combinedContinuator.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_combinedContinuator.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_evalContinuator.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_evalContinuator.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_firstImprHC.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_firstImprHC.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_fitContinuator.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_fitContinuator.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_fullEvalContinuator.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_fullEvalContinuator.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_iterContinuator.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_iterContinuator.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_neutralHC.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_neutralHC.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_randomBestHC.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_randomBestHC.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_simpleHC.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_simpleHC.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson2/CMakeLists.txt create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson2/testNeighborhood.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson2/testNeighborhood.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson3/CMakeLists.txt create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson3/testSimulatedAnnealing.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson3/testSimulatedAnnealing.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson4/CMakeLists.txt create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson4/testSimpleTS.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson4/testSimpleTS.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson5/CMakeLists.txt create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson5/testILS.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson5/testILS.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/CMakeLists.txt create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/adaptiveWalks.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/adaptiveWalks.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/autocorrelation.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/autocorrelation.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/densityOfStates.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/densityOfStates.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/fdc.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/fdc.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/fitnessCloud.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/fitnessCloud.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/neutralDegree.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/neutralDegree.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/neutralWalk.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/neutralWalk.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/sampling.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/sampling.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testMetropolisHasting.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testMetropolisHasting.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testRandomNeutralWalk.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testRandomNeutralWalk.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testRandomWalk.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testRandomWalk.param create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson7/CMakeLists.txt create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson7/hybridAlgo.cpp create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson7/hybridAlgo.param diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/AUTHORS b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/AUTHORS new file mode 100644 index 000000000..c9f1498f0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/AUTHORS @@ -0,0 +1,4 @@ +Authors: + Sebastien Verel + Arnaud Liefooghe + Jérémie Humeau diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/CMakeLists.txt b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/CMakeLists.txt new file mode 100644 index 000000000..3b58ccd7f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/CMakeLists.txt @@ -0,0 +1,46 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +########################################################################################################################################## +### 0) If you want to set your own variables in mo-conf.cmake and avoid the cmd line +########################################################################################################################################## + +INCLUDE(mo-conf.cmake OPTIONAL) + +########################################################################################################################################## + + +########################################################################################################################################## +### 1) Project properties +########################################################################################################################################## + +# set the project name +PROJECT(ParadisEO-MO) + +SET(PACKAGE_BUGREPORT "paradiseo-help@lists.gforge.inria.fr" CACHE STRING "Package bug report" FORCE) +SET(PACKAGE_NAME "ParadisEO-MO - Moving Objects" CACHE STRING "Package name" FORCE) +SET(PACKAGE_STRING "ParadisEO-MO 1.3" CACHE STRING "MO Package string full name" FORCE) +SET(PACKAGE_VERSION "1.3" CACHE STRING "Package version" FORCE) +SET(GLOBAL_VERSION "1.3" CACHE STRING "Global version" FORCE) +SET(VERSION "1.3.0" CACHE STRING "Version" FORCE) +########################################################################################################################################## + + +########################################################################################################################################## +### 2) Include the common CMake configuration +########################################################################################################################################## + +# The "config" variable must be provided on the command line +IF(NOT DEFINED config OR NOT config) + MESSAGE(FATAL_ERROR "The \"config\" variable must be set on the command line to + give the path of the install configuration file. ") +ENDIF(NOT DEFINED config OR NOT config) + +# Need the config file whose full path is given thanks to the "config" variable +INCLUDE(${config}) + +EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/CTestCustom.cmake + ${MO_BIN_DIR}/CTestCustom.cmake) +########################################################################################################################################## + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/CTestConfig.cmake b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/CTestConfig.cmake new file mode 100644 index 000000000..465d208d6 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/CTestConfig.cmake @@ -0,0 +1,7 @@ +set(CTEST_PROJECT_NAME "ParadisEO") +set(CTEST_NIGHTLY_START_TIME "00:00:00 EST") + +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "cdash.inria.fr") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=ParadisEO") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/CTestCustom.cmake b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/CTestCustom.cmake new file mode 100644 index 000000000..61bcd9133 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/CTestCustom.cmake @@ -0,0 +1,7 @@ +SET(CTEST_CUSTOM_COVERAGE_EXCLUDE + ${CTEST_CUSTOM_COVERAGE_EXCLUDE} +"test/" +"paradiseo-eo/" +"problems/" +"tutorial/" +) diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/README b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/README new file mode 100644 index 000000000..e1308a753 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/README @@ -0,0 +1,79 @@ + PARADISEO-MO README FILE +======================================================================= + +======================================================================= + +Welcome to PARADISEO-MO (Moving Objects), a part of the ParadisEO framework. + +======================================================================= + BUILDING PARADISEO-OLD-MO +======================================================================= +The basic installation procedure goes the following: + +To compile paradiseo-mo in the default directory, +go to paradiseo-mo/build/ and run: + > cmake ../ -Dconfig= + > make + // for an easy-use of the provided lessons + > make install + // optional (if the documentation is not already available) + > make doc + +To compile paradiseo-mo anywhere else, simply run: + > cmake $(MO) -Dconfig= + > make + // for an easy-use of the provided lessons + > make install + // optional (if the documentation is not already available) + > make doc + +where $(MO) is the top-level directory of PARADISEO-MO. + +To clean everything, simply run + > make clean + +====================================================================== + DIRECTORY STRUCTURE +====================================================================== +After unpacking the archive file, you should end up with the following +structure: + +.../ The MAIN PARADISEO-MO directory, created when unpacking. + | + +-- build Repertory where the executables will be produced. + | + | + +-- src SOURCE directory contains most PARADISEO-MO .h files. + | + | + +-- doc DOCUMENTATION directory (generated by Doxygen). + | | + | +- html HTML files - start at index.html. + | | + | +- latex latex files - use to generate Postcript doc. + | | + | +- man Unix man format documentation. + | + | + +-- tutorial TUTORIAL with lessons + | + +- Lesson1 How make a Hill Climbing. Example on the oneMax problem. + | + +- Lesson2 How make a Neighborhood. + | + +- Lesson3 How make a Simulated Annealing. Example on the QUEEN problem. + | + +- Lesson4 How make a Simple Tabu Search. Example on the QUEEN problem. + | + +- Lesson5 How make a Iterated Tabu Search on the QUEEN problem. + | + +- Lesson6 How make a Landscape analysis. + | + +- Lesson7 How make a Hybridization between a algorithm genetic and a local search. + + +=================================================================== + NOTES +=================================================================== + +Mailing list : paradiseo-help@lists.gforge.inria.fr diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/doc/CMakeLists.txt b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/doc/CMakeLists.txt new file mode 100755 index 000000000..8963a9ba5 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/doc/CMakeLists.txt @@ -0,0 +1,26 @@ + +########################################################################################## +### MO Doc generation using Doxygen +########################################################################################## + +IF (DOXYGEN_FOUND) + + SET(DOC_DIR ${CMAKE_BINARY_DIR}/doc CACHE PATH "MO documentation directory") + SET(MO_DOC_CONFIG_FILE "mo.doxyfile" CACHE PATH "MO documentation configuration file") + # define the doc target + IF (DOXYGEN_EXECUTABLE) + ADD_CUSTOM_TARGET(doc + COMMAND ${DOXYGEN_EXECUTABLE} ${MO_DOC_CONFIG_FILE} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + ENDIF (DOXYGEN_EXECUTABLE) + + # configure doxyfile file + CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/doc/${MO_DOC_CONFIG_FILE}.cmake" + "${CMAKE_BINARY_DIR}/doc/${MO_DOC_CONFIG_FILE}") + +ELSE (DOXYGEN_FOUND) + MESSAGE(STATUS "Unable to generate the documentation, Doxygen package not found") +ENDIF (DOXYGEN_FOUND) + +########################################################################################## diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/doc/index.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/doc/index.h new file mode 100644 index 000000000..da6778372 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/doc/index.h @@ -0,0 +1,52 @@ +/** @mainpage Welcome to ParadisEO-MO + +@section Introduction + +ParadisEO-MO is a white-box object-oriented generic framework dedicated to the flexible design of local search algorithms (hill-climbing, tabu search, simulated annealing, ...) + +@section tutorials Tutorials + +Tutorials for ParadisEO-MO are available in the "Tutorials section" of the ParadisEO website. + +@section Design + +For an introduction to the design of ParadisEO-MO, +you can look at the ParadisEO website. + +@section LICENSE + + 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 + +*/ + +/** @page webpages Related webpages + +- ParadisEO homepage +- INRIA GForge project page +- README +*/ diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/doc/mo.doxyfile.cmake b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/doc/mo.doxyfile.cmake new file mode 100644 index 000000000..19a13b947 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/doc/mo.doxyfile.cmake @@ -0,0 +1,1523 @@ +# Doxyfile 1.7.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = @PACKAGE_NAME@ + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = @PACKAGE_VERSION@ + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = @CMAKE_BINARY_DIR@/doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, +# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, +# Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene, +# Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = YES + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = @CMAKE_SOURCE_DIR@ + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = YES + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = YES + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it parses. +# With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this tag. +# The format is ext=language, where ext is a file extension, and language is one of +# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, +# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat +# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = YES + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penality. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will rougly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = YES + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = YES + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = NO + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by +# doxygen. The layout file controls the global structure of the generated output files +# in an output format independent way. The create the layout file that represents +# doxygen's defaults, run doxygen with the -l option. You can optionally specify a +# file name after the option, if omitted DoxygenLayout.xml will be used as the name +# of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = NO + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = NO + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = @CMAKE_SOURCE_DIR@ + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = *.cpp \ + *.h \ + NEWS \ + README + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = */tutorial/* + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = *::* + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 3 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = mo + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER +# are set, an additional index file will be generated that can be used as input for +# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated +# HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. +# For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's +# filter section matches. +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to FRAME, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. Other possible values +# for this tag are: HIERARCHIES, which will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list; +# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which +# disables this behavior completely. For backwards compatibility with previous +# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE +# respectively. + +GENERATE_TREEVIEW = YES + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = YES + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = @EO_BIN_DIR@/doc/eo.doxytag=http://eodev.sourceforge.net/eo/doc/html + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = @CMAKE_BINARY_DIR@/doc/mo.doxytag + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# By default doxygen will write a font called FreeSans.ttf to the output +# directory and reference it in all dot files that doxygen generates. This +# font does not include all possible unicode characters however, so when you need +# these (or just want a differently looking font) you can specify the font name +# using DOT_FONTNAME. You need need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = FreeSans + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = NO + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = YES + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Options related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = YES diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/install.cmake b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/install.cmake new file mode 100644 index 000000000..8113a6dd7 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/install.cmake @@ -0,0 +1,130 @@ +###################################################################################### +### CMake basic configuration +###################################################################################### + +# check cmake version compatibility +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +# regular expression checking +INCLUDE_REGULAR_EXPRESSION("^.*$" "^$") + +# set a language for the entire project. +ENABLE_LANGUAGE(CXX) +ENABLE_LANGUAGE(C) + +#################################################################################### + + +##################################################################################### +### Include required modules & utilities +##################################################################################### +INCLUDE(CMakeBackwardCompatibilityCXX) + +INCLUDE(FindDoxygen) + +INCLUDE(FindGnuplot) + +INCLUDE(CheckLibraryExists) + +INCLUDE(Dart OPTIONAL) + +INCLUDE(CPack) + +# Set a special flag if the environment is windows (should do the same in a config.g file) +IF (WIN32) + ADD_DEFINITIONS(-D_WINDOWS=1) +ENDIF (WIN32) +###################################################################################### + + +##################################################################################### +### Manage the build type +##################################################################################### + +# the user should choose the build type on windows environments,excepted under cygwin (default=none) +SET(CMAKE_DEFAULT_BUILD_TYPE "Release" CACHE STRING "Variable that stores the default CMake build type" FORCE) + +FIND_PROGRAM(MEMORYCHECK_COMMAND + NAMES purify valgrind + PATHS + "/usr/local/bin /usr/bin [HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]" + DOC "Path to the memory checking command, used for memory error detection.") + +IF(NOT CMAKE_BUILD_TYPE) + SET( CMAKE_BUILD_TYPE + ${CMAKE_DEFAULT_BUILD_TYPE} CACHE STRING + "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." + FORCE) +ENDIF(NOT CMAKE_BUILD_TYPE) + +IF(WIN32 AND NOT CYGWIN) + IF(CMAKE_CXX_COMPILER MATCHES cl) + IF(NOT WITH_SHARED_LIBS) + IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + SET(CMAKE_CXX_FLAGS "/nologo /Gy") + SET(CMAKE_CXX_FLAGS_DEBUG "/W3 /MTd /Z7 /Od") + SET(CMAKE_CXX_FLAGS_RELEASE "/w /MT /O2 /wd4530") + SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Z7 /Od") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE") + ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + ENDIF(NOT WITH_SHARED_LIBS) + ENDIF(CMAKE_CXX_COMPILER MATCHES cl) +ELSE(WIN32 AND NOT CYGWIN) + IF(CMAKE_COMPILER_IS_GNUCXX) + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -fprofile-arcs -ftest-coverage -Wall -Wextra -Wno-unused-parameter -Wno-ignored-qualifiers") + SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") + SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -O6") + ENDIF(CMAKE_COMPILER_IS_GNUCXX) +ENDIF(WIN32 AND NOT CYGWIN) + +IF(CMAKE_BUILD_TYPE MATCHES Debug) + ADD_DEFINITIONS(-DCMAKE_VERBOSE_MAKEFILE=ON) +ENDIF(CMAKE_BUILD_TYPE MATCHES Debug) + +##################################################################################### + +###################################################################################### +### compilation of examples? +###################################################################################### + +SET(ENABLE_CMAKE_EXAMPLE TRUE CACHE BOOL "Enable copy of benchs and parameters file?") + +###################################################################################### +### Test config +###################################################################################### + +IF (ENABLE_CMAKE_TESTING OR ENABLE_MINIMAL_CMAKE_TESTING) + ENABLE_TESTING() +ENDIF (ENABLE_CMAKE_TESTING OR ENABLE_MINIMAL_CMAKE_TESTING) +###################################################################################### + +####################################################################################### +### Paths to EO, MO and MOEO must be specified above. +####################################################################################### + +SET(EO_SRC_DIR "${CMAKE_SOURCE_DIR}/../paradiseo-eo" CACHE PATH "ParadisEO-EO source directory" FORCE) +SET(EO_BIN_DIR "${CMAKE_BINARY_DIR}/../../paradiseo-eo/build" CACHE PATH "ParadisEO-EO binary directory" FORCE) + +SET(MO_SRC_DIR "${CMAKE_SOURCE_DIR}/../paradiseo-mo" CACHE PATH "ParadisMO-MO source directory" FORCE) +SET(MO_BIN_DIR "${CMAKE_BINARY_DIR}/../../paradiseo-mo/build" CACHE PATH "ParadisMO-MO binary directory" FORCE) + +SET(OLDMO_SRC_DIR "${CMAKE_SOURCE_DIR}/../paradiseo-old-mo" CACHE PATH "ParadisMO-MO source directory" FORCE) +SET(OLDMO_BIN_DIR "${CMAKE_BINARY_DIR}/../../paradiseo-old-mo/build" CACHE PATH "ParadisMO-MO binary directory" FORCE) + +SET(MOEO_SRC_DIR "${CMAKE_SOURCE_DIR}/../paradiseo-moeo" CACHE PATH "ParadisMOEO-MOEO source directory" FORCE) +SET(MOEO_BIN_DIR "${CMAKE_BINARY_DIR}/../../paradiseo-moeo/build" CACHE PATH "ParadisMOEO-MOEO binary directory" FORCE) + +SET(PROBLEMS_SRC_DIR "${CMAKE_SOURCE_DIR}/../problems" CACHE PATH "Problems dependant source directory" FORCE) + +###################################################################################### +###################################################################################### +### Subdirectories that CMake should process for MO, MOEO and PEO +###################################################################################### + +ADD_SUBDIRECTORY(doc) +ADD_SUBDIRECTORY(src) +ADD_SUBDIRECTORY(test) +ADD_SUBDIRECTORY(tutorial) +###################################################################################### + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/CMakeLists.txt b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/CMakeLists.txt new file mode 100644 index 000000000..d41d4587a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/CMakeLists.txt @@ -0,0 +1,3 @@ +############################################################### +# This is a dummy file +############################################################### diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/acceptCrit/moAcceptanceCriterion.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/acceptCrit/moAcceptanceCriterion.h new file mode 100644 index 000000000..266b30f45 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/acceptCrit/moAcceptanceCriterion.h @@ -0,0 +1,44 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moAcceptanceCriterion_h +#define _moAcceptanceCriterion_h + +#include +#include + +/** + * Abstract class for Acceptance criteria + */ +template< class Neighbor > +class moAcceptanceCriterion : public eoBF, virtual public moMemory { + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/acceptCrit/moAlwaysAcceptCrit.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/acceptCrit/moAlwaysAcceptCrit.h new file mode 100644 index 000000000..777ef0b18 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/acceptCrit/moAlwaysAcceptCrit.h @@ -0,0 +1,57 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moAlwaysAcceptCrit_h +#define _moAlwaysAcceptCrit_h + +#include +#include + +/** + * Acceptance Criterion for extreme diversification : always accept new solution + */ +template< class Neighbor > +class moAlwaysAcceptCrit : public moAcceptanceCriterion, public moDummyMemory { + +public: + typedef typename Neighbor::EOT EOT; + + /** + * Always accept the new solution + * @param _sol1 the previous solution + * @param _sol2 the new solution after local search + * @return always true + */ + bool operator()(EOT& _sol1, EOT& _sol2) { + return true; + } + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/acceptCrit/moBetterAcceptCrit.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/acceptCrit/moBetterAcceptCrit.h new file mode 100644 index 000000000..13f2f867c --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/acceptCrit/moBetterAcceptCrit.h @@ -0,0 +1,76 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moBetterAcceptCrit_h +#define _moBetterAcceptCrit_h + +#include +#include +#include + +/** + * Acceptance Criterion for extreme intensification : accept if the new solution is better than previous one + */ +template< class Neighbor > +class moBetterAcceptCrit : public moAcceptanceCriterion, public moDummyMemory { + +public: + typedef typename Neighbor::EOT EOT; + + /* + constructor with a specific comparator + + @param _comparator the comparaison method of two solutions + */ + moBetterAcceptCrit(moSolComparator& _comparator):comparator(_comparator) {} + + /* + default constructor: + compare the fitness value: accept if the fitness is higher + */ + moBetterAcceptCrit():comparator(defaultComparator) {} + + /** + * Accept if the new solution is better than previous one according to the comparator + * @param _sol1 the previous solution + * @param _sol2 the new solution after local search + * @return true if the new solution is better than previous one + */ + bool operator()(EOT& _sol1, EOT& _sol2) { + return comparator(_sol1, _sol2); + } + +private: + moSolComparator& comparator; + + moSolComparator defaultComparator; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/eoDummyMonOp.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/eoDummyMonOp.h new file mode 100644 index 000000000..dba88fa7f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/eoDummyMonOp.h @@ -0,0 +1,56 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moDummyMonOp_h +#define _moDummyMonOp_h + +#include + +/** + * The mutation operator that does nothing at all ! + */ +template +class eoDummyMonOp: public eoMonOp { +public: + /** + * Do nothing on the solution + * @param _solution the related solution + */ + virtual bool operator()(EOT & _solution) { + return true; + } +}; + +#endif + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moDummyLS.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moDummyLS.h new file mode 100644 index 000000000..fd24d3575 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moDummyLS.h @@ -0,0 +1,71 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moDummyLS_h +#define _moDummyLS_h + +#include +#include +#include + +/** + * Dummy Local Search: + * + * To do nothing, only the full evaluation of the solution if necessary ;-) +*/ +template +class moDummyLS: public moLocalSearch +{ +public: + typedef typename Neighbor::EOT EOT; + typedef moNeighborhood Neighborhood ; + + /** + * Simple constructor + * @param _fullEval the full evaluation function + */ + moDummyLS(eoEvalFunc& _fullEval): + moLocalSearch(explorer, trueCont, _fullEval) + {} + + /** + * @return name of the class + */ + virtual std::string className(void) const { + return "moDummyLS"; + } + +private: + // always true continuator + moTrueContinuator trueCont; + // dummy Explorer + moDummyExplorer explorer; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moFirstImprHC.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moFirstImprHC.h new file mode 100644 index 000000000..67030da6e --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moFirstImprHC.h @@ -0,0 +1,112 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moFirstImprHC_h +#define _moFirstImprHC_h + +#include +#include +#include +#include +#include + +/** + * First improvement HC: + * Hill-Climbing local search + * + * At each iteration, + * one of the random solution in the neighborhood is selected + * if the selected neighbor have higher fitness than the current solution + * then the solution is replaced by the selected neighbor + * the algorithm stops when there is no higher neighbor + */ +template +class moFirstImprHC: public moLocalSearch +{ +public: + typedef typename Neighbor::EOT EOT; + typedef moNeighborhood Neighborhood ; + + /** + * Basic constructor for a hill-climber + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + */ + moFirstImprHC(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval): + moLocalSearch(explorer, trueCont, _fullEval), + explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp) + {} + + /** + * Simple constructor for a hill-climber + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _cont an external continuator + */ + moFirstImprHC(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, moContinuator& _cont): + moLocalSearch(explorer, _cont, _fullEval), + explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp) + {} + + /** + * General constructor for a hill-climber + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _cont an external continuator + * @param _compN a neighbor vs neighbor comparator + * @param _compSN a solution vs neighbor comparator + */ + moFirstImprHC(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, moContinuator& _cont, moNeighborComparator& _compN, moSolNeighborComparator& _compSN): + moLocalSearch(explorer, _cont, _fullEval), + explorer(_neighborhood, _eval, _compN, _compSN) + {} + + /** + * Return the class id. + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moFirstImprHV"; + } + +private: + // always true continuator + moTrueContinuator trueCont; + // compare the fitness values of neighbors: true if strictly greater + moNeighborComparator defaultNeighborComp; + // compare the fitness values of the solution and the neighbor: true if strictly greater + moSolNeighborComparator defaultSolNeighborComp; + // the explorer of the first improvement HC + moFirstImprHCexplorer explorer; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moILS.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moILS.h new file mode 100644 index 000000000..934335b2d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moILS.h @@ -0,0 +1,118 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moILS_h +#define _moILS_h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/** + * Iterated Local Search + */ +template > +class moILS: public moLocalSearch< NeighborLO > +{ +public: + + typedef typename Neighbor::EOT EOT; + typedef moNeighborhood Neighborhood ; + + + /** + * Basic constructor for Iterated Local Search + * @param _ls the local search to iterates + * @param _fullEval the full evaluation function + * @param _op the operator used to perturb solution + * @param _nbIteration the time limit for search + */ + moILS(moLocalSearch& _ls, eoEvalFunc& _fullEval, eoMonOp& _op, unsigned int _nbIteration): + moLocalSearch< moDummyNeighbor >(explorer, iterCont, _fullEval), + iterCont(_nbIteration), + defaultPerturb(_op, _fullEval), + explorer(_ls, defaultPerturb, defaultAccept) + {} + + /** + * Simple constructor for Iterated Local Search + * @param _ls the local search to iterates + * @param _fullEval the full evaluation function + * @param _op the operator used to perturb solution + * @param _cont a continuator + */ + moILS(moLocalSearch& _ls, eoEvalFunc& _fullEval, eoMonOp& _op, moContinuator& _cont): + moLocalSearch< NeighborLO >(explorer, _cont, _fullEval), + iterCont(0), + defaultPerturb(_op, _fullEval), + explorer(_ls, defaultPerturb, defaultAccept) + {} + + /** + * General constructor for Iterated Local Search + * @param _ls the local search to iterates + * @param _fullEval the full evaluation function + * @param _cont a continuator + * @param _perturb a perturbation operator + * @param _accept a acceptance criteria + */ + // moILS(moLocalSearch& _ls, eoEvalFunc& _fullEval, moContinuator >& _cont, moMonOpPerturb& _perturb, moAcceptanceCriterion& _accept): + // moILS(moLocalSearch& _ls, eoEvalFunc& _fullEval, moContinuator& _cont, moPerturbation& _perturb): + moILS(moLocalSearch& _ls, eoEvalFunc& _fullEval, moContinuator& _cont, moPerturbation& _perturb, moAcceptanceCriterion& _accept): + moLocalSearch(explorer, _cont, _fullEval), + iterCont(0), + defaultPerturb(dummyOp, _fullEval), + explorer(_ls, _perturb, _accept) + {} + +private: + + class dummmyMonOp: public eoMonOp { + public: + bool operator()(EOT&) { + return false; + } + } dummyOp; + + moIterContinuator > iterCont; + moMonOpPerturb defaultPerturb; + moAlwaysAcceptCrit defaultAccept; + moILSexplorer< Neighbor , NeighborLO > explorer; // inherits from moNeighborhoodExplorer< NeighborLO > +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moLocalSearch.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moLocalSearch.h new file mode 100644 index 000000000..bf77a8f3f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moLocalSearch.h @@ -0,0 +1,146 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moLocalSearch_h +#define _moLocalSearch_h + +#include +#include +#include +#include +#include + +/** + * the main algorithm of the local search + */ +template +class moLocalSearch: public eoMonOp { +public: + typedef moNeighborhood Neighborhood; + typedef moNeighborhoodExplorer NeighborhoodExplorer; + typedef typename Neighbor::EOT EOT; + + /** + * Constructor of a moLocalSearch + * @param _searchExpl a neighborhood explorer + * @param _cont an external continuator (can be a checkpoint!) + * @param _fullEval a full evaluation function + */ + moLocalSearch(NeighborhoodExplorer& _searchExpl, + moContinuator & _cont, eoEvalFunc& _fullEval) : + searchExplorer(_searchExpl), cont(&_cont), fullEval(_fullEval) { + } + ; + + /** + * Run the local search on a solution + * @param _solution the related solution + */ + virtual bool operator()(EOT & _solution) { + + if (_solution.invalid()) + fullEval(_solution); + + // initialization of the parameter of the search (for example fill empty the tabu list) + searchExplorer.initParam(_solution); + + // initialization of the external continuator (for example the time, or the number of generations) + cont->init(_solution); + + bool b; + do { + // explore the neighborhood of the solution + searchExplorer(_solution); + // if a solution in the neighborhood can be accepted + if (searchExplorer.accept(_solution)) { + searchExplorer.move(_solution); + searchExplorer.moveApplied(true); + } else + searchExplorer.moveApplied(false); + + // update the parameter of the search (for ex. Temperature of the SA) + searchExplorer.updateParam(_solution); + + b = (*cont)(_solution); + } while (b && searchExplorer.isContinue(_solution)); + + searchExplorer.terminate(_solution); + + cont->lastCall(_solution); + + return true; + } + ; + + /** + * Set an external continuator + * @param _cont the external continuator + */ + void setContinuator(moContinuator & _cont) { + cont = &_cont; + } + + /** + * external continuator object + * + * @overload + * @return the external continuator + */ + moContinuator* getContinuator() const { + return cont; + } + + /** + * to get the neighborhood explorer + * + * @overload + * @return the neighborhood explorer + */ + moNeighborhoodExplorer & getNeighborhoodExplorer() const { + return searchExplorer; + } + +protected: + // make the exploration of the neighborhood according to a local search heuristic + moNeighborhoodExplorer& searchExplorer; + + // external continuator + moContinuator * cont; + + //full evaluation function + eoEvalFunc& fullEval; +}; + +#endif + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moMetropolisHasting.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moMetropolisHasting.h new file mode 100644 index 000000000..5b4292459 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moMetropolisHasting.h @@ -0,0 +1,110 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moMetropolisHasting_h +#define _moMetropolisHasting_h + +#include +#include +#include +#include +#include + +/** + * Metropolis-Hasting local search + * Only the symetric case is considered when Q(x,y) = Q(y,x) + * Fitness must be > 0 + * + * At each iteration, + * one of the random solution in the neighborhood is selected + * if the selected neighbor have higher or equal fitness than the current solution + * then the solution is replaced by the selected neighbor + * if a random number from [0,1] is lower than fitness(neighbor) / fitness(solution) + * then the solution is replaced by the selected neighbor + * the algorithm stops when the number of iterations is too large + */ +template +class moMetropolisHasting: public moLocalSearch +{ +public: + typedef typename Neighbor::EOT EOT; + typedef moNeighborhood Neighborhood ; + + /** + * Basic constructor of the Metropolis-Hasting + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _nbStep maximum step to do + */ + moMetropolisHasting(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, unsigned int _nbStep): + moLocalSearch(explorer, trueCont, _fullEval), + explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _nbStep) + {} + + /** + * Simple constructor of the Metropolis-Hasting + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _nbStep maximum step to do + * @param _cont an external continuator + */ + moMetropolisHasting(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, unsigned int _nbStep, moContinuator& _cont): + moLocalSearch(explorer, _cont, _fullEval), + explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _nbStep) + {} + + /** + * General constructor of the Metropolis-Hasting + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _nbStep maximum step to do + * @param _cont an external continuator + * @param _compN a neighbor vs neighbor comparator + * @param _compSN a solution vs neighbor comparator + */ + moMetropolisHasting(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, unsigned int _nbStep, moContinuator& _cont, moNeighborComparator& _compN, moSolNeighborComparator& _compSN): + moLocalSearch(explorer, _cont, _fullEval), + explorer(_neighborhood, _eval, _compN, _compSN, _nbStep) + {} + +private: + // always true continuator + moTrueContinuator trueCont; + // compare the fitness values of neighbors + moNeighborComparator defaultNeighborComp; + // compare the fitness values of the solution and the neighbor + moSolNeighborComparator defaultSolNeighborComp; + // MetropolisHasting explorer + moMetropolisHastingExplorer explorer; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moNeutralHC.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moNeutralHC.h new file mode 100644 index 000000000..2fd2583d5 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moNeutralHC.h @@ -0,0 +1,106 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moNeutralHC_h +#define _moNeutralHC_h + +#include +#include +#include +#include +#include + +/** + * Hill-Climbing local search + * + * At each iteration, + * one of the random best solution in the neighborhood is selected + * if the selected neighbor have higher or equal fitness than the current solution + * then the solution is replaced by the selected neighbor + * the algorithm stops when there is no higher or equal neighbor, or if the number of iterations is too large + */ +template +class moNeutralHC: public moLocalSearch +{ +public: + typedef typename Neighbor::EOT EOT; + typedef moNeighborhood Neighborhood ; + + /** + * Basic constructor for a hill-climber + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _nbStep maximum step to do + */ + moNeutralHC(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, unsigned int _nbStep): + moLocalSearch(explorer, trueCont, _fullEval), + explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _nbStep) + {} + + /** + * Simple constructor for a hill-climber + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _nbStep maximum step to do + * @param _cont an external continuator + */ + moNeutralHC(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, unsigned int _nbStep, moContinuator& _cont): + moLocalSearch(explorer, _cont, _fullEval), + explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _nbStep) + {} + + /** + * General constructor for a hill-climber + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _nbStep maximum step to do + * @param _cont an external continuator + * @param _compN a neighbor vs neighbor comparator + * @param _compSN a solution vs neighbor comparator + */ + moNeutralHC(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, unsigned int _nbStep, moContinuator& _cont, moNeighborComparator& _compN, moSolNeighborComparator& _compSN): + moLocalSearch(explorer, _cont, _fullEval), + explorer(_neighborhood, _eval, _compN, _compSN, _nbStep) + {} + +private: + // always true continuator + moTrueContinuator trueCont; + // compare the fitness values of neighbors + moNeighborComparator defaultNeighborComp; + // compare the fitness values of the solution and the neighbor + moSolNeighborComparator defaultSolNeighborComp; + // the explorer of the HC with neutral move (equals fitness move) + moNeutralHCexplorer explorer; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moRandomBestHC.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moRandomBestHC.h new file mode 100644 index 000000000..3e7a32d62 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moRandomBestHC.h @@ -0,0 +1,104 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moRandomBestHC_h +#define _moRandomBestHC_h + +#include +#include +#include +#include +#include + +/** + * Random Best HC: + * Hill-Climbing local search + * + * At each iteration, + * one of the random best solution in the neighborhood is selected + * if the selected neighbor have higher fitness than the current solution + * then the solution is replaced by the selected neighbor + * the algorithm stops when there is no higher neighbor + */ +template +class moRandomBestHC: public moLocalSearch +{ +public: + typedef typename Neighbor::EOT EOT; + typedef moNeighborhood Neighborhood ; + + /** + * Basic constructor for a hill-climber + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + */ + moRandomBestHC(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval): + moLocalSearch(explorer, trueCont, _fullEval), + explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp) + {} + + /** + * Simple constructor for a hill-climber + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _cont an external continuator + */ + moRandomBestHC(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, moContinuator& _cont): + moLocalSearch(explorer, _cont, _fullEval), + explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp) + {} + + /** + * General constructor for a hill-climber + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _cont an external continuator + * @param _compN a neighbor vs neighbor comparator + * @param _compSN a solution vs neighbor comparator + */ + moRandomBestHC(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, moContinuator& _cont, moNeighborComparator& _compN, moSolNeighborComparator& _compSN): + moLocalSearch(explorer, _cont, _fullEval), + explorer(_neighborhood, _eval, _compN, _compSN) + {} + +private: + // always true continuator + moTrueContinuator trueCont; + // compare the fitness values of neighbors + moNeighborComparator defaultNeighborComp; + // compare the fitness values of the solution and the neighbor + moSolNeighborComparator defaultSolNeighborComp; + // the explorer of the HC with random choice of the best solution + moRandomBestHCexplorer explorer; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moRandomNeutralWalk.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moRandomNeutralWalk.h new file mode 100644 index 000000000..4f21588c5 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moRandomNeutralWalk.h @@ -0,0 +1,102 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moRandomNeutralWalk_h +#define _moRandomNeutralWalk_h + +#include +#include +#include +#include +#include + +/** + * Random Neutral Walk: + * Random Neutral walk local search + * + * At each iteration, + * one random neighbor with the same fitness is selected and replace the current solution + * the algorithm stops when the number of steps is reached + */ +template +class moRandomNeutralWalk: public moLocalSearch +{ +public: + typedef typename Neighbor::EOT EOT; + typedef moNeighborhood Neighborhood ; + + /** + * Basic constructor for a random walk + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _nbStepMax number of step of the walk + */ + moRandomNeutralWalk(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, unsigned _nbStepMax): + moLocalSearch(explorer, trueCont, _fullEval), + explorer(_neighborhood, _eval, defaultSolNeighborComp, _nbStepMax) + {} + + /** + * Simple constructor for a random walk + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _nbStepMax number of step of the walk + * @param _cont an external continuator + */ + moRandomNeutralWalk(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, unsigned _nbStepMax, moContinuator& _cont): + moLocalSearch(explorer, _cont, _fullEval), + explorer(_neighborhood, _eval, defaultSolNeighborComp, _nbStepMax) + {} + + /** + * General constructor for a random walk + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _nbStepMax number of step of the walk + * @param _cont an external continuator + * @param _comp a solution vs neighbor comparator + */ + moRandomNeutralWalk(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, unsigned _nbStepMax, moContinuator& _cont, moSolNeighborComparator& _comp): + moLocalSearch(explorer, _cont, _fullEval), + explorer(_neighborhood, _eval, _comp, _nbStepMax) + {} + +private: + // always true continuator + moTrueContinuator trueCont; + // the explorer of the random walk + moRandomNeutralWalkExplorer explorer; + // compare the fitness values of the solution and the neighbor + moSolNeighborComparator defaultSolNeighborComp; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moRandomSearch.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moRandomSearch.h new file mode 100644 index 000000000..c0a468d6a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moRandomSearch.h @@ -0,0 +1,90 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moRandomSearch_h +#define _moRandomSearch_h + +#include +#include +#include +#include +#include + +/** + * Random Search: + * Pure random search local search + * + * At each iteration, + * one random solution is selected and replace the current solution + * the algorithm stops when the number of solution is reached + */ +template +class moRandomSearch: public moLocalSearch +{ +public: + typedef typename Neighbor::EOT EOT; + + /** + * Simple constructor for a random search + * @param _init the solution initializer, to explore at random the search space + * @param _fullEval the full evaluation function + * @param _nbSolMax number of solutions + */ + moRandomSearch(eoInit & _init, eoEvalFunc& _fullEval, unsigned _nbSolMax): + moLocalSearch(explorer, trueCont, _fullEval), + explorer(_init, _fullEval, _nbSolMax>0?_nbSolMax - 1:0) + {} + + /** + * General constructor for a random search + * @param _init the solution initializer, to explore at random the search space + * @param _fullEval the full evaluation function + * @param _nbSolMax number of solutions + * @param _cont external continuator + */ + moRandomSearch(eoInit & _init, eoEvalFunc& _fullEval, unsigned _nbSolMax, moContinuator& _cont): + moLocalSearch(explorer, _cont, _fullEval), + explorer(_init, _fullEval, _nbSolMax>0?_nbSolMax - 1:0) + {} + + /** + * @return name of the class + */ + virtual std::string className(void) const { + return "moRandomSearch"; + } + +private: + // always true continuator + moTrueContinuator trueCont; + // the explorer of the random walk + moRandomSearchExplorer explorer; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moRandomWalk.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moRandomWalk.h new file mode 100644 index 000000000..dafa3f277 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moRandomWalk.h @@ -0,0 +1,87 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moRandomWalk_h +#define _moRandomWalk_h + +#include +#include +#include +#include +#include + +/** + * Random Walk: + * Random walk local search + * + * At each iteration, + * one random neighbor is selected and replace the current solution + * the algorithm stops when the number of steps is reached + */ +template +class moRandomWalk: public moLocalSearch +{ +public: + typedef typename Neighbor::EOT EOT; + typedef moNeighborhood Neighborhood ; + + /** + * Simple constructor for a random walk + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _nbStepMax number of step of the walk + */ + moRandomWalk(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, unsigned _nbStepMax): + moLocalSearch(explorer, iterCont, _fullEval), + iterCont(_nbStepMax), + explorer(_neighborhood, _eval) + {} + + /** + * General constructor for a random walk + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _cont a user-defined continuator + */ + moRandomWalk(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, moContinuator& _cont): + moLocalSearch(explorer, _cont, _fullEval), + iterCont(0), + explorer(_neighborhood, _eval) + {} + +private: + // the continuator to stop on a maximum number of step + moIterContinuator iterCont; + // the explorer of the random walk + moRandomWalkExplorer explorer; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moSA.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moSA.h new file mode 100644 index 000000000..c126f31fc --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moSA.h @@ -0,0 +1,120 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moSA_h +#define _moSA_h + +#include +#include +#include +#include +#include +#include +#include + +/** + * Simulated Annealing + */ +template +class moSA: public moLocalSearch +{ +public: + + typedef typename Neighbor::EOT EOT; + typedef moNeighborhood Neighborhood ; + + + /** + * Basic constructor for a simulated annealing + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _initT initial temperature for cooling schedule (default = 10) + * @param _alpha factor of decreasing for cooling schedule (default = 0.9) + * @param _span number of iteration with equal temperature for cooling schedule (default = 100) + * @param _finalT final temperature, threshold of the stopping criteria for cooling schedule (default = 0.01) + */ + moSA(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, double _initT=10, double _alpha=0.9, unsigned _span=100, double _finalT=0.01): + moLocalSearch(explorer, trueCont, _fullEval), + defaultCool(_initT, _alpha, _span, _finalT), + explorer(_neighborhood, _eval, defaultSolNeighborComp, defaultCool) + {} + + /** + * Simple constructor for a simulated annealing + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _cool a cooling schedule + */ + moSA(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, moCoolingSchedule& _cool): + moLocalSearch(explorer, trueCont, _fullEval), + defaultCool(0, 0, 0, 0), + explorer(_neighborhood, _eval, defaultSolNeighborComp, _cool) + {} + + /** + * General constructor for a simulated annealing + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _cool a cooling schedule + * @param _cont an external continuator + */ + moSA(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, moCoolingSchedule& _cool, moContinuator& _cont): + moLocalSearch(explorer, _cont, _fullEval), + defaultCool(0, 0, 0, 0), + explorer(_neighborhood, _eval, defaultSolNeighborComp, _cool) + {} + + /** + * General constructor for a simulated annealing + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _cool a cooling schedule + * @param _comp a solution vs neighbor comparator + * @param _cont an external continuator + */ + moSA(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, moCoolingSchedule& _cool, moSolNeighborComparator& _comp, moContinuator& _cont): + moLocalSearch(explorer, _cont, _fullEval), + defaultCool(0, 0, 0, 0), + explorer(_neighborhood, _eval, _comp, _cool) + {} + + + +private: + moTrueContinuator trueCont; + moSimpleCoolingSchedule defaultCool; + moSolNeighborComparator defaultSolNeighborComp; + moSAexplorer explorer; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moSimpleHC.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moSimpleHC.h new file mode 100644 index 000000000..c334d0629 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moSimpleHC.h @@ -0,0 +1,104 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moSimpleHC_h +#define _moSimpleHC_h + +#include +#include +#include +#include +#include + +/** + * Simple HC: + * Hill-Climbing local search + * + * At each iteration, + * the first best solution in the neighborhood is selected + * if the selected neighbor have higher fitness than the current solution + * then the solution is replaced by the selected neighbor + * the algorithm stops when there is no higher neighbor + */ +template +class moSimpleHC: public moLocalSearch +{ +public: + typedef typename Neighbor::EOT EOT; + typedef moNeighborhood Neighborhood ; + + /** + * Simple constructor for a hill-climber + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + */ + moSimpleHC(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval): + moLocalSearch(explorer, trueCont, _fullEval), + explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp) + {} + + /** + * Simple constructor for a hill-climber + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _cont an external continuator + */ + moSimpleHC(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, moContinuator& _cont): + moLocalSearch(explorer, _cont, _fullEval), + explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp) + {} + + /** + * Simple constructor for a hill-climber + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _cont an external continuator + * @param _compN a neighbor vs neighbor comparator + * @param _compSN a solution vs neighbor comparator + */ + moSimpleHC(Neighborhood& _neighborhood, eoEvalFunc& _fullEval, moEval& _eval, moContinuator& _cont, moNeighborComparator& _compN, moSolNeighborComparator& _compSN): + moLocalSearch(explorer, _cont, _fullEval), + explorer(_neighborhood, _eval, _compN, _compSN) + {} + +private: + // always true continuator + moTrueContinuator trueCont; + // compare the fitness values of neighbors + moNeighborComparator defaultNeighborComp; + // compare the fitness values of the solution and the neighbor + moSolNeighborComparator defaultSolNeighborComp; + // the explorer of the simple HC + moSimpleHCexplorer explorer; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moTS.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moTS.h new file mode 100644 index 000000000..cd1a6dc57 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moTS.h @@ -0,0 +1,164 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moTS_h +#define _moTS_h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * Tabu Search + */ +template +class moTS: public moLocalSearch +{ +public: + + typedef typename Neighbor::EOT EOT; + typedef moNeighborhood Neighborhood ; + + /** + * Basic constructor for a tabu search + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _time the time limit for stopping criteria + * @param _tabuListSize the size of the tabu list + */ + moTS(Neighborhood& _neighborhood, + eoEvalFunc& _fullEval, + moEval& _eval, + unsigned int _time, + unsigned int _tabuListSize + ): + moLocalSearch(explorer, timeCont, _fullEval), + timeCont(_time), + tabuList(_tabuListSize,0), + explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, tabuList, dummyIntensification, dummyDiversification, defaultAspiration) + {} + + /** + * Simple constructor for a tabu search + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _time the time limit for stopping criteria + * @param _tabuList the tabu list + */ + moTS(Neighborhood& _neighborhood, + eoEvalFunc& _fullEval, + moEval& _eval, + unsigned int _time, + moTabuList& _tabuList): + moLocalSearch(explorer, timeCont, _fullEval), + timeCont(_time), + tabuList(0,0), + explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _tabuList, dummyIntensification, dummyDiversification, defaultAspiration) + {} + + /** + * General constructor for a tabu search + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _cont an external continuator + * @param _tabuList the tabu list + * @param _aspiration the aspiration Criteria + */ + moTS(Neighborhood& _neighborhood, + eoEvalFunc& _fullEval, + moEval& _eval, + moContinuator& _cont, + moTabuList& _tabuList, + moAspiration& _aspiration): + moLocalSearch(explorer, _cont, _fullEval), + timeCont(0), + tabuList(0,0), + explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _tabuList, dummyIntensification, dummyDiversification, _aspiration) + {} + + /** + * General constructor for a tabu search + * @param _neighborhood the neighborhood + * @param _fullEval the full evaluation function + * @param _eval neighbor's evaluation function + * @param _neighborComp a comparator between 2 neighbors + * @param _solNeighborComp a solution vs neighbor comparator + * @param _cont an external continuator + * @param _tabuList the tabu list + * @param _intensification the intensification strategy + * @param _diversification the diversification strategy + * @param _aspiration the aspiration Criteria + */ + moTS(Neighborhood& _neighborhood, + eoEvalFunc& _fullEval, + moEval& _eval, + moNeighborComparator& _neighborComp, + moSolNeighborComparator& _solNeighborComp, + moContinuator& _cont, + moTabuList& _tabuList, + moIntensification& _intensification, + moDiversification& _diversification, + moAspiration& _aspiration): + moLocalSearch(explorer, _cont, _fullEval), + timeCont(0), + tabuList(0,0), + explorer(_neighborhood, _eval, _neighborComp, _solNeighborComp, _tabuList, _intensification, _diversification, _aspiration) + {} + + /* + * To get the explorer and then to be abble to get the best solution so far + * @return the TS explorer + */ + moTSexplorer& getExplorer() { + return explorer; + } + +private: + moTimeContinuator timeCont; + moNeighborComparator defaultNeighborComp; + moSolNeighborComparator defaultSolNeighborComp; + moNeighborVectorTabuList tabuList; + moDummyIntensification dummyIntensification; + moDummyDiversification dummyDiversification; + moBestImprAspiration defaultAspiration; + moTSexplorer explorer; +}; +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moVNS.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moVNS.h new file mode 100644 index 000000000..050e29593 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/algo/moVNS.h @@ -0,0 +1,75 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 _moVNS_h +#define _moVNS_h + +#include +#include +#include +#include + +#include +#include +#include + + +/** + * the "Variable Neighborhood Search" metaheuristic + */ +template +class moVNS: public moLocalSearch< Neighbor > +{ +public: + typedef typename Neighbor::EOT EOT; + typedef moNeighborhood Neighborhood ; + + + /** + * full constructor for a VNS + * @param _selection selection the "neighborhood" search heuristics during the search + * @param _acceptCrit acceptance criteria which compare and accept or not the two solutions + * @param _fullEval the full evaluation function + * @param _cont an external continuator + */ + moVNS(moVariableNeighborhoodSelection & _selection, + moAcceptanceCriterion& _acceptCrit, + eoEvalFunc& _fullEval, + moContinuator& _cont) : + moLocalSearch(explorer, _cont, _fullEval), + explorer(_selection, _acceptCrit) + {} + +private: + // the explorer of the VNS + moVNSexplorer explorer; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moComparator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moComparator.h new file mode 100644 index 000000000..153e39422 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moComparator.h @@ -0,0 +1,60 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moComparator_h +#define _moComparator_h + +#include +#include + + +/** + * Comparator of two types + */ +template< class T1, class T2 > +class moComparator : public eoBF +{ +public: + + /** + * @param _ref1 a reference on a variable of type T1 + * @param _ref2 a reference on a variable of type T2 + * @return true if _ref1 and _ref2 are equals + */ + virtual bool equals(const T1& _ref1, const T2& _ref2) = 0; + +}; + +#endif + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moEqualNeighborComparator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moEqualNeighborComparator.h new file mode 100644 index 000000000..6ea148df0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moEqualNeighborComparator.h @@ -0,0 +1,69 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moEqualNeighborComparator_h +#define _moEqualNeighborComparator_h + +#include +#include + +/** + * Comparator of two neighbors : a neighbor is better if the fitness is higher or equal + */ +template< class Neighbor > +class moEqualNeighborComparator : public moNeighborComparator +{ +public: + + /** + * Compare two neighbors + * @param _neighbor1 the first neighbor + * @param _neighbor2 the second neighbor + * @return true if the neighbor2 is better or equal than neighbor1 + */ + virtual bool operator()(const Neighbor& _neighbor1, const Neighbor& _neighbor2) { + return (_neighbor1.fitness() <= _neighbor2.fitness()); + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moEqualNeighborComparator"; + } +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moEqualSolComparator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moEqualSolComparator.h new file mode 100644 index 000000000..0764d4e21 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moEqualSolComparator.h @@ -0,0 +1,68 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moEqualSolComparator_h +#define _moEqualSolComparator_h + +#include + +/** + * Comparator of two solutions : a neighbor is better if the fitness is higher or equal + */ +template< class EOT > +class moEqualSolComparator : public moSolComparator +{ +public: + + /** + * Compare two solutions + * @param _sol1 the first solution + * @param _sol2 the second solution + * @return true if the solution2 is better than solution1 + */ + virtual bool operator()(const EOT& _sol1, const EOT& _sol2) { + return (_sol1.fitness() <= _sol2.fitness()); + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moEqualSolComparator"; + } +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moEqualSolNeighborComparator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moEqualSolNeighborComparator.h new file mode 100644 index 000000000..6f706dc73 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moEqualSolNeighborComparator.h @@ -0,0 +1,74 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moEqualSolNeighborComparator_h +#define _moEqualSolNeighborComparator_h + +#include +#include + +#include +#include + + +/** + * Comparator of a solution and its neighbor : a neighbor is better if the fitness is higher or equal + */ +template< class Neighbor > +class moEqualSolNeighborComparator : public moSolNeighborComparator +{ +public: + typedef typename Neighbor::EOT EOT ; + + /** + * Compare two neighbors + * @param _sol the solution + * @param _neighbor the neighbor + * @return true if the neighbor is better or equal than sol + */ + virtual bool operator()(const EOT& _sol, const Neighbor& _neighbor) { + return (_sol.fitness() <= _neighbor.fitness()); + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moEqualSolNeighborComparator"; + } +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moNeighborComparator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moNeighborComparator.h new file mode 100644 index 000000000..869adbb5c --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moNeighborComparator.h @@ -0,0 +1,79 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moNeighborComparator_h +#define _moNeighborComparator_h + +#include +#include + +/** + * Comparator of two neighbors + */ +template< class Neighbor > +class moNeighborComparator : public moComparator +{ +public: + + /** + * Compare two neighbors + * @param _neighbor1 the first neighbor + * @param _neighbor2 the second neighbor + * @return true if the neighbor2 is better than neighbor1 + */ + virtual bool operator()(const Neighbor& _neighbor1, const Neighbor& _neighbor2) { + return (_neighbor1.fitness() < _neighbor2.fitness()); + } + + /** + * Compare two neighbors + * @param _neighbor1 the first neighbor + * @param _neighbor2 the second neighbor + * @return true if the neighbor2 is equal to neighbor1 + */ + virtual bool equals(const Neighbor& _neighbor1, const Neighbor& _neighbor2) { + return (_neighbor1.fitness() == _neighbor2.fitness()); + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moNeighborComparator"; + } +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moSolComparator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moSolComparator.h new file mode 100644 index 000000000..d7f30c2f8 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moSolComparator.h @@ -0,0 +1,72 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moSolComparator_h +#define _moSolComparator_h + +#include + +/** + * Comparator of two solutions + */ +template< class EOT > +class moSolComparator : public moComparator +{ +public: + + /** + * Compare two solutions + * @param _sol1 the first solution + * @param _sol2 the second solution + * @return true if the solution2 is better than solution1 + */ + virtual bool operator()(const EOT& _sol1, const EOT& _sol2) { + return (_sol1.fitness() < _sol2.fitness()); + } + + /** + * Test the equality between two solutions + * @param _sol1 the first solution + * @param _sol2 the second solution + * @return true if the solution2 is equal to solution1 + */ + virtual bool equals(const EOT& _sol1, const EOT& _sol2) { + return (_sol1.fitness() == _sol2.fitness()); + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moSolComparator"; + } +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moSolNeighborComparator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moSolNeighborComparator.h new file mode 100644 index 000000000..2275a6494 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/comparator/moSolNeighborComparator.h @@ -0,0 +1,84 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moSolNeighborComparator_h +#define _moSolNeighborComparator_h + +#include +#include + +#include +#include + + +/** + * Comparator of a solution and its neighbor + */ +template< class Neighbor > +class moSolNeighborComparator : public moComparator +{ +public: + typedef typename Neighbor::EOT EOT ; + + /** + * Compare two neighbors + * @param _sol the solution + * @param _neighbor the neighbor + * @return true if the neighbor is better than sol + */ + virtual bool operator()(const EOT& _sol, const Neighbor& _neighbor) { + return (_sol.fitness() < _neighbor.fitness()); + } + + /** + * Test the equality between two neighbors + * @param _sol the solution + * @param _neighbor the neighbor + * @return true if the neighbor is equal to the solution + */ + virtual bool equals(const EOT& _sol, const Neighbor& _neighbor) { + return (_sol.fitness() == _neighbor.fitness()); + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moSolNeighborComparator"; + } +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moAverageFitnessNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moAverageFitnessNeighborStat.h new file mode 100644 index 000000000..4c268d6d3 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moAverageFitnessNeighborStat.h @@ -0,0 +1,88 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moAverageFitnessNeighborStat_h +#define moAverageFitnessNeighborStat_h + +#include +#include + +/** + * From moNeighborhoodStat, to compute the average of fitness in the neighborhood + */ +template< class Neighbor > +class moAverageFitnessNeighborStat : public moStat +{ +public : + typedef typename Neighbor::EOT EOT ; + typedef typename EOT::Fitness Fitness ; + + using moStat< EOT, double >::value; + + /** + * Constructor + * @param _nhStat a neighborhoodStat + */ + moAverageFitnessNeighborStat(moNeighborhoodStat & _nhStat): + moStat(0.0, "average"), nhStat(_nhStat) {} + + /** + * Set the average of fitness in the neighborhood + * @param _sol the first solution + */ + virtual void init(EOT & _sol) { + value() = nhStat.getMean(); + } + + /** + * Set the average of fitness in the neighborhood + * @param _sol the corresponding solution + */ + virtual void operator()(EOT & _sol) { + value() = nhStat.getMean(); + } + + /** + * @return the class name + */ + virtual std::string className(void) const { + return "moAverageFitnessNeighborStat"; + } + +private: + /** moNeighborhoodStat */ + moNeighborhoodStat & nhStat; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moBestFitnessStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moBestFitnessStat.h new file mode 100644 index 000000000..192919c88 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moBestFitnessStat.h @@ -0,0 +1,95 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moBestFitnessStat_h +#define moBestFitnessStat_h + +#include + +/** + * The statistic which save the best solution found during the search + */ +template +class moBestFitnessStat : public moStat +{ +public : + typedef typename EOT::Fitness Fitness; + using moStat< EOT , typename EOT::Fitness >::value; + + /** + * Default Constructor + * @param _reInitSol when true the best so far is reinitialized + */ + moBestFitnessStat(bool _reInitSol = true): moStat(Fitness(), "best"), reInitSol(_reInitSol), firstTime(true) { + } + + /** + * Initialization of the best solution on the first one + * @param _sol the first solution + */ + virtual void init(EOT & _sol) { + if (reInitSol) + value() = _sol.fitness(); + else if (firstTime) + { + value() = _sol.fitness(); + firstTime = false; + } + } + + /** + * Update the best solution + * @param _sol the current solution + */ + virtual void operator()(EOT & _sol) { + if (value() < _sol.fitness()) + { + value() = _sol.fitness(); + } + } + + /** + * @return name of the class + */ + virtual std::string className(void) const { + return "moBestFitnessStat"; + } + +protected: + bool reInitSol; + bool firstTime; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moBestNoImproveContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moBestNoImproveContinuator.h new file mode 100644 index 000000000..86981bef4 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moBestNoImproveContinuator.h @@ -0,0 +1,118 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 _moBestNoImproveContinuator_h +#define _moBestNoImproveContinuator_h + +#include +#include +#include + +/** + * Stop when the best solution cannot be improved + * within a given number of iterations + */ +template< class Neighbor > +class moBestNoImproveContinuator : public moContinuator +{ +public: + typedef typename Neighbor::EOT EOT ; + + /** + * Constructor + * + * @param _bestSol the best solution + * @param _maxNoImprove number maximum of iterations + * @param _solComparator a comparator between solutions + * @param _verbose true/false : verbose mode on/off + */ + moBestNoImproveContinuator(const EOT & _bestSol, + unsigned int _maxNoImprove, + moSolComparator& _solComparator, + bool _verbose = true): bestSol(_bestSol), maxNoImprove(_maxNoImprove), solComparator(_solComparator), verbose(_verbose) {} + + /** + * Constructor where the comparator of solutions is the default comparator + * + * @param _bestSol the best solution + * @param _maxNoImprove number maximum of iterations + * @param _verbose true/false : verbose mode on/off + */ + moBestNoImproveContinuator(const EOT & _bestSol, + unsigned int _maxNoImprove, + bool _verbose = true): bestSol(_bestSol), maxNoImprove(_maxNoImprove), solComparator(defaultSolComp), verbose(_verbose) {} + + /** + * Count and test the number of non improvement of the best solution + * improvement: if the current solution is STRICTLY better than the current best solution + * + *@param _solution a solution + *@return true if counter < maxNoImprove + */ + virtual bool operator()(EOT & _solution) { + if (solComparator(_solution, bestSol) || solComparator.equals(_solution, bestSol)) + cpt++; + else + cpt = 0; + + bool res = (cpt < maxNoImprove); + + if (!res && verbose) + std::cout << "STOP in moBestNoImproveContinuator: Reached maximum number of iterations without improvement [" << cpt << "/" << maxNoImprove << "]" << std::endl; + + return res; + } + + /** + * reset the counter of iteration + * @param _solution a solution + */ + virtual void init(EOT & _solution) { + cpt = 0; + } + + /** + * the current number of iteration without improvement + * @return the number of iteration + */ + unsigned int value() { + return cpt ; + } + +private: + const EOT & bestSol; + unsigned int maxNoImprove; + unsigned int cpt; + // comparator between solutions + moSolComparator& solComparator; + bool verbose; + moSolComparator defaultSolComp; + +}; +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moBestSoFarStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moBestSoFarStat.h new file mode 100644 index 000000000..fa5797139 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moBestSoFarStat.h @@ -0,0 +1,94 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moBestSoFarStat_h +#define moBestSoFarStat_h + +#include + +/** + * The statistic which save the best solution found during the search + */ +template +class moBestSoFarStat : public moStat +{ +public : + using moStat< EOT , EOT >::value; + + /** + * Default Constructor + * @param _reInitSol when true the best so far is reinitialized + */ + moBestSoFarStat(bool _reInitSol = true): moStat(EOT(), "best"), reInitSol(_reInitSol), firstTime(true) { + } + + /** + * Initialization of the best solution on the first one + * @param _sol the first solution + */ + virtual void init(EOT & _sol) { + if (reInitSol) + value() = _sol; + else if (firstTime) + { + value() = _sol; + firstTime = false; + } + } + + /** + * Update the best solution + * @param _sol the current solution + */ + virtual void operator()(EOT & _sol) { + if (value().fitness() < _sol.fitness()) + { + value() = _sol; + } + } + + /** + * @return name of the class + */ + virtual std::string className(void) const { + return "moBestSoFarStat"; + } + +protected: + bool reInitSol; + bool firstTime; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moBooleanStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moBooleanStat.h new file mode 100644 index 000000000..a098efc23 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moBooleanStat.h @@ -0,0 +1,82 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moBooleanStat_h +#define moBooleanStat_h + +#include + +/** + * The statistic gives from a boolean variable + */ +template +class moBooleanStat : public moStat +{ +public : + using moStat< EOT, bool>::value; + + /** + * Default Constructor + */ + moBooleanStat(bool * _b): moStat(*_b, "boolean"), b(_b) { + } + + /** + * Init the number of iteration + * @param _sol a solution + */ + virtual void init(EOT & _sol) { + value() = *b; + } + + /** + * Set the number of iteration + * @param _sol a solution + */ + virtual void operator()(EOT & _sol) { + value() = *b; + } + + /** + * @return name of the class + */ + virtual std::string className(void) const { + return "moBooleanStat"; + } + +private: + bool * b; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moCheckpoint.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moCheckpoint.h new file mode 100644 index 000000000..37b5cd610 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moCheckpoint.h @@ -0,0 +1,197 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moCheckpoint_h +#define moCheckpoint_h + +#include +#include +#include +#include +#include +#include + +/** + * Continuator allowing to add others (continuators, stats, monitors or updaters) + */ +template +class moCheckpoint : public moContinuator { +public : + + typedef typename Neighbor::EOT EOT ; + + /** + * Constructor (moCheckpoint must have at least one continuator) + * @param _cont a continuator + * @param _interval frequency to compute statistical operators + */ + moCheckpoint(moContinuator& _cont, unsigned int _interval=1):interval(_interval), counter(0) { + continuators.push_back(&_cont); + } + + /** + * add a continuator to the checkpoint + * @param _cont a continuator + */ + void add(moContinuator& _cont) { + continuators.push_back(&_cont); + } + + /** + * add a statistic operator to the checkpoint + * @param _stat a statistic operator + */ + void add(moStatBase& _stat) { + stats.push_back(&_stat); + } + + /** + * add a monitor to the checkpoint + * @param _mon a monitor + */ + void add(eoMonitor& _mon) { + monitors.push_back(&_mon); + } + + /** + * add a updater to the checkpoint + * @param _upd an updater + */ + void add(eoUpdater& _upd) { + updaters.push_back(&_upd); + } + + /** + * add a MO updater to the checkpoint + * @param _moupd an mo updater + */ + void add(moUpdater& _moupd) { + moupdaters.push_back(&_moupd); + } + + /** + * init all continuators containing in the checkpoint regarding a solution + * @param _sol the corresponding solution + */ + virtual void init(EOT& _sol) { + for (unsigned i = 0; i < stats.size(); ++i) + stats[i]->init(_sol); + counter=1; + + for (unsigned i = 0; i < moupdaters.size(); ++i) + moupdaters[i]->init(); + + for (unsigned int i = 0; i < monitors.size(); ++i) + (*monitors[i])(); + + for (unsigned i = 0; i < continuators.size(); ++i) + continuators[i]->init(_sol); + } + + /** + * @return class name + */ + virtual std::string className(void) const { + return "moCheckpoint"; + } + + /** + * apply operator of checkpoint's containers + * @param _sol reference of the solution + * @return true if all continuator return true + */ + bool operator()(EOT & _sol) { + unsigned i; + bool bContinue = true; + + for (i = 0; i < stats.size(); ++i) { + if (counter % interval == 0) + (*stats[i])(_sol); + counter++; + } + + for (i = 0; i < updaters.size(); ++i) + (*updaters[i])(); + + for (i = 0; i < moupdaters.size(); ++i) + (*moupdaters[i])(); + + for (i = 0; i < monitors.size(); ++i) + (*monitors[i])(); + + for (i = 0; i < continuators.size(); ++i) + if ( !(*continuators[i])(_sol) ) + bContinue = false; + + return bContinue; + } + + /** + * last call of statistic operators, monitors and updaters + * @param _sol reference of the solution + */ + void lastCall(EOT& _sol) { + unsigned int i; + for (i = 0; i < stats.size(); ++i) + stats[i]->lastCall(_sol); + + for (i = 0; i < updaters.size(); ++i) + updaters[i]->lastCall(); + + for (i = 0; i < moupdaters.size(); ++i) + moupdaters[i]->lastCall(); + + for (i = 0; i < monitors.size(); ++i) + monitors[i]->lastCall(); + } + +private : + /** continuators vector */ + std::vector*> continuators; + /** statistic operators vector */ + std::vector*> stats; + /** monitors vector */ + std::vector monitors; + /** updaters vector */ + std::vector updaters; + /** MO updaters vector */ + std::vector moupdaters; + + unsigned int interval; + unsigned int counter; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moCombinedContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moCombinedContinuator.h new file mode 100644 index 000000000..7533bd4fa --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moCombinedContinuator.h @@ -0,0 +1,93 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moCombinedContinuator_h +#define _moCombinedContinuator_h + +#include +#include +#include + +/** + * Combined several continuators. + * Continue until one of the continuators returns false + */ +template< class Neighbor > +class moCombinedContinuator : public moContinuator +{ +public: + typedef typename Neighbor::EOT EOT ; + + /** + * Constructor (moCheckpoint must have at least one continuator) + * @param _cont a continuator + */ + moCombinedContinuator(moContinuator& _cont) { + continuators.push_back(&_cont); + } + + /** + * add a continuator to the combined continuator + * @param _cont a continuator + */ + void add(moContinuator& _cont) { + continuators.push_back(&_cont); + } + + /** + * init all continuators + * @param _solution a solution + */ + virtual void init(EOT & _solution) { + for (unsigned int i = 0; i < continuators.size(); ++i) + continuators[i]->init(_solution); + } + + /** + *@param _solution a solution + *@return true all the continuators are true + */ + virtual bool operator()(EOT & _solution) { + bool bContinue = true; + + // some data may be update in each continuator. + // So, all continuators are tested + for (unsigned int i = 0; i < continuators.size(); ++i) + if ( !(*continuators[i])(_solution) ) + bContinue = false; + + return bContinue; + } + +private: + /** continuators vector */ + std::vector< moContinuator* > continuators; + +}; +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moContinuator.h new file mode 100644 index 000000000..cec268038 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moContinuator.h @@ -0,0 +1,64 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moContinuator_h +#define _moContinuator_h + +#include +#include + +/** + * To make specific continuator from a solution + */ +template< class Neighbor > +class moContinuator : public eoUF +{ +public: + + typedef typename Neighbor::EOT EOT ; + + /** + * Init Continuator parameters + * @param _solution the related solution + */ + virtual void init(EOT& _solution) {}; + + /** + * Last Call to terminate the checkpoint + * @param _solution the related solution + */ + virtual void lastCall(EOT& _solution) {}; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moCounterMonitorSaver.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moCounterMonitorSaver.h new file mode 100644 index 000000000..f57e05d2d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moCounterMonitorSaver.h @@ -0,0 +1,97 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moCounterMonitorSaver_h +#define moCounterMonitorSaver_h + +#include +#include + +/** + * Class calling monitors with a given frequency + */ +class moCounterMonitorSaver : public eoUpdater { +public : + + /** + * Constructor + * @param _interval frequency to call monitors + * @param _mon a monitor + */ + moCounterMonitorSaver(unsigned _interval, eoMonitor& _mon) : interval(_interval), counter(0) { + monitors.push_back(&_mon); + } + + /** + * call monitors if interval is reach by a counter + */ + void operator()(void) { + if (counter++ % interval == 0) + for (unsigned i = 0; i < monitors.size(); i++) + (*monitors[i])(); + } + + /** + * last call of monitors + */ + void lastCall(void) { + for (unsigned i = 0; i < monitors.size(); i++) + monitors[i]->lastCall(); + } + + /** + * attach another monitor to this class + * @param _mon the monitor to attach + */ + void add(eoMonitor& _mon) { + monitors.push_back(&_mon); + } + + /** + * @return name of the class + */ + virtual std::string className(void) const { + return "moCounterMonitorSaver"; + } + +private : + /** interval and counter value */ + unsigned int interval, counter; + + /** monitor's vector */ + std::vector monitors; +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moCounterStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moCounterStat.h new file mode 100644 index 000000000..85534e67e --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moCounterStat.h @@ -0,0 +1,80 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moCounterStat_h +#define moCounterStat_h + +#include + +/** + * The statistic gives the number of iteration + */ +template +class moCounterStat : public moStat +{ +public : + using moStat< EOT, unsigned int>::value; + + /** + * Default Constructor + */ + moCounterStat(): moStat(0, "counter") { + } + + /** + * Init the number of iteration + * @param _sol a solution + */ + virtual void init(EOT & _sol) { + value() = 0; + } + + /** + * Set the number of iteration + * @param _sol a solution + */ + virtual void operator()(EOT & _sol) { + value() = value() + 1; + } + + /** + * @return name of the class + */ + virtual std::string className(void) const { + return "moCounterStat"; + } + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moDistanceStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moDistanceStat.h new file mode 100644 index 000000000..06cfe0007 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moDistanceStat.h @@ -0,0 +1,93 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moDistanceStat_h +#define moDistanceStat_h + +#include +#include + +/** + * The statistic gives the distance to a reference solution + * The reference solution could be the global optimum, or the best knowed solution + * It allows to compute the Fitness-Distance correlation (FDC) + */ +template +class moDistanceStat : public moStat +{ +public : + using moStat< EOT, T >::value; + + /** + * Constructor + * @param _dist a distance + * @param _ref the reference solution + */ + moDistanceStat(eoDistance & _dist, EOT & _ref): moStat(0, "distance"), dist(_dist), refSolution(_ref) {} + + /** + * Compute distance between the first solution and the reference solution + * @param _sol the first solution + */ + virtual void init(EOT & _sol) { + value() = dist(_sol, refSolution); + } + + /** + * Compute distance between a solution and the reference solution + * @param _sol a solution + */ + virtual void operator()(EOT & _sol) { + value() = dist(_sol, refSolution); + } + + /** + * @return name of the class + */ + virtual std::string className(void) const { + return "moDistanceStat"; + } + +private: + /** the distance */ + eoDistance & dist; + /** + * the reference solution does not change during the run + * it could be the best solution knowed of the problem + */ + EOT refSolution; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moEvalsContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moEvalsContinuator.h new file mode 100644 index 000000000..1a020da6c --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moEvalsContinuator.h @@ -0,0 +1,99 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moEvalsContinuator_h +#define _moEvalsContinuator_h + +#include +#include +#include +#include + +/** + * Continue until a maximum fixed number of full evaluation and neighbor evaluation is reached (total number of evaluation = full evaluation + incremental evaluation) + * + * + * Becareful 1: if restartCounter is true, then the number of neighbor evaluations (for example incremental evaluations) is considered during the local search (not before it) + * + * Becareful 2: Can not be used if the evaluation function is used in parallel + * + * Becareful 3: Check if the incremental does not use full evaluation, otherwise the total number of evaluations is not correct + */ +template< class Neighbor > +class moEvalsContinuator : public moContinuator +{ +public: + typedef typename Neighbor::EOT EOT ; + + /** + * Constructor + * @param _fullEval full evaluation function to count + * @param _neighborEval neighbor evaluation function to count + * @param _maxEvals number maximum of evaluations (full and incremental evaluations) + * @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative + */ + moEvalsContinuator(eoEvalFuncCounter & _fullEval, moEvalCounter & _neighborEval, unsigned int _maxEvals, bool _restartCounter = true): fullEval(_fullEval), neighborEval(_neighborEval), maxEvals(_maxEvals), restartCounter(_restartCounter) {} + + /** + * Test if continue + * @param _solution a solution + * @return true if number of evaluations < maxEvals + */ + virtual bool operator()(EOT & _solution) { + return (fullEval.value() + neighborEval.value() - nbEval_start < maxEvals); + } + + /** + * Reset the number of evaluations + * @param _solution a solution + */ + virtual void init(EOT & _solution) { + if (restartCounter) + nbEval_start = fullEval.value() + neighborEval.value(); + else + nbEval_start = 0; + } + + /** + * the current number of evaluation from the begining + * @return the number of evaluation + */ + unsigned int value() { + return fullEval.value() + neighborEval.value() - nbEval_start ; + } + +private: + eoEvalFuncCounter & fullEval; + moEvalCounter & neighborEval; + unsigned int maxEvals; + bool restartCounter; + unsigned int nbEval_start ; + +}; +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moFitContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moFitContinuator.h new file mode 100644 index 000000000..03ac6b686 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moFitContinuator.h @@ -0,0 +1,63 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moFitContinuator_h +#define _moFitContinuator_h + +#include +#include + +/** + * Continue until a maximum fitness is reached + */ +template< class Neighbor > +class moFitContinuator : public moContinuator +{ +public: + typedef typename Neighbor::EOT EOT ; + typedef typename EOT::Fitness Fitness ; + + /** + * @param _maxFit maximum fitness to reach + */ + moFitContinuator(Fitness _maxFit): maxFit(_maxFit) {} + + /** + *@param _solution a solution + *@return true if counter < maxFit + */ + virtual bool operator()(EOT & _solution) { + return (_solution.fitness() < maxFit); + } + +private: + Fitness maxFit; + +}; +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moFitnessStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moFitnessStat.h new file mode 100644 index 000000000..d4f2f4bea --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moFitnessStat.h @@ -0,0 +1,83 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moFitnessStat_h +#define moFitnessStat_h + +#include + +/** + * Stat given the fitness of the current solution + */ +template +class moFitnessStat : public moStat +{ +public : + typedef typename EOT::Fitness Fitness; + using moStat< EOT, Fitness >::value; + + /** + * Constructor + * @param _description a description of the stat + */ + moFitnessStat(std::string _description = "fitness"): + moStat(Fitness(), _description) {} + + /** + * store the initial fitness value + * @param _sol the initial solution + */ + virtual void init(EOT & _sol) + { + value() = _sol.fitness(); + } + + /** + * store fitness value + * @param _sol the corresponding solution + */ + virtual void operator()(EOT & _sol) + { + value() = _sol.fitness(); + } + + /** + * @return the name of the class + */ + virtual std::string className(void) const { + return "moFitnessStat"; + } +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moFullEvalContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moFullEvalContinuator.h new file mode 100644 index 000000000..5239c1dea --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moFullEvalContinuator.h @@ -0,0 +1,96 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moFullEvalContinuator_h +#define _moFullEvalContinuator_h + +#include +#include +#include + +/** + * Continue until a maximum fixed number of full evaluation is reached + * + * + * Becareful 1: if restartCounter is true, then the number of full evaluations is considered during the local search (not before it) + * + * Becareful 2: Can not be used if the evaluation function is used in parallel + */ +template< class Neighbor > +class moFullEvalContinuator : public moContinuator +{ +public: + typedef typename Neighbor::EOT EOT ; + + /** + * Constructor + * @param _eval evaluation function to count + * @param _maxFullEval number maximum of iterations + * @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative + */ + moFullEvalContinuator(eoEvalFuncCounter & _eval, unsigned int _maxFullEval, bool _restartCounter = true): eval(_eval), maxFullEval(_maxFullEval), restartCounter(_restartCounter) { + nbEval_start = eval.value(); + } + + /** + * Test if continue + * @param _solution a solution + * @return true if number of evaluations < maxFullEval + */ + virtual bool operator()(EOT & _solution) { + return (eval.value() - nbEval_start < maxFullEval); + } + + /** + * Reset the number of evaluations + * @param _solution a solution + */ + virtual void init(EOT & _solution) { + if (restartCounter) + nbEval_start = eval.value(); + else + nbEval_start = 0; + } + + /** + * the current number of evaluation from the begining + * @return the number of evaluation + */ + unsigned int value() { + return eval.value() - nbEval_start ; + } + +private: + eoEvalFuncCounter & eval; + unsigned int nbEval_start ; + bool restartCounter; + unsigned int maxFullEval ; + +}; +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moIterContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moIterContinuator.h new file mode 100644 index 000000000..f10db39f5 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moIterContinuator.h @@ -0,0 +1,86 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moIterContinuator_h +#define _moIterContinuator_h + +#include +#include + +/** + * Continue until a maximum fixed number of iterations is reached + */ +template< class Neighbor > +class moIterContinuator : public moContinuator +{ +public: + typedef typename Neighbor::EOT EOT ; + + /** + * @param _maxIter number maximum of iterations + * @param _verbose true/false : verbose mode on/off + */ + moIterContinuator(unsigned int _maxIter, bool _verbose=true): maxIter(_maxIter), verbose(_verbose) {} + + /** + *@param _solution a solution + *@return true if counter < maxIter + */ + virtual bool operator()(EOT & _solution) { + bool res; + cpt++; + res = (cpt < maxIter); + if (!res && verbose) + std::cout << "STOP in moIterContinuator: Reached maximum number of iterations [" << cpt << "/" << maxIter << "]" << std::endl; + return res; + } + + /** + * reset the counter of iteration + * @param _solution a solution + */ + virtual void init(EOT & _solution) { + cpt = 0; + } + + /** + * the current number of iteration + * @return the number of iteration + */ + unsigned int value() { + return cpt ; + } + +private: + unsigned int maxIter; + unsigned int cpt; + bool verbose; + +}; +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moMaxNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moMaxNeighborStat.h new file mode 100644 index 000000000..d0dbd8136 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moMaxNeighborStat.h @@ -0,0 +1,89 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moMaxNeighborStat_h +#define moMaxNeighborStat_h + +#include +#include +#include + +/** + * From moNeighborhoodStat, to compute the max fitness in the neighborhood + */ +template< class Neighbor > +class moMaxNeighborStat : public moStat +{ +public : + typedef typename Neighbor::EOT EOT ; + typedef typename EOT::Fitness Fitness ; + + using moStat< EOT, Fitness >::value; + + /** + * Constructor + * @param _nhStat a neighborhoodStat + */ + moMaxNeighborStat(moNeighborhoodStat & _nhStat): + moStat(Fitness(), "min"), nhStat(_nhStat) {} + + /** + * Set the max fitness in the neighborhood + * @param _sol the first solution + */ + virtual void init(EOT & _sol) { + value() = nhStat.getMax(); + } + + /** + * Set the max fitness in the neighborhood + * @param _sol the corresponding solution + */ + virtual void operator()(EOT & _sol) { + value() = nhStat.getMax(); + } + + /** + * @return the class name + */ + virtual std::string className(void) const { + return "moMaxNeighborStat"; + } + +private: + /** moNeighborhoodStat */ + moNeighborhoodStat & nhStat; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moMinNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moMinNeighborStat.h new file mode 100644 index 000000000..bd1cae1f9 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moMinNeighborStat.h @@ -0,0 +1,89 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moMinNeighborStat_h +#define moMinNeighborStat_h + +#include +#include +#include + +/** + * From moNeighborhoodStat, to compute the min fitness in the neighborhood + */ +template< class Neighbor > +class moMinNeighborStat : public moStat +{ +public : + typedef typename Neighbor::EOT EOT ; + typedef typename EOT::Fitness Fitness ; + + using moStat< EOT, Fitness >::value; + + /** + * Constructor + * @param _nhStat a neighborhoodStat + */ + moMinNeighborStat(moNeighborhoodStat & _nhStat): + moStat(Fitness(), "min"), nhStat(_nhStat) {} + + /** + * Set the worst fitness in the neighborhood + * @param _sol the first solution + */ + virtual void init(EOT & _sol) { + value() = nhStat.getMin(); + } + + /** + * Set the worst fitness in the neighborhood + * @param _sol the corresponding solution + */ + virtual void operator()(EOT & _sol) { + value() = nhStat.getMin(); + } + + /** + * @return the class name + */ + virtual std::string className(void) const { + return "moMinNeighborStat"; + } + +private: + /** moNeighborhoodStat */ + moNeighborhoodStat & nhStat; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moMinusOneCounterStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moMinusOneCounterStat.h new file mode 100644 index 000000000..dfb9be881 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moMinusOneCounterStat.h @@ -0,0 +1,90 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moMinusOneCounterStat_h +#define moMinusOneCounterStat_h + +#include + +/** + * The statistic gives the number of iteration minus 1 + * then the last iteration is not counted (for example for length of adaptive walk) + */ +template +class moMinusOneCounterStat : public moStat +{ +public : + using moStat< EOT, unsigned int>::value; + + /** + * Default Constructor + */ + moMinusOneCounterStat(): moStat(0, "counter") { + counter = 0; + } + + /** + * Init the number of iteration + * @param _sol a solution + */ + virtual void init(EOT & _sol) { + counter = 0; + value() = 0; + } + + /** + * Set the number of iteration + * @param _sol a solution + */ + virtual void operator()(EOT & _sol) { + counter++; + if (counter > 0) + value() = counter - 1; + else + value() = 0; + } + + /** + * @return name of the class + */ + virtual std::string className(void) const { + return "moMinusOneCounterStat"; + } + +private: + unsigned int counter; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNbInfNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNbInfNeighborStat.h new file mode 100644 index 000000000..1fa6783bb --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNbInfNeighborStat.h @@ -0,0 +1,90 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moNbInfNeighborStat_h +#define moNbInfNeighborStat_h + +#include +#include +#include + +/** + * From moNeighborhoodStat, to compute the number of solutions in the neighborhood + * with (strictly) lower fitness than the current solution +*/ +template< class Neighbor > +class moNbInfNeighborStat : public moStat +{ +public : + typedef typename Neighbor::EOT EOT ; + typedef typename EOT::Fitness Fitness ; + + using moStat< EOT, unsigned >::value; + + /** + * Constructor + * @param _nhStat a neighborhoodStat + */ + moNbInfNeighborStat(moNeighborhoodStat & _nhStat): + moStat(0, "nb inf"), nhStat(_nhStat) {} + + /** + * Set the number of solutions in the neighborhood with (strictly) lower fitness than the current solution + * @param _sol the first solution + */ + virtual void init(EOT & _sol) { + value() = nhStat.getNbInf(); + } + + /** + * Set the number of solutions in the neighborhood with (strictly) lower fitness than the current solution + * @param _sol the corresponding solution + */ + virtual void operator()(EOT & _sol) { + value() = nhStat.getNbInf(); + } + + /** + * @return the class name + */ + virtual std::string className(void) const { + return "moNbInfNeighborStat"; + } + +private: + /** moNeighborhoodStat */ + moNeighborhoodStat & nhStat; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNbSupNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNbSupNeighborStat.h new file mode 100644 index 000000000..027d8f1e8 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNbSupNeighborStat.h @@ -0,0 +1,90 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moNbSupNeighborStat_h +#define moNbSupNeighborStat_h + +#include +#include +#include + +/** + * From moNeighborhoodStat, to compute the number of solutions in the neighborhood + * with higher fitness than the current solution + */ +template< class Neighbor > +class moNbSupNeighborStat : public moStat +{ +public : + typedef typename Neighbor::EOT EOT ; + typedef typename EOT::Fitness Fitness ; + + using moStat< EOT, unsigned >::value; + + /** + * Constructor + * @param _nhStat a neighborhoodStat + */ + moNbSupNeighborStat(moNeighborhoodStat & _nhStat): + moStat(0, "nb sup"), nhStat(_nhStat) {} + + /** + * Set the number of solutions in the neighborhood with better fitness than the current solution + * @param _sol the first solution + */ + virtual void init(EOT & _sol) { + value() = nhStat.getNbSup(); + } + + /** + * Set the number of solutions in the neighborhood with better fitness than the current solution + * @param _sol the corresponding solution + */ + virtual void operator()(EOT & _sol) { + value() = nhStat.getNbSup(); + } + + /** + * @return the class name + */ + virtual std::string className(void) const { + return "moNbSupNeighborStat"; + } + +private: + /** moNeighborhoodStat */ + moNeighborhoodStat & nhStat; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeighborBestStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeighborBestStat.h new file mode 100644 index 000000000..7aa4b2ed6 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeighborBestStat.h @@ -0,0 +1,167 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moNeighborBestStat_h +#define moNeighborBestStat_h + +#include + +#include +#include +#include +#include + +/** + * Compute the fitness of the best solution among k neighbor or all neighbors + */ +template< class Neighbor > +class moNeighborBestStat : public moStat +{ +public : + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; + typedef typename EOT::Fitness Fitness ; + + using moStat< EOT, Fitness >::value; + + /** + * Constructor + * @param _neighborhood a neighborhood + * @param _eval an evaluation function + * @param _neighborComparator a neighbor Comparator + * @param _solNeighborComparator a comparator between a solution and a neighbor + * @param _k number of neighbors visited + */ + moNeighborBestStat(Neighborhood& _neighborhood, moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator, unsigned int _k = 0): + moStat(true, "neighborhood"), + neighborhood(_neighborhood), eval(_eval), + neighborComparator(_neighborComparator), + solNeighborComparator(_solNeighborComparator), + kmax(_k) + {} + + /** + * Default Constructor + * where the comparators are basic, there only compare the fitness values + * + * @param _neighborhood a neighborhood + * @param _eval an evaluation function + * @param _k number of neighbors visited (default all) + */ + moNeighborBestStat(Neighborhood& _neighborhood, moEval& _eval, unsigned _k = 0): + moStat(Fitness(), "best"), + neighborhood(_neighborhood), eval(_eval), + neighborComparator(defaultNeighborComp), + solNeighborComparator(defaultSolNeighborComp), + kmax(_k) + {} + + /** + * Compute classical statistics of the first solution's neighborhood + * @param _solution the first solution + */ + virtual void init(EOT & _solution) { + operator()(_solution); + } + + /** + * Compute the best fitness amoung all neighbors or k neighbors + * @param _solution the corresponding solution + */ + virtual void operator()(EOT & _solution) { + Neighbor current ; + Neighbor best ; + + if (neighborhood.hasNeighbor(_solution)) { + //init the first neighbor + neighborhood.init(_solution, current); + + //eval the _solution moved with the neighbor and stock the result in the neighbor + eval(_solution, current); + + //initialize the best neighbor + best = current; + + // number of visited neighbors + unsigned int k = 1; + + //test all others neighbors + while ( ( (kmax == 0) || (k < kmax) ) && neighborhood.cont(_solution)) { + //next neighbor + neighborhood.next(_solution, current); + //eval + eval(_solution, current); + + //if we found a better neighbor, update the best + if (neighborComparator(best, current)) + best = current; + + k++; + } + + value() = best.fitness(); + } + else { + //if _solution hasn't neighbor, + value() = Fitness(); + } + } + + /** + * @return the class name + */ + virtual std::string className(void) const { + return "moNeighborBestStat"; + } + +private: + // to explore the neighborhood + Neighborhood& neighborhood ; + moEval& eval; + + // comparator betwenn solution and neighbor or between neighbors + moNeighborComparator& neighborComparator; + moSolNeighborComparator& solNeighborComparator; + + // default comparators + // compare the fitness values of neighbors + moNeighborComparator defaultNeighborComp; + // compare the fitness values of the solution and the neighbor + moSolNeighborComparator defaultSolNeighborComp; + + // number of neighbor to explore + unsigned int kmax; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeighborEvalContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeighborEvalContinuator.h new file mode 100644 index 000000000..ba3a41a9d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeighborEvalContinuator.h @@ -0,0 +1,94 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moNeighborEvalContinuator_h +#define _moNeighborEvalContinuator_h + +#include +#include +#include + +/** + * Continue until a maximum fixed number of neighbor evaluation is reached + * + * + * Becareful 1: if restartCounter is true, then the number of neighbor evaluations (for example incremental evaluations) is considered during the local search (not before it) + * + * Becareful 2: Can not be used if the evaluation function is used in parallel + */ +template< class Neighbor > +class moNeighborEvalContinuator : public moContinuator +{ +public: + typedef typename Neighbor::EOT EOT ; + + /** + * Constructor + * @param _eval neighbor evaluation function to count + * @param _maxNeighborEval number maximum of iterations + * @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative + */ + moNeighborEvalContinuator(moEvalCounter & _eval, unsigned int _maxNeighborEval, bool _restartCounter = true): eval(_eval), maxNeighborEval(_maxNeighborEval), restartCounter(_restartCounter) {} + + /** + * Test if continue + * @param _solution a solution + * @return true if number of evaluations < maxNeighborEval + */ + virtual bool operator()(EOT & _solution) { + return (eval.value() - nbEval_start < maxNeighborEval); + } + + /** + * Reset the number of evaluations + * @param _solution a solution + */ + virtual void init(EOT & _solution) { + if (restartCounter) + nbEval_start = eval.value(); + else + nbEval_start = 0; + } + + /** + * the current number of evaluation from the begining + * @return the number of evaluation + */ + unsigned int value() { + return eval.value() - nbEval_start ; + } + +private: + moEvalCounter & eval; + unsigned int maxNeighborEval; + bool restartCounter; + unsigned int nbEval_start ; + +}; +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeighborFitnessStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeighborFitnessStat.h new file mode 100644 index 000000000..ab0d3bcb9 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeighborFitnessStat.h @@ -0,0 +1,113 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moNeighborFitnessStat_h +#define moNeighborFitnessStat_h + +#include +#include +#include + +/** + * Compute the fitness of one random neighbor + */ +template< class Neighbor > +class moNeighborFitnessStat : public moStat +{ +public : + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; + typedef typename EOT::Fitness Fitness ; + + using moStat< EOT, Fitness >::value; + + /** + * Constructor + * @param _neighborhood a neighborhood + * @param _eval an evaluation function + */ + moNeighborFitnessStat(Neighborhood& _neighborhood, moEval& _eval): + moStat(Fitness(), "neighborhood"), + neighborhood(_neighborhood), eval(_eval) + { + if (!neighborhood.isRandom()) { + std::cout << "moNeighborFitnessStat::Warning -> the neighborhood used is not random, the neighbor will not be random" << std::endl; + } + } + + /** + * Compute the fitness of one random neighbor + * @param _solution the first solution + */ + virtual void init(EOT & _solution) { + operator()(_solution); + } + + /** + * Compute the fitness of one random neighbor + * @param _solution the corresponding solution + */ + virtual void operator()(EOT & _solution) { + if (neighborhood.hasNeighbor(_solution)) { + Neighbor current ; + + //init the first neighbor which is supposed to be random + neighborhood.init(_solution, current); + + //eval the _solution moved with the neighbor and stock the result in the neighbor + eval(_solution, current); + + // the fitness value is collected + value() = current.fitness(); + } else { + //if _solution hasn't neighbor, + value() = Fitness(); + } + } + + /** + * @return the class name + */ + virtual std::string className(void) const { + return "moNeighborFitnessStat"; + } + +private: + // the neighborhood + Neighborhood& neighborhood ; + moEval& eval; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeighborhoodStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeighborhoodStat.h new file mode 100644 index 000000000..c3fdc278e --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeighborhoodStat.h @@ -0,0 +1,264 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moNeighborhoodStat_h +#define moNeighborhoodStat_h + +#include + +#include +#include +#include +#include + +/** + * All possible statitic on the neighborhood fitness + * to combine with other specific statistic to print them + */ +template< class Neighbor > +class moNeighborhoodStat : public moStat +{ +public : + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; + typedef typename EOT::Fitness Fitness ; + + using moStat< EOT, bool >::value; + + /** + * Constructor + * @param _neighborhood a neighborhood + * @param _eval an evaluation function + * @param _neighborComparator a neighbor Comparator + * @param _solNeighborComparator a comparator between a solution and a neighbor + */ + moNeighborhoodStat(Neighborhood& _neighborhood, moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator): + moStat(true, "neighborhood"), + neighborhood(_neighborhood), eval(_eval), + neighborComparator(_neighborComparator), + solNeighborComparator(_solNeighborComparator) + {} + + /** + * Default Constructor + * where the comparators are basic, there only compare the fitness values + * + * @param _neighborhood a neighborhood + * @param _eval an evaluation function + */ + moNeighborhoodStat(Neighborhood& _neighborhood, moEval& _eval): + moStat(true, "neighborhood"), + neighborhood(_neighborhood), eval(_eval), + neighborComparator(defaultNeighborComp), + solNeighborComparator(defaultSolNeighborComp) + {} + + /** + * Compute classical statistics of the first solution's neighborhood + * @param _solution the first solution + */ + virtual void init(EOT & _solution) { + operator()(_solution); + } + + /** + * Compute classical statistics of a solution's neighborhood + * @param _solution the corresponding solution + */ + virtual void operator()(EOT & _solution) { + Neighbor current ; + Neighbor best ; + Neighbor lowest ; + + if (neighborhood.hasNeighbor(_solution)) { + //init the first neighbor + neighborhood.init(_solution, current); + + //eval the _solution moved with the neighbor and stock the result in the neighbor + eval(_solution, current); + + // init the statistics + value() = true; + + mean = current.fitness(); + sd = mean * mean; + nb = 1; + nbInf = 0; + nbEqual = 0; + nbSup = 0; + + if (solNeighborComparator.equals(_solution, current)) + nbEqual++; + else if (solNeighborComparator(_solution, current)) + nbSup++; + else + nbInf++; + + //initialize the best neighbor + best = current; + lowest = current; + + //test all others neighbors + while (neighborhood.cont(_solution)) { + //next neighbor + neighborhood.next(_solution, current); + //eval + eval(_solution, current); + + mean += current.fitness(); + sd += current.fitness() * current.fitness(); + nb++; + + if (solNeighborComparator.equals(_solution, current)) + nbEqual++; + else if (solNeighborComparator(_solution, current)) + nbSup++; + else + nbInf++; + + //if we found a better neighbor, update the best + if (neighborComparator(best, current)) + best = current; + + if (neighborComparator(current, lowest)) + lowest = current; + } + + max = best.fitness(); + min = lowest.fitness(); + + mean /= nb; + if (nb > 1) + sd = sqrt( (sd - nb * mean * mean) / (nb - 1.0) ); + else + sd = 0.0; + } + else { + //if _solution hasn't neighbor, + value() = false; + } + } + + /** + * @return the worst fitness value found in the neighborhood + */ + Fitness getMin() { + return min; + } + + /** + * @return the best fitness value found in the neighborhood + */ + Fitness getMax() { + return max; + } + + /** + * @return the mean fitness value of the neighborhood + */ + double getMean() { + return mean; + } + + /** + * @return the standard deviation value of the neighborhood + */ + double getSD() { + return sd; + } + + /** + * @return the size of the neighborhood + */ + unsigned getSize() { + return nb; + } + + /** + * @return the number of neighbors having a better fitness than the current solution + */ + unsigned getNbSup() { + return nbSup; + } + + /** + * @return the number of neighbors having the same fitness than the current solution + */ + unsigned getNbEqual() { + return nbEqual; + } + + /** + * @return the number of neighbors having a worst fitness than the current solution + */ + unsigned getNbInf() { + return nbInf; + } + + /** + * @return the class name + */ + virtual std::string className(void) const { + return "moNeighborhoodStat"; + } + +protected: + + //the neighborhood + Neighborhood& neighborhood ; + moEval& eval; + + // comparator betwenn solution and neighbor or between neighbors + moNeighborComparator& neighborComparator; + moSolNeighborComparator& solNeighborComparator; + + // default comparators + // compare the fitness values of neighbors + moNeighborComparator defaultNeighborComp; + // compare the fitness values of the solution and the neighbor + moSolNeighborComparator defaultSolNeighborComp; + + // the stastics of the fitness + Fitness max, min; + //mean and standard deviation + double mean, sd ; + + // number of neighbors in the neighborhood; + unsigned int nb; + + // number of neighbors with lower, equal and higher fitness + unsigned int nbInf, nbEqual, nbSup ; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeutralDegreeNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeutralDegreeNeighborStat.h new file mode 100644 index 000000000..88ab663b4 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moNeutralDegreeNeighborStat.h @@ -0,0 +1,90 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moNeutralDegreeNeighborStat_h +#define moNeutralDegreeNeighborStat_h + +#include +#include + +/** + * From moNeighborhoodStat, to compute the neutral degree of the solution + * which is the number of solutions in the neighborhood + * with equals fitness + */ +template< class Neighbor > +class moNeutralDegreeNeighborStat : public moStat +{ +public : + typedef typename Neighbor::EOT EOT ; + typedef typename EOT::Fitness Fitness ; + + using moStat< EOT, unsigned >::value; + + /** + * Constructor + * @param _nhStat a neighborhoodStat + */ + moNeutralDegreeNeighborStat(moNeighborhoodStat & _nhStat): + moStat(0, "neutral degree"), nhStat(_nhStat) {} + + /** + * Set the neutral degree of the solution which is the number of solutions in the neighborhood with equals fitness + * @param _sol the first solution + */ + virtual void init(EOT & _sol) { + value() = nhStat.getNbEqual(); + } + + /** + * Set the neutral degree of the solution which is the number of solutions in the neighborhood with equals fitness + * @param _sol the corresponding solution + */ + virtual void operator()(EOT & _sol) { + value() = nhStat.getNbEqual(); + } + + /** + * @return the class name + */ + virtual std::string className(void) const { + return "moNeutralDegreeNeighborStat"; + } + +private: + /** moNeighborhoodStat */ + moNeighborhoodStat & nhStat; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moSecondMomentNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moSecondMomentNeighborStat.h new file mode 100644 index 000000000..c5b1009f7 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moSecondMomentNeighborStat.h @@ -0,0 +1,90 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moSecondMomentNeighborStat_h +#define moSecondMomentNeighborStat_h + +#include +#include + +/** + * From moNeighborhoodStat, to compute the average and the standard deviation of fitness in the neighborhood + */ +template< class Neighbor > +class moSecondMomentNeighborStat : public moStat > +{ +public : + typedef typename Neighbor::EOT EOT ; + typedef typename EOT::Fitness Fitness ; + + using moStat< EOT, std::pair >::value; + + /** + * Constructor + * @param _nhStat a neighborhoodStat + */ + moSecondMomentNeighborStat(moNeighborhoodStat & _nhStat): + moStat >(std::make_pair(0.0,0.0), "average and stdev"), nhStat(_nhStat) {} + + /** + * Set the average and the standard deviation of fitness in the neighborhood + * @param _sol the first solution + */ + virtual void init(EOT & _sol) { + value().first = nhStat.getMean(); + value().second = nhStat.getSD(); + } + + /** + * Set the average and the standard deviation of fitness in the neighborhood + * @param _sol the corresponding solution + */ + virtual void operator()(EOT & _sol) { + value().first = nhStat.getMean(); + value().second = nhStat.getSD(); + } + + /** + * @return the class name + */ + virtual std::string className(void) const { + return "moSecondMomentNeighborStat"; + } + +private: + /** moNeighborhoodStat */ + moNeighborhoodStat & nhStat; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moSizeNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moSizeNeighborStat.h new file mode 100644 index 000000000..6e7ae60f1 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moSizeNeighborStat.h @@ -0,0 +1,89 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moSizeNeighborStat_h +#define moSizeNeighborStat_h + +#include +#include + +/** + * From moNeighborhoodStat, to compute the number of solutions in the neighborhood + * + */ +template< class Neighbor > +class moSizeNeighborStat : public moStat +{ +public : + typedef typename Neighbor::EOT EOT ; + typedef typename EOT::Fitness Fitness ; + + using moStat< EOT, unsigned >::value; + + /** + * Constructor + * @param _nhStat a neighborhoodStat + */ + moSizeNeighborStat(moNeighborhoodStat & _nhStat): + moStat(0, "size"), nhStat(_nhStat) {} + + /** + * Set the number of solutions in the neighborhood + * @param _sol the first solution + */ + virtual void init(EOT & _sol) { + value() = nhStat.getSize(); + } + + /** + * Set the number of solutions in the neighborhood + * @param _sol the corresponding solution + */ + virtual void operator()(EOT & _sol) { + value() = nhStat.getSize(); + } + + /** + * @return the class name + */ + virtual std::string className(void) const { + return "moSizeNeighborStat"; + } + +private: + /** moNeighborhoodStat */ + moNeighborhoodStat & nhStat; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moSolutionStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moSolutionStat.h new file mode 100644 index 000000000..17a997e25 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moSolutionStat.h @@ -0,0 +1,82 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moSolutionStat_h +#define moSolutionStat_h + +#include + +/** + * The statistic which only give the current solution. + * Be careful, the solution is given by copy + * + */ +template +class moSolutionStat : public moStat +{ +public : + using moStat< EOT, EOT >::value; + + /** + * Constructor + * @param _description a description of the parameter + */ + moSolutionStat(std::string _description = "solution"): + moStat(EOT(), _description) { } + + /** + * Initialization the solution by copy + * @param _sol the intial solution + */ + virtual void init(EOT & _sol) { + value() = _sol; + } + + /** + * Set the solution by copy + * @param _sol the corresponding solution + */ + virtual void operator()(EOT & _sol) { + value() = _sol; + } + + /** + * @return name of the class + */ + virtual std::string className(void) const { + return "moSolutionStat"; + } +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moStat.h new file mode 100644 index 000000000..b986166f3 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moStat.h @@ -0,0 +1,61 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moStat_h +#define moStat_h + +#include + +/** + * The actual class that will be used as base for all statistics + * that need to be calculated over the solution + * It is a moStatBase AND an eoValueParam so it can be used in Monitors. + */ +template +class moStat : public eoValueParam, public moStatBase +{ +public: + + /** + * Constructor + * @param _value a default parameter's value + * @param _description a description of the parameter + */ + moStat(T _value, std::string _description): + eoValueParam(_value, _description) {} + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moStatBase.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moStatBase.h new file mode 100644 index 000000000..f0553ee1f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moStatBase.h @@ -0,0 +1,61 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moStatBase_h +#define moStatBase_h + +#include +#include + +/** + * Base class for all statistics that need to be calculated + * over the solution +*/ +template +class moStatBase : public eoUF +{ +public: + /** + * last call of a statistical operator + */ + virtual void lastCall(EOT &) {} + + /** + * first call of a statistical operator + */ + virtual void init(EOT &) {} + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moStatFromStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moStatFromStat.h new file mode 100644 index 000000000..e8da634ad --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moStatFromStat.h @@ -0,0 +1,83 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moStatFromStat_h +#define moStatFromStat_h + +#include + +/** + * The statistic which copy another statistic + */ +template +class moStatFromStat : public moStat +{ +public : + using moStat< EOT , T >::value; + + /** + * Constructor + * @param _stat a stat + */ + moStatFromStat(moStat & _stat): moStat(0, _stat.description()), stat(_stat) { + } + + /** + * The value of this stat is a copy of the value of the initial stat + * @param _sol a solution + */ + virtual void init(EOT & _sol) { + value() = stat.value(); + } + + /** + * The value of this stat is a copy of the value of the initial stat + * @param _sol a solution + */ + virtual void operator()(EOT & _sol) { + value() = stat.value(); + } + + /** + * @return name of the class + */ + virtual std::string className(void) const { + return "moStatFromStat"; + } + +private: + moStat & stat; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moStdFitnessNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moStdFitnessNeighborStat.h new file mode 100644 index 000000000..b9a547954 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moStdFitnessNeighborStat.h @@ -0,0 +1,88 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moStdFitnessNeighborStat_h +#define moStdFitnessNeighborStat_h + +#include +#include + +/** + * From moNeighborhoodStat, to compute the average and the standard deviation of fitness in the neighborhood + */ +template< class Neighbor > +class moStdFitnessNeighborStat : public moStat +{ +public : + typedef typename Neighbor::EOT EOT ; + typedef typename EOT::Fitness Fitness ; + + using moStat< EOT, double >::value; + + /** + * Constructor + * @param _nhStat a neighborhoodStat + */ + moStdFitnessNeighborStat(moNeighborhoodStat & _nhStat): + moStat(0.0, "stdev"), nhStat(_nhStat) {} + + /** + * Set the average and the standard deviation of fitness in the neighborhood + * @param _sol the first solution + */ + virtual void init(EOT & _sol) { + value() = nhStat.getSD(); + } + + /** + * Set the average and the standard deviation of fitness in the neighborhood + * @param _sol the corresponding solution + */ + virtual void operator()(EOT & _sol) { + value() = nhStat.getSD(); + } + + /** + * @return the class name + */ + virtual std::string className(void) const { + return "moStdFitnessNeighborStat"; + } + +private: + /** moNeighborhoodStat */ + moNeighborhoodStat & nhStat; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moTimeContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moTimeContinuator.h new file mode 100644 index 000000000..c393a07ec --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moTimeContinuator.h @@ -0,0 +1,131 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moTimeContinuator_h +#define _moTimeContinuator_h + +#include + +/** + * Termination condition until a running time is reached. + */ +template < class Neighbor > +class moTimeContinuator: public moContinuator +{ +public: + + typedef typename Neighbor::EOT EOT; + + /** + * Constructor + * @param _max maximum running time + * @param _verbose verbose mode true/false -> on/off + */ + moTimeContinuator(time_t _max, bool _verbose = true): max(_max), verbose(_verbose) { + external = false; + start = time(NULL); + } + + + /** + * Synchronize the whole time with an external starting time + * @param _externalStart external starting time + */ + virtual void setStartingTime(time_t _externalStart) { + external = true; + start = _externalStart; + } + + + /** + * To get the starting time + * @return starting time + */ + virtual time_t getStartingTime() { + return start; + } + + + /** + * To set the maximum running time + * + * @param _maxTime maximum running time + */ + virtual void maxTime(time_t _maxTime) { + max = _maxTime; + } + + + /** + * Returns false when the running time is reached. + * @param _sol the current solution + */ + virtual bool operator() (EOT& _sol) + { + bool res; + time_t elapsed = (time_t) difftime(time(NULL), start); + res = (elapsed < max); + if (!res && verbose) + std::cout << "STOP in moTimeContinuator: Reached maximum time [" << elapsed << "/" << max << "]" << std::endl; + return res; + } + + /** + * reset the start time + * @param _solution a solution + */ + virtual void init(EOT & _solution) { + if (!external) + start = time(NULL); + } + + + /** + * Class name + */ + virtual std::string className(void) const + { + return "moTimeContinuator"; + } + + +private: + + /** maximum running time */ + time_t max; + /** starting time */ + time_t start; + /** external start flag */ + bool external; + /** verbose mode */ + bool verbose; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moTrueContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moTrueContinuator.h new file mode 100644 index 000000000..88feb91a3 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moTrueContinuator.h @@ -0,0 +1,68 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moTrueContinuator_h +#define _moTrueContinuator_h + +#include + +/** + * Continuator always return True + */ +template< class Neighbor > +class moTrueContinuator : public moContinuator +{ +public: + typedef typename Neighbor::EOT EOT ; + + // empty constructor + moTrueContinuator() {} ; + + /** + * @param _solution a solution + * @return always true + */ + virtual bool operator()(EOT & _solution) { + return true; + } + + /** + * NOTHING TO DO + * @param _solution a solution + */ + virtual void init(EOT & _solution) {} + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moUnsignedStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moUnsignedStat.h new file mode 100644 index 000000000..c1f8342cd --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moUnsignedStat.h @@ -0,0 +1,82 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moUnsignedStat_h +#define moUnsignedStat_h + +#include + +/** + * The statistic gives from a boolean variable + */ +template +class moUnsignedStat : public moStat +{ +public : + using moStat< EOT, unsigned int>::value; + + /** + * Default Constructor + */ + moUnsignedStat(unsigned int * _b): moStat(*_b, "unsigned"), b(_b) { + } + + /** + * Init the number of iteration + * @param _sol a solution + */ + virtual void init(EOT & _sol) { + value() = *b; + } + + /** + * Set the number of iteration + * @param _sol a solution + */ + virtual void operator()(EOT & _sol) { + value() = *b; + } + + /** + * @return name of the class + */ + virtual std::string className(void) const { + return "moUnsignedStat"; + } + +private: + unsigned int * b; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moUpdater.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moUpdater.h new file mode 100644 index 000000000..0be846d38 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moUpdater.h @@ -0,0 +1,67 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moUpdater_h +#define moUpdater_h + +#include +#include + +/** + * Base class for to update what ever you want + * similar to eoUpdater + * But there is an init method ! +*/ +class moUpdater : public eoF +{ +public: + /** + * first call of the updater + */ + virtual void init() {} + + /** + * last call of the updater + */ + virtual void lastCall() {} + + /** + * class name + */ + virtual std::string className(void) const + { return "moUpdater"; } + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moValueStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moValueStat.h new file mode 100644 index 000000000..6c8806e87 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moValueStat.h @@ -0,0 +1,84 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moValueStat_h +#define moValueStat_h + +#include +#include + +/** + * The statistic gives the number of iteration + */ +template +class moValueStat : public moStat +{ +public : + using moStat< EOT, double>::value; + + /** + * Default Constructor + */ + moValueStat(eoValueParam & _valueParam): moStat(0, "value"), valueParam(_valueParam) { + } + + /** + * Init the number of iteration + * @param _sol a solution + */ + virtual void init(EOT & _sol) { + value() = (double) valueParam.value(); + } + + /** + * Set the number of iteration + * @param _sol a solution + */ + virtual void operator()(EOT & _sol) { + value() = (double) valueParam.value() ; + } + + /** + * @return name of the class + */ + virtual std::string className(void) const { + return "moValueStat"; + } + +private: + eoValueParam & valueParam; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moVectorMonitor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moVectorMonitor.h new file mode 100644 index 000000000..b04eb8adf --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/continuator/moVectorMonitor.h @@ -0,0 +1,241 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moVectorMonitor_h +#define moVectorMonitor_h + +#include +#include +#include + +/** + * To save the values of the same type (double, unsigned int, or EOT) in a vector + * It is similar to eoFileMonitor + * + */ +template +class moVectorMonitor : public eoMonitor +{ +public: + + /** + * Constructor + * @param _param the parameter of type double to save in the vector + */ + moVectorMonitor(eoValueParam & _param) : doubleParam(&_param), intParam(NULL), eotParam(NULL) + { + // precision of the output by default + precisionOutput = std::cout.precision(); + } + + /** + * Default Constructor + * @param _param the parameter of type unsigned int to save in the vector + */ + moVectorMonitor(eoValueParam & _param) : doubleParam(NULL), intParam(&_param), eotParam(NULL) + { + // precision of the output by default + precisionOutput = std::cout.precision(); + } + + /** + * Default Constructor + * @param _param the parameter of type EOT to save in the vector + */ + moVectorMonitor(eoValueParam & _param) : doubleParam(NULL), intParam(NULL), eotParam(&_param) + { + // precision of the output by default + precisionOutput = std::cout.precision(); + } + + /** + * Default Constructor + * @param _param the parameter of type eoScalarFitness to save in the vector + */ + template + moVectorMonitor(eoValueParam > & _param) : doubleParam( & (eoValueParam&)_param), intParam(NULL), eotParam(NULL) + { + // precision of the output by default + precisionOutput = std::cout.precision(); + } + + /** + * Default Constructor + * @param _param unvalid Parameter + */ + template + moVectorMonitor(eoValueParam & _param) : doubleParam(NULL), intParam(NULL), eotParam(NULL) + { + std::cerr << "Sorry the type can not be in a vector of moVectorMonitor" << std::endl; + } + + /** + * To test if the value are basic type (double or unsigned int), or EOT type + * + * @return true if the type is a EOT type + */ + bool solutionType() { + return eotParam != NULL; + } + + /** + * To "print" the value of the parameter in the vector + * + * @return this monitor (sorry I don't why, but it is like this in EO) + */ + eoMonitor& operator()(void) { + if (doubleParam != NULL) + valueVec.push_back(doubleParam->value()); + else + if (intParam != NULL) + valueVec.push_back((double) intParam->value()); + else + eotVec.push_back(eotParam->value()); + return *this ; + } + + /** + * To have all the values + * + * @return the vector of values + */ + const std::vector& getValues() const { + return valueVec; + } + + /** + * To have all the solutions + * + * @return the vector of solutions + */ + const std::vector& getSolutions() const { + return eotVec; + } + + /** + * to get the value out. + * @return the string of the value + */ + std::string getValue(unsigned int i) const { + std::ostringstream os; + + // set the precision of the output + os.precision(precisionOutput); + + if (eotParam == NULL) + os << (valueVec[i]) ; + else + os << (eotVec[i]) ; + + return os.str(); + } + + /** + * clear the vector + */ + void clear() { + valueVec.clear(); + eotVec.clear(); + } + + /** + * number of value + * @return size of the vector + */ + unsigned int size() { + if (eotParam == NULL) + return valueVec.size(); + else + return eotVec.size(); + } + + /** + * to set the precision of the output file + * @param _precision precision of the output (number of digit) + */ + void precision(unsigned int _precision) { + precisionOutput = _precision; + } + + /** + * to export the vector of values into one file + * @param _filename file name + * @param _openFile to specify if it writes at the following of the file + */ + void fileExport(std::string _filename, bool _openFile=false) { + // create file + std::ofstream os; + + if(! _openFile) + os.open(_filename.c_str()); + + else + os.open(_filename.c_str(),std::ios::app); + + + if (!os) { + std::string str = "moVectorMonitor: Could not open " + _filename; + throw std::runtime_error(str); + } + + for (unsigned int i = 0; i < size(); i++) { + os << getValue(i); + + os << std::endl ; + } + + } + + /** + * @return name of the class + */ + virtual std::string className(void) const { + return "moVectorMonitor"; + } + +protected: + eoValueParam * doubleParam ; + eoValueParam * intParam ; + eoValueParam * eotParam ; + + std::vector valueVec; + std::vector eotVec; + + // precision of the output + unsigned int precisionOutput; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/coolingSchedule/moCoolingSchedule.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/coolingSchedule/moCoolingSchedule.h new file mode 100644 index 000000000..9b65cf1b5 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/coolingSchedule/moCoolingSchedule.h @@ -0,0 +1,64 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moCoolingSchedule_h +#define _moCoolingSchedule_h + +#include + +/** + * Cooling Schedule of the temperature in the simulated algorithm + * + */ +template< class EOT > +class moCoolingSchedule : public eoUF +{ +public: + /** + * Init the solution with the initial temperature + * @param _solution initial solution + */ + virtual double init(EOT & _solution) = 0; + + /** + * update the temperature + * @param _temp current temperature to update + * @param _acceptedMove true when the move is accepted, false otherwise + */ + virtual void update(double& _temp, bool _acceptedMove) = 0; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/coolingSchedule/moDynSpanCoolingSchedule.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/coolingSchedule/moDynSpanCoolingSchedule.h new file mode 100644 index 000000000..34b386312 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/coolingSchedule/moDynSpanCoolingSchedule.h @@ -0,0 +1,140 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moDynSpanCoolingSchedule_h +#define _moDynSpanCoolingSchedule_h + +#include + +/** + * Cooling Schedule of the temperature in the simulated algorithm + * dynamic span : maximum number of tries and maximum number of moves + * stop on the number of span with no move + * + */ +template< class EOT > +class moDynSpanCoolingSchedule : public moCoolingSchedule +{ +public: + /** + * default constructor + * @param _initT initial temperature + * @param _alpha factor of decreasing + * @param _spanTriesMax maximum number of total move at equal temperature + * @param _spanMoveMax maximum number of moves at equal temperature + * @param _nbSpanMax maximum number of span with no move before stopping the search + */ + moDynSpanCoolingSchedule(double _initT, double _alpha, unsigned int _spanTriesMax, unsigned int _spanMoveMax, unsigned int _nbSpanMax) : + initT(_initT), alpha(_alpha), spanTriesMax(_spanTriesMax), spanMoveMax(_spanMoveMax), nbSpanMax(_nbSpanMax) { + } + + /** + * Initial temperature + * @param _solution initial solution + */ + virtual double init(EOT & _solution) { + // number of tries since the last temperature change + spanTries = 0; + + // number of move since the last temperature change + spanMove = 0; + + // number of successive span with no move + nbSpan = 0; + + return initT; + } + + /** + * update the temperature by a factor + * @param _temp current temperature to update + * @param _acceptedMove true when the move is accepted, false otherwise + */ + virtual void update(double& _temp, bool _acceptedMove) { + spanTries++; + + if (_acceptedMove) + spanMove++; + + if (spanTries >= spanTriesMax || spanMove >= spanMoveMax) { + _temp *= alpha; + + if (spanMove == 0) // no move during this span ? + nbSpan++; + else + nbSpan = 0; + + spanTries = 0; + spanMove = 0; + } + } + + /** + * compare the number of span with no move + * @param _temp current temperature + * @return true if the search can continue + */ + virtual bool operator()(double _temp) { + return nbSpan <= nbSpanMax; + } + +private: + // initial temperature + double initT; + + // coefficient of decrease + double alpha; + + // number of total move at equal temperature + unsigned int spanTries; + + // number of move at equal temperature + unsigned int spanMove; + + // number of successive spans with no move + unsigned int nbSpan; + + // maximum number of total move at equal temperature + unsigned int spanTriesMax; + + // maximum number of move at equal temperature + unsigned int spanMoveMax; + + // maximum number of successive spans with no move + unsigned int nbSpanMax; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/coolingSchedule/moSimpleCoolingSchedule.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/coolingSchedule/moSimpleCoolingSchedule.h new file mode 100644 index 000000000..5ff4f4920 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/coolingSchedule/moSimpleCoolingSchedule.h @@ -0,0 +1,105 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moSimpleCoolingSchedule_h +#define _moSimpleCoolingSchedule_h + +#include + +/** + * Classical cooling Schedule of the temperature in the simulated algorithm with initial and final temperature and a factor of decrease + * + */ +template< class EOT > +class moSimpleCoolingSchedule : public moCoolingSchedule +{ +public: + /** + * Constructor + * @param _initT initial temperature + * @param _alpha factor of decreasing + * @param _span number of iteration with equal temperature + * @param _finalT final temperature, threshold of the stopping criteria + */ + moSimpleCoolingSchedule(double _initT, double _alpha, unsigned _span, double _finalT) : initT(_initT), alpha(_alpha), span(_span), finalT(_finalT) {} + + /** + * Getter on the initial temperature + * @param _solution initial solution + * @return the initial temperature + */ + virtual double init(EOT & _solution) { + // number of iteration with the same temperature + step = 0; + + return initT; + } + + /** + * update the temperature by a factor + * @param _temp current temperature to update + * @param _acceptedMove true when the move is accepted, false otherwise + */ + virtual void update(double& _temp, bool _acceptedMove) { + if (step >= span) { + _temp *= alpha; + step = 0; + } else + step++; + } + + /** + * compare the temperature to the threshold + * @param _temp current temperature + * @return true if the current temperature is over the threshold (final temperature) + */ + virtual bool operator()(double _temp) { + return _temp > finalT; + } + +private: + // initial temperature + double initT; + // coefficient of decrease + double alpha; + // maximum number of iterations at the same temperature + unsigned int span; + // threshold temperature + double finalT; + // number of steps with the same temperature + unsigned int step; +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moDoubleIncrEvaluation.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moDoubleIncrEvaluation.h new file mode 100644 index 000000000..c7027e2b8 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moDoubleIncrEvaluation.h @@ -0,0 +1,104 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moDoubleIncrEvaluation_H +#define moDoubleIncrEvaluation_H + +#include +#include + +/** + * Base class for the double incremental evaluation of the neighborhood + * + * The sizes of the neighborhoods are equal + */ +template +class moDoubleIncrEvaluation : public moNeighborhoodEvaluation, public moUpdater +{ +public: + typedef typename Neighbor::EOT EOT; + typedef typename EOT::Fitness Fitness; + + /** + * Constructor + * + * @param _neighborhoodSize the size of the neighborhood + */ + moDoubleIncrEvaluation(unsigned int _neighborhoodSize) : moNeighborhoodEvaluation(), moUpdater(), neighborhoodSize(_neighborhoodSize), firstEval(true) { + deltaFitness = new Fitness[neighborhoodSize]; + } + + /** + * Destructor + */ + ~moDoubleIncrEvaluation() { + if (deltaFitness != NULL) + delete [] deltaFitness; + } + + /** + * Initialisation of the evaluation process + * The first evaluation will be a simple incremental evaluation + * + */ + virtual void init() { + firstEval = true; + } + + virtual void operator()() { + } + + /** + * Evaluation of the neighborhood + * Here nothing to do + * + * @param _solution the current solution + */ + virtual void operator()(EOT & _solution) { + } + + /** the delta of fitness for each neighbors + * The fitness of the neighbor i is given by : fitness(solution) + deltaFitness[i] + */ + Fitness * deltaFitness; + +protected: + /** the neighborhood size */ + unsigned int neighborhoodSize; + + /** flag : true when it is the first evaluation */ + bool firstEval; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moDoubleIncrNeighborhoodEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moDoubleIncrNeighborhoodEval.h new file mode 100644 index 000000000..61ef09176 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moDoubleIncrNeighborhoodEval.h @@ -0,0 +1,76 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moDoubleIncrNeighborhoodEval_H +#define moDoubleIncrNeighborhoodEval_H + +#include +#include + +/** + * Evaluation of a neighbor from the full evaluation f the neighborhood + * + * + */ +template +class moDoubleIncrNeighborhoodEval : public moEval +{ +public: + typedef typename moEval::EOT EOT; + + /** + * Ctor + * @param _evaluation the double incremental evaluation of the neighborhood + */ + moDoubleIncrNeighborhoodEval(moDoubleIncrEvaluation& _evaluation) : evaluation(_evaluation) {} + + /** + * evaluation of a neighbor with the double incremental evaluation + * + * @param _sol current solution + * @param _neighbor the neighbor to be evaluated + */ + void operator()(EOT & _sol, Neighbor & _neighbor) + { + _neighbor.fitness(_sol.fitness() + evaluation.deltaFitness[_neighbor.index()]); + } + + +private: + /** the evaluation of the neighborhood */ + moDoubleIncrEvaluation & evaluation; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moDummyEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moDummyEval.h new file mode 100644 index 000000000..2809f12a3 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moDummyEval.h @@ -0,0 +1,53 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moDummyEval_h +#define _moDummyEval_h + +#include + +/** + * Dummy Evaluation function + */ +template +class moDummyEval : public moEval { +public: + typedef typename Neighbor::EOT EOT; + typedef typename EOT::Fitness Fitness; + + /** + * NOTHING TO DO + * @param _sol unused solution + * @param _n unused neighbor + */ + void operator()(EOT& _sol, Neighbor& _n) {} + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moEval.h new file mode 100644 index 000000000..835a8ae8e --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moEval.h @@ -0,0 +1,51 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moEval_H +#define moEval_H + +#include + +/** + * Abstract class for the evaluation + */ +template +class moEval : public eoBF +{ +public: + typedef typename Neighbor::EOT EOT; + typedef typename EOT::Fitness Fitness; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moEvalCounter.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moEvalCounter.h new file mode 100644 index 000000000..e795f4384 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moEvalCounter.h @@ -0,0 +1,66 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moEvalCounter_h +#define _moEvalCounter_h + +#include +#include + +/** + Counts the number of neighbor evaluations actually performed, thus checks first + if it has to evaluate.. etc. +*/ +template +class moEvalCounter : public moEval, public eoValueParam +{ +public: + typedef typename Neighbor::EOT EOT; + typedef typename EOT::Fitness Fitness; + + moEvalCounter(moEval& _eval, std::string _name = "Neighbor Eval. ") + : eoValueParam(0, _name), eval(_eval) {} + + /** + * Increase the number of neighbor evaluations and perform the evaluation + * + * @param _solution a solution + * @param _neighbor a neighbor + */ + void operator()(EOT& _solution, Neighbor& _neighbor) { + value()++; + eval(_solution, _neighbor); + } + +private: + moEval & eval; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moFullEvalByCopy.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moFullEvalByCopy.h new file mode 100644 index 000000000..701a7b951 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moFullEvalByCopy.h @@ -0,0 +1,82 @@ + /* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moFullEvalByCopy_H +#define moFullEvalByCopy_H + +#include +#include + +/** + * Evaluation by copy + */ +template +class moFullEvalByCopy : public moEval +{ +public: + typedef typename moEval::EOT EOT; + typedef typename moEval::Fitness Fitness; + + /** + * Ctor + * @param _eval the full evaluation object + */ + moFullEvalByCopy(eoEvalFunc & _eval) : eval(_eval) {} + + /** + * Full evaluation of the neighbor by copy + * @param _sol current solution + * @param _neighbor the neighbor to be evaluated + */ + void operator()(EOT & _sol, Neighbor & _neighbor) + { + // tmp solution + EOT tmp(_sol); + // move tmp solution wrt _neighbor + _neighbor.move(tmp); + // eval copy + tmp.invalidate(); + eval(tmp); + // set the fitness value to the neighbor + _neighbor.fitness(tmp.fitness()); + } + + +private: + /** the full evaluation object */ + eoEvalFunc & eval; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moFullEvalByModif.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moFullEvalByModif.h new file mode 100644 index 000000000..80ee94d1c --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moFullEvalByModif.h @@ -0,0 +1,96 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 moFullEvalByModif_H +#define moFullEvalByModif_H + +#include +#include + +/** + * Full evaluation to use with a moBackableNeighbor + * !!!WARNING!!! Use only when your solution is composed by a fitness Value and a "genotype" + * + */ +template +class moFullEvalByModif : public moEval +{ +public: + typedef typename moEval::EOT EOT; + typedef typename moEval::Fitness Fitness; + + /** + * Ctor + * @param _eval the full evaluation object + */ + moFullEvalByModif(eoEvalFunc& _eval) : eval(_eval) {} + + /** + * Full evaluation of the neighbor by copy + * @param _sol current solution + * @param _neighbor the neighbor to be evaluated + */ + void operator()(EOT & _sol, BackableNeighbor & _neighbor) + { + // tmp fitness value of the current solution + Fitness tmpFit; + + // save current fitness value + tmpFit = _sol.fitness(); + + // move the current solution wrt _neighbor + _neighbor.move(_sol); + + // eval the modified solution + _sol.invalidate(); + eval(_sol); + + // set the fitness value to the neighbor + _neighbor.fitness(_sol.fitness()); + + // move the current solution back + _neighbor.moveBack(_sol); + + // set the fitness back + _sol.fitness(tmpFit); + } + + +private: + /** the full evaluation object */ + eoEvalFunc & eval; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moNeighborhoodEvaluation.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moNeighborhoodEvaluation.h new file mode 100644 index 000000000..92274c133 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/eval/moNeighborhoodEvaluation.h @@ -0,0 +1,56 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moNeighborhoodEvaluation_H +#define moNeighborhoodEvaluation_H + +#include + +/** + * Abstract class for the evaluation + * of all the neighborhood + * in one step + * + * It is usefull for example in a double incremental evaluation (QAP, UBQP problems) + * This class is used in combinaison with the class moEvaluatedNeighborhood + */ +template +class moNeighborhoodEvaluation : public eoUF +{ +public: + typedef typename Neighbor::EOT EOT; + typedef typename EOT::Fitness Fitness; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moDummyExplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moDummyExplorer.h new file mode 100644 index 000000000..3d58dbb08 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moDummyExplorer.h @@ -0,0 +1,111 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moDummyExplorer_h +#define _moDummyExplorer_h + +#include + +/** + * Dummy Explorer the neighborhood: nothing is explored + */ +template< class Neighbor > +class moDummyExplorer : public moNeighborhoodExplorer +{ +public: + typedef moNeighborhood Neighborhood; + typedef typename Neighbor::EOT EOT; + typedef typename EOT::Fitness Fitness ; + + moDummyExplorer(): moNeighborhoodExplorer() { } + + /** + * NOTHING TO DO + * @param _solution unused solution + */ + void initParam (EOT& _solution) { } ; + + /** + * NOTHING TO DO + * @param _solution unused solution + */ + void updateParam (EOT& _solution) { } ; + + /** + * NOTHING TO DO + * @param _solution unused solution + * @return always false + */ + bool isContinue(EOT& _solution) { + return false; + } ; + + /** + * NOTHING TO DO + * @param _solution unused solution + */ + void move(EOT& _solution) { } ; + + /** + * NOTHING TO DO + * @param _solution unused solution + * @return always false + */ + virtual bool accept(EOT& _solution) { + return false; + } ; + + /** + * NOTHING TO DO + * @param _solution unused solution + */ + virtual void terminate(EOT& _solution) { } ; + + /** + * NOTHING TO DO + * @param _solution unused solution + */ + void operator()(EOT & _solution) { } + + /** + * Return the class name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moDummyExplorer"; + } + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moFirstImprHCexplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moFirstImprHCexplorer.h new file mode 100644 index 000000000..4689ca9f0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moFirstImprHCexplorer.h @@ -0,0 +1,155 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moFirstImprHCexplorer_h +#define _moFirstImprHCexplorer_h + +#include +#include +#include +#include + +/** + * Explorer for a first improvement heuristic + */ +template< class Neighbor> +class moFirstImprHCexplorer : public moNeighborhoodExplorer +{ +public: + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; + + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::currentNeighbor; + using moNeighborhoodExplorer::selectedNeighbor; + + /** + * Constructor + * @param _neighborhood the neighborhood + * @param _eval the evaluation function + * @param _neighborComparator a neighbor comparator + * @param _solNeighborComparator a solution vs neighbor comparator + */ + moFirstImprHCexplorer(Neighborhood& _neighborhood, moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator) : moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) { + isAccept = false; + } + + /** + * Destructor + */ + ~moFirstImprHCexplorer() { + } + + /** + * initParam: NOTHING TO DO + * @param _solution unused solution + */ + virtual void initParam(EOT & _solution) {}; + + /** + * updateParam: NOTHING TO DO + * @param _solution unused solution + */ + virtual void updateParam(EOT & _solution) {}; + + /** + * terminate: NOTHING TO DO + * @param _solution unused solution + */ + virtual void terminate(EOT & _solution) {}; + + /** + * Explore the neighborhood of a solution until an ameliorated neighbor is found + * @param _solution + */ + virtual void operator()(EOT & _solution) { + + //Test if _solution has a Neighbor + if (neighborhood.hasNeighbor(_solution)) { + //init the first neighbor + neighborhood.init(_solution, currentNeighbor); + + //eval the _solution moved with the neighbor and stock the result in the neighbor + eval(_solution, currentNeighbor); + + //test all others neighbors + while (! solNeighborComparator(_solution, currentNeighbor) && neighborhood.cont(_solution)) { + //next neighbor + neighborhood.next(_solution, currentNeighbor); + //eval + eval(_solution, currentNeighbor); + } + + // the selected neighbor + selectedNeighbor = currentNeighbor; + } + else { + //if _solution hasn't neighbor, + isAccept=false; + } + }; + + /** + * continue if a move is accepted + * @param _solution the solution + * @return true if an ameliorated neighbor was found + */ + virtual bool isContinue(EOT & _solution) { + return isAccept ; + }; + + /** + * accept test if an ameliorated neighbor was found + * @param _solution the solution + * @return true if the best neighbor ameliorate the fitness + */ + virtual bool accept(EOT & _solution) { + if (neighborhood.hasNeighbor(_solution)) { + isAccept = solNeighborComparator(_solution, selectedNeighbor) ; + } + return isAccept; + }; + +private: + // comparator betwenn solution and neighbor or between neighbors + moNeighborComparator& neighborComparator; + moSolNeighborComparator& solNeighborComparator; + + // true if the move is accepted + bool isAccept ; +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moILSexplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moILSexplorer.h new file mode 100644 index 000000000..761009005 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moILSexplorer.h @@ -0,0 +1,179 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moILSexplorer_h +#define _moILSexplorer_h + +#include +#include +#include +#include +#include +#include +//#include +//#include + +/** + * Explorer for an Iterated Local Search + */ + +//template< class Neighbor > +//class moILSexplorer : public moNeighborhoodExplorer< moDummyNeighbor > + +template< class Neighbor, class NeighborLO > +class moILSexplorer : public moNeighborhoodExplorer< NeighborLO > +{ +public: + typedef moNeighborhood Neighborhood ; + typedef typename Neighbor::EOT EOT; + typedef moNeighborhood NeighborhoodLO; + + //typedef moDummyNeighbor dummyNeighbor; + //typedef moDummyNeighborhood dummyNeighborhood; + + /** + * Constructor + * @param _ls a local search + * @param _perturb a perturbation operator + * @param _acceptCrit a acceptance criteria + */ + moILSexplorer(moLocalSearch& _ls, moPerturbation& _perturb, moAcceptanceCriterion& _acceptCrit) : moNeighborhoodExplorer(), ls(_ls), perturb(_perturb), acceptCrit(_acceptCrit) { + firstIteration=true; + } + + /** + * Destructor + */ + ~moILSexplorer() { + + } + + /** + * Init perturbation and acceptance criteria + * @param _solution the current solution + */ + virtual void initParam(EOT & _solution) { + firstIteration=true; + perturb.init(_solution); + acceptCrit.init(_solution); + }; + + /** + * Update perturbation and acceptance criteria + * @param _solution the current solution + */ + virtual void updateParam(EOT & _solution) { + if ((*this).moveApplied()) { + perturb.add(_solution,emptyNeighbor); + acceptCrit.add(_solution,emptyNeighbor); + } + perturb.update(_solution, emptyNeighbor); + acceptCrit.update(_solution, emptyNeighbor); + }; + + /** + * terminate: NOTHING TO DO + * @param _solution a solution (unused) + */ + virtual void terminate(EOT & _solution) {}; + + /** + * Perturb and apply local search on a solution + * @param _solution the solution + */ + virtual void operator()(EOT & _solution) { + //copy the solution to perform new local search + currentSol=_solution; + + //perturb solution exept at the first iteration + if (!firstIteration) { + perturb(currentSol); + } + else + firstIteration=false; + + //apply the local search on the copy + ls(currentSol); + +// std::cout << "(solution)\t" << current << std::endl; + + }; + + /** + * Always continue + * @param _solution the solution + * @return always true + */ + virtual bool isContinue(EOT & _solution) { + return true; + }; + + /** + * copy the solution found by the local search + * @param _solution the solution + */ + virtual void move(EOT & _solution) { + _solution=currentSol; + }; + + /** + * accept test if an ameliorated neighbor was found + * @param _solution the solution + * @return true if acceptance criteria is verified + */ + virtual bool accept(EOT & _solution) { + return acceptCrit(_solution, currentSol); + }; + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moILSexplorer"; + } + +private: + //Usefull to use the momory of tabuSearch + Neighbor emptyNeighbor; + EOT currentSol; + moLocalSearch& ls; + moPerturbation & perturb; + moAcceptanceCriterion& acceptCrit; + + bool firstIteration; +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moMetropolisHastingExplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moMetropolisHastingExplorer.h new file mode 100644 index 000000000..3123c4914 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moMetropolisHastingExplorer.h @@ -0,0 +1,180 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moMetropolisHastingExplorer_h +#define _moMetropolisHastingExplorer_h + +#include + +#include +#include +#include +#include + +#include + +/** + * Explorer for the Metropolis-Hasting Sampling. + * Only the symetric case is considered when Q(x,y) = Q(y,x) + * Fitness must be > 0 + */ +template< class Neighbor > +class moMetropolisHastingExplorer : public moNeighborhoodExplorer +{ +public: + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; + + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::selectedNeighbor; + + /** + * Constructor + * @param _neighborhood the neighborhood + * @param _eval the evaluation function + * @param _neighborComparator a neighbor comparator + * @param _solNeighborComparator a solution vs neighbor comparator + * @param _nbStep maximum number of step to do + */ + moMetropolisHastingExplorer(Neighborhood& _neighborhood, moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator, unsigned int _nbStep) : moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator), nbStep(_nbStep) { + isAccept = false; + if (!neighborhood.isRandom()) { + std::cout << "moMetropolisHastingExplorer::Warning -> the neighborhood used is not random" << std::endl; + } + } + + /** + * Destructor + */ + ~moMetropolisHastingExplorer() { + } + + /** + * initialization of the number of step to be done + * @param _solution unused solution + */ + virtual void initParam(EOT & _solution) { + step = 0; + isAccept = true; + }; + + /** + * increase the number of step + * @param _solution unused solution + */ + virtual void updateParam(EOT & _solution) { + step++; + }; + + /** + * terminate: NOTHING TO DO + * @param _solution unused solution + */ + virtual void terminate(EOT & _solution) {}; + + /** + * Explore the neighborhood of a solution + * @param _solution + */ + virtual void operator()(EOT & _solution) { + //Test if _solution has a Neighbor + if (neighborhood.hasNeighbor(_solution)) { + //init the first neighbor + neighborhood.init(_solution, selectedNeighbor); + + //eval the _solution moved with the neighbor and stock the result in the neighbor + eval(_solution, selectedNeighbor); + } + else { + //if _solution hasn't neighbor, + isAccept=false; + } + }; + + /** + * continue if there is a neighbor and it is remainds some steps to do + * @param _solution the solution + * @return true there is some steps to do + */ + virtual bool isContinue(EOT & _solution) { + return (step < nbStep) ; + }; + + /** + * accept test if an ameliorated neighbor was found + * @param _solution the solution + * @return true if the best neighbor ameliorate the fitness + */ + virtual bool accept(EOT & _solution) { + double alpha=0.0; + if (neighborhood.hasNeighbor(_solution)) { + if (solNeighborComparator(_solution, selectedNeighbor)) + isAccept = true; + else { + if (_solution.fitness() != 0) { + if ( (double)selectedNeighbor.fitness() < (double)_solution.fitness()) // maximizing + alpha = (double) selectedNeighbor.fitness() / (double) _solution.fitness(); + else //minimizing + alpha = (double) _solution.fitness() / (double) selectedNeighbor.fitness(); + isAccept = (rng.uniform() < alpha) ; + } + else { + if ( (double) selectedNeighbor.fitness() < (double) _solution.fitness()) // maximizing + isAccept = true; + else + isAccept = false; + } + } + } + return isAccept; + }; + +private: + // comparator betwenn solution and neighbor or between neighbors + moNeighborComparator& neighborComparator; + moSolNeighborComparator& solNeighborComparator; + + // current number of step + unsigned int step; + + // maximum number of steps to do + unsigned int nbStep; + + // true if the move is accepted + bool isAccept ; +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moNeighborhoodExplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moNeighborhoodExplorer.h new file mode 100644 index 000000000..8b4113b7a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moNeighborhoodExplorer.h @@ -0,0 +1,178 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _neighborhoodExplorer_h +#define _neighborhoodExplorer_h + +//EO inclusion +#include + +#include +#include +#include +#include + +/** + * Explore the neighborhood according to the local search algorithm + * + * During this exploration, + * the parameters are updated + * one neighbor is selected + * a comparason with the solution is made to acccept or not this new neighbor + * + * The current neighbor (currentNeigbor) is the neighbor under consideration during the search (in operator()(EOT &)) + * + * The selected neighbor (selectedNeighbor) is the neighbor selected in method operator()(EOT &). + * If this neighbor is accepted, then the solution is moved on this neighbor (in move(EOT &)) + * + */ +template< class Neighbor > +class moNeighborhoodExplorer : public eoUF +{ +public: + typedef moNeighborhood Neighborhood; + typedef typename Neighbor::EOT EOT; + typedef typename EOT::Fitness Fitness ; + + moNeighborhoodExplorer():neighborhood(dummyNeighborhood), eval(dummyEval), isMoved(false) {} + + /** + * Constructor with a Neighborhood and evaluation function + * @param _neighborhood the neighborhood + * @param _eval the evaluation function + */ + moNeighborhoodExplorer(Neighborhood& _neighborhood, moEval& _eval):neighborhood(_neighborhood), eval(_eval), isMoved(false) {} + + /** + * Init Search parameters + * @param _solution the solution to explore + */ + virtual void initParam (EOT& _solution) = 0 ; + + /** + * Update Search parameters + * @param _solution the solution to explore + */ + virtual void updateParam (EOT& _solution) = 0 ; + + /** + * Test if the exploration continue or not + * @param _solution the solution to explore + * @return true if the exploration continue, else return false + */ + virtual bool isContinue(EOT& _solution) = 0 ; + + /** + * Move a solution on the selected neighbor + * This method can be re-defined according to the metaheuritic + * + * @param _solution the solution to explore + */ + virtual void move(EOT& _solution) { + // move the solution + selectedNeighbor.move(_solution); + + // update the fitness + _solution.fitness(selectedNeighbor.fitness()); + } + + /** + * Test if a solution is accepted + * @param _solution the solution to explore + * @return true if the solution is accepted, else return false + */ + virtual bool accept(EOT& _solution) = 0 ; + + /** + * Terminate the search + * @param _solution the solution to explore + */ + virtual void terminate(EOT& _solution) = 0 ; + + /** + * Getter of "isMoved" + * @return true if move is applied + */ + bool moveApplied() { + return isMoved; + } + + /** + * Setter of "isMoved" + * @param _isMoved + */ + void moveApplied(bool _isMoved) { + isMoved=_isMoved; + } + + /** + * Getter of the current neighbor + * @return current neighbor + */ + Neighbor & getCurrentNeighbor() { + return currentNeighbor; + } + + /** + * Getter of the selected neighbor + * @return selected neighbor + */ + Neighbor & getSelectedNeighbor() { + return selectedNeighbor; + } + +protected: + // default class for the empty constructor + moDummyNeighborhood dummyNeighborhood; + + // default class for the empty constructor + moDummyEval dummyEval; + + // the neighborhood which is explored + Neighborhood & neighborhood; + + // evaluation of a neighbor + moEval& eval; + + // flag : true a the neighbor is accepted and the movement is made + bool isMoved; + + // the current neighbor of the exploration : common features of algorithm + Neighbor currentNeighbor; + + // the selected neighbor after the exploration of the neighborhood + Neighbor selectedNeighbor; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moNeutralHCexplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moNeutralHCexplorer.h new file mode 100644 index 000000000..40443de40 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moNeutralHCexplorer.h @@ -0,0 +1,133 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moNeutralHCexplorer_h +#define _moNeutralHCexplorer_h + +#include +#include +#include +#include + +/** + * Explorer for a neutral Hill-climbing + */ +template< class Neighbor > +class moNeutralHCexplorer : public moRandomBestHCexplorer +{ +public: + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; + + using moNeighborhoodExplorer::neighborhood; + using moRandomBestHCexplorer::solNeighborComparator; + using moRandomBestHCexplorer::isAccept; + using moRandomBestHCexplorer::bestVector; + using moRandomBestHCexplorer::initParam; + using moRandomBestHCexplorer::updateParam; + + /** + * Constructor + * @param _neighborhood the neighborhood + * @param _eval the evaluation function + * @param _neighborComparator a neighbor comparator + * @param _solNeighborComparator a solution vs neighbor comparator + * @param _nbStep maximum step to do + */ + moNeutralHCexplorer(Neighborhood& _neighborhood, + moEval& _eval, + moNeighborComparator& _neighborComparator, + moSolNeighborComparator& _solNeighborComparator, + unsigned _nbStep) : + moRandomBestHCexplorer(_neighborhood, _eval, _neighborComparator, _solNeighborComparator),nbStep(_nbStep) { + //Some cycle is possible with equals fitness solutions if the neighborhood is not random + } + + /** + * Destructor + */ + ~moNeutralHCexplorer() { + } + + /** + * initial number of step + * @param _solution the current solution + */ + virtual void initParam(EOT & _solution) { + moRandomBestHCexplorer::initParam(_solution); + + step = 0; + }; + + /** + * one more step + * @param _solution the current solution + */ + virtual void updateParam(EOT & _solution) { + moRandomBestHCexplorer::updateParam(_solution); + + step++; + }; + + /** + * continue if there is a neighbor and it is remains some steps to do + * @param _solution the solution + * @return true there is some steps to do + */ + virtual bool isContinue(EOT & _solution) { + return (step < nbStep) && isAccept ; + }; + + /** + * accept test if an ameliorated or an equal neighbor was be found + * @param _solution the solution + * @return true if the best neighbor ameliorate the fitness or is equals + */ + virtual bool accept(EOT & _solution) { + if (neighborhood.hasNeighbor(_solution)) + isAccept = solNeighborComparator(_solution, bestVector[0]) || solNeighborComparator.equals(_solution, bestVector[0]) ; + return isAccept; + }; + +private: + // current number of step + unsigned int step; + + // maximum number of steps to do + unsigned int nbStep; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moRandomBestHCexplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moRandomBestHCexplorer.h new file mode 100644 index 000000000..d5e12f087 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moRandomBestHCexplorer.h @@ -0,0 +1,204 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 _moRandomBestHCexplorer_h +#define _moRandomBestHCexplorer_h + +#include +#include +#include +#include +#include +#include + +/** + * Explorer for Hill-Climbing + * which choose randomly one of the best solution in the neighborhood at each iteration + */ +template< class Neighbor > +class moRandomBestHCexplorer : public moNeighborhoodExplorer +{ +public: + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; + + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::currentNeighbor; + using moNeighborhoodExplorer::selectedNeighbor; + + /** + * Constructor + * @param _neighborhood the neighborhood + * @param _eval the evaluation function + * @param _neighborComparator a neighbor comparator + * @param _solNeighborComparator solution vs neighbor comparator + */ + moRandomBestHCexplorer(Neighborhood& _neighborhood, + moEval& _eval, + moNeighborComparator& _neighborComparator, + moSolNeighborComparator& _solNeighborComparator) : + moNeighborhoodExplorer(_neighborhood, _eval), + neighborComparator(_neighborComparator), + solNeighborComparator(_solNeighborComparator) { + isAccept = false; + } + + /** + * Destructor + */ + ~moRandomBestHCexplorer() { + } + + /** + * empty the vector of best solutions + * @param _solution unused solution + */ + virtual void initParam(EOT & _solution) { + // delete all the best solutions + bestVector.clear(); + }; + + /** + * empty the vector of best solutions + * @param _solution unused solution + */ + virtual void updateParam(EOT & _solution) { + // delete all the best solutions + bestVector.clear(); + }; + + /** + * terminate: NOTHING TO DO + * @param _solution unused solution + */ + virtual void terminate(EOT & _solution) {}; + + /** + * Explore the neighborhood of a solution + * @param _solution the current solution + */ + virtual void operator()(EOT & _solution) { + + //Test if _solution has a Neighbor + if (neighborhood.hasNeighbor(_solution)) { + //init the first neighbor + neighborhood.init(_solution, currentNeighbor); + + //eval the _solution moved with the neighbor and stock the result in the neighbor + eval(_solution, currentNeighbor); + + //initialize the best neighbor + bestVector.push_back(currentNeighbor); + + //test all others neighbors + while (neighborhood.cont(_solution)) { + //next neighbor + neighborhood.next(_solution, currentNeighbor); + + //eval + eval(_solution, currentNeighbor); + + //if we found a better neighbor, update the best + if (neighborComparator(bestVector[0], currentNeighbor)) { + bestVector.clear(); + bestVector.push_back(currentNeighbor); + } + else if (neighborComparator.equals(currentNeighbor, bestVector[0])) //if the current is equals to previous best solutions then update vector of the best solution + bestVector.push_back(currentNeighbor); + } + + // choose randomly one of the best solutions + unsigned int i = rng.random(bestVector.size()); + + // the selected Neighbor + selectedNeighbor = bestVector[i]; + } + else { + //if _solution hasn't neighbor, + isAccept=false; + } + }; + + /** + * continue if a move is accepted + * @param _solution the solution + * @return true if an ameliorated neighbor was be found + */ + virtual bool isContinue(EOT & _solution) { + return isAccept ; + }; + + /** + * move the solution with the best neighbor + * @param _solution the solution to move + */ + /* + virtual void move(EOT & _solution) { + // choose randomly one of the best solutions + unsigned int i = rng.random(bestVector.size()); + + //move the solution + bestVector[i].move(_solution); + + //update its fitness + _solution.fitness(bestVector[i].fitness()); + }; + */ + + /** + * accept test if an amelirated neighbor was found + * @param _solution the solution + * @return true if the best neighbor ameliorate the fitness + */ + virtual bool accept(EOT & _solution) { + if (neighborhood.hasNeighbor(_solution)) + isAccept = solNeighborComparator(_solution, selectedNeighbor) ; + return isAccept; + }; + +protected: + // comparator betwenn solution and neighbor or between neighbors + moNeighborComparator& neighborComparator; + moSolNeighborComparator& solNeighborComparator; + + // the best solutions in the neighborhood + std::vector bestVector; + + // true if the move is accepted + bool isAccept ; +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moRandomNeutralWalkExplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moRandomNeutralWalkExplorer.h new file mode 100644 index 000000000..6db9ad32b --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moRandomNeutralWalkExplorer.h @@ -0,0 +1,175 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moRandomNeutralWalkexplorer_h +#define _moRandomNeutralWalkexplorer_h + +#include +#include +#include + +/** + * Explorer for a random neutral walk + * accept the movement when the neighbor has the same fitnes + * To sample the neutral networks by random walk, there is no memory + * neighborhood must be explored in random order + */ +template< class Neighbor > +class moRandomNeutralWalkExplorer : public moNeighborhoodExplorer +{ +public: + typedef typename Neighbor::EOT EOT; + typedef moNeighborhood Neighborhood; + + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::currentNeighbor; + using moNeighborhoodExplorer::selectedNeighbor; + + /** + * Constructor + * @param _neighborhood the neighborhood + * @param _eval the evaluation function + * @param _solNeighborComparator a solution vs neighbor comparator + * @param _nbStep maximum number of step to do + */ + moRandomNeutralWalkExplorer(Neighborhood& _neighborhood, + moEval& _eval, + moSolNeighborComparator& _solNeighborComparator, + unsigned _nbStep): + moNeighborhoodExplorer(_neighborhood, _eval), + solNeighborComparator(_solNeighborComparator), + nbStep(_nbStep) { + isAccept = false; + if (!neighborhood.isRandom()) { + std::cout << "moRandomNeutralWalkExplorer::Warning -> the neighborhood used is not random" << std::endl; + } + } + + /** + * Destructor + */ + ~moRandomNeutralWalkExplorer() { + } + + /** + * initialization of the number of step to be done + * @param _solution unused solution + */ + virtual void initParam(EOT & _solution) { + step = 0; + isAccept = true; + }; + + /** + * increase the number of step + * @param _solution unused solution + */ + virtual void updateParam(EOT & _solution) { + step++; + }; + + /** + * terminate: NOTHING TO DO + * @param _solution unused solution + */ + virtual void terminate(EOT & _solution) {}; + + /** + * Explore the neighborhood of a solution + * @param _solution + */ + virtual void operator()(EOT & _solution) { + + //Test if _solution has a Neighbor + if (neighborhood.hasNeighbor(_solution)) { + //init the first neighbor + neighborhood.init(_solution, currentNeighbor); + + //eval the _solution moved with the neighbor and stock the result in the neighbor + eval(_solution, currentNeighbor); + + //test all others neighbors + while (! solNeighborComparator.equals(_solution, currentNeighbor) && neighborhood.cont(_solution)) { + //next neighbor + neighborhood.next(_solution, currentNeighbor); + //eval + eval(_solution, currentNeighbor); + } + + // the selected neighbor + selectedNeighbor = currentNeighbor; + } + else { + //if _solution hasn't neighbor, + isAccept=false; + } + }; + + /** + * continue if there is a neighbor and it is remains some steps to do + * @param _solution the solution + * @return true there is some steps to do + */ + virtual bool isContinue(EOT & _solution) { + return (step < nbStep) && isAccept ; + }; + + /** + * accept test if an equals neighbor was be found + * @param _solution the solution + * @return true if the best neighbor ameliorate the fitness + */ + virtual bool accept(EOT & _solution) { + if (neighborhood.hasNeighbor(_solution)) + isAccept = solNeighborComparator.equals(_solution, selectedNeighbor) ; + return isAccept; + }; + +private: + // comparator betwenn solution and neighbor or between neighbors + moSolNeighborComparator& solNeighborComparator; + + // current number of step + unsigned int step; + + // maximum number of steps to do + unsigned int nbStep; + + // true if the move is accepted + bool isAccept ; +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moRandomSearchExplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moRandomSearchExplorer.h new file mode 100644 index 000000000..0b09da1d9 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moRandomSearchExplorer.h @@ -0,0 +1,150 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moRandomSearchexplorer_h +#define _moRandomSearchexplorer_h + +#include +#include +#include +#include + +/** + * Explorer for a pure random search: + * the solution is initialized at each step + */ +template< class Neighbor > +class moRandomSearchExplorer : public moNeighborhoodExplorer +{ +public: + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; + + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; + + /** + * Constructor + * @param _init the solution initializer, to explore at random the search space + * @param _fulleval the evaluation function + * @param _nbStep maximum number of step to do + */ + moRandomSearchExplorer(eoInit& _init, eoEvalFunc& _fulleval, unsigned _nbStep) : moNeighborhoodExplorer(), init(_init), fulleval(_fulleval), nbStep(_nbStep) { + // number of step done + step = 0; + } + + /** + * Destructor + */ + ~moRandomSearchExplorer() {} + + /** + * initialization of the number of step to be done + * @param _solution unused solution + */ + virtual void initParam(EOT & _solution) { + step = 0; + }; + + /** + * increase the number of step + * @param _solution unused solution + */ + virtual void updateParam(EOT & _solution) { + step++; + }; + + /** + * terminate: NOTHING TO DO + * @param _solution unused solution + */ + virtual void terminate(EOT & _solution) {}; + + /** + * Explore the neighborhood with only one random solution + * we supposed that the first neighbor is uniformly selected in the neighborhood + * @param _solution + */ + virtual void operator()(EOT & _solution) { + //init the first neighbor + init(_solution); + + //eval the _solution moved with the neighbor and stock the result in the neighbor + if (_solution.invalid()) + fulleval(_solution); + }; + + /** + * continue if it is remains some steps to do + * @param _solution the solution + * @return true there is some steps to do + */ + virtual bool isContinue(EOT & _solution) { + return (step < nbStep) ; + }; + + /** + * move the solution with the best neighbor + * @param _solution the solution to move + */ + virtual void move(EOT & _solution) { + // the solution is already move. So nothing to do ! + }; + + /** + * accept test : always accept + * @param _solution the solution + * @return true if the best neighbor ameliorate the fitness + */ + virtual bool accept(EOT & _solution) { + return true; + }; + +private: + // initialization method to explore at random the search space + eoInit & init; + + // the full eval function + eoEvalFunc & fulleval; + + // current number of step + unsigned int step; + + // maximum number of steps to do + unsigned int nbStep; +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moRandomWalkExplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moRandomWalkExplorer.h new file mode 100644 index 000000000..5f4de7eef --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moRandomWalkExplorer.h @@ -0,0 +1,151 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moRandomWalkexplorer_h +#define _moRandomWalkexplorer_h + +#include +#include +#include +#include + +/** + * Explorer for a random walk + * + * Choose at each step a random neighbor's solution + * So the neighborhood have to be "random" + * + * The number of steps of the walk is not limited in the explorer + */ +template< class Neighbor > +class moRandomWalkExplorer : public moNeighborhoodExplorer +{ +public: + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; + + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::currentNeighbor; + using moNeighborhoodExplorer::selectedNeighbor; + + /** + * Constructor + * @param _neighborhood the neighborhood (which have to be random) + * @param _eval the evaluation function + */ + moRandomWalkExplorer(Neighborhood& _neighborhood, moEval& _eval) : moNeighborhoodExplorer(_neighborhood, _eval) { + isAccept = false; + if (!neighborhood.isRandom()) { + std::cout << "moRandomWalkExplorer::Warning -> the neighborhood used is not random" << std::endl; + } + } + + /** + * Destructor + */ + ~moRandomWalkExplorer() { + } + + /** + * initialization of the number of step to be done + * @param _solution unused solution + */ + virtual void initParam(EOT & _solution) { + isAccept = true; + }; + + /** + * increase the number of step + * @param _solution unused solution + */ + virtual void updateParam(EOT & _solution) { + }; + + /** + * terminate: NOTHING TO DO + * @param _solution unused solution + */ + virtual void terminate(EOT & _solution) {}; + + /** + * Explore the neighborhood with only one random solution + * we supposed that the first neighbor is uniformly selected in the neighborhood + * @param _solution a solution + */ + virtual void operator()(EOT & _solution) { + + //Test if _solution has a Neighbor + if (neighborhood.hasNeighbor(_solution)) { + //init the first neighbor + neighborhood.init(_solution, selectedNeighbor); + + //eval the _solution moved with the neighbor and stock the result in the neighbor + eval(_solution, selectedNeighbor); + + isAccept = true; + } + else { + //if _solution hasn't neighbor, + isAccept=false; + } + }; + + /** + * continue if there is a neighbor and it is remains some steps to do + * @param _solution the solution + * @return true there is some steps to do + */ + virtual bool isContinue(EOT & _solution) { + return isAccept ; + }; + + /** + * accept test if an amelirated neighbor was be found + * @param _solution the solution + * @return true if the best neighbor ameliorate the fitness + */ + virtual bool accept(EOT & _solution) { + if (neighborhood.hasNeighbor(_solution)) + isAccept = true ; + return isAccept; + }; + +private: + // true if the move is accepted + bool isAccept ; +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moSAexplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moSAexplorer.h new file mode 100644 index 000000000..3d9f477ee --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moSAexplorer.h @@ -0,0 +1,182 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moSAexplorer_h +#define _moSAexplorer_h + +#include + +#include +#include +#include +#include + +#include + +/** + * Explorer for the Simulated Annealing + * Only the symetric case is considered when Q(x,y) = Q(y,x) + * Fitness must be > 0 + * + */ +template< class Neighbor > +class moSAexplorer : public moNeighborhoodExplorer +{ +public: + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; + + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::selectedNeighbor; + + /** + * Constructor + * @param _neighborhood the neighborhood + * @param _eval the evaluation function + * @param _solNeighborComparator a solution vs neighbor comparator + * @param _coolingSchedule the cooling schedule + */ + moSAexplorer(Neighborhood& _neighborhood, moEval& _eval, moSolNeighborComparator& _solNeighborComparator, moCoolingSchedule& _coolingSchedule) : moNeighborhoodExplorer(_neighborhood, _eval), solNeighborComparator(_solNeighborComparator), coolingSchedule(_coolingSchedule) { + isAccept = false; + + if (!neighborhood.isRandom()) { + std::cout << "moSAexplorer::Warning -> the neighborhood used is not random" << std::endl; + } + } + + /** + * Destructor + */ + ~moSAexplorer() { + } + + /** + * initialization of the initial temperature + * @param _solution the solution + */ + virtual void initParam(EOT & _solution) { + temperature = coolingSchedule.init(_solution); + isAccept = false; + }; + + /** + * decrease the temperature if necessary + * @param _solution unused solution + */ + virtual void updateParam(EOT & _solution) { + coolingSchedule.update(temperature, this->moveApplied()); + }; + + /** + * terminate: NOTHING TO DO + * @param _solution unused solution + */ + virtual void terminate(EOT & _solution) {}; + + /** + * Explore one random solution in the neighborhood + * @param _solution the solution + */ + virtual void operator()(EOT & _solution) { + //Test if _solution has a Neighbor + if (neighborhood.hasNeighbor(_solution)) { + //init on the first neighbor: supposed to be random solution in the neighborhood + neighborhood.init(_solution, selectedNeighbor); + + //eval the _solution moved with the neighbor and stock the result in the neighbor + eval(_solution, selectedNeighbor); + } + else { + //if _solution hasn't neighbor, + isAccept=false; + } + }; + + /** + * continue if the temperature is not too low + * @param _solution the solution + * @return true if the criteria from the cooling schedule is true + */ + virtual bool isContinue(EOT & _solution) { + return coolingSchedule(temperature); + }; + + /** + * acceptance criterion according to the boltzmann criterion + * @param _solution the solution + * @return true if better neighbor or rnd < exp(delta f / T) + */ + virtual bool accept(EOT & _solution) { + if (neighborhood.hasNeighbor(_solution)) { + if (solNeighborComparator(_solution, selectedNeighbor)) // accept if the current neighbor is better than the solution + isAccept = true; + else { + double alpha=0.0; + double fit1, fit2; + fit1=(double)selectedNeighbor.fitness(); + fit2=(double)_solution.fitness(); + if (fit1 < fit2) // this is a maximization + alpha = exp((fit1 - fit2) / temperature ); + else // this is a minimization + alpha = exp((fit2 - fit1) / temperature ); + isAccept = (rng.uniform() < alpha) ; + } + } + return isAccept; + }; + + /** + * Getter + * @return the temperature + */ + double getTemperature() { + return temperature; + } + +private: + // comparator betwenn solution and neighbor + moSolNeighborComparator& solNeighborComparator; + + moCoolingSchedule& coolingSchedule; + + // temperatur of the process + double temperature; + + // true if the move is accepted + bool isAccept ; +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moSimpleHCexplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moSimpleHCexplorer.h new file mode 100644 index 000000000..573881d2f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moSimpleHCexplorer.h @@ -0,0 +1,167 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moSimpleHCexplorer_h +#define _moSimpleHCexplorer_h + +#include +#include +#include +#include + +/** + * Explorer for a simple Hill-climbing + */ +template< class Neighbor > +class moSimpleHCexplorer : public moNeighborhoodExplorer +{ +public: + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; + + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::currentNeighbor; + using moNeighborhoodExplorer::selectedNeighbor; + + /** + * Constructor + * @param _neighborhood the neighborhood + * @param _eval the evaluation function + * @param _neighborComparator a neighbor comparator + * @param _solNeighborComparator solution vs neighbor comparator + */ + moSimpleHCexplorer(Neighborhood& _neighborhood, moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator) : moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) { + isAccept = false; + } + + /** + * Destructor + */ + ~moSimpleHCexplorer() { + } + + /** + * initParam: NOTHING TO DO + * @param _solution unused solution + */ + virtual void initParam(EOT & _solution) {}; + + /** + * updateParam: NOTHING TO DO + * @param _solution unused solution + */ + virtual void updateParam(EOT & _solution) {}; + + /** + * terminate: NOTHING TO DO + * @param _solution unused solution + */ + virtual void terminate(EOT & _solution) {}; + + /** + * Explore the neighborhood of a solution + * @param _solution the current solution + */ + virtual void operator()(EOT & _solution) { + //Test if _solution has a Neighbor + if (neighborhood.hasNeighbor(_solution)) { + //init the first neighbor + neighborhood.init(_solution, currentNeighbor); + + //eval the _solution moved with the neighbor and stock the result in the neighbor + eval(_solution, currentNeighbor); + + //initialize the best neighbor + selectedNeighbor = currentNeighbor; + + //test all others neighbors + while (neighborhood.cont(_solution)) { + //next neighbor + neighborhood.next(_solution, currentNeighbor); + //eval + eval(_solution, currentNeighbor); + //if we found a better neighbor, update the best + if (neighborComparator(selectedNeighbor, currentNeighbor)) { + selectedNeighbor = currentNeighbor; + } + } + + } + else { + //if _solution hasn't neighbor, + isAccept=false; + } + }; + + /** + * continue if a move is accepted + * @param _solution the solution + * @return true if an ameliorated neighbor was be found + */ + virtual bool isContinue(EOT & _solution) { + return isAccept ; + }; + + /** + * accept test if an amelirated neighbor was be found + * @param _solution the solution + * @return true if the best neighbor ameliorate the fitness + */ + virtual bool accept(EOT & _solution) { + if (neighborhood.hasNeighbor(_solution)) { + isAccept = solNeighborComparator(_solution, selectedNeighbor) ; + } + return isAccept; + }; + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moSimpleHCexplorer"; + } + +private: + // comparator betwenn solution and neighbor or between neighbors + moNeighborComparator& neighborComparator; + moSolNeighborComparator& solNeighborComparator; + + // true if the move is accepted + bool isAccept ; +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moTSexplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moTSexplorer.h new file mode 100644 index 000000000..062af93cc --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moTSexplorer.h @@ -0,0 +1,247 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moTSexplorer_h +#define _moTSexplorer_h + +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * Explorer for a Tabu Search + */ +template< class Neighbor > +class moTSexplorer : public moNeighborhoodExplorer +{ +public: + typedef typename Neighbor::EOT EOT ; + typedef moNeighborhood Neighborhood ; + + using moNeighborhoodExplorer::currentNeighbor; + using moNeighborhoodExplorer::selectedNeighbor; + + /** + * Constructor + * @param _neighborhood the neighborhood + * @param _eval the evaluation function + * @param _neighborComparator a neighbor comparator + * @param _solNeighborComparator a comparator between a solution and a neighbor + * @param _tabuList the tabu list + * @param _intensification the intensification box + * @param _diversification the diversification box + * @param _aspiration the aspiration criteria + */ + moTSexplorer(Neighborhood& _neighborhood, + moEval& _eval, + moNeighborComparator& _neighborComparator, + moSolNeighborComparator& _solNeighborComparator, + moTabuList & _tabuList, + moIntensification & _intensification, + moDiversification & _diversification, + moAspiration & _aspiration + ) : + moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator), + tabuList(_tabuList), intensification(_intensification), diversification(_diversification), aspiration(_aspiration) + { + isAccept = false; + } + + /** + * Destructor + */ + ~moTSexplorer() { + } + + /** + * init tabu list, intensification box, diversification box and aspiration criteria + * @param _solution + */ + virtual void initParam(EOT& _solution) + { + tabuList.init(_solution); + intensification.init(_solution); + diversification.init(_solution); + aspiration.init(_solution); + bestSoFar=_solution; + }; + + + /** + * update params of tabu list, intensification box, diversification box and aspiration criteria + * @param _solution + */ + virtual void updateParam(EOT& _solution) + { + if ((*this).moveApplied()) { + tabuList.add(_solution, selectedNeighbor); + intensification.add(_solution, selectedNeighbor); + diversification.add(_solution, selectedNeighbor); + if (_solution.fitness() > bestSoFar.fitness()) + bestSoFar = _solution; + } + tabuList.update(_solution, selectedNeighbor); + intensification.update(_solution, selectedNeighbor); + diversification.update(_solution, selectedNeighbor); + aspiration.update(_solution, selectedNeighbor); + }; + + + /** + * terminate : _solution becomes the best so far + */ + virtual void terminate(EOT & _solution) { + _solution= bestSoFar; + }; + + + /** + * Explore the neighborhood of a solution + * @param _solution + */ + virtual void operator()(EOT & _solution) + { + bool found=false; + intensification(_solution); + diversification(_solution); + if (neighborhood.hasNeighbor(_solution)) + { + //init the current neighbor + neighborhood.init(_solution, currentNeighbor); + //eval the current neighbor + eval(_solution, currentNeighbor); + + //Find the first non-tabu element + if ( (!tabuList.check(_solution, currentNeighbor)) || aspiration(_solution, currentNeighbor) ) { + // set selectedNeighbor + selectedNeighbor = currentNeighbor; + found=true; + } + while (neighborhood.cont(_solution) && !found) { + //next neighbor + neighborhood.next(_solution, currentNeighbor); + //eval + eval(_solution, currentNeighbor); + + if ( (!tabuList.check(_solution, currentNeighbor)) || aspiration(_solution, currentNeighbor) ) { + // set selectedNeighbor + selectedNeighbor = currentNeighbor; + found=true; + } + } + //Explore the neighborhood + if (found) { + isAccept=true; + while (neighborhood.cont(_solution)) { + //next neighbor + neighborhood.next(_solution, currentNeighbor); + //eval + eval(_solution, currentNeighbor); + //check if the current is better than the best and is not tabu or if it is aspirat (by the aspiration criteria of course) + if ( (!tabuList.check(_solution, currentNeighbor) || aspiration(_solution, currentNeighbor)) && neighborComparator(selectedNeighbor, currentNeighbor)) { + // set selectedNeighbor + selectedNeighbor = currentNeighbor; + } + } + } + else { + isAccept=false; + } + } + else { + isAccept=false; + } + + }; + + + /** + * always continue + * @param _solution the solution + * @return true + */ + virtual bool isContinue(EOT & _solution) { + return true; + }; + + /** + * accept test if an ameliorated neighbor was found + * @param _solution the solution + * @return true if the best neighbor ameliorate the fitness + */ + virtual bool accept(EOT & _solution) { + return isAccept; + }; + + + /** + * Give the current best found so far + * @return the best solution so far + */ + const EOT& getBest() { + return bestSoFar; + }; + +protected: + + using moNeighborhoodExplorer::neighborhood; + using moNeighborhoodExplorer::eval; + + // comparator between solution and neighbor or between neighbors + moNeighborComparator& neighborComparator; + moSolNeighborComparator& solNeighborComparator; + + // Tabu components + moTabuList & tabuList; + moIntensification & intensification; + moDiversification & diversification; + moAspiration & aspiration; + + // Best neighbor + // Neighbor best; + + //Best so far Solution + EOT bestSoFar; + + // true if the move is accepted + bool isAccept ; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moVNSexplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moVNSexplorer.h new file mode 100644 index 000000000..3c9c2ef27 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/explorer/moVNSexplorer.h @@ -0,0 +1,172 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 _moVNSexplorer_h +#define _moVNSexplorer_h + +#include +#include +#include +#include + +/** + * Explorer for the "Variable Neighborhood Search" metaheuristic + */ +template< class Neighbor> +class moVNSexplorer : public moNeighborhoodExplorer< Neighbor > +{ +public: + + typedef typename Neighbor::EOT EOT; + + /** + * Default constructor + */ + + moVNSexplorer() {} + + /** + * Constructor + * @param _selection selection the "neighborhood" search heuristics during the search + * @param _acceptCrit acceptance criteria which compare and accept or not the two solutions + */ + moVNSexplorer(moVariableNeighborhoodSelection & _selection, + moAcceptanceCriterion& _acceptCrit): + moNeighborhoodExplorer(), selection(_selection), acceptCrit(_acceptCrit), stop(false), first(true) + {} + + /** + * Empty destructor + */ + ~moVNSexplorer() { + } + + /** + * Initialization on the initial search opeartors based on the "first" neighborhood + * @param _solution the current solution + */ + virtual void initParam(EOT& _solution) { + // the best solution found + bestSoFar = _solution; + // initialization of the LS + selection.init(_solution); + // for the first ls, the solution will be improved, so the next ls must be applied + first = true; + } + + /** + * Change the search operators on the next neighborhood search. + * @param _solution the current solution + */ + virtual void updateParam(EOT & _solution) { + if (!first && (*this).moveApplied()) { + first = false; + selection.init(_solution); + } else + if (selection.cont(currentSol)) { + selection.next(_solution); + } else + stop = true; + } + + /** + * terminate: return the best solution found + */ + virtual void terminate(EOT & _solution) { + _solution = bestSoFar; + } + + /** + * Explore the neighborhood of a solution by the "neighborhood" search heuristics + * @param _solution the current solution + */ + virtual void operator()(EOT & _solution) { + eoMonOp & shake = selection.getShake(); + eoMonOp & ls = selection.getLocalSearch(); + + currentSol = _solution; + shake(currentSol); + ls(currentSol); + + // update the best solution found + if (bestSoFar.fitness() < currentSol.fitness()) + bestSoFar = currentSol; + } + + /** + * continue if a move is accepted + * @param _solution the solution + * @return true if an ameliorated neighbor was be found + */ + virtual bool isContinue(EOT & _solution) { + return !stop; + }; + + /** + * move the solution with to current accepted solution + * @param _solution the solution to move + */ + virtual void move(EOT & _solution) { + _solution = currentSol; + }; + + /** + * accept test if an amelirated neighbor was be found according to acceptance criteria + * @param _solution the solution + * @return true if the neighbor ameliorate the fitness + */ + virtual bool accept(EOT & _solution) { + return acceptCrit(_solution, currentSol); + }; + + /** + * Return the class id. + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moVNSexplorer"; + } + +private: + /** the set of LS and shake operators to applied */ + moVariableNeighborhoodSelection& selection; + /** Acceptance criterium between two LS */ + moAcceptanceCriterion& acceptCrit; + /** stopping criterium flag */ + bool stop; + /** the current solution */ + EOT currentSol; + /** Best solution found during the search */ + EOT bestSoFar; + /** first LS flag */ + bool first; +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moAspiration.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moAspiration.h new file mode 100644 index 000000000..7a9e338e0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moAspiration.h @@ -0,0 +1,59 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moAspiration_h +#define _moAspiration_h + +#include + +/** + * Abstract class for Aspiration Criteria + */ +template< class Neighbor > +class moAspiration : public eoBF +{ +public: + typedef typename Neighbor::EOT EOT; + + /** + * Virtual Init + * @param _sol the current solution + */ + virtual void init(EOT & _sol) = 0; + + /** + * Virtual update + * @param _sol the current solution + * @param _neighbor the current neighbor + */ + virtual void update(EOT & _sol, Neighbor & _neighbor) = 0; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moBestImprAspiration.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moBestImprAspiration.h new file mode 100644 index 000000000..7187ef666 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moBestImprAspiration.h @@ -0,0 +1,87 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moBestImprAspiration_h +#define _moBestImprAspiration_h + +#include + +/** + * Aspiration criteria accepts a solution better than the best so far + */ +template< class Neighbor > +class moBestImprAspiration : public moAspiration +{ +public: + + typedef typename Neighbor::EOT EOT; + + /** + * init the best solution + * @param _sol the best solution found + */ + void init(EOT & _sol) { + bestFoundSoFar = _sol; + } + + /** + * update the "bestFoundSoFar" if a best solution is found + * @param _sol a solution + * @param _neighbor a neighbor + */ + void update(EOT & _sol, Neighbor & _neighbor) { + if (bestFoundSoFar.fitness() < _sol.fitness()) + bestFoundSoFar = _sol; + } + + /** + * Test the tabu feature of the neighbor: + * test if the neighbor's fitness is better than the "bestFoundSoFar" fitness + * @param _sol a solution + * @param _neighbor a neighbor + * @return true if _neighbor fitness is better than the "bestFoundSoFar" + */ + bool operator()(EOT & _sol, Neighbor & _neighbor) { + return (bestFoundSoFar.fitness() < _neighbor.fitness()); + } + + /** + * Getter + * @return a reference on the best found so far solution + */ + EOT& getBest() { + return bestFoundSoFar; + } + +private: + EOT bestFoundSoFar; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moCountMoveMemory.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moCountMoveMemory.h new file mode 100644 index 000000000..22cbba5fd --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moCountMoveMemory.h @@ -0,0 +1,119 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moCountMoveMemory_h +#define _moCountMoveMemory_h + +#include + +/** + * Count the number of move, no move and the successive stagnation since the last Move + */ +template< class Neighbor > +class moCountMoveMemory : virtual public moMemory { + +public: + typedef typename Neighbor::EOT EOT; + + /** + * Init all the counters + * @param _sol unused solution + */ + void init(EOT & _sol) { + nbMove=0; + nbNoMove=0; + counter=0; + } + + /** + * @param _sol unused solution + * @param _neighbor unused neighbor + */ + void add(EOT & _sol, Neighbor & _neighbor) { + nbMove++; + counter=0; + } + + /** + * @param _sol unused solution + * @param _neighbor unused neighbor + */ + void update(EOT & _sol, Neighbor & _neighbor) { + nbNoMove++; + counter++; + } + + /** + * ClearMemory : Reinit all the counters + */ + void clearMemory() { + nbMove=0; + nbNoMove=0; + counter=0; + } + + /** + * Getter of the number of move + * @return the counter + */ + unsigned int getNbMove() { + return nbMove; + } + + /** + * Getter of the number of no move + * @return the counter + */ + unsigned int getNbNoMove() { + return nbNoMove; + } + + /** + * Getter of the number of successive stagnation since the last Move + * @return the counter + */ + unsigned int getCounter() { + return counter; + } + + /** + * Init counter + */ + void initCounter() { + counter=0; + } + +private: + unsigned int nbMove; + unsigned int nbNoMove; + unsigned int counter; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moDiversification.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moDiversification.h new file mode 100644 index 000000000..5df67a3fe --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moDiversification.h @@ -0,0 +1,42 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moDiversification_h +#define _moDiversification_h + +#include +#include + +/** + * Abstract class for diversification strategy + */ +template< class Neighbor > +class moDiversification : virtual public moMemory, public eoUF {}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moDummyDiversification.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moDummyDiversification.h new file mode 100644 index 000000000..72cd1f686 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moDummyDiversification.h @@ -0,0 +1,53 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moDummyDiversification_h +#define _moDummyDiversification_h + +#include +#include + +/** + * Dummy diversification strategy + */ +template< class Neighbor > +class moDummyDiversification : public moDiversification, public moDummyMemory +{ +public: + typedef typename Neighbor::EOT EOT; + + /** + * @return always false + */ + bool operator()(EOT &) { + return false; + } +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moDummyIntensification.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moDummyIntensification.h new file mode 100644 index 000000000..d6fd9ef3d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moDummyIntensification.h @@ -0,0 +1,53 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moDummyIntensification_h +#define _moDummyIntensification_h + +#include +#include + +/** + * Dummy intensification strategy + */ +template< class Neighbor > +class moDummyIntensification : public moIntensification, public moDummyMemory +{ +public: + typedef typename Neighbor::EOT EOT; + + /** + * @return always false + */ + bool operator()(EOT &) { + return false; + } +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moDummyMemory.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moDummyMemory.h new file mode 100644 index 000000000..c927a30f0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moDummyMemory.h @@ -0,0 +1,67 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moDummyMemory_h +#define _moDummyMemory_h + +#include + +/** + * Dummy memory to make an empty memory + */ +template< class Neighbor > +class moDummyMemory : virtual public moMemory { + +public: + typedef typename Neighbor::EOT EOT; + + /** + * Init : NOTHIING TO DO + */ + void init(EOT & _sol) {} + + /** + * Add : NOTHIING TO DO + */ + void add(EOT & _sol, Neighbor & _neighbor) {} + + /** + * Update : NOTHIING TO DO + */ + void update(EOT & _sol, Neighbor & _neighbor) {} + + /** + * ClearMemory : NOTHIING TO DO + */ + void clearMemory() {} + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moIndexedVectorTabuList.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moIndexedVectorTabuList.h new file mode 100644 index 000000000..f01e17f1b --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moIndexedVectorTabuList.h @@ -0,0 +1,121 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moIndexedVectorTabuList_h +#define _moIndexedVectorTabuList_h + +#include +#include +#include + +/** + * Tabu List of indexed neighbors save in a vector + * each neighbor can not used during howlong iterations + */ +template +class moIndexedVectorTabuList : public moTabuList +{ +public: + typedef typename Neighbor::EOT EOT; + + /** + * Constructor + * @param _maxSize maximum size of the tabu list + * @param _howlong how many iteration a move is tabu + */ + moIndexedVectorTabuList(unsigned int _maxSize, unsigned int _howlong) : maxSize(_maxSize), howlong(_howlong) { + tabuList.resize(_maxSize); + } + + /** + * init the tabuList by clearing the memory + * @param _sol the current solution + */ + virtual void init(EOT & _sol) { + clearMemory(); + } + + + /** + * add a new neighbor in the tabuList + * @param _sol unused solution + * @param _neighbor the current neighbor + */ + virtual void add(EOT & _sol, Neighbor & _neighbor) { + if (_neighbor.index() < maxSize) + tabuList[_neighbor.index()] = howlong; + } + + /** + * update the tabulist by decreasing the number of tabu iteration + * @param _sol unused solution + * @param _neighbor unused neighbor + */ + virtual void update(EOT & _sol, Neighbor & _neighbor) { + for (unsigned int i = 0; i < maxSize; i++) + if (tabuList[i] > 0) + tabuList[i]--; + } + + /** + * check if the move is tabu + * @param _sol unused solution + * @param _neighbor the current neighbor + * @return true if tabuList contains _sol + */ + virtual bool check(EOT & _sol, Neighbor & _neighbor) { + return (tabuList[_neighbor.index()] > 0); + } + + /** + * clearMemory: remove all solution of the tabuList + */ + virtual void clearMemory() { + for (unsigned int i = 0; i < maxSize; i++) + tabuList[i] = 0; + } + + void print(){ + std::cout << "Tabulist:" << std::endl; + for(int i=0; i tabuList; + //maximum size of the tabu list + unsigned int maxSize; + //how many iteration a move is tabu + unsigned int howlong; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moIntensification.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moIntensification.h new file mode 100644 index 000000000..44d6c1bc3 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moIntensification.h @@ -0,0 +1,42 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moIntensification_h +#define _moIntensification_h + +#include +#include + +/** + * Abstract class for intensification strategy + */ +template< class Neighbor > +class moIntensification : virtual public moMemory, public eoUF {}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moMemory.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moMemory.h new file mode 100644 index 000000000..c45f583af --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moMemory.h @@ -0,0 +1,40 @@ +#ifndef _moMemory_h +#define _moMemory_h + +/** + * Abstract class for different memory + */ +template< class Neighbor > +class moMemory //: public eoObject +{ +public: + typedef typename Neighbor::EOT EOT; + + /** + * Init the memory + * @param _sol the current solution + */ + virtual void init(EOT & _sol) = 0; + + /** + * Add data to the memory + * @param _sol the current solution + * @param _neighbor the current neighbor + */ + virtual void add(EOT & _sol, Neighbor & _neighbor) = 0; + + /** + * update the memory + * @param _sol the current solution + * @param _neighbor the current neighbor + */ + virtual void update(EOT & _sol, Neighbor & _neighbor) = 0; + + /** + * clear the memory + */ + virtual void clearMemory() = 0; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moMonOpDiversification.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moMonOpDiversification.h new file mode 100644 index 000000000..46fa8547b --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moMonOpDiversification.h @@ -0,0 +1,72 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moMonOpDiversification_h +#define _moMonOpDiversification_h + + +#include +#include +#include +#include + +/** + * Diversification strategy applies a "monOp" operator + */ +template< class Neighbor > +class moMonOpDiversification : public moDiversification, public moDummyMemory +{ +public: + typedef typename Neighbor::EOT EOT; + + /** + * Constructor + * @param _monOp an eoMonOp (diversification operator) + * @param _fullEval a full evaluation function + */ + moMonOpDiversification(eoMonOp& _monOp, eoEvalFunc& _fullEval):monOp(_monOp), fullEval(_fullEval) {} + + /** + * Apply monOp on the solution + * @param _solution to diversify + * @return value of monOp + */ + bool operator()(EOT& _solution) { + bool res = monOp(_solution); + fullEval(_solution); + return res; + } + +private: + /** monOp */ + eoMonOp& monOp; + eoEvalFunc& fullEval; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moNeighborVectorTabuList.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moNeighborVectorTabuList.h new file mode 100644 index 000000000..dbf8edb0f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moNeighborVectorTabuList.h @@ -0,0 +1,138 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moNeighborVectorTabuList_h +#define _moNeighborVectorTabuList_h + +#include +#include +#include + +/** + * Tabu List of neighbors stocked in a vector + */ +template +class moNeighborVectorTabuList : public moTabuList +{ +public: + typedef typename Neighbor::EOT EOT; + + /** + * Constructor + * @param _maxSize maximum size of the tabu list + * @param _howlong how many iteration a move is tabu (0 -> no limits) + */ + moNeighborVectorTabuList(unsigned int _maxSize, unsigned int _howlong) : maxSize(_maxSize), howlong(_howlong), index(0) { + tabuList.reserve(_maxSize); + tabuList.resize(0); + } + + /** + * init the tabuList by clearing the memory + * @param _sol the current solution + */ + virtual void init(EOT & _sol) { + clearMemory(); + } + + + /** + * add a new neighbor in the tabuList + * @param _sol unused solution + * @param _neighbor the current neighbor + */ + virtual void add(EOT & _sol, Neighbor & _neighbor) { + + if (tabuList.size() < maxSize) { + std::pair tmp; + tmp.first=_neighbor; + tmp.second=howlong; + tabuList.push_back(tmp); + } + else { + tabuList[index%maxSize].first = _neighbor; + tabuList[index%maxSize].second = howlong; + index++; + } + } + + /** + * update the tabulist + * @param _sol unused solution + * @param _neighbor unused neighbor + */ + virtual void update(EOT & _sol, Neighbor & _neighbor) { + if (howlong > 0) + for (unsigned int i=0; i 0) + tabuList[i].second--; + } + + /** + * check if the move is tabu + * @param _sol unused solution + * @param _neighbor the current neighbor + * @return true if tabuList contains _sol + */ + virtual bool check(EOT & _sol, Neighbor & _neighbor) { + for (unsigned int i=0; i 0 && tabuList[i].second > 0 && tabuList[i].first.equals(_neighbor)) || (howlong==0 && tabuList[i].first.equals(_neighbor))) + return true; + } + return false; + } + + /** + * clearMemory: remove all solution of the tabuList + */ + virtual void clearMemory() { + tabuList.resize(0); + index = 0; + } + + void print(){ + std::cout << "TAbulist:" << std::endl; + for(int i=0; i > tabuList; + //maximum size of the tabu list + unsigned int maxSize; + //how many iteration a move is tabu + unsigned int howlong; + //index on the tabulist + unsigned long index; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moRndIndexedVectorTabuList.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moRndIndexedVectorTabuList.h new file mode 100644 index 000000000..82ffc0e04 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moRndIndexedVectorTabuList.h @@ -0,0 +1,81 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel + + 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 _moRndIndexedVectorTabuList_h +#define _moRndIndexedVectorTabuList_h + +#include +#include + + +/** + * Tabu List of indexed neighbors save in a vector + * each neighbor can not used during howlong + rnd(howlongRnd) iterations + * see paper: + * Zhipeng Lu, Fred Glover, Jin-Kao Hao. "A Hybrid Metaheuristic Approach to Solving the UBQP Problem". European Journal of Operational Research, 2010. + */ +template +class moRndIndexedVectorTabuList : public moIndexedVectorTabuList +{ +public: + typedef typename Neighbor::EOT EOT; + + //tabu list + using moIndexedVectorTabuList::tabuList; + //maximum size of the tabu list + using moIndexedVectorTabuList::maxSize; + //how many iteration a move is tabu + using moIndexedVectorTabuList::howlong; + + /** + * Constructor + * @param _maxSize maximum size of the tabu list + * @param _howlong how many minimal iteration a move is tabu + * @param _howlongRnd how many additional iterations a move is tabu (random between [0 , _howlongRnd [ ) + */ + moRndIndexedVectorTabuList(unsigned int _maxSize, unsigned int _howlong, unsigned int _howlongRnd) : moIndexedVectorTabuList(_maxSize, _howlong), howlongRnd(_howlongRnd) { + } + + /** + * add a new neighbor in the tabuList + * @param _sol unused solution + * @param _neighbor the current neighbor + */ + virtual void add(EOT & _sol, Neighbor & _neighbor) { + if (_neighbor.index() < maxSize) + tabuList[_neighbor.index()] = howlong + rng.uniform(howlongRnd) ; + } + + +protected: + // the random part of the forbidden time + unsigned int howlongRnd; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moSolVectorTabuList.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moSolVectorTabuList.h new file mode 100644 index 000000000..ba72ccc43 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moSolVectorTabuList.h @@ -0,0 +1,134 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moSolVectorTabuList_h +#define _moSolVectorTabuList_h + +#include +#include +#include + +/** + * Tabu List of solution stocked in a vector + */ +template +class moSolVectorTabuList : public moTabuList +{ +public: + typedef typename Neighbor::EOT EOT; + + /** + * Constructor + * @param _maxSize maximum size of the tabu list + * @param _howlong how many iteration a solution is tabu + */ + moSolVectorTabuList(unsigned int _maxSize, unsigned int _howlong) : maxSize(_maxSize), howlong(_howlong) { + tabuList.reserve(_maxSize); + tabuList.resize(0); + } + + /** + * init the tabuList by clearing the memory + * @param _sol the current solution + */ + virtual void init(EOT & _sol) { + clearMemory(); + } + + + /** + * add a new solution in the tabuList + * @param _sol the current solution + * @param _neighbor unused neighbor + */ + virtual void add(EOT & _sol, Neighbor & _neighbor) { + + if (tabuList.size() < maxSize) { + std::pair tmp; + tmp.first=_sol; + tmp.second=howlong; + tabuList.push_back(tmp); + } + else { + tabuList[index%maxSize].first = _sol; + tabuList[index%maxSize].second = howlong; + index++; + } + } + + /** + * update the tabulist: NOTHING TO DO + * @param _sol the current solution + * @param _neighbor the current neighbor (unused) + */ + virtual void update(EOT & _sol, Neighbor & _neighbor) { + if (howlong > 0) + for (unsigned int i=0; i 0) + tabuList[i].second--; + } + + /** + * check if the solution is tabu + * @param _sol the current solution + * @param _neighbor the current neighbor (unused) + * @return true if tabuList contains _sol + */ + virtual bool check(EOT & _sol, Neighbor & _neighbor) { + EOT tmp=_sol; + _neighbor.move(tmp); + for (unsigned int i=0; i 0 && tabuList[i].second > 0 && tabuList[i].first == tmp) || (howlong==0 && tabuList[i].first==tmp)) + return true; + } + return false; + } + + /** + * clearMemory: remove all solution of the tabuList + */ + virtual void clearMemory() { + tabuList.resize(0); + index = 0; + } + + +private: + //tabu list + std::vector< std::pair > tabuList; + //maximum size of the tabu list + unsigned int maxSize; + //how many iteration a move is tabu + unsigned int howlong; + //index on the tabulist + unsigned long index; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moTabuList.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moTabuList.h new file mode 100644 index 000000000..018996e8a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/memory/moTabuList.h @@ -0,0 +1,53 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moTabuList_h +#define _moTabuList_h + +#include + +/** + * Abstract class for the Tabu List + */ +template< class Neighbor > +class moTabuList : public moMemory +{ +public: + typedef typename Neighbor::EOT EOT; + + /** + * Check if a neighbor is tabu or not + * @param _sol the current solution + * @param _neighbor the neighbor + * @return true if the neighbor is tabu + */ + virtual bool check(EOT & _sol, Neighbor & _neighbor) = 0; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/mo b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/mo new file mode 100755 index 000000000..81d1f5305 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/mo @@ -0,0 +1,40 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 __newmo +#define __newmo + +#include "mo.h" + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/mo.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/mo.h new file mode 100755 index 000000000..45913e3de --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/mo.h @@ -0,0 +1,212 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _newmo_h +#define _newmo_h + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moBackableNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moBackableNeighbor.h new file mode 100644 index 000000000..4a851c451 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moBackableNeighbor.h @@ -0,0 +1,56 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _BackableNeighbor_h +#define _BackableNeighbor_h + +#include + +/** + * Neighbor with a move back function to use in a moFullEvalByModif + */ +template< class EOT, class Fitness=typename EOT::Fitness > +class moBackableNeighbor : virtual public moNeighbor +{ +public: + + /** + * the function to move back a solution + * @param _solution the solution to moveBack + */ + virtual void moveBack(EOT & _solution)=0; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moBackwardVectorVNSelection.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moBackwardVectorVNSelection.h new file mode 100644 index 000000000..b3050c439 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moBackwardVectorVNSelection.h @@ -0,0 +1,100 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 _moBackwardVectorVNSelection_h +#define _moBackwardVectorVNSelection_h + +#include + +/** + * This class is used for the Variable Neighborhood Search explorer inherits from moVectorVNSelection + * The search heuristics are saved in vectors + * They are given in backward order from the last ones to the first ones + * + */ +template< class EOT > +class moBackwardVectorVNSelection: public moVectorVNSelection{ + + using moVectorVNSelection::LSvector; + using moVectorVNSelection::current; + +public: + + /** + * Default constructor with first search heuristics + * + * @param _firstLS first local search + * @param _firstShake first heuristic which perturbs the solution + * @param _cycle when true, the first heuristics follows the last ones. Otherwise the search stop. + */ + moBackwardVectorVNSelection(eoMonOp& _firstLS, eoMonOp& _firstShake, bool _cycle = true) : moVectorVNSelection(_firstLS, _firstShake), cycle(_cycle){} + + /** + * Return the class id. + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moBackwardVectorVNSelection"; + } + + /** + * test if there is still some heuristics + * + * @param _solution the current solution + * @return true if there is some heuristics + */ + virtual bool cont(EOT& _solution){ + return (cycle || (current > 0)); + } + + /** + * put the current heuristics on the first ones + * + * @param _solution the current solution + */ + virtual void init(EOT& _solution){ + current = LSvector.size() - 1; + } + + /** + * put the current heuristics on the next ones + * + * @param _solution the current solution + */ + virtual void next(EOT& _solution){ + current = (current + LSvector.size() -1) % LSvector.size(); + } + +private: + // boolean to indicate the last heuristics follow the first ones + bool cycle; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moDummyNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moDummyNeighbor.h new file mode 100644 index 000000000..a8cd01087 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moDummyNeighbor.h @@ -0,0 +1,48 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moDummyNeighbor_h +#define _moDummyNeighbor_h + +#include + +/** + * Dummy Neighborhood + */ +template< class EOT, class Fitness=typename EOT::Fitness > +class moDummyNeighbor : public moNeighbor< EOT, Fitness > { +public: + + /** + * NOTHING TO DO + * @param _solution the related solution + */ + virtual void move(EOT& _solution) {} +}; +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moDummyNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moDummyNeighborhood.h new file mode 100644 index 000000000..26c62163c --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moDummyNeighborhood.h @@ -0,0 +1,78 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moDummyNeighborhood_h +#define _moDummyNeighborhood_h + +#include +#include + +/** + * Dummy Neighborhood + */ +template< class Neighbor > +class moDummyNeighborhood : public moNeighborhood { +public: + typedef typename Neighbor::EOT EOT; + + /** + * NOTHING TO DO + * @param _solution unused solution + * @return always false + */ + virtual bool hasNeighbor(EOT & _solution) { + return false; + } + + /** + * NOTHING TO DO + * @param _solution unused solution + * @param _current unused neighbor + */ + virtual void init(EOT & _solution, Neighbor & _current) {} + + /** + * NOTHING TO DO + * @param _solution unused solution + * @param _current unused neighbor + */ + virtual void next(EOT & _solution, Neighbor & _current) {} + + /** + * NOTHING TO DO + * @param _solution unused solution + * @return always false + */ + virtual bool cont(EOT & _solution) { + return false; + } + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moEvaluatedNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moEvaluatedNeighborhood.h new file mode 100644 index 000000000..52f1f54d8 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moEvaluatedNeighborhood.h @@ -0,0 +1,128 @@ + /* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 _moEvaluatedNeighborhood_h +#define _moEvaluatedNeighborhood_h + +#include +#include + +/** + * A Neighborhood for the evaluation of all neighbors + * in one step + * + * It is usefull for example in a double incremental evaluation (QAP, UBQP problems) + * This class is used in combinaison with the class moNeighborhoodEvaluation + */ +template +class moEvaluatedNeighborhood: public moNeighborhood { +public: + + /** + * Define type of a solution corresponding to Neighbor + */ + typedef typename Neighbor::EOT EOT; + + /** + * Constructor + * @param _originalNeighborhood the original neighborhood to apply + * @param _nhEval the evaluation function of the neighborhood + */ + moEvaluatedNeighborhood(moNeighborhood & _originalNeighborhood, moNeighborhoodEvaluation & _nhEval) : + moNeighborhood(), originalNeighborhood(_originalNeighborhood), nhEval(_nhEval) { + } + + /** + * @return true if the neighborhood is random (default false) + */ + virtual bool isRandom() { + return originalNeighborhood.isRandom(); + } + + /** + * Test if a neighbor exists + * @param _solution the solution to explore + * @return true if the neighborhood was not empty + */ + virtual bool hasNeighbor(EOT& _solution) { + return originalNeighborhood.hasNeighbor(_solution); + } + + /** + * Initialization of the neighborhood with the full evaluation + * + * @param _solution the solution to explore + * @param _neighbor the first neighbor + */ + virtual void init(EOT & _solution, Neighbor & _neighbor) { + // full evaluation of the neighborhood + nhEval(_solution); + // initialisation of the original neighborhood + originalNeighborhood.init(_solution, _neighbor); + } + + /** + * Give the next neighbor with the original neighborhood + * @param _solution the solution to explore + * @param _neighbor the next neighbor + */ + virtual void next(EOT & _solution, Neighbor & _neighbor) { + originalNeighborhood.next(_solution, _neighbor); + } + + /** + * give the continuation with the original neighborhood + * + * @param _solution the solution to explore + * @return true if there is again a neighbor to explore + */ + virtual bool cont(EOT & _solution) { + return originalNeighborhood.cont(_solution); + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moEvaluatedNeighborhood"; + } + +protected: + moNeighborhood & originalNeighborhood; + moNeighborhoodEvaluation & nhEval ; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moForwardVectorVNSelection.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moForwardVectorVNSelection.h new file mode 100644 index 000000000..d7d3546cb --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moForwardVectorVNSelection.h @@ -0,0 +1,100 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 _moForwardVectorVNSelection_h +#define _moForwardVectorVNSelection_h + +#include + +/** + * This class is used for the Variable Neighborhood Search explorer inherits from moVectorVNSelection + * The search heuristics are saved in vectors + * They are given in forward order from the first ones to the last ones + * + */ +template< class EOT > +class moForwardVectorVNSelection: public moVectorVNSelection{ + + using moVectorVNSelection::LSvector; + using moVectorVNSelection::current; + +public: + + /** + * Default constructor with first search heuristics + * + * @param _firstLS first local search + * @param _firstShake first heuristic which perturbs the solution + * @param _cycle when true, the first heuristics follows the last ones. Otherwise the search stop. + */ + moForwardVectorVNSelection(eoMonOp& _firstLS, eoMonOp& _firstShake, bool _cycle = true) : moVectorVNSelection(_firstLS, _firstShake), cycle(_cycle){} + + /** + * Return the class id. + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moForwardVectorVNSelection"; + } + + /** + * test if there is still some heuristics + * + * @param _solution the current solution + * @return true if there is some heuristics + */ + virtual bool cont(EOT& _solution){ + return (cycle || (current <= (LSvector.size() - 2))); + } + + /** + * put the current heuristics on the first ones + * + * @param _solution the current solution + */ + virtual void init(EOT& _solution){ + current = 0; + } + + /** + * put the current heuristics on the next ones + * + * @param _solution the current solution + */ + virtual void next(EOT& _solution){ + current = (current + 1) % LSvector.size(); + } + +private: + // boolean to indicate the first heuristics follow the last ones + bool cycle; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moIndexNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moIndexNeighbor.h new file mode 100644 index 000000000..52c9ea1b0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moIndexNeighbor.h @@ -0,0 +1,115 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _IndexNeighbor_h +#define _IndexNeighbor_h + +#include + +/** + * Index Neighbor + */ +template +class moIndexNeighbor: virtual public moNeighbor { +public: + + using moNeighbor::fitness; + + /** + * Default Constructor + */ + moIndexNeighbor() : + moNeighbor (), key(0) { + } + + /** + * Copy Constructor + * @param _n the neighbor to copy + */ + moIndexNeighbor(const moIndexNeighbor& _n) : + moNeighbor (_n) { + this->key = _n.key; + } + + /** + * Assignment operator + * @param _source the source neighbor + */ + + moIndexNeighbor & operator=(const moIndexNeighbor & _source) { + moNeighbor::operator=(_source); + this->key = _source.key; + return *this; + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moIndexNeighbor"; + } + + /** + * Getter + * @return index of the IndexNeighbor + */ + unsigned int index() { + return key; + } + + /** + * Setter + * @param _key index of the IndexNeighbor + */ + void index(unsigned int _key) { + key = _key; + } + + /** + * @param _neighbor a neighbor + * @return if _neighbor and this one are equals + */ + virtual bool equals(moIndexNeighbor& _neighbor) { + return (key == _neighbor.index()); + } + +protected: + // key allowing to describe the neighbor + unsigned int key; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moIndexNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moIndexNeighborhood.h new file mode 100644 index 000000000..83d06b267 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moIndexNeighborhood.h @@ -0,0 +1,89 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moIndexNeighborhood_h +#define _moIndexNeighborhood_h + +#include + +/** + * A Indexed Neighborhood + */ +template +class moIndexNeighborhood: virtual public moNeighborhood { +public: + /** + * Define type of a solution corresponding to Neighbor + */ + typedef typename Neighbor::EOT EOT; + + /** + * Constructor + * @param _neighborhoodSize the size of the neighborhood + */ + moIndexNeighborhood(unsigned int _neighborhoodSize) : + neighborhoodSize(_neighborhoodSize) { + } + + /** + * getter to get the value of neighborhoodSize + * @return the neighborhoodSize + */ + unsigned int getNeighborhoodSize() const { + return neighborhoodSize; + } + + /** + * Setter to fixe the neighoodSize + * @param _neighborhoodSize the value to set + */ + + void setNeighborhoodSize(unsigned int _neighborhoodSize) { + neighborhoodSize = _neighborhoodSize; + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moIndexNeighborhood"; + } + +protected: + // size of the neighborhood + unsigned int neighborhoodSize; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moNeighbor.h new file mode 100644 index 000000000..889dd6817 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moNeighbor.h @@ -0,0 +1,110 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moNeighbor_h +#define _moNeighbor_h + +//EO inclusion +#include +#include +#include + +/** + * Container of the neighbor informations + */ +template +class moNeighbor: public EO { +public: + typedef EOType EOT; + using EO::fitness; + + /** + * Default Constructor + */ + moNeighbor() : + EO () { + } + + /** + * Copy Constructor + * @param _neighbor to copy + */ + moNeighbor(const moNeighbor& _neighbor) { + if (!(_neighbor.invalid())) + fitness(_neighbor.fitness()); + else + (*this).invalidate(); + } + + /** + * Assignment operator + * @param _neighbor the neighbor to assign + * @return a neighbor equal to the other + */ + virtual moNeighbor& operator=( + const moNeighbor& _neighbor) { + if (!(_neighbor.invalid())) + fitness(_neighbor.fitness()); + else + (*this).invalidate(); + + return (*this); + } + + /** + * Move a solution + * @param _solution the related solution + */ + virtual void move(EOT & _solution) = 0; + + /** + * Test equality between two neighbors + * @param _neighbor a neighbor + * @return if _neighbor and this one are equals + */ + virtual bool equals(moNeighbor & _neighbor) { + return false; + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moNeighbor"; + } + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moNeighborhood.h new file mode 100644 index 000000000..60d11c1f2 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moNeighborhood.h @@ -0,0 +1,101 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moNeighborhood_h +#define _moNeighborhood_h + +#include + +/** + * A Neighborhood + */ +template< class Neighbor > +class moNeighborhood : public eoObject +{ +public: + /** + * Define type of a solution corresponding to Neighbor + */ + typedef typename Neighbor::EOT EOT; + + /** + * Default Constructor + */ + moNeighborhood() {} + + /** + * @return true if the neighborhood is random (default false) + */ + virtual bool isRandom() { + return false; + } + + /** + * Test if a solution has (again) a Neighbor + * @param _solution the related solution + * @return true if _solution has a Neighbor + */ + virtual bool hasNeighbor(EOT & _solution) = 0 ; + + /** + * Initialization of the neighborhood + * @param _solution the solution to explore + * @param _current the first neighbor + */ + virtual void init(EOT & _solution, Neighbor & _current) = 0 ; + + /** + * Give the next neighbor + * @param _solution the solution to explore + * @param _current the next neighbor + */ + virtual void next(EOT & _solution, Neighbor & _current) = 0 ; + + /** + * Test if there is again a neighbor + * @param _solution the solution to explore + * @return true if there is again a neighbor not explored + */ + virtual bool cont(EOT & _solution) = 0 ; + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moNeighborhood"; + } +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moOrderNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moOrderNeighborhood.h new file mode 100644 index 000000000..7561d143b --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moOrderNeighborhood.h @@ -0,0 +1,130 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 _moOrderNeighborhood_h +#define _moOrderNeighborhood_h + +#include + +/** + * An ordered Neighborhood + */ +template +class moOrderNeighborhood: public moIndexNeighborhood { +public: + + /** + * Define type of a solution corresponding to Neighbor + */ + typedef typename Neighbor::EOT EOT; + + using moIndexNeighborhood::neighborhoodSize; + + /** + * Constructor + * @param _neighborhoodSize the size of the neighborhood + */ + moOrderNeighborhood(unsigned int _neighborhoodSize) : + moIndexNeighborhood (_neighborhoodSize), currentIndex(0) { + } + + /** + * Test if a neighbor exists + * @param _solution the solution to explore + * @return true if the neighborhood was not empty + */ + virtual bool hasNeighbor(EOT& _solution) { + return neighborhoodSize > 0; + } + + /** + * Initialization of the neighborhood + * @param _solution the solution to explore + * @param _neighbor the first neighbor + */ + virtual void init(EOT & _solution, Neighbor & _neighbor) { + currentIndex = 0; + _neighbor.index(currentIndex); + } + + /** + * Give the next neighbor + * @param _solution the solution to explore + * @param _neighbor the next neighbor + */ + virtual void next(EOT & _solution, Neighbor & _neighbor) { + currentIndex++; + _neighbor.index(currentIndex); + } + + /** + * test if all neighbors are explore or not,if false, there is no neighbor left to explore + * currentIndex is the index which have been used before, it is not the next neighbor which can be possibly evaluated + * + * @param _solution the solution to explore + * @return true if there is again a neighbor to explore + */ + virtual bool cont(EOT & _solution) { + return (currentIndex < neighborhoodSize - 1); + } + + /** + * Getter + * @return the position in the Neighborhood + */ + unsigned int position() { + return currentIndex; + } + + /** + * Setter the position in the Neighborhood + */ + void setPosition(unsigned int _currentIndex) { + currentIndex=_currentIndex; + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moOrderNeighborhood"; + } + +protected: + unsigned int currentIndex; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moRndNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moRndNeighborhood.h new file mode 100644 index 000000000..9c7ec2d22 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moRndNeighborhood.h @@ -0,0 +1,51 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moRndNeighborhood_h +#define _moRndNeighborhood_h + +#include + +/** + * Class used to specify a neighborhood is random + */ +template< class Neighbor > +class moRndNeighborhood : virtual public moNeighborhood { + +public: + + /** + * @return true + */ + bool isRandom() { + return true; + } +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moRndVectorVNSelection.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moRndVectorVNSelection.h new file mode 100644 index 000000000..3debb85d4 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moRndVectorVNSelection.h @@ -0,0 +1,118 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 _moRndVectorVNSelection_h +#define _moRndVectorVNSelection_h + +#include +#include + +#include + +/** + * This class is used for the Variable Neighborhood Search explorer inherits from moVectorVNSelection + * The search heuristics are saved in vectors + * They are given in random order (at each initialization the order is changed) + * + */ +template< class EOT > +class moRndVectorVNSelection: public moVectorVNSelection +{ + using moVectorVNSelection::LSvector; + using moVectorVNSelection::current; + +public: + + /** + * Default constructor with first search heuristics + * + * @param _firstLS first local search + * @param _firstShake first heuristic which perturbs the solution + * @param _cycle when true, the first heuristics follows the last ones. Otherwise the search stop. + */ + moRndVectorVNSelection(eoMonOp& _firstLS, eoMonOp& _firstShake, bool _cycle = true) : moVectorVNSelection(_firstLS, _firstShake), cycle(_cycle){} + + /** + * Return the class id. + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moRndVectorVNSelection"; + } + + /** + * test if there is still some heuristics + * + * @param _solution the current solution + * @return true if there is some heuristics + */ + virtual bool cont(EOT& _solution){ + return ( cycle || (currentOrder <= (order.size() - 2)) ); + } + + /** + * put the current heuristics on the first ones + * + * @param _solution the current solution + */ + virtual void init(EOT& _solution) { + if(order.size() == 0) + for(unsigned int i = 0; i < LSvector.size(); i++) + order.push_back(i); + + std::random_shuffle(order.begin(), order.end(), gen); + + currentOrder = 0; + current = order[currentOrder]; + } + + /** + * put the current heuristics on the next ones + * + * @param _solution the current solution + */ + virtual void next(EOT& _solution){ + currentOrder = (currentOrder + 1) % order.size(); + + current = order[currentOrder]; + } + +private: + // boolean to indicate the first heuristics follow the last ones + bool cycle; + // index in order vector + unsigned int currentOrder; + // the index of heuristics in random order + std::vector order; + // random generator + UF_random_generator gen; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moRndWithReplNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moRndWithReplNeighborhood.h new file mode 100644 index 000000000..16e9b0211 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moRndWithReplNeighborhood.h @@ -0,0 +1,109 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moRndWithReplNeighborhood_h +#define _moRndWithReplNeighborhood_h + +#include +#include +#include + +/** + * A Random With replacement Neighborhood + */ +template< class Neighbor > +class moRndWithReplNeighborhood : public moIndexNeighborhood, public moRndNeighborhood +{ +public: + + /** + * Define type of a solution corresponding to Neighbor + */ + typedef typename Neighbor::EOT EOT; + + using moIndexNeighborhood::neighborhoodSize; + + /** + * Constructor + * @param _neighborhoodSize the size of the neighborhood + */ + moRndWithReplNeighborhood(unsigned int _neighborhoodSize): moIndexNeighborhood(_neighborhoodSize) {} + + /** + * Test if it exist a neighbor + * @param _solution the solution to explore + * @return true if the neighborhood was not empty + */ + virtual bool hasNeighbor(EOT& _solution) { + return neighborhoodSize > 0; + } + + /** + * Initialization of the neighborhood + * @param _solution the solution to explore + * @param _neighbor the first neighbor + */ + virtual void init(EOT & _solution, Neighbor & _neighbor) { + _neighbor.index(rng.random(neighborhoodSize)); + } + + /** + * Give the next neighbor + * @param _solution the solution to explore + * @param _neighbor the next neighbor + */ + virtual void next(EOT & _solution, Neighbor & _neighbor) { + _neighbor.index(rng.random(neighborhoodSize)); + } + + /** + * test if all neighbors are explore or not,if false, there is no neighbor left to explore + * @param _solution the solution to explore + * @return true if there is again a neighbor to explore + */ + virtual bool cont(EOT & _solution) { + return neighborhoodSize > 0; + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moRndWithReplNeighborhood"; + } + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moRndWithoutReplNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moRndWithoutReplNeighborhood.h new file mode 100644 index 000000000..8c66ee3f9 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moRndWithoutReplNeighborhood.h @@ -0,0 +1,138 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moRndWithoutReplNeighborhood_h +#define _moRndWithoutReplNeighborhood_h + +#include +#include +#include + +/** + * A Random without replacement Neighborhood + */ +template< class Neighbor > +class moRndWithoutReplNeighborhood : public moIndexNeighborhood, public moRndNeighborhood +{ +public: + + /** + * Define type of a solution corresponding to Neighbor + */ + typedef typename Neighbor::EOT EOT; + + + using moIndexNeighborhood::neighborhoodSize; + + /** + * Constructor + * @param _neighborhoodSize the size of the neighborhood + */ + moRndWithoutReplNeighborhood(unsigned int _neighborhoodSize): moIndexNeighborhood(_neighborhoodSize), maxIndex(0) { + for (unsigned int i=0; i < neighborhoodSize; i++) + indexVector.push_back(i); + } + + /** + * Test if it exist a neighbor + * @param _solution the solution to explore + * @return true if the neighborhood was not empty + */ + virtual bool hasNeighbor(EOT& _solution) { + return neighborhoodSize > 0; + } + + /** + * Initialization of the neighborhood + * @param _solution the solution to explore + * @param _neighbor the first neighbor + */ + virtual void init(EOT & _solution, Neighbor & _neighbor) { + unsigned int i, tmp; + maxIndex = neighborhoodSize ; + i = rng.random(maxIndex); + _neighbor.index(indexVector[i]); + tmp=indexVector[i]; + indexVector[i]=indexVector[maxIndex-1]; + indexVector[maxIndex-1]=tmp; + maxIndex--; + } + + /** + * Give the next neighbor + * @param _solution the solution to explore + * @param _neighbor the next neighbor + */ + virtual void next(EOT & _solution, Neighbor & _neighbor) { + unsigned int i, tmp; + i = rng.random(maxIndex); + _neighbor.index(indexVector[i]); + tmp=indexVector[i]; + indexVector[i]=indexVector[maxIndex-1]; + indexVector[maxIndex-1]=tmp; + maxIndex--; + } + + /** + * test if all neighbors are explore or not,if false, there is no neighbor left to explore + * maxIndex is number of neighbors + * @param _solution the solution to explore + * @return true if there is again a neighbor to explore + */ + virtual bool cont(EOT & _solution) { + return (maxIndex > 0) ; + } + + /** + * Getter + * @return the position in the Neighborhood + */ + unsigned int position() { + return indexVector[maxIndex]; + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moRndWithoutReplNeighborhood"; + } + +private: + unsigned int maxIndex; + std::vector indexVector; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moVariableNeighborhoodSelection.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moVariableNeighborhoodSelection.h new file mode 100644 index 000000000..99af9a98d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moVariableNeighborhoodSelection.h @@ -0,0 +1,88 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 _moVariableNeighborhoodSelection_h +#define _moVariableNeighborhoodSelection_h + +#include +#include + +/** + * This class is used for the Variable Neighborhood Search explorer + * It gives the sequence of search heuristics based on the different "neighborhoods" + * The class is built such as the moNeighborhood" with init, next, cont + * and two methods to get the heuristics which shake the solution, and which give the local search + * + */ +template< class EOT > +class moVariableNeighborhoodSelection +{ +public: + + /** + * Return the class id. + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moVariableNeighborhoodSelection"; + } + + /** + * test if there is still some search heuristics to use + * @return true if there is some neighborhood to explore + */ + virtual bool cont(EOT& _solution) = 0; + + /** + * put on the first search heuristics + */ + virtual void init(EOT& _solution) = 0; + + /** + * put the next search heuristics + */ + virtual void next(EOT& _solution) = 0; + + /** + * Get the current "shake" operator based on the current neighborhood + * + * @return current shake operator + */ + virtual eoMonOp & getShake() = 0; + + /** + * Get the current local search based on the current neighborhood + * + * @return current local search + */ + virtual eoMonOp & getLocalSearch() = 0; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moVectorVNSelection.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moVectorVNSelection.h new file mode 100644 index 000000000..3070e0e9a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/neighborhood/moVectorVNSelection.h @@ -0,0 +1,108 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 _moVectorVNSelection_h +#define _moVectorVNSelection_h + +#include +#include + +/** + * This class is used for the Variable Neighborhood Search explorer inherits from moVariableNeighborhoodSelection + * The search heuristics are saved in vectors + * The way to croos the vector is not defined here + * + */ +template< class EOT > +class moVectorVNSelection: public moVariableNeighborhoodSelection{ + +public: + + /** + * Default constructor with first search heuristics + * + * @param _firstLS first local search + * @param _firstShake first heuristic which perturbs the solution + */ + moVectorVNSelection(eoMonOp& _firstLS, eoMonOp& _firstShake){ + LSvector.push_back(&_firstLS); + shakeVector.push_back(&_firstShake); + + current = 0; + } + + /** + * Add some search heuristics + * + * @param _otherLS the added local search + * @param _otherShake the added heuristic which perturbs the solution + */ + void add(eoMonOp& _otherLS, eoMonOp& _otherShake){ + LSvector.push_back(&_otherLS); + shakeVector.push_back(&_otherShake); + } + + /** + * Return the class id. + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moVectorVNSelection"; + } + + /** + * Get the current "shake" operator based on the current neighborhood + * + * @return current shake operator + */ + virtual eoMonOp & getShake() { + return *(shakeVector[current]); + } + + /** + * Get the current local search based on the current neighborhood + * + * @return current local search + */ + virtual eoMonOp & getLocalSearch() { + return *(LSvector[current]); + } + +protected: + // vector of local searches + std::vector* > LSvector; + // vector of "shake" heiristics which perturbs the current solution + std::vector* > shakeVector; + // index of the current search heuristics which is applied + unsigned int current; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moLocalSearchInit.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moLocalSearchInit.h new file mode 100644 index 000000000..d91c5c719 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moLocalSearchInit.h @@ -0,0 +1,66 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moLocalSearchInit_h +#define _moLocalSearchInit_h + +#include +#include + +/** + * Initialization of the solution with a local search + */ +template< class Neighbor > +class moLocalSearchInit : public eoInit { +public: + typedef typename Neighbor::EOT EOT; + + /** + * Constructor + * @param _init initialization of the solution before the local search + * @param _ls the local search to apply to the solution + */ + moLocalSearchInit(eoInit& _init, moLocalSearch& _ls) : init(_init), ls(_ls) { + } + + /** + * Apply the local search on the solution + * @param _solution to perturb + */ + void operator()(EOT& _solution) { + init(_solution); + ls(_solution); + } + +private: + eoInit& init; + moLocalSearch & ls; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moMonOpPerturb.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moMonOpPerturb.h new file mode 100644 index 000000000..c056bbf6a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moMonOpPerturb.h @@ -0,0 +1,72 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moMonOpPerturb_h +#define _moMonOpPerturb_h + +#include +#include +#include +#include + +/** + * Perturbation operator using only a eoMonOp + */ +template< class Neighbor > +class moMonOpPerturb : public moPerturbation, public moDummyMemory { + +public: + typedef typename Neighbor::EOT EOT; + + /** + * Constructor + * @param _monOp an eoMonOp (pertubation operator) + * @param _fullEval a full evaluation function + */ + moMonOpPerturb(eoMonOp& _monOp, eoEvalFunc& _fullEval):monOp(_monOp), fullEval(_fullEval) {} + + /** + * Apply monOp on the solution + * @param _solution to perturb + * @return value of monOp + */ + bool operator()(EOT& _solution) { + bool res = monOp(_solution); + _solution.invalidate(); + fullEval(_solution); + return res; + } + +private: + /** monOp */ + eoMonOp& monOp; + eoEvalFunc& fullEval; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moNeighborhoodPerturb.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moNeighborhoodPerturb.h new file mode 100644 index 000000000..676f5a828 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moNeighborhoodPerturb.h @@ -0,0 +1,109 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moNeighborhoodPerturb_h +#define _moNeighborhoodPerturb_h + +#include +#include +#include + +/** + * Neighborhood Perturbation: explore the neighborhood to perturb the solution (the neighborhood could be different as the one used in the Local Search) + */ +template< class Neighbor, class OtherNeighbor > +class moNeighborhoodPerturb : public moPerturbation { + +public: + typedef typename Neighbor::EOT EOT; + typedef moNeighborhood OtherNH; + + /** + * Constructor + * @param _otherNeighborhood a neighborhood + * @param _eval an Evaluation Function + */ + moNeighborhoodPerturb(OtherNH& _otherNeighborhood, moEval& _eval): otherNeighborhood(_otherNeighborhood), eval(_eval) {} + + /** + * Apply move on the solution + * @param _solution the current solution + * @return true + */ + virtual bool operator()(EOT& _solution) { + if (otherNeighborhood.hasNeighbor(_solution)) { + eval(_solution, current); + current.move(_solution); + _solution.fitness(current.fitness()); + } + return true; + } + + /** + * Init the neighborhood + * @param _sol the current solution + */ + virtual void init(EOT & _sol) { + if (otherNeighborhood.hasNeighbor(_sol)) + otherNeighborhood.init(_sol, current); + } + + /** + * ReInit the neighborhood because a move was done + * @param _sol the current solution + * @param _neighbor unused neighbor (always empty) + */ + virtual void add(EOT & _sol, Neighbor & _neighbor) { + (*this).init(_sol); + } + + /** + * Explore another neighbor because no move was done + * @param _sol the current solution + * @param _neighbor unused neighbor (always empty) + */ + virtual void update(EOT & _sol, Neighbor & _neighbor) { + if (otherNeighborhood.cont(_sol)) + otherNeighborhood.next(_sol, current); + else + (*this).init(_sol); + } + + /** + * NOTHING TO DO + */ + virtual void clearMemory() {} + +private: + OtherNH& otherNeighborhood; + moEval& eval; + OtherNeighbor current; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moPerturbation.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moPerturbation.h new file mode 100644 index 000000000..46fb9b0b9 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moPerturbation.h @@ -0,0 +1,42 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moPertubation_h +#define _moPertubation_h + +#include +#include + +/** + * Abstract class for Perturbation operator + */ +template< class Neighbor > +class moPerturbation : public eoMonOp, virtual public moMemory {}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moRestartPerturb.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moRestartPerturb.h new file mode 100644 index 000000000..c1b4b78ba --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moRestartPerturb.h @@ -0,0 +1,77 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moRestartPerturb_h +#define _moRestartPerturb_h + + +#include +#include +#include +#include + +/** + * Restart Perturbation : restart when maximum number of iteration with no improvement is reached + */ +template< class Neighbor > +class moRestartPerturb : public moPerturbation, public moCountMoveMemory { + +public: + typedef typename Neighbor::EOT EOT; + + /** + * Constructor + * @param _initializer an initializer of solution + * @param _fullEval a full evaluation function + * @param _threshold maximum number of iteration with no improvement + */ + moRestartPerturb(eoInit& _initializer, eoEvalFunc& _fullEval, unsigned int _threshold):initializer(_initializer), fullEval(_fullEval), threshold(_threshold) {} + + /** + * Apply restart when necessary + * @param _solution to restart + * @return true + */ + bool operator()(EOT& _solution) { + if ((*this).getCounter()>= threshold) { + initializer(_solution); + fullEval(_solution); + (*this).initCounter(); + } + return true; + } + +private: + eoInit& initializer; + eoEvalFunc& fullEval; + unsigned int threshold; +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moSolInit.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moSolInit.h new file mode 100644 index 000000000..8707d47fa --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/perturb/moSolInit.h @@ -0,0 +1,60 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moSolInit_h +#define _moSolInit_h + +#include + +/** + * Initialization of the solution with the external solution + */ +template< class EOT > +class moSolInit : public eoInit { +public: + + /** + * Constructor + * @param _extSol external solution of the initialization + */ + moSolInit(EOT & _extSol) : extSol(_extSol) {} + + /** + * Initialization on the external solution + * @param _solution to initialize + */ + void operator()(EOT& _solution) { + _solution = extSol; + } + +private: + EOT& extSol; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitNeighbor.h new file mode 100644 index 000000000..f112fe180 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitNeighbor.h @@ -0,0 +1,111 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _bitNeighbor_h +#define _bitNeighbor_h + +#include +#include +#include + +/** + * Neighbor related to a vector of Bit + */ +template< class Fitness > +class moBitNeighbor : public moBackableNeighbor >, public moIndexNeighbor > +{ +public: + typedef eoBit EOT; + + using moBackableNeighbor::fitness; + using moIndexNeighbor::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 "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); + _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 diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitsNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitsNeighbor.h new file mode 100644 index 000000000..e0f1363f1 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitsNeighbor.h @@ -0,0 +1,149 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 _moBitsNeighbor_h +#define _moBitsNeighbor_h + +#include +#include + +/** + * Neighbor to flip several bits + * of a solution of type eoBit + */ +template< class EOT, class Fitness=typename EOT::Fitness > +class moBitsNeighbor : virtual public moNeighbor, public moBackableNeighbor +{ +public: + + // position of bits which are flipped + std::vector bits; + + // number of bits to flip + unsigned int nBits; + + /** + * Default Constructor + */ + moBitsNeighbor() : moNeighbor() {} + + /** + * Copy Constructor + * @param _source the neighbor to copy + */ + moBitsNeighbor(const moBitsNeighbor& _source) : moNeighbor(_source) { + bits.resize(_source.bits.size()); + + nBits = _source.nBits; + + for(unsigned i = 0; i < bits.size(); i++) + this->bits[i] = _source.bits[i] ; + } + + /** + * Assignment operator + * @param _source the source neighbor + */ + moBitsNeighbor & operator=(const moBitsNeighbor & _source) { + moNeighbor::operator=(_source); + + if (bits.size() != _source.bits.size()) + bits.resize(_source.bits.size()); + + nBits = _source.nBits; + + for(unsigned i = 0; i < bits.size(); i++) + this->bits[i] = _source.bits[i] ; + + return *this ; + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moBitsNeighbor"; + } + + /** + * flipped the bits according to the bits vector + * @param _solution the solution to move + */ + virtual void move(EOT& _solution) { + for(unsigned i = 0; i < nBits; i++) + _solution[ this->bits[i] ] = !_solution[ this->bits[i] ]; + } + + /** + * flipped the bits according to the bits vector + * @param _solution the solution to move back + */ + virtual void moveBack(EOT& _solution) { + for(unsigned i = 0; i < nBits; i++) + _solution[ this->bits[i] ] = !_solution[ this->bits[i] ]; + } + + /** + * @param _neighbor a neighbor + * @return if _neighbor and this one are equals + */ + virtual bool equals(moBitsNeighbor & _neighbor) { + if (nBits != _neighbor.nBits) + return false; + else { + unsigned int i = 0; + + while ((i < nBits) && (bits[i] == _neighbor.bits[i])) i++; + + if (i < nBits) + return false; + else + return true; + } + } + + /** + * 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 << this->fitness() << " " << nBits ; + for(unsigned int i = 0; i < nBits; i++) + _os << " " << bits[i] ; + } + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitsNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitsNeighborhood.h new file mode 100644 index 000000000..5bfb2576d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitsNeighborhood.h @@ -0,0 +1,125 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 _moBitsNeighborhood_h +#define _moBitsNeighborhood_h + +#include +#include +#include + +/** + * A neighborhood for bit string solutions + * where several bits could be flipped + * in a given Hamming distance + */ +template< class Neighbor > +class moBitsNeighborhood : public moNeighborhood +{ +public: + + /** + * Define type of a solution corresponding to Neighbor + */ + typedef typename Neighbor::EOT EOT; + + /** + * Constructor + * @param _length bit string length + * @param _nBits maximum number of bits to flip (radius of the neighborhood) + * @param _exactDistance when true, only neighbor with exactly k bits flip are considered, other neighbor <= Hamming distance k + */ + moBitsNeighborhood(unsigned _length, unsigned _nBits, bool _exactDistance = false): moNeighborhood(), length(_length), nBits(_nBits) { + // neighborhood size : + // for distance == nBits : length \choose nBits = length! / ( (length - nBits)! * nBits!) + // for distance <= nBits : sum of previous distances + if (_exactDistance) { + neighborhoodSize = numberOfNeighbors(nBits); + } else { + neighborhoodSize = 0; + for(int d = 1; d <= nBits; d++) + neighborhoodSize += numberOfNeighbors(d); + } + + } + + /** + * Number fo neighbors at Hamming distance d + * + * @param d Hamming distance + */ + unsigned int numberOfNeighbors(unsigned d) { + unsigned int fact_nBits = 1; + + for(unsigned k = 1; k <= d; k++) + fact_nBits *= k; + + unsigned int fact_length = 1; + + for(unsigned k = length; k > length - d; k--) + fact_length *= k; + + return fact_length / fact_nBits; + } + + /** + * Test if it exist a neighbor + * @param _solution the solution to explore + * @return true if the neighborhood was not empty (bit string larger than 0) + */ + virtual bool hasNeighbor(EOT& _solution) { + return _solution.size() > 0; + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moBitsNeighborhood"; + } + +protected: + // length of the bit strings + unsigned int length; + + // radius of the neighborhood + unsigned int nBits; + + // size of the neighborhood + unsigned int neighborhoodSize; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitsWithReplNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitsWithReplNeighborhood.h new file mode 100644 index 000000000..8c833f1a2 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitsWithReplNeighborhood.h @@ -0,0 +1,199 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 _moBitsWithReplNeighborhood_h +#define _moBitsWithReplNeighborhood_h + +#include +#include +#include +#include + +/** + * A neighborhood for bit string solutions + * where several bits could be flipped + * under a given Hamming distance + * + * The neighborhood is explored in a random order + * Each neighbors is visited once time + * and the number of visited neighbors is a parameter + */ +template< class Neighbor > +class moBitsWithReplNeighborhood : public moBitsNeighborhood +{ + using moBitsNeighborhood::neighborhoodSize; + using moBitsNeighborhood::length; + using moBitsNeighborhood::nBits; + using moBitsNeighborhood::numberOfNeighbors; + +public: + + /** + * Define type of a solution corresponding to Neighbor + */ + typedef typename Neighbor::EOT EOT; + + /** + * Constructor + * + * @param _length bit string length + * @param _nBits maximum number of bits to flip (radius of the neighborhood) + * @param _sampleSize number of neighbor to sample in the neighborhood, if 0 all the neighborhood is sampled + * @param _exactDistance when true, only neighbor with exactly k bits flip are considered, other neighbor <= Hamming distance k + */ + moBitsWithReplNeighborhood(unsigned _length, unsigned _nBits, unsigned _sampleSize, bool _exactDistance = false): moBitsNeighborhood(_length, _nBits, _exactDistance), sampleSize(_sampleSize), exactDistance(_exactDistance) { + if (sampleSize > neighborhoodSize || sampleSize == 0) + sampleSize = neighborhoodSize; + + indexVector.resize(length); + + for(unsigned int i = 0; i < length; i++) + indexVector[i] = i; + + if (!exactDistance) { + nSize.resize(nBits); + nSize[0] = numberOfNeighbors(1); + for(unsigned d = 2; d <= nBits; d++) + nSize[d - 1] = nSize[d - 2] + numberOfNeighbors(d); + } + + nNeighbors = 0; + } + + /** + * one random neighbor at Hamming distance _n + * + * @param _solution the solution to explore + * @param _neighbor the first neighbor + * @param _n Hamming distance of the neighbor + */ + virtual void randomNeighbor(EOT & _solution, Neighbor & _neighbor, unsigned _n) { + _neighbor.bits.resize(_n); + _neighbor.nBits = _n; + + unsigned i; + unsigned b; + unsigned tmp; + + for(unsigned k = 0; k < _n; k++) { + i = rng.random(length - k); + b = indexVector[i]; + + _neighbor.bits[k] = b; + + indexVector[i] = indexVector[length - k - 1]; + indexVector[length - k - 1] = b; + } + } + + /** + * one random neighbor at maximal Hamming distance _n + * + * @param _solution the solution to explore + * @param _neighbor the first neighbor + */ + virtual void randomNeighbor(EOT & _solution, Neighbor & _neighbor) { + if (exactDistance) + randomNeighbor(_solution, _neighbor, nBits); + else { + // equiprobability between neighbors at maximal Hamming distance nBits + unsigned n = rng.random(neighborhoodSize); + + unsigned d = 1; + while (n < nSize[d - 1]) d++; + + randomNeighbor(_solution, _neighbor, d); + } + } + + /** + * Initialization of the neighborhood: + * one random neighbor + * + * @param _solution the solution to explore + * @param _neighbor the first neighbor + */ + virtual void init(EOT & _solution, Neighbor & _neighbor) { + randomNeighbor(_solution, _neighbor); + + nNeighbors = 1; + } + + /** + * Give the next neighbor + * apply several bit flips on the solution + * @param _solution the solution to explore (population of solutions) + * @param _neighbor the next neighbor which in order of distance + */ + virtual void next(EOT & _solution, Neighbor & _neighbor) { + randomNeighbor(_solution, _neighbor); + + nNeighbors++; + } + + /** + * Test if all neighbors are explored or not,if false, there is no neighbor left to explore + * @param _solution the solution to explore + * @return true if there is again a neighbor to explore: population size larger or equals than 1 + */ + virtual bool cont(EOT & _solution) { + return nNeighbors < sampleSize ; + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moBitsWithReplNeighborhood"; + } + +protected: + // vector of possible bits + std::vector indexVector; + + // maximum number of visited neighbor i.e. number of neighbor to sample in the neighborhood + unsigned int sampleSize; + + // number of visited neighbors + unsigned nNeighbors; + + // when true, only neighbors at Hamming distance nBits + bool exactDistance; + + // the number of neighbors below the given distance + std::vector nSize; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitsWithoutReplNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitsWithoutReplNeighborhood.h new file mode 100644 index 000000000..c07bc451c --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/bitString/moBitsWithoutReplNeighborhood.h @@ -0,0 +1,229 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 _moBitsWithoutReplNeighborhood_h +#define _moBitsWithoutReplNeighborhood_h + +#include +#include +#include +#include + +/** + * A neighborhood for bit string solutions + * where several bits could be flipped + * under a given Hamming distance + * + * The neighborhood is explored in a random order + * Each neighbors is visited once time + * and the number of visited neighbors is a parameter + */ +template< class Neighbor > +class moBitsWithoutReplNeighborhood : public moBitsNeighborhood +{ + using moBitsNeighborhood::neighborhoodSize; + using moBitsNeighborhood::length; + using moBitsNeighborhood::nBits; + +public: + + /** + * Define type of a solution corresponding to Neighbor + */ + typedef typename Neighbor::EOT EOT; + + /** + * Constructor + * @param _length bit string length + * @param _nBits maximum number of bits to flip (radius of the neighborhood) + * @param _sampleSize number of neighbor to sample in the neighborhood, if 0 all the neighborhood is sampled + * @param _exactDistance when true, only neighbor with exactly k bits flip are considered, other neighbor <= Hamming distance k + */ + moBitsWithoutReplNeighborhood(unsigned _length, unsigned _nBits, unsigned _sampleSize, bool _exactDistance = false): moBitsNeighborhood(_length, _nBits, _exactDistance), sampleSize(_sampleSize) { + if (sampleSize > neighborhoodSize || sampleSize == 0) + sampleSize = neighborhoodSize; + + indexVector.resize(neighborhoodSize); + + for(unsigned int i = 0; i < neighborhoodSize; i++) + indexVector[i] = i; + + /* all the neighbors */ + if (neighborhoodSize >= 1000000) { + std::cout << "moBitsNeighborhood::Warning : the neighborhood size is larger than 10^6 : " << neighborhoodSize << std::endl; + } + + int j; + bool last; + + unsigned firstIndex; + if (_exactDistance) + firstIndex = nBits; + else + firstIndex = 1; + + for(int d = firstIndex; d <= nBits; d++) { + vector bits(d); + + // the first one for this Hamming distance + for(unsigned i = 0; i < d; i++) + bits[i] = i; + + neighborsVec.push_back(bits); + + // the others ones + last = false; + + while(!last) { + j = d - 1; + + if (bits[j] < length - 1) { + bits[j]++; + neighborsVec.push_back(bits); + } else { + j--; + + while ( (j >= 0) && (bits[j] + 1 == bits[j+1]) ) + j--; + + if (j < 0) { + last = true; + } else { + bits[j]++; + + for(unsigned i = j+1; i < d; i++) + bits[i] = bits[i-1] + 1; + + neighborsVec.push_back(bits); + } + } + + } + } + + if (neighborhoodSize != neighborsVec.size()) + std::cout << "moBitsNeighborhood::Warning -> error in the neighborhood size computation, please check... : " << neighborhoodSize << " / " << neighborsVec.size() << std::endl; + } + + /** + * Initialization of the neighborhood: + * apply several bit flips on the solution + * @param _solution the solution to explore + * @param _neighbor the first neighbor + */ + virtual void init(EOT & _solution, Neighbor & _neighbor) { + maxIndex = neighborhoodSize ; + + unsigned i = rng.random(maxIndex); + key = indexVector[i]; + + unsigned tmp = indexVector[i]; + indexVector[i] = indexVector[maxIndex - 1]; + indexVector[maxIndex - 1] = tmp; + maxIndex--; + + _neighbor.bits.resize(nBits); + setNeighbor(key, _neighbor); + } + + /** + * Give the next neighbor + * apply several bit flips on the solution + * @param _solution the solution to explore (population of solutions) + * @param _neighbor the next neighbor which in order of distance + */ + virtual void next(EOT & _solution, Neighbor & _neighbor) { + unsigned i = rng.random(maxIndex); + key = indexVector[i]; + + unsigned tmp = indexVector[i]; + indexVector[i] = indexVector[maxIndex - 1]; + indexVector[maxIndex - 1] = tmp; + maxIndex--; + + setNeighbor(key, _neighbor); + } + + /** + * Test if all neighbors are explored or not,if false, there is no neighbor left to explore + * @param _solution the solution to explore + * @return true if there is again a neighbor to explore: population size larger or equals than 1 + */ + virtual bool cont(EOT & _solution) { + return neighborhoodSize - maxIndex < sampleSize ; + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moBitsWithoutReplNeighborhood"; + } + + unsigned int index() { + return key; + } + +protected: + // number of remainded neighbors to sample + unsigned int maxIndex; + + // vector of possible index + std::vector indexVector; + + // maximum number of visited neighbor i.e. number of neighbor to sample in the neighborhood + unsigned int sampleSize; + + // list of neighbors + vector< vector > neighborsVec; + + // key of the neighbor which is currently explored + unsigned int key; + + /** + * Set the neighbor to the correct neighbor + * @param _key index in neighborVec of the neighbor to set + * @param _neighbor neighbor to set + */ + virtual void setNeighbor(unsigned _key, Neighbor & _neighbor) { + _neighbor.nBits = neighborsVec[_key].size(); + + for(unsigned i = 0; i < _neighbor.nBits; i++) + _neighbor.bits[i] = neighborsVec[_key][i]; + } + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moMaxSATincrEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moMaxSATincrEval.h new file mode 100644 index 000000000..69dfbdb2e --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moMaxSATincrEval.h @@ -0,0 +1,121 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moMaxSATincrEval_h +#define _moMaxSATincrEval_h + +#include +#include + +/** + * Incremental evaluation Function for the max SAT problem + */ +template +class moMaxSATincrEval : public moEval { +public : + typedef typename Neighbor::EOT EOT; + + moMaxSATincrEval(MaxSATeval & _fulleval) : fulleval(_fulleval) { + nbClauses = _fulleval.nbClauses; + nbVar = _fulleval.nbVar; + + clauses = _fulleval.clauses; + variables = _fulleval.variables; + } + + /** + * incremental evaluation of the neighbor for the max SAT problem + * @param _solution the solution (of type bit string) to move + * @param _neighbor the neighbor (of type moBitNeigbor) to consider + */ + virtual void operator()(EOT & _solution, Neighbor & _neighbor) { + // the difference of fitness + int delta = 0; + + // the flipped bit + unsigned int bit = _neighbor.index(); + + // clauses which can be modified by the flipped bit + const std::vector & modifiedClauses = variables[bit + 1] ; // remember that the variables start at index 1 and not 0 + unsigned int size = modifiedClauses.size(); + + int nc; + bool litt; + + for (unsigned int k = 0; k < size; k++) { + // number of the clause + nc = modifiedClauses[k]; + + // negative means that the not(variable) is in the clause + if (nc < 0) { + nc = - nc; + litt = !_solution[bit]; + } else + litt = _solution[bit]; + + if (litt) { + // the litteral was true and becomes false + _solution[bit] = !_solution[bit]; + + if (!fulleval.clauseEval(nc, _solution)) + // the clause was true and becomes false + delta--; + + _solution[bit] = !_solution[bit]; + } else { + // the litteral was false and becomes true + if (!fulleval.clauseEval(nc, _solution)) + // the clause was false and becomes true + delta++; + } + } + + _neighbor.fitness(_solution.fitness() + delta); + } + +protected: + // number of variables + unsigned int nbVar; + // number of clauses + unsigned int nbClauses; + + // list of clauses: + // each clause has the number of the variable (from 1 to nbVar) + // when the value, litteral = not(variable) + std::vector * clauses; + + // list of variables: + // for each variable, the list of clauses + std::vector * variables; + + //full eval of the max SAT + MaxSATeval & fulleval; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moOneMaxIncrEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moOneMaxIncrEval.h new file mode 100644 index 000000000..c97b096e2 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moOneMaxIncrEval.h @@ -0,0 +1,58 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moOneMaxIncrEval_H +#define _moOneMaxIncrEval_H + +#include + +/** + * Incremental evaluation Function for the OneMax problem + */ +template< class Neighbor > +class moOneMaxIncrEval : public moEval +{ +public: + typedef typename Neighbor::EOT EOT; + + /* + * incremental evaluation of the neighbor for the oneMax problem + * @param _solution the solution to move (bit string) + * @param _neighbor the neighbor to consider (of type moBitNeigbor) + */ + virtual void operator()(EOT & _solution, Neighbor & _neighbor) { + if (_solution[_neighbor.index()] == 0) + _neighbor.fitness(_solution.fitness() + 1); + else + _neighbor.fitness(_solution.fitness() - 1); + } +}; + +#endif + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moQAPIncrEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moQAPIncrEval.h new file mode 100644 index 000000000..3fd529a7f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moQAPIncrEval.h @@ -0,0 +1,92 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moQAPIncrEval_H +#define _moQAPIncrEval_H + +#include +#include + +/** + * Incremental evaluation Function for the QAP problem + */ +template< class Neighbor > +class moQAPIncrEval : public moEval +{ +public: + typedef typename Neighbor::EOT EOT; + + /* + * default constructor + * @param _qapEval full evaluation of the QAP problem + */ + moQAPIncrEval(QAPeval & _qapEval) { + n = _qapEval.getNbVar(); + A = _qapEval.getA(); + B = _qapEval.getB(); + } + + /* + * incremental evaluation of the neighbor for the QAP problem + * @param _solution the solution to move (permutation) + * @param _neighbor the neighbor to consider (of type moSwapNeigbor) + */ + virtual void operator()(EOT & _solution, Neighbor & _neighbor) { + int d; + int k; + + unsigned i, j; + + _neighbor.getIndices(n, i, j); + + d = (A[i][i]-A[j][j])*(B[_solution[j]][_solution[j]]-B[_solution[i]][_solution[i]]) + + (A[i][j]-A[j][i])*(B[_solution[j]][_solution[i]]-B[_solution[i]][_solution[j]]); + + for (k = 0; k < n; k++) + if (k != i && k != j) + d = d + (A[k][i]-A[k][j])*(B[_solution[k]][_solution[j]]-B[_solution[k]][_solution[i]]) + + (A[i][k]-A[j][k])*(B[_solution[j]][_solution[k]]-B[_solution[i]][_solution[k]]); + + _neighbor.fitness(_solution.fitness() + d); + } + +private: + // number of variables + int n; + + // matrix A + int ** A; + + // matrix B + int ** B; + +}; + +#endif + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moRoyalRoadIncrEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moRoyalRoadIncrEval.h new file mode 100644 index 000000000..3296ab25f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moRoyalRoadIncrEval.h @@ -0,0 +1,88 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moRoyalRoadIncrEval_H +#define _moRoyalRoadIncrEval_H + +#include +#include + +/** + * Incremental evaluation Function for the Royal Road problem + */ +template< class Neighbor > +class moRoyalRoadIncrEval : public moEval +{ +public: + typedef typename Neighbor::EOT EOT; + + /** + * Constructor + * @param _rr full evaluation of the Royal Road (to have the same block size) + */ + moRoyalRoadIncrEval(RoyalRoadEval & _rr) : k(_rr.blockSize()) {} + + /** + * incremental evaluation of the neighbor for the Royal Road problem + * @param _solution the solution to move (bit string) + * @param _neighbor the neighbor to consider (of type moBitNeigbor) + */ + virtual void operator()(EOT & _solution, Neighbor & _neighbor) { + // which block can be changed? + unsigned int n = _neighbor.index() / k; + + // complete block? + unsigned int offset = n * k; + + unsigned int j = 0; + while (j < k && _solution[offset + j]) j++; + + if (j == k) // the block is complete, so the fitness decreases from one + _neighbor.fitness(_solution.fitness() - 1); + else { + if ((_solution[_neighbor.index()] == 0) && (offset + j == _neighbor.index())) { // can the block be filled? + j++; // next bit + while ( j < k && _solution[offset + j]) j++; + + if (j == k) // the block can be filled, so the fitness increases from one + _neighbor.fitness(_solution.fitness() + 1); + else + _neighbor.fitness(_solution.fitness()); + } else + _neighbor.fitness(_solution.fitness()); + } + } + +protected: + // size of the blocks + unsigned int k; +}; + +#endif + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moUBQPBitsIncrEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moUBQPBitsIncrEval.h new file mode 100644 index 000000000..d6a55c3d7 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moUBQPBitsIncrEval.h @@ -0,0 +1,124 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moUBQPBitsIncrEval_H +#define _moUBQPBitsIncrEval_H + +#include +#include + +/** + * Incremental evaluation Function for the UBQPSimple problem + * when several bits are flipped (moBitsNeighbor) + */ +template< class Neighbor > +class moUBQPBitsIncrEval : public moEval +{ +public: + typedef typename Neighbor::EOT EOT; + + /* + * default constructor + * @param _ubqpEval full evaluation of the UBQP problem + */ + moUBQPBitsIncrEval(UbqpEval & _ubqpEval) { + n = _ubqpEval.getNbVar(); + Q = _ubqpEval.getQ(); + } + + /* + * Incremental evaluation of the neighbor for the UBQP problem (complexity O(n * k) when k bits are flipped) + * @param _solution the solution to move (bit string) + * @param _neighbor the neighbor to consider of type moBitsNeighbor (several bits are flipped) + */ + virtual void operator()(EOT & _solution, Neighbor & _neighbor) { + unsigned int b; + unsigned int j; + int d, delta; + + delta = 0; + for(unsigned i = 0; i < _neighbor.nBits; i++) { + b = _neighbor.bits[i]; + d = Q[b][b]; + + for(j = 0; j < b; j++) + if (_solution[j] == 1) + d += Q[b][j]; + + for(j = b+1; j < n; j++) + if (_solution[j] == 1) + d += Q[j][b]; + + if (_solution[b] == 0) + delta += d; + else + delta -= d; + + // move the solution on this bit + _solution[b] = !_solution[b]; + } + + // move back the solution + for(unsigned i = 0; i < _neighbor.nBits; i++) { + b = _neighbor.bits[i]; + _solution[b] = !_solution[b]; + } + + _neighbor.fitness(_solution.fitness() + delta); + } + + /* + * to get the matrix Q + * + * @return matrix Q + */ + int** getQ() { + return Q; + } + + /* + * to get the number of variable (bit string length) + * + * @return bit string length + */ + int getNbVar() { + return n; + } + +private: + // number of variables + int n; + + // matrix Q (supposed to be in lower triangular form) + int ** Q; + +}; + +#endif + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moUBQPSimpleIncrEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moUBQPSimpleIncrEval.h new file mode 100644 index 000000000..78e6be0f5 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moUBQPSimpleIncrEval.h @@ -0,0 +1,108 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + +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 _moUBQPSimpleIncrEval_H +#define _moUBQPSimpleIncrEval_H + +#include +#include + +/** + * Incremental evaluation Function for the UBQPSimple problem + */ +template< class Neighbor > +class moUBQPSimpleIncrEval : public moEval +{ +public: + typedef typename Neighbor::EOT EOT; + + /* + * default constructor + * @param _ubqpEval full evaluation of the UBQP problem + */ + moUBQPSimpleIncrEval(UbqpEval & _ubqpEval) { + n = _ubqpEval.getNbVar(); + Q = _ubqpEval.getQ(); + } + + /* + * Incremental evaluation of the neighbor for the UBQP problem (linear time complexity) + * @param _solution the solution to move (bit string) + * @param _neighbor the neighbor to consider (of type moBitNeighbor) + */ + virtual void operator()(EOT & _solution, Neighbor & _neighbor) { + unsigned int i = _neighbor.index(); + unsigned int j; + + int d = Q[i][i]; + + for(j = 0; j < i; j++) + if (_solution[j] == 1) + d += Q[i][j]; + + for(j = i+1; j < n; j++) + if (_solution[j] == 1) + d += Q[j][i]; + + if (_solution[i] == 0) + _neighbor.fitness(_solution.fitness() + d); + else + _neighbor.fitness(_solution.fitness() - d); + + } + + /* + * to get the matrix Q + * + * @return matrix Q + */ + int** getQ() { + return Q; + } + + /* + * to get the number of variable (bit string length) + * + * @return bit string length + */ + int getNbVar() { + return n; + } + +private: + // number of variables + int n; + + // matrix Q (supposed to be in lower triangular form) + int ** Q; + +}; + +#endif + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moUBQPdoubleIncrEvaluation.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moUBQPdoubleIncrEvaluation.h new file mode 100644 index 000000000..d9d149a83 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/eval/moUBQPdoubleIncrEvaluation.h @@ -0,0 +1,161 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moUBQPdoubleIncrEvaluation_H +#define moUBQPdoubleIncrEvaluation_H + +#include +#include +#include + +/** + * The neighborhood evaluation for the UBQP + * The double incremental evaluation is used + * + * BECAREFULL: This object must be added to the moCheckpoint of the local search (init method) + */ +template +class moUBQPdoubleIncrEvaluation : public moDoubleIncrEvaluation +{ +public: + typedef typename Neighbor::EOT EOT; + typedef typename EOT::Fitness Fitness; + + using moDoubleIncrEvaluation::deltaFitness; + using moDoubleIncrEvaluation::firstEval; + + /** + * Constructor + * + * @param _neighborhoodSize the size of the neighborhood + * @param _incrEval the incremental evaluation of the UBQP + */ + moUBQPdoubleIncrEvaluation(unsigned int _neighborhoodSize, moUBQPSimpleIncrEval & _incrEval) : moDoubleIncrEvaluation(_neighborhoodSize), searchExplorer(NULL) + { + n = _incrEval.getNbVar(); + Q = _incrEval.getQ(); + } + + void neighborhoodExplorer(moNeighborhoodExplorer & _searchExplorer) { + searchExplorer = & _searchExplorer; + } + + /** + * Evaluation of the neighborhood + * Here nothing to do + * + * @param _solution the current solution + */ + virtual void operator()(EOT & _solution) { + if (firstEval) { + firstEval = false; + + // compute the delta in the simple incremental way O(n) + unsigned int j; + int d; + for(unsigned i = 0; i < n; i++) { + d = Q[i][i]; + + for(j = 0; j < i; j++) + if (_solution[j]) + d += Q[i][j]; + + for(j = i+1; j < n; j++) + if (_solution[j]) + d += Q[j][i]; + + if (_solution[i]) + d = - d; + + deltaFitness[i] = d; + } + } else { + + if (searchExplorer->moveApplied()) { + // compute the new fitness only when the solution has moved + // the selectedNeighbor is the neighbor which is selected in the neighborhood + // the movement is made on this neighbor + // we suppose that the neighborhood is bit string neighborhood (indexed neighbor) + unsigned iMove = searchExplorer->getSelectedNeighbor().index(); + + for(unsigned i = 0; i < n; i++) { + if (i == iMove) + deltaFitness[i] = - deltaFitness[i] ; + else { + if (_solution[i] != _solution[iMove]) + if (i < iMove) + deltaFitness[i] += Q[iMove][i]; + else + deltaFitness[i] += Q[i][iMove]; + else + if (i < iMove) + deltaFitness[i] -= Q[iMove][i]; + else + deltaFitness[i] -= Q[i][iMove]; + } + } + } + } + } + + /* + * to get the matrix Q + * + * @return matrix Q + */ + int** getQ() { + return Q; + } + + /* + * to get the number of variable (bit string length) + * + * @return bit string length + */ + int getNbVar() { + return n; + } + +private: + // number of variables + int n; + + // matrix Q (supposed to be in lower triangular form) + int ** Q; + + /** The search explorer of the local search */ + moNeighborhoodExplorer * searchExplorer; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moIndexedSwapNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moIndexedSwapNeighbor.h new file mode 100644 index 000000000..0b503ca35 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moIndexedSwapNeighbor.h @@ -0,0 +1,99 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moIndexedSwapNeighbor_h +#define _moIndexedSwapNeighbor_h + +#include +#include + +/** + * Indexed Swap Neighbor: the position of the swap are computed according to the index + */ +template +class moIndexedSwapNeighbor: public moBackableNeighbor, public moIndexNeighbor +{ +public: + + using moBackableNeighbor::fitness; + using moIndexNeighbor::key; + + /** + * Apply the swap + * @param _solution the solution to move + */ + virtual void move(EOT& _solution) { + unsigned int tmp; + unsigned i, j; + + this->getIndices(_solution.size(), i, j); + + tmp = _solution[i]; + _solution[i] = _solution[j]; + _solution[j] = tmp; + + _solution.invalidate(); + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moIndexedSwapNeighbor"; + } + + /** + * apply the swap to restore the solution (use by moFullEvalByModif) + * @param _solution the solution to move back + */ + virtual void moveBack(EOT& _solution) { + + move(_solution); + } + + /** + * Get the two indexes of the swap + * @param N size of the permutation + * @param _first first index + * @param _second second index + */ + void getIndices(unsigned N, unsigned int & _first, unsigned int & _second) { + unsigned int n = (unsigned int) ( (1 + sqrt(1 + 8 * key)) / 2); + + _first = key - (n - 1) * n / 2; + _second = N - 1 - (n - 1 - _first); + } + + + + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moShiftNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moShiftNeighbor.h new file mode 100644 index 000000000..88d48301d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moShiftNeighbor.h @@ -0,0 +1,115 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moShiftNeighbor_h +#define _moShiftNeighbor_h + +#include + +/** + * Indexed Shift Neighbor + */ +template +class moShiftNeighbor: public moIndexNeighbor +{ +public: + + using moIndexNeighbor::key; + + /** + * Apply move on a solution regarding a key + * @param _sol the solution to move + */ + virtual void move(EOT & _sol) { + unsigned int tmp ; + size=_sol.size(); + translate(key+1); + // keep the first component to change + tmp = _sol[first]; + // shift + if (first < second) { + for (unsigned int i=first; i second*/ + for (unsigned int i=first; i>second; i--) + _sol[i] = _sol[i-1]; + // shift the first component + _sol[second] = tmp; + } + _sol.invalidate(); + } + + /** + * fix two indexes regarding a key + * @param _key the key allowing to compute the two indexes for the shift + */ + void translate(unsigned int _key) { + int step; + int val = _key; + int tmpSize = size * (size-1) / 2; + // moves from left to right + if (val <= tmpSize) { + step = size - 1; + first = 0; + while ((val - step) > 0) { + val = val - step; + step--; + first++; + } + second = first + val + 1; + } + // moves from right to left (equivalent moves are avoided) + else { /* val > tmpSize */ + val = val - tmpSize; + step = size - 2; + second = 0; + while ((val - step) > 0) { + val = val - step; + step--; + second++; + } + first = second + val + 1; + } + } + + void print() { + std::cout << key << ": [" << first << ", " << second << "] -> " << (*this).fitness() << std::endl; + } + +private: + unsigned int first; + unsigned int second; + unsigned int size; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moSwapNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moSwapNeighbor.h new file mode 100644 index 000000000..55dfcbe8d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moSwapNeighbor.h @@ -0,0 +1,105 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moSwapNeighbor_h +#define _moSwapNeighbor_h + +#include + +/** + * Swap Neighbor + */ +template +class moSwapNeighbor: public moBackableNeighbor { +public: + + /** + * Apply the swap + * @param _solution the solution to move + */ + virtual void move(EOT& _solution) { + EOT tmp(1); + tmp[0] = _solution[indices.first]; + _solution[indices.first] = _solution[indices.second]; + _solution[indices.second] = tmp[0]; + _solution.invalidate(); + } + + /** + * apply the swap to restore the solution (use by moFullEvalByModif) + * @param _solution the solution to move back + */ + virtual void moveBack(EOT& _solution) { + move(_solution); + } + + /** + * Setter to fix the two indexes to swap + * @param _first first index + * @param _second second index + */ + void setIndices(unsigned int _first, unsigned int _second) { + indices.first = _first; + indices.second = _second; + } + + /** + * Get the two indexes to swap + * @param _first first index + * @param _second second index + */ + void getIndices(unsigned int & _first, unsigned int & _second) { + _first = indices.first; + _second = indices.second; + } + + /** + * @param _neighbor a neighbor + * @return if _neighbor and this one are equals + */ + virtual bool equals(moSwapNeighbor& _neighbor) { + unsigned f, s; + _neighbor.getIndices(f, s); + return (((indices.first == f) && (indices.second == s)) || ((indices.first == s) && (indices.second == f))); + } + + /** + * Print the Neighbor + */ + void print() { + std::cout << "[" << indices.first << ", " << indices.second << "] -> " + << (*this).fitness() << std::endl; + } + +private: + std::pair indices; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moSwapNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moSwapNeighborhood.h new file mode 100644 index 000000000..8354337e6 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moSwapNeighborhood.h @@ -0,0 +1,100 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 _moSwapNeighborhood_h +#define _moSwapNeighborhood_h + +#include +#include + +/** + * Swap Neighborhood + */ +template +class moSwapNeighborhood : public moNeighborhood > +{ +public: + typedef moSwapNeighbor Neighbor; + + /** + * @return true if there is at least an available neighbor + */ + virtual bool hasNeighbor(EOT& _solution) { + return (_solution.size() > 1); + }; + + /** + * Initialization of the neighborhood + * @param _solution the solution to explore + * @param _current the first neighbor + */ + virtual void init(EOT& _solution, Neighbor& _current) { + indices.first=0; + indices.second=1; + _current.setIndices(0,1); + } + + /** + * Give the next neighbor + * @param _solution the solution to explore + * @param _current the next neighbor + */ + virtual void next(EOT& _solution, Neighbor& _current) { + if (indices.second==_solution.size()-1) { + indices.first++; + indices.second=indices.first+1; + } + else + indices.second++; + _current.setIndices(indices.first, indices.second); + } + + /** + * Test if there is again a neighbor + * @param _solution the solution to explore + * @return true if there is again a neighbor not explored + */ + virtual bool cont(EOT& _solution) { + return !((indices.first == (_solution.size()-2)) && (indices.second == (_solution.size()-1))); + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moSwapNeighborhood"; + } + +private: + std::pair indices; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moTwoOptExNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moTwoOptExNeighbor.h new file mode 100755 index 000000000..ed7198574 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moTwoOptExNeighbor.h @@ -0,0 +1,104 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moTwoOptExNeighbor_h +#define _moTwoOptExNeighbor_h + +#include + +/** + * Two-opt exchange neighbor + */ +template +class moTwoOptExNeighbor: public moBackableNeighbor { +public: + + /** + * Apply the move + * @param _solution the solution to move + */ + virtual void move(EOT& _solution) { + unsigned int stop = (indices.second - indices.first + 1) / 2; + for (unsigned int i=0; i & _neighbor) { + unsigned f, s; + _neighbor.getIndices(f, s); + return ((indices.first == f) && (indices.second == s) || (indices.first == s) && (indices.second == f)); + } + + /** + * Print the neighbor + */ + void print() { + std::cout << "[" << indices.first << ", " << indices.second << "] -> " << (*this).fitness() << std::endl; + } + +private: + std::pair indices; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moTwoOptExNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moTwoOptExNeighborhood.h new file mode 100755 index 000000000..9723946bb --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/problems/permutation/moTwoOptExNeighborhood.h @@ -0,0 +1,103 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moTwoOptExNeighborhood_h +#define _moTwoOptExNeighborhood_h + +#include +#include + +#include + +/** + * Two-opt exchange neighborhood + */ + +template +class moTwoOptExNeighborhood : public moNeighborhood< moTwoOptExNeighbor > +{ +public: + typedef moTwoOptExNeighbor Neighbor; + + /** + * @return true if there is at least an available neighbor + */ + virtual bool hasNeighbor(EOT& _solution) { + return (_solution.size() > 1); + }; + + /** + * Initialization of the neighborhood + * @param _solution the solution to explore + * @param _current the first neighbor + */ + virtual void init(EOT& _solution, Neighbor& _current) { + indices.first=0; + indices.second=1; + _current.setIndices(0,1); + } + + /** + * Give the next neighbor + * @param _solution the solution to explore + * @param _current the next neighbor + */ + virtual void next(EOT& _solution, Neighbor& _current) { + if (indices.second==_solution.size()-1) { + indices.first++; + indices.second=indices.first+1; + } + else + indices.second++; + _current.setIndices(indices.first, indices.second); + } + + /** + * Test if there is again a neighbor + * @param _solution the solution to explore + * @return true if there is again a neighbor not explored + */ + virtual bool cont(EOT& _solution) { + return !((indices.first == (_solution.size()-2)) && (indices.second == (_solution.size()-1))); + } + + /** + * Return the class Name + * @return the class name as a std::string + */ + virtual std::string className() const { + return "moTwoOptExNeighborhood"; + } + +private: + std::pair indices; + +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moAdaptiveWalkSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moAdaptiveWalkSampling.h new file mode 100644 index 000000000..72101dfcb --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moAdaptiveWalkSampling.h @@ -0,0 +1,110 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moAdaptiveWalkSampling_h +#define moAdaptiveWalkSampling_h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * To compute the length and final solution of an adaptive walk: + * Perform a first improvement Hill-climber based on the neighborhood (adaptive walk), + * The lengths of HC are collected and the final solution which are local optima + * The adaptive walk is repeated several times + * + */ +template +class moAdaptiveWalkSampling : public moSampling +{ +public: + typedef typename Neighbor::EOT EOT ; + + using moSampling::localSearch; + + /** + * Constructor + * @param _init initialisation method of the solution + * @param _neighborhood neighborhood giving neighbor in random order + * @param _fullEval a full evaluation function + * @param _eval an incremental evaluation of neighbors + * @param _nbAdaptWalk Number of adaptive walks + */ + moAdaptiveWalkSampling(eoInit & _init, + moNeighborhood & _neighborhood, + eoEvalFunc& _fullEval, + moEval& _eval, + unsigned int _nbAdaptWalk) : + moSampling(initHC, * new moRandomSearch(initHC, _fullEval, _nbAdaptWalk), copyStat), + copyStat(lengthStat), + checkpoint(trueCont), + hc(_neighborhood, _fullEval, _eval, checkpoint), + initHC(_init, hc) + { + // to count the number of step in the HC + checkpoint.add(lengthStat); + + // add the solution into statistics + add(solStat); + } + + /** + * Destructor + */ + ~moAdaptiveWalkSampling() { + // delete the pointer on the local search which has been constructed in the constructor + delete localSearch; + } + +protected: + moSolutionStat solStat; + moMinusOneCounterStat lengthStat; + moTrueContinuator trueCont; + moStatFromStat copyStat; + moCheckpoint checkpoint; + moFirstImprHC hc; + moLocalSearchInit initHC; +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moAutocorrelationSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moAutocorrelationSampling.h new file mode 100644 index 000000000..3dbeaf954 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moAutocorrelationSampling.h @@ -0,0 +1,89 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moAutocorrelationSampling_h +#define moAutocorrelationSampling_h + +#include +#include +#include +#include +#include +#include + +/** + * To compute the autocorrelation function: + * Perform a random walk based on the neighborhood, + * The fitness values of solutions are collected during the random walk + * The autocorrelation can be computed from the serie of fitness values + * + */ +template +class moAutocorrelationSampling : public moSampling +{ +public: + typedef typename Neighbor::EOT EOT ; + + using moSampling::localSearch; + + /** + * Constructor + * @param _init initialisation method of the solution + * @param _neighborhood neighborhood giving neighbor in random order + * @param _fullEval Fitness function, full evaluation function + * @param _eval neighbor evaluation, incremental evaluation function + * @param _nbStep Number of steps of the random walk + */ + moAutocorrelationSampling(eoInit & _init, + moNeighborhood & _neighborhood, + eoEvalFunc& _fullEval, + moEval& _eval, + unsigned int _nbStep) : + moSampling(_init, * new moRandomWalk(_neighborhood, _fullEval, _eval, _nbStep), fitnessStat) {} + + /** + * Destructor + */ + ~moAutocorrelationSampling() { + // delete the pointer on the local search which has been constructed in the constructor + delete localSearch; + } + +protected: + moFitnessStat fitnessStat; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moDensityOfStatesSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moDensityOfStatesSampling.h new file mode 100644 index 000000000..571f546de --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moDensityOfStatesSampling.h @@ -0,0 +1,83 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moDensityOfStatesSampling_h +#define moDensityOfStatesSampling_h + +#include +#include +#include +#include +#include + +/** + * To compute the density of states: + * Sample the fitness of random solution in the search space + * The fitness values of solutions are collected during the random search + * + */ +template +class moDensityOfStatesSampling : public moSampling +{ +public: + typedef typename Neighbor::EOT EOT ; + + using moSampling::localSearch; + + /** + * Constructor + * @param _init initialisation method of the solution + * @param _fullEval Fitness function, full evaluation function + * @param _nbSol Number of solutions in the sample + */ + moDensityOfStatesSampling(eoInit & _init, + eoEvalFunc& _fullEval, + unsigned int _nbSol) : + moSampling(_init, * new moRandomSearch(_init, _fullEval, _nbSol), fitnessStat) {} + + /** + * default destructor + */ + ~moDensityOfStatesSampling() { + // delete the pointer on the local search which has been constructed in the constructor + delete localSearch; + } + +protected: + moFitnessStat fitnessStat; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moFDCsampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moFDCsampling.h new file mode 100644 index 000000000..22a224759 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moFDCsampling.h @@ -0,0 +1,95 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moFDCsampling_h +#define moFDCsampling_h + +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * To compute the fitness distance correlation: + * Sample the fitness and the distance from a particular solution of random solution in the search space + * The fitness values and distances of solutions are collected during the random search + * Then the correlation between the fitness and the distance can be computed + * + */ +template +class moFDCsampling : public moSampling +{ +public: + typedef typename Neighbor::EOT EOT ; + + using moSampling::localSearch; + + /** + * Constructor + * @param _init initialisation method of the solution + * @param _fullEval a full evaluation function + * @param _dist the distance function between solution + * @param _refSol the reference solution to compute the distance (think of global optimum when possible) + * @param _nbSol Number of solutions of the sample + */ + moFDCsampling(eoInit & _init, + eoEvalFunc& _fullEval, + eoDistance& _dist, + EOT& _refSol, + unsigned int _nbSol) : + moSampling(_init, * new moRandomSearch(_init, _fullEval, _nbSol), fitnessStat), + distStat(_dist, _refSol) + { + add(distStat); + } + + /** + * Destructor + */ + ~moFDCsampling() { + // delete the pointer on the local search which has been constructed in the constructor + delete localSearch; + } + +protected: + moFitnessStat fitnessStat; + moDistanceStat distStat; +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moFitnessCloudSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moFitnessCloudSampling.h new file mode 100644 index 000000000..15817555a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moFitnessCloudSampling.h @@ -0,0 +1,100 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moFitnessCloudSampling_h +#define moFitnessCloudSampling_h + +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * To compute an estimation of the fitness cloud, + * i.e. the scatter plot of solution fitness versus neighbor fitness: + * + * This class do nothing. See others mo(...)FitnessCloudSampling classes + * with different fitness sampling methods + */ +template +class moFitnessCloudSampling : public moSampling +{ +public: + typedef typename Neighbor::EOT EOT ; + + using moSampling::localSearch; + + /** + * Constructor + * @param _init initialisation method of the solution + * @param _neighborhood neighborhood to get a neighbor + * @param _fullEval Fitness function, full evaluation function + * @param _eval neighbor evaluation, incremental evaluation function + * @param _nbSol Number of solutions in the sample + */ + moFitnessCloudSampling(eoInit & _init, + moNeighborhood & _neighborhood, + eoEvalFunc& _fullEval, + moEval& _eval, + unsigned int _nbSol) : + moSampling(_init, * new moDummyLS(_fullEval), fitnessStat), + neighborhood(_neighborhood), + fullEval(_fullEval), + eval(_eval), + nbSol(_nbSol) + {} + + /** + * default destructor + */ + ~moFitnessCloudSampling() { + // delete the pointer on the local search which has been constructed in the constructor + delete localSearch; + } + +protected: + moNeighborhood & neighborhood; + eoEvalFunc& fullEval; + moEval& eval; + unsigned int nbSol; + moFitnessStat fitnessStat; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moHillClimberSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moHillClimberSampling.h new file mode 100644 index 000000000..e3e277bf7 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moHillClimberSampling.h @@ -0,0 +1,110 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moHillClimberSampling_h +#define moHillClimberSampling_h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * To compute the length and final solution of an adaptive walk: + * Perform a simple Hill-climber based on the neighborhood (gradiant walk, the whole neighborhood is visited), + * The lengths of HC are collected and the final solution which are local optima + * The adaptive walk is repeated several times + * + */ +template +class moHillClimberSampling : public moSampling +{ +public: + typedef typename Neighbor::EOT EOT ; + + using moSampling::localSearch; + + /** + * Constructor + * @param _init initialisation method of the solution + * @param _neighborhood neighborhood giving neighbor in random order + * @param _fullEval a full evaluation function + * @param _eval an incremental evaluation of neighbors + * @param _nbAdaptWalk Number of adaptive walks + */ + moHillClimberSampling(eoInit & _init, + moNeighborhood & _neighborhood, + eoEvalFunc& _fullEval, + moEval& _eval, + unsigned int _nbAdaptWalk) : + moSampling(initHC, * new moRandomSearch(initHC, _fullEval, _nbAdaptWalk), copyStat), + copyStat(lengthStat), + checkpoint(trueCont), + hc(_neighborhood, _fullEval, _eval, checkpoint), + initHC(_init, hc) + { + // to count the number of step in the HC + checkpoint.add(lengthStat); + + // add the solution into statistics + add(solStat); + } + + /** + * Destructor + */ + ~moHillClimberSampling() { + // delete the pointer on the local search which has been constructed in the constructor + delete localSearch; + } + +protected: + moSolutionStat solStat; + moMinusOneCounterStat lengthStat; + moTrueContinuator trueCont; + moStatFromStat copyStat; + moCheckpoint checkpoint; + moSimpleHC hc; + moLocalSearchInit initHC; +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moMHBestFitnessCloudSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moMHBestFitnessCloudSampling.h new file mode 100644 index 000000000..d68044498 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moMHBestFitnessCloudSampling.h @@ -0,0 +1,113 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moMHBestFitnessCloudSampling_h +#define moMHBestFitnessCloudSampling_h + +#include +#include +#include +#include +#include +#include +#include + +/** + * To compute an estimation of the fitness cloud, + * i.e. the scatter plot of solution fitness versus neighbor fitness: + * + * Here solution are sampled with Metropolis-Hasting method + * + * Sample the fitness of solutions from Metropolis-Hasting sampling + * and the best fitness of k random neighbor + * + * The values are collected during the Metropolis-Hasting walk + * + */ +template +class moMHBestFitnessCloudSampling : public moFitnessCloudSampling +{ +public: + typedef typename Neighbor::EOT EOT ; + + using moSampling::localSearch; + using moSampling::checkpoint; + using moSampling::monitorVec; + using moSampling::continuator; + using moFitnessCloudSampling::fitnessStat; + + /** + * Constructor + * @param _init initialisation method of the solution + * @param _neighborhood neighborhood to get one random neighbor (supposed to be random neighborhood) + * @param _fullEval Fitness function, full evaluation function + * @param _eval neighbor evaluation, incremental evaluation function + * @param _nbStep Number of step of the MH sampling + */ + moMHBestFitnessCloudSampling(eoInit & _init, + moNeighborhood & _neighborhood, + eoEvalFunc& _fullEval, + moEval& _eval, + unsigned int _nbStep) : + moFitnessCloudSampling(_init, _neighborhood, _fullEval, _eval, _nbStep), + neighborBestStat(_neighborhood, _eval) + { + // delete the dummy local search + delete localSearch; + + // Metropolis-Hasting sampling + localSearch = new moMetropolisHasting(_neighborhood, _fullEval, _eval, _nbStep); + + // delete the checkpoint with the wrong continuator + delete checkpoint; + + // set the continuator + continuator = localSearch->getContinuator(); + + // re-construction of the checkpoint + checkpoint = new moCheckpoint(*continuator); + checkpoint->add(fitnessStat); + checkpoint->add(*monitorVec[0]); + + // one random neighbor + add(neighborBestStat); + } + +protected: + moNeighborBestStat< Neighbor > neighborBestStat; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moMHRndFitnessCloudSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moMHRndFitnessCloudSampling.h new file mode 100644 index 000000000..f72d6ff42 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moMHRndFitnessCloudSampling.h @@ -0,0 +1,113 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moMHRndFitnessCloudSampling_h +#define moMHRndFitnessCloudSampling_h + +#include +#include +#include +#include +#include +#include +#include + +/** + * To compute an estimation of the fitness cloud, + * i.e. the scatter plot of solution fitness versus neighbor fitness: + * + * Here solution are sampled with Metropolis-Hasting method + * + * Sample the fitness of solutions from Metropolis-Hasting sampling + * and the fitness of one random neighbor + * + * The values are collected during the Metropolis-Hasting walk + * + */ +template +class moMHRndFitnessCloudSampling : public moFitnessCloudSampling +{ +public: + typedef typename Neighbor::EOT EOT ; + + using moSampling::localSearch; + using moSampling::checkpoint; + using moSampling::monitorVec; + using moSampling::continuator; + using moFitnessCloudSampling::fitnessStat; + + /** + * Constructor + * @param _init initialisation method of the solution + * @param _neighborhood neighborhood to get one random neighbor (supposed to be random neighborhood) + * @param _fullEval Fitness function, full evaluation function + * @param _eval neighbor evaluation, incremental evaluation function + * @param _nbStep Number of step of the MH sampling + */ + moMHRndFitnessCloudSampling(eoInit & _init, + moNeighborhood & _neighborhood, + eoEvalFunc& _fullEval, + moEval& _eval, + unsigned int _nbStep) : + moFitnessCloudSampling(_init, _neighborhood, _fullEval, _eval, _nbStep), + neighborFitnessStat(_neighborhood, _eval) + { + // delete the dummy local search + delete localSearch; + + // Metropolis-Hasting sampling + localSearch = new moMetropolisHasting(_neighborhood, _fullEval, _eval, _nbStep); + + // delete the checkpoint with the wrong continuator + delete checkpoint; + + // set the continuator + continuator = localSearch->getContinuator(); + + // re-construction of the checkpoint + checkpoint = new moCheckpoint(*continuator); + checkpoint->add(fitnessStat); + checkpoint->add(*monitorVec[0]); + + // one random neighbor + add(neighborFitnessStat); + } + +protected: + moNeighborFitnessStat< Neighbor > neighborFitnessStat; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moNeutralDegreeSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moNeutralDegreeSampling.h new file mode 100644 index 000000000..bc7386ba2 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moNeutralDegreeSampling.h @@ -0,0 +1,125 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moNeutralDegreeSampling_h +#define moNeutralDegreeSampling_h + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * To compute the neutral degree: + * Sample the fitness of random solution in the search space (1er information) + * and sample the neutral degree (2nd information), i.e. the number of neighbor solutions with the same fitness value + * The values are collected during the random search + * + */ +template +class moNeutralDegreeSampling : public moSampling +{ +public: + typedef typename Neighbor::EOT EOT ; + + using moSampling::localSearch; + + /** + * Constructor + * @param _init initialisation method of the solution + * @param _neighborhood neighborhood to compute the neutral degree + * @param _fullEval Fitness function, full evaluation function + * @param _eval neighbor evaluation, incremental evaluation function + * @param _nbSol Number of solutions in the sample + */ + moNeutralDegreeSampling(eoInit & _init, + moNeighborhood & _neighborhood, + eoEvalFunc& _fullEval, + moEval& _eval, + unsigned int _nbSol) : + moSampling(_init, * new moRandomSearch(_init, _fullEval, _nbSol), fitnessStat), + neighborhoodStat(_neighborhood, _eval), + ndStat(neighborhoodStat) + { + add(neighborhoodStat, false); + add(ndStat); + } + + /** + * Constructor with comparators + * @param _init initialisation method of the solution + * @param _neighborhood neighborhood to compute the neutral degree + * @param _fullEval Fitness function, full evaluation function + * @param _eval neighbor evaluation, incremental evaluation function + * @param _neighborComparator a neighbor Comparator + * @param _solNeighborComparator a comparator between a solution and a neighbor + * @param _nbSol Number of solutions in the sample + */ + moNeutralDegreeSampling(eoInit & _init, + moNeighborhood & _neighborhood, + eoEvalFunc& _fullEval, + moEval& _eval, + moNeighborComparator& _neighborComparator, + moSolNeighborComparator& _solNeighborComparator, + unsigned int _nbSol) : + moSampling(_init, * new moRandomSearch(_init, _fullEval, _nbSol), fitnessStat), + neighborhoodStat(_neighborhood, _eval, _neighborComparator, _solNeighborComparator), + ndStat(neighborhoodStat) + { + add(neighborhoodStat, false); + add(ndStat); + } + + /** + * default destructor + */ + ~moNeutralDegreeSampling() { + // delete the pointer on the local search which has been constructed in the constructor + delete localSearch; + } + +protected: + moFitnessStat fitnessStat; + moNeighborhoodStat< Neighbor > neighborhoodStat; + moNeutralDegreeNeighborStat< Neighbor > ndStat; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moNeutralWalkSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moNeutralWalkSampling.h new file mode 100644 index 000000000..258792fe0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moNeutralWalkSampling.h @@ -0,0 +1,148 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moNeutralWalkSampling_h +#define moNeutralWalkSampling_h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * To explore the evolvability of solutions in a neutral networks: + * Perform a random neutral walk based on the neighborhood, + * The measures of evolvability of solutions are collected during the random neutral walk + * The distribution and autocorrelation can be computed from the serie of values + * + * Informations collected: + * - the current solution of the walk + * - the distance from the starting solution + * - the minimal fitness in the neighborhood + * - the average fitness + * - the standard deviation of the fitness + * - the maximal fitness + * - the size of the neighborhood + * - the number of neighbors with lower fitness + * - the number of neighbors with equal fitness (neutral degree) + * - the number of neighbors with higher fitness + */ +template +class moNeutralWalkSampling : public moSampling +{ +public: + typedef typename Neighbor::EOT EOT ; + + using moSampling::localSearch; + + /** + * Constructor + * @param _initSol the first solution of the walk + * @param _neighborhood neighborhood giving neighbor in random order + * @param _fullEval Fitness function, full evaluation function + * @param _eval neighbor evaluation, incremental evaluation function + * @param _distance component to measure the distance from the initial solution + * @param _nbStep Number of steps of the random walk + */ + moNeutralWalkSampling(EOT & _initSol, + moNeighborhood & _neighborhood, + eoEvalFunc& _fullEval, + moEval& _eval, + eoDistance & _distance, + unsigned int _nbStep) : + moSampling(init, * new moRandomNeutralWalk(_neighborhood, _fullEval, _eval, _nbStep), solutionStat), + init(_initSol), + distStat(_distance, _initSol), + neighborhoodStat(_neighborhood, _eval), + minStat(neighborhoodStat), + averageStat(neighborhoodStat), + stdStat(neighborhoodStat), + maxStat(neighborhoodStat), + nbSupStat(neighborhoodStat), + nbInfStat(neighborhoodStat), + sizeStat(neighborhoodStat), + ndStat(neighborhoodStat) + { + add(neighborhoodStat, false); + add(distStat); + add(minStat); + add(averageStat); + add(stdStat); + add(maxStat); + add(sizeStat); + add(nbInfStat); + add(ndStat); + add(nbSupStat); + } + + /** + * default destructor + */ + ~moNeutralWalkSampling() { + // delete the pointer on the local search which has been constructed in the constructor + delete localSearch; + } + +protected: + moSolInit init; + moSolutionStat solutionStat; + moDistanceStat distStat; + moNeighborhoodStat< Neighbor > neighborhoodStat; + moMinNeighborStat< Neighbor > minStat; + moAverageFitnessNeighborStat< Neighbor > averageStat; + moStdFitnessNeighborStat< Neighbor > stdStat; + moMaxNeighborStat< Neighbor > maxStat; + moNbSupNeighborStat< Neighbor > nbSupStat; + moNbInfNeighborStat< Neighbor > nbInfStat; + moSizeNeighborStat< Neighbor > sizeStat; + moNeutralDegreeNeighborStat< Neighbor > ndStat; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moRndBestFitnessCloudSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moRndBestFitnessCloudSampling.h new file mode 100644 index 000000000..12826c512 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moRndBestFitnessCloudSampling.h @@ -0,0 +1,111 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moRndBestFitnessCloudSampling_h +#define moRndBestFitnessCloudSampling_h + +#include +#include +#include +#include +#include +#include +#include + +/** + * To compute an estimation of the fitness cloud, + * i.e. the scatter plot of solution fitness versus neighbor fitness: + * + * Sample the fitness of random solution in the search space + * and the best fitness of k random neighbor + * + * The values are collected during the random search + * + */ +template +class moRndBestFitnessCloudSampling : public moFitnessCloudSampling +{ +public: + typedef typename Neighbor::EOT EOT ; + + using moSampling::localSearch; + using moSampling::checkpoint; + using moSampling::monitorVec; + using moSampling::continuator; + using moFitnessCloudSampling::fitnessStat; + + /** + * Constructor + * @param _init initialisation method of the solution + * @param _neighborhood neighborhood to get one random neighbor (supposed to be random neighborhood) + * @param _fullEval Fitness function, full evaluation function + * @param _eval neighbor evaluation, incremental evaluation function + * @param _nbSol Number of solutions in the sample + */ + moRndBestFitnessCloudSampling(eoInit & _init, + moNeighborhood & _neighborhood, + eoEvalFunc& _fullEval, + moEval& _eval, + unsigned int _nbSol) : + moFitnessCloudSampling(_init, _neighborhood, _fullEval, _eval, _nbSol), + neighborBestStat(_neighborhood, _eval) + { + // delete the dummy local search + delete localSearch; + + // random sampling + localSearch = new moRandomSearch(_init, _fullEval, _nbSol); + + // delete the checkpoint with the wrong continuator + delete checkpoint; + + // set the continuator + continuator = localSearch->getContinuator(); + + // re-construction of the checkpoint + checkpoint = new moCheckpoint(*continuator); + checkpoint->add(fitnessStat); + checkpoint->add(*monitorVec[0]); + + // one random neighbor + add(neighborBestStat); + } + +protected: + moNeighborBestStat< Neighbor > neighborBestStat; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moRndRndFitnessCloudSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moRndRndFitnessCloudSampling.h new file mode 100644 index 000000000..ab778d69d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moRndRndFitnessCloudSampling.h @@ -0,0 +1,111 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moRndRndFitnessCloudSampling_h +#define moRndRndFitnessCloudSampling_h + +#include +#include +#include +#include +#include +#include +#include + +/** + * To compute an estimation of the fitness cloud, + * i.e. the scatter plot of solution fitness versus neighbor fitness: + * + * Sample the fitness of random solution in the search space + * and the fitness of one random neighbor + * + * The values are collected during the random search + * + */ +template +class moRndRndFitnessCloudSampling : public moFitnessCloudSampling +{ +public: + typedef typename Neighbor::EOT EOT ; + + using moSampling::localSearch; + using moSampling::checkpoint; + using moSampling::monitorVec; + using moSampling::continuator; + using moFitnessCloudSampling::fitnessStat; + + /** + * Constructor + * @param _init initialisation method of the solution + * @param _neighborhood neighborhood to get one random neighbor (supposed to be random neighborhood) + * @param _fullEval Fitness function, full evaluation function + * @param _eval neighbor evaluation, incremental evaluation function + * @param _nbSol Number of solutions in the sample + */ + moRndRndFitnessCloudSampling(eoInit & _init, + moNeighborhood & _neighborhood, + eoEvalFunc& _fullEval, + moEval& _eval, + unsigned int _nbSol) : + moFitnessCloudSampling(_init, _neighborhood, _fullEval, _eval, _nbSol), + neighborFitnessStat(_neighborhood, _eval) + { + // delete the dummy local search + delete localSearch; + + // random sampling + localSearch = new moRandomSearch(_init, _fullEval, _nbSol); + + // delete the checkpoint with the wrong continuator + delete checkpoint; + + // set the continuator + continuator = localSearch->getContinuator(); + + // re-construction of the checkpoint + checkpoint = new moCheckpoint(*continuator); + checkpoint->add(fitnessStat); + checkpoint->add(*monitorVec[0]); + + // one random neighbor + add(neighborFitnessStat); + } + +protected: + moNeighborFitnessStat< Neighbor > neighborFitnessStat; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moSampling.h new file mode 100644 index 000000000..b118b9d48 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moSampling.h @@ -0,0 +1,239 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moSampling_h +#define moSampling_h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/** + * To sample the search space: + * A local search is used to sample the search space + * Some statistics are computed at each step of the local search + * + * Can be used to study the fitness landscape + */ +template +class moSampling : public eoF +{ +public: + typedef typename Neighbor::EOT EOT ; + + /** + * Constructor + * @param _init initialisation method of the solution + * @param _localSearch local search to sample the search space + * @param _stat statistic to compute during the search + * @param _monitoring the statistic is saved into the monitor if true + */ + template + moSampling(eoInit & _init, moLocalSearch & _localSearch, moStat & _stat, bool _monitoring = true) : init(_init), localSearch(&_localSearch), continuator(_localSearch.getContinuator()) + { + checkpoint = new moCheckpoint(*continuator); + add(_stat, _monitoring); + // precision of the output by default + precisionOutput = std::cout.precision(); + } + + /** + * default destructor + */ + ~moSampling() { + // delete all monitors + for (unsigned i = 0; i < monitorVec.size(); i++) + delete monitorVec[i]; + + // delete the checkpoint + delete checkpoint ; + } + + /** + * Add a statistic + * @param _stat another statistic to compute during the search + * @param _monitoring the statistic is saved into the monitor if true + */ + template< class ValueType > + void add(moStat & _stat, bool _monitoring = true) { + checkpoint->add(_stat); + + if (_monitoring) { + moVectorMonitor * monitor = new moVectorMonitor(_stat); + monitorVec.push_back(monitor); + checkpoint->add(*monitor); + } + } + + /** + * To sample the search and get the statistics which are stored in the moVectorMonitor vector + */ + void operator()(void) { + // clear all statistic vectors + for (unsigned i = 0; i < monitorVec.size(); i++) + monitorVec[i]->clear(); + + // change the checkpoint to compute the statistics + localSearch->setContinuator(*checkpoint); + + // the initial solution + EOT solution; + + // initialisation of the solution + init(solution); + + // compute the sampling + (*localSearch)(solution); + + // set back to initial continuator + localSearch->setContinuator(*continuator); + } + + /** + * to set the precision of the output file + * @param _precision precision of the output (number of digit) + */ + void precision(unsigned int _precision) { + precisionOutput = _precision; + } + + /** + * to export the vectors of values into one file + * @param _filename file name + * @param _delim delimiter between statistics + * @param _openFile to specify if it writes at the following of the file + */ + void fileExport(std::string _filename, std::string _delim = " ", bool _openFile=false) { + // create file + std::ofstream os; + + if(! _openFile) + os.open(_filename.c_str()); + + else + os.open(_filename.c_str(),std::ios::app); + + if (!os) { + std::string str = "moSampling: Could not open " + _filename; + throw std::runtime_error(str); + } + + // set the precision of the output + os.precision(precisionOutput); + for (unsigned int j = 0; j < monitorVec.size(); j++) + monitorVec[j]->precision(precisionOutput); + + // all vector have the same size + unsigned vecSize = monitorVec[0]->size(); + + for (unsigned int i = 0; i < vecSize; i++) { + os << monitorVec[0]->getValue(i); + + for (unsigned int j = 1; j < monitorVec.size(); j++) { + os << _delim.c_str() << monitorVec[j]->getValue(i); + } + + os << std::endl ; + } + + } + + /** + * to export one vector of values into a file + * @param _col number of vector to print into file + * @param _filename file name + * @param _openFile to specify if it writes at the following of the file + */ + void fileExport(unsigned int _col, std::string _filename, bool _openFile=false) { + if (_col >= monitorVec.size()) { + std::string str = "moSampling: Could not export into file the vector. The index does not exists (too large)"; + throw std::runtime_error(str); + } + + monitorVec[_col]->precision(precisionOutput); + monitorVec[_col]->fileExport(_filename, _openFile); + } + + + /** + * to get one vector of values + * @param _numStat number of statistics to get (in the order of creation) + * @return the vector of value (all values are converted in double) + */ + const std::vector & getValues(unsigned int _numStat) { + return monitorVec[_numStat]->getValues(); + } + + /** + * to get one vector of solutions values + * @param _numStat number of statistics to get (in the order of creation) + * @return the vector of value (all values are converted in double) + */ + const std::vector & getSolutions(unsigned int _numStat) { + return monitorVec[_numStat]->getSolutions(); + } + + /** + * @return name of the class + */ + virtual std::string className(void) const { + return "moSampling"; + } + +protected: + eoInit & init; + moLocalSearch * localSearch; + + moContinuator * continuator; + moCheckpoint * checkpoint; + + std::vector< moVectorMonitor *> monitorVec; + + // precision of the output + unsigned int precisionOutput; + +}; + + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moStatistics.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moStatistics.h new file mode 100644 index 000000000..7c74cbc16 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/src/sampling/moStatistics.h @@ -0,0 +1,226 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau + + 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 moStatistics_h +#define moStatistics_h + +#include +#include +#include + +/** + * Tools to compute some basic statistics + * + * Remember it is better to use some statistic tool like R, etc. + * But it could be usefull to have here in paradisEO + */ +class moStatistics +{ +public: + /** + * Default Constructor + */ + moStatistics() { } + + /** + * To compute min, max , average and standard deviation of a vector of double + * + * @param data vector of double + * @param min to compute + * @param max to compute + * @param avg average to compute + * @param std standard deviation to compute + */ + void basic(const std::vector & data, + double & min, double & max, double & avg, double & std) { + + if (data.size() == 0) { + min = 0.0; + max = 0.0; + avg = 0.0; + std = 0.0; + } else { + unsigned int n = data.size(); + + min = data[0]; + max = data[0]; + avg = 0.0; + std = 0.0; + + double d; + for (unsigned int i = 0; i < n; i++) { + d = data[i]; + if (d < min) + min = d; + if (max < d) + max = d; + avg += d; + std += d * d; + } + + avg /= n; + + std = (std / n) - avg * avg ; + if (std > 0) + std = sqrt(std); + } + } + + /** + * To compute the distance between solutions + * + * @param data vector of solutions + * @param distance method to compute the distance + * @param matrix matrix of distances between solutions + */ + template + void distances(const std::vector & data, eoDistance & distance, + std::vector< std::vector > & matrix) { + if (data.size() == 0) { + matrix.resize(0); + } else { + unsigned int n = data.size(); + + matrix.resize(n); + for (unsigned i = 0; i < n; i++) + matrix[i].resize(n); + + unsigned j; + for (unsigned i = 0; i < n; i++) { + matrix[i][i] = 0.0; + for (j = 0; j < i; j++) { + matrix[i][j] = distance(data[i], data[j]); + matrix[j][i] = matrix[i][j]; + } + } + } + } + + /** + * To compute the autocorrelation and partial autocorrelation + * + * @param data vector of double + * @param nbS number of correlation coefficients + * @param rho autocorrelation coefficients + * @param phi partial autocorrelation coefficients + */ + void autocorrelation(const std::vector & data, unsigned int nbS, + std::vector & rho, std::vector & phi) { + if (data.size() == 0) { + rho.resize(0); + phi.resize(0); + } else { + unsigned int n = data.size(); + + std::vector cov; + cov.resize(nbS+1); + //double cov[nbS+1]; + std::vector m; + m.resize(nbS+1); + //double m[nbS+1]; + std::vector sig; + sig.resize(nbS+1); + //double sig[nbS+1]; + + rho.resize(nbS+1); + phi.resize(nbS+1); + rho[0] = 1.0; + phi[0] = 1.0; + + unsigned s, k; + + for (s = 0; s <= nbS; s++) { + cov[s] = 0; + m[s] = 0; + sig[s] = 0; + } + + double m0, s0; + unsigned j; + + k = 0; + s = nbS; + while (s > 0) { + while (k + s < n) { + for (j = 0; j <= s; j++) { + m[j] += data[k+j]; + sig[j] += data[k+j] * data[k+j]; + cov[j] += data[k] * data[k+j]; + } + k++; + } + + m[s] /= n - s; + sig[s] = sig[s] / (n - s) - m[s] * m[s]; + if (sig[s] <= 0) + sig[s] = 0; + else + sig[s] = sqrt(sig[s]); + m0 = m[0] / (n - s); + s0 = sqrt(sig[0] / (n - s) - m0 * m0); + cov[s] = cov[s] / (n - s) - (m[0] / (n - s)) * m[s]; + rho[s] = cov[s] / (sig[s] * s0); + s--; + } + + std::vector< std::vector > phi2; + phi2.resize(nbS+1); + for(unsigned int i=0; i + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 _moTestClass_h +#define _moTestClass_h + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include + +typedef eoBit bitVector; +typedef moBitNeighbor bitNeighbor; + +class moDummyRndNeighborhood: public moOrderNeighborhood , + public moRndNeighborhood { +public: + moDummyRndNeighborhood(unsigned int a) : + moOrderNeighborhood (a) { + } +}; + +typedef moDummyRndNeighborhood bitNeighborhood; + +typedef EO Solution; + +class moDummyNeighborTest: public moNeighbor { +public: + virtual void move(Solution & _solution) { + } +}; + +class moDummyBackableNeighbor: public moBackableNeighbor { +public: + virtual void move(Solution & _solution) { + } + virtual void moveBack(Solution & _solution) { + } +}; + +class moDummyNeighborhoodTest: public moNeighborhood { +public: + typedef moDummyNeighborTest Neighbor; + + moDummyNeighborhoodTest() : + i(0), j(0) { + } + + virtual bool hasNeighbor(EOT & _solution) { + bool res; + if (i % 3 == 0 || i == 1) + res = false; + else + res = true; + i++; + return res; + } + virtual void init(EOT & _solution, Neighbor & _current) { + } + virtual void next(EOT & _solution, Neighbor & _current) { + } + virtual bool cont(EOT & _solution) { + j++; + return (j % 10 != 0); + } + +private: + int i, j; +}; + +class moDummyEvalTest: public eoEvalFunc { +public: + void operator()(Solution& _sol) { + if (_sol.invalid()) + _sol.fitness(100); + else + _sol.fitness(_sol.fitness() + 50); + } +}; + +class evalOneMax: public moEval { +private: + unsigned size; + +public: + evalOneMax(unsigned _size) : + size(_size) { + } + ; + + ~evalOneMax(void) { + } + ; + + void operator()(bitVector& _sol, bitNeighbor& _n) { + unsigned int fit = _sol.fitness(); + if (_sol[_n.index()]) + fit--; + else + fit++; + _n.fitness(fit); + } +}; + +class dummyEvalOneMax: public moEval { +private: + unsigned size; + +public: + dummyEvalOneMax(unsigned _size) : + size(_size) { + } + ; + + ~dummyEvalOneMax(void) { + } + ; + + void operator()(bitVector& _sol, bitNeighbor& _n) { + unsigned int fit = _sol.fitness(); + _n.fitness(fit); + } +}; + +class monitor1: public eoMonitor { +public: + + monitor1(unsigned int& _a) : + a(_a) { + } + + eoMonitor& operator()() { + a++; + return *this; + } + + void lastCall() { + a++; + } + +private: + unsigned int& a; +}; + +class monitor2: public eoMonitor { +public: + + monitor2(unsigned int& _a) : + a(_a) { + } + + eoMonitor& operator()() { + a++; + return *this; + } + + void lastCall() { + a++; + } + +private: + unsigned int& a; +}; + +class updater1: public eoUpdater { +public: + updater1(unsigned int& _a) : + a(_a) { + } + + void operator()() { + a++; + } + + void lastCall() { + a++; + } + +private: + unsigned int& a; +}; + +class dummyInit: public eoInit { +public: + void operator()(bitVector& sol) { + } +}; + +class dummyInit2: public eoInit { + +public: + dummyInit2(unsigned int _size) : + size(_size) { + } + + void operator()(bitVector& sol) { + sol.resize(0); + for (unsigned int i = 0; i < size; i++) + sol.push_back(true); + } + +private: + unsigned int size; +}; + +#endif diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moAdaptiveWalkSampling.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moAdaptiveWalkSampling.cpp new file mode 100755 index 000000000..586624246 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moAdaptiveWalkSampling.cpp @@ -0,0 +1,77 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Boufaras Karima + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include +#include +#include +#include +#include + +int main() { + + std::cout << "[t-moAdaptiveWalkSampling] => START" << std::endl; + + bitNeighborhood nh(5); + oneMaxEval fullEval; + evalOneMax eval(5); + dummyInit2 init(5); + moIterContinuator cont(2); + + moAdaptiveWalkSampling test(init,nh,fullEval,eval,3); + moCounterStat stat2; + test.add(stat2); + + test(); + + std::vector res; + std::vector res2; + res = test.getValues(1); + res2= test.getSolutions(0); + + for (unsigned int i=0; i OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moAlwaysAcceptCrit.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moAlwaysAcceptCrit.cpp new file mode 100644 index 000000000..ab50c5f10 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moAlwaysAcceptCrit.cpp @@ -0,0 +1,51 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moAlwaysAcceptCrit] => START" << std::endl; + + bitVector sol1, sol2; + + moAlwaysAcceptCrit test; + + assert(test(sol1,sol2)); + + std::cout << "[t-moAlwaysAcceptCrit] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moAutocorrelationSampling.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moAutocorrelationSampling.cpp new file mode 100644 index 000000000..77733bbd2 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moAutocorrelationSampling.cpp @@ -0,0 +1,58 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include + +int main() { + + std::cout << "[t-moAutocorrelationSampling] => START" << std::endl; + + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + dummyInit2 init(4); + + moAutocorrelationSampling test(init, nh, fullEval, eval, 3); + + test(); + + test.fileExport("outputTestAutocorrelationSampling"); + + + std::cout << "[t-moAutocorrelationSampling] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moBestImprAspiration.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moBestImprAspiration.cpp new file mode 100644 index 000000000..cd2de284d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moBestImprAspiration.cpp @@ -0,0 +1,78 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ +#include +#include "moTestClass.h" + +#include +#include +#include + +int main() { + + std::cout << "[t-moBestImprAspiration] => START" << std::endl; + + moBestImprAspiration test; + eoBit sol1(4); + eoBit sol2(4); + eoBit sol3(4); + eoBit sol4(4); + bitNeighbor n1; + bitNeighbor n2; + bitNeighbor n3; + bitNeighbor n4; + + sol3[0]=true; + sol4[3]=true; + + sol1.fitness(4); + sol2.fitness(5); + sol3.fitness(3); + sol4.fitness(3); + n1.fitness(4); + n2.fitness(5); + n3.fitness(3); + n4.fitness(3); + + + //verification qu'on update bien le best so far quand il faut + test.init(sol1); + assert(test.getBest()==sol1); + assert(!test(sol2,n2)); + assert(test(sol3,n3)); + test.update(sol3,n3); + assert(test.getBest()==sol3); + assert(!test(sol4,n4)); + test.update(sol4,n4); + assert(test.getBest()==sol3); + + std::cout << "[t-moBestImprAspiration] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moBetterAcceptCrit.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moBetterAcceptCrit.cpp new file mode 100644 index 000000000..acd528598 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moBetterAcceptCrit.cpp @@ -0,0 +1,61 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moBetterAcceptCrit] => START" << std::endl; + + bitVector sol1, sol2, sol3; + + sol1.fitness(2); + sol2.fitness(3); + sol3.fitness(3); + + moSolComparator comparator; + + moBetterAcceptCrit test(comparator); + + assert(test(sol2, sol1)); + assert(!test(sol1, sol2)); + assert(!test(sol2, sol3)); + + + std::cout << "[t-moBetterAcceptCrit] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moBitNeighbor.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moBitNeighbor.cpp new file mode 100644 index 000000000..71ac6bca7 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moBitNeighbor.cpp @@ -0,0 +1,85 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 +*/ + +#include + +#include +#include + +int main() { + + std::cout << "[t-moBitNeighbor] => START" << std::endl; + + //init sol + eoBit sol; + sol.push_back(true); + sol.push_back(false); + sol.push_back(true); + + //verif du constructeur vide + moBitNeighbor test1; + assert(test1.index()==0); + + //verif du setter d'index et du constructeur de copy + test1.index(6); + test1.fitness(2); + moBitNeighbor test2(test1); + assert(test2.index()==6); + assert(test2.fitness()==2); + + //verif du getter + assert(test1.index()==6); + + //verif de l'operateur= + test1.fitness(8); + test1.index(2); + test2=test1; + assert(test2.fitness()==8); + assert(test2.index()==2); + + //verif de move + test2.move(sol); + assert(!sol[2]); + + //verif de moveBack + test2.moveBack(sol); + assert(sol[2]); + + test1.printOn(std::cout); + test2.printOn(std::cout); + + assert(test1.className()=="moBitNeighbor"); + std::cout << "[t-moBitNeighbor] => OK" << std::endl; + return EXIT_SUCCESS; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCheckpoint.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCheckpoint.cpp new file mode 100644 index 000000000..e080b9a7b --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCheckpoint.cpp @@ -0,0 +1,122 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include +#include "moTestClass.h" + +#include +#include +#include + +int main() { + + std::cout << "[t-moCheckpoint] => START" << std::endl; + + unsigned int a=2; + unsigned int b=15; + unsigned int c= 10; + unsigned int d= 47; + + eoBit s(3); + s[0]=true; + s[1]=true; + s[2]=false; + + s.fitness(17); + + + //verification que toutes les operateurs sont bien apellés + moSolutionStat< eoBit< eoMinimizingFitness > > stat; + updater1 up1(a); + updater1 up2(b); + monitor1 mon1(c); + monitor2 mon2(d); + moTrueContinuator< bitNeighbor > cont; + + moCheckpoint< bitNeighbor > test1(cont); + moCheckpoint< bitNeighbor > test2(cont, 3); + + test1.add(up1); + test1.add(up2); + test1.add(mon1); + test1.add(mon2); + test1.add(stat); + + test2.add(up1); + test2.add(up2); + test2.add(mon1); + test2.add(mon2); + test2.add(stat); + + test1.init(s); + test1(s); + assert(a==3 && b==16 && c==12 && d==49); + assert(stat.value()[0]); + assert(stat.value()[1]); + assert(!stat.value()[2]); + assert(stat.value().fitness()==17); + + test1(s); + assert(a==4 && b==17 && c==13 && d==50); + assert(stat.value()[0]); + assert(stat.value()[1]); + assert(!stat.value()[2]); + assert(stat.value().fitness()==17); + + s.fitness(4); + + test2.init(s); + test2(s); + assert(a==5 && b==18 && c==15 && d==52); + assert(stat.value()[0]); + assert(stat.value()[1]); + assert(!stat.value()[2]); + assert(stat.value().fitness()==4); + + s.fitness(6); + test2(s); + assert(stat.value().fitness()==4); + test2(s); + assert(stat.value().fitness()==6); + test2(s); + assert(stat.value().fitness()==6); + + test1.lastCall(s); + assert(a==9 && b==22 && c==19 && d==56); + test2.lastCall(s); + assert(a==10 && b==23 && c==20 && d==57); + + assert(test1.className()=="moCheckpoint"); + std::cout << "[t-moCheckpoint] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCombinedContinuator.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCombinedContinuator.cpp new file mode 100644 index 000000000..7cbeb1229 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCombinedContinuator.cpp @@ -0,0 +1,65 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include +#include +#include "moTestClass.h" + + +int main() { + + std::cout << "[t-moCombinedContinuator] => START" << std::endl; + + moIterContinuator cont1(3, false); + moTrueContinuator cont2; + + moCombinedContinuator test(cont2); + test.add(cont1); + + Solution s; + + test.init(s); + assert(test(s)); + assert(test(s)); + assert(!test(s)); + test.init(s); + assert(test(s)); + assert(test(s)); + assert(!test(s)); + + std::cout << "[t-moCombinedContinuator] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCountMoveMemory.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCountMoveMemory.cpp new file mode 100644 index 000000000..403970835 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCountMoveMemory.cpp @@ -0,0 +1,91 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moCountMoveMemory] => START" << std::endl; + + bitVector sol; + bitNeighbor n; + + + moCountMoveMemory test; + + test.init(sol); + assert(test.getNbMove()==0); + assert(test.getNbNoMove()==0); + assert(test.getCounter()==0); + + test.add(sol,n); + assert(test.getNbMove()==1); + assert(test.getNbNoMove()==0); + assert(test.getCounter()==0); + + test.add(sol,n); + assert(test.getNbMove()==2); + assert(test.getNbNoMove()==0); + assert(test.getCounter()==0); + + test.update(sol,n); + assert(test.getNbMove()==2); + assert(test.getNbNoMove()==1); + assert(test.getCounter()==1); + + test.add(sol,n); + assert(test.getNbMove()==3); + assert(test.getNbNoMove()==1); + assert(test.getCounter()==0); + + test.update(sol,n); + assert(test.getNbMove()==3); + assert(test.getNbNoMove()==2); + assert(test.getCounter()==1); + + test.update(sol,n); + assert(test.getNbMove()==3); + assert(test.getNbNoMove()==3); + assert(test.getCounter()==2); + + test.clearMemory(); + assert(test.getNbMove()==0); + assert(test.getNbNoMove()==0); + assert(test.getCounter()==0); + + std::cout << "[t-moCountMoveMemory] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCounterMonitorSaver.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCounterMonitorSaver.cpp new file mode 100644 index 000000000..2672be7f3 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCounterMonitorSaver.cpp @@ -0,0 +1,71 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include "moTestClass.h" + +#include +#include +#include + + +int main() { + + std::cout << "[t-moCounterMonitorSaver] => START" << std::endl; + + unsigned int a=1; + unsigned int b=10; + + monitor1 mon1(a); + monitor2 mon2(b); + + moCounterMonitorSaver test(3, mon1); + test.add(mon2); + + //on verifie qu'on apelle les moniteurs seulement tout les 3 itération + + test(); + assert(a==2 && b==11); + test(); + assert(a==2 && b==11); + test(); + assert(a==2 && b==11); + test(); + assert(a==3 && b==12); + + //test du lastCall + test.lastCall(); + assert(a==4 && b==13); + + assert(test.className()=="moCounterMonitorSaver"); + std::cout << "[t-moCounterMonitorSaver] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCounterStat.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCounterStat.cpp new file mode 100644 index 000000000..08ce62b8e --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moCounterStat.cpp @@ -0,0 +1,62 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include + +int main() { + + std::cout << "[t-moCounterStat] => START" << std::endl; + + moCounterStat test; + + int a=3; + + test.init(a); + assert(test.value()==0); + a=5; + test(a); + assert(test.value()==1); + a=-3; + test(a); + assert(test.value()==2); + a=-12; + test.init(a); + assert(test.value()==0); + + assert(test.className()=="moCounterStat"); + + std::cout << "[t-moCounterStat] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDensityOfStatesSampling.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDensityOfStatesSampling.cpp new file mode 100644 index 000000000..adc97bb27 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDensityOfStatesSampling.cpp @@ -0,0 +1,54 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include + +int main() { + + std::cout << "[t-moDensityOfStatesSampling] => START" << std::endl; + + oneMaxEval fullEval; + dummyInit2 init(4); + + moDensityOfStatesSampling test(init, fullEval, 3); + test(); + + test.fileExport("outputTestDensityOfState"); + + std::cout << "[t-moDensityOfStatesSampling] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDistanceStat.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDistanceStat.cpp new file mode 100644 index 000000000..c14971756 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDistanceStat.cpp @@ -0,0 +1,73 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include +#include + +int main() { + + std::cout << "[t-moDistanceStat] => START" << std::endl; + + eoBit sol1; + eoBit sol2; + eoBit sol3; + sol1.push_back(true); + sol1.push_back(false); + sol1.push_back(true); + + sol2.push_back(true); + sol2.push_back(true); + sol2.push_back(false); + + sol3.push_back(true); + sol3.push_back(true); + sol3.push_back(true); + + //verification de la stat avec une distance de Hamming + + eoHammingDistance< eoBit > dist; + + moDistanceStat< eoBit > test(dist, sol1); + + test(sol2); + assert(test.value()==2); + test(sol3); + assert(test.value()==1); + + assert(test.className()=="moDistanceStat"); + std::cout << "[t-moDistanceStat] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyEval.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyEval.cpp new file mode 100644 index 000000000..5f618b4e5 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyEval.cpp @@ -0,0 +1,46 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moDummyEval] => START" << std::endl; + + moDummyEval test; + + std::cout << "[t-moDummyEval] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyExplorer.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyExplorer.cpp new file mode 100644 index 000000000..8a3791698 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyExplorer.cpp @@ -0,0 +1,49 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moDummyExplorer] => START" << std::endl; + + moDummyExplorer test; + + assert(test.className()=="moDummyExplorer"); + + std::cout << "[t-moDummyExplorer] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyLS.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyLS.cpp new file mode 100644 index 000000000..c1204757f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyLS.cpp @@ -0,0 +1,51 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include + +int main() { + + std::cout << "[t-moDummyLS] => START" << std::endl; + + oneMaxEval fullEval; + moDummyLS test(fullEval); + + assert(test.className()=="moDummyLS"); + + std::cout << "[t-moDummyLS] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyMemory.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyMemory.cpp new file mode 100644 index 000000000..4dcda2bc1 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyMemory.cpp @@ -0,0 +1,63 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include "moTestClass.h" + +#include +#include +#include + +int main() { + + std::cout << "[t-moDummyMemory] => START" << std::endl; + + eoBit sol(4); + bitNeighbor n; + moDummyDiversification test1; + test1.init(sol); + test1.add(sol, n); + test1.update(sol, n); + test1.clearMemory(); + assert(!test1(sol)); + + moDummyIntensification test2; + test2.init(sol); + test2.add(sol, n); + test2.update(sol, n); + test2.clearMemory(); + assert(!test2(sol)); + + + std::cout << "[t-moDummyMemory] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyNeighbor.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyNeighbor.cpp new file mode 100644 index 000000000..cd60ddb01 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyNeighbor.cpp @@ -0,0 +1,46 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moDummyNeighbor] => START" << std::endl; + + moDummyNeighbor test; + + std::cout << "[t-moDummyNeighbor] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyNeighborhood.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyNeighborhood.cpp new file mode 100644 index 000000000..c38083873 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDummyNeighborhood.cpp @@ -0,0 +1,56 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include +#include +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moDummyNeighborhood] => START" << std::endl; + + bitVector sol; + moDummyNeighbor n; + + moDummyNeighborhood > test; + + assert(!test.hasNeighbor(sol)); + assert(!test.cont(sol)); + test.init(sol,n); + test.next(sol,n); + + + std::cout << "[t-moDummyNeighborhood] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDynSpanCoolingSchedule.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDynSpanCoolingSchedule.cpp new file mode 100755 index 000000000..7bef4ad59 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moDynSpanCoolingSchedule.cpp @@ -0,0 +1,91 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 + */ + +#include +#include +#include + +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moDynSpanCoolingSchedule] => START" << std::endl; + + double temperature; + + bitVector sol; + + moDynSpanCoolingSchedule test(100, 0.1, 3, 2, 2); + + temperature = test.init(sol); + assert(temperature == 100); + + //temperature must not changed 2* + test.update(temperature, 0); + assert(temperature == 100); + assert(test(temperature)); + test.update(temperature, 0); + assert(temperature == 100); + assert(test(temperature)); + + //then temperature must be /10 + test.update(temperature, 0); + assert(temperature == 10); + assert(test(temperature)); + test.update(temperature, 0); + assert(temperature == 10); + assert(test(temperature)); + test.update(temperature, 0); + assert(temperature == 10); + assert(test(temperature)); + + test.update(temperature, 0); + assert(temperature == 1); + std::cout << "\n"; + assert(test(temperature)); + test.update(temperature, 0); + std::cout << "\n"; + assert(temperature == 1); + assert(test(temperature)); + test.update(temperature, 0); + std::cout << "\n"; + assert(temperature == 1); + assert(test(temperature)); + + test.update(temperature, 0); + assert(temperature == 0.1); + assert(!test(temperature)); + + + std::cout << "[t-moDynSpanCoolingSchedule] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moEvalCounter.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moEvalCounter.cpp new file mode 100644 index 000000000..000a6d5ba --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moEvalCounter.cpp @@ -0,0 +1,66 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moEvalCounter] => START" << std::endl; + + evalOneMax eval(4); + bitVector sol; + sol.resize(4); + sol[0]=true; + sol[1]=false; + sol[2]=true; + sol[3]=true; + sol.fitness(3); + bitNeighbor n; + n.index(2); + + moEvalCounter test(eval); + + test(sol,n); + assert(test.value()==1); + assert(n.fitness()==2); + n.index(1); + test(sol,n); + assert(test.value()==2); + assert(n.fitness()==4); + + std::cout << "[t-moEvalCounter] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFDCsampling.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFDCsampling.cpp new file mode 100644 index 000000000..34da40c43 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFDCsampling.cpp @@ -0,0 +1,61 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + + +#include +#include "moTestClass.h" +#include +#include + +int main() { + + std::cout << "[t-moFDCsampling] => START" << std::endl; + + oneMaxEval fullEval; + dummyInit2 init(4); + eoHammingDistance dist; + bitVector sol(4, false); + sol.fitness(0); + + + moFDCsampling test(init, fullEval, dist, sol, 3); + + test(); + + test.fileExport("outputTestFDCsampling"); + + std::cout << "[t-moFDCsampling] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFirstImprHC.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFirstImprHC.cpp new file mode 100644 index 000000000..e92984567 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFirstImprHC.cpp @@ -0,0 +1,64 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include +#include +#include + +int main() { + + std::cout << "[t-moFirstImprHC] => START" << std::endl; + + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + + //test first constructor + moFirstImprHC test1(nh, fullEval, eval); + + //test second constructor + moTrueContinuator cont; + moFirstImprHC test2(nh, fullEval, eval, cont); + + //test third constructor + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; + moFirstImprHC test3(nh, fullEval, eval, cont, ncomp, sncomp); + + std::cout << "[t-moFirstImprHC] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFirstImprHCexplorer.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFirstImprHCexplorer.cpp new file mode 100644 index 000000000..d8b28c3f0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFirstImprHCexplorer.cpp @@ -0,0 +1,93 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include +#include "moTestClass.h" + +#include +#include +#include + +int main() { + + std::cout << "[t-moFirstImprHCexplorer] => START" << std::endl; + + //Instanciation + eoBit sol(4, true); + sol.fitness(4); + bitNeighborhood nh(4); + evalOneMax eval(4); + moNeighborComparator ncomp; + moSolNeighborComparator sncomp; + + moFirstImprHCexplorer test(nh, eval, ncomp, sncomp); + + //on verifie qu'on améliore peut continuer à explorer tant qu'on améliore la solution + + test(sol); + assert(test.accept(sol)); + test.move(sol); + assert(sol.fitness()==3); + assert(!sol[0]); + assert(test.isContinue(sol)); + + + test(sol); + assert(test.accept(sol)); + test.move(sol); + assert(sol.fitness()==2); + assert(!sol[1]); + assert(test.isContinue(sol)); + + test(sol); + assert(test.accept(sol)); + test.move(sol); + assert(sol.fitness()==1); + assert(!sol[2]); + assert(test.isContinue(sol)); + + test(sol); + assert(test.accept(sol)); + test.move(sol); + assert(sol.fitness()==0); + assert(!sol[3]); + assert(test.isContinue(sol)); + + test(sol); + assert(!test.accept(sol)); + assert(sol.fitness()==0); + assert(!test.isContinue(sol)); + + std::cout << "[t-moFirstImprHCexplorer] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFitContinuator.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFitContinuator.cpp new file mode 100644 index 000000000..34e686444 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFitContinuator.cpp @@ -0,0 +1,61 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moFitContinuator] => START" << std::endl; + + moFitContinuator test1(3); + moFitContinuator test2(5); + + bitVector sol1; + Solution sol2; + + sol1.fitness(4); + assert(test1(sol1)); + sol1.fitness(3); + assert(!test1(sol1)); + + sol2.fitness(3); + assert(test2(sol2)); + sol2.fitness(5); + assert(!test2(sol2)); + + std::cout << "[t-moFitContinuator] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFitnessCloudSampling.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFitnessCloudSampling.cpp new file mode 100644 index 000000000..ae2392d5a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFitnessCloudSampling.cpp @@ -0,0 +1,75 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include "moTestClass.h" +#include + + +int main() { + + std::cout << "[t-moFitnessCloudSampling] => START" << std::endl; + + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + dummyInit2 init(4); + + moFitnessCloudSampling test1(init, nh, fullEval, eval, 3); + + moRndRndFitnessCloudSampling test2(init, nh, fullEval, eval, 3); + + moRndBestFitnessCloudSampling test3(init, nh, fullEval, eval, 3); + + moMHRndFitnessCloudSampling test4(init, nh, fullEval, eval, 3); + + moMHBestFitnessCloudSampling test5(init, nh, fullEval, eval, 3); + + test1(); + test2(); + test3(); + test4(); + test5(); + + test1.fileExport("outputTestFitnessCloudSampling"); + + + std::cout << "[t-moFitnessCloudSampling] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFitnessStat.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFitnessStat.cpp new file mode 100644 index 000000000..f243d1e19 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFitnessStat.cpp @@ -0,0 +1,57 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include + +#include +#include +#include + +int main() { + + std::cout << "[t-moFitnessStat] => START" << std::endl; + + eoBit sol; + + moFitnessStat< eoBit > test; + sol.fitness(3); + test(sol); + assert(test.value()==3); + + sol.fitness(12); + test(sol); + assert(test.value()==12); + + assert(test.className()=="moFitnessStat"); + std::cout << "[t-moFitnessStat] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFullEvalByCopy.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFullEvalByCopy.cpp new file mode 100644 index 000000000..b487c6751 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFullEvalByCopy.cpp @@ -0,0 +1,63 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 +*/ + +#include "moTestClass.h" +#include + +#include +#include + +int main() { + + //Pas grand chose à faire: le gros du travail est fait par le voisin et l'eval + + std::cout << "[t-moFullEvalByCopy] => START" << std::endl; + + Solution sol; + moDummyNeighborTest neighbor; + moDummyEvalTest eval; + + //verif constructor + moFullEvalByCopy test(eval); + + sol.fitness(3); + + //verif operator() + test(sol,neighbor); + assert(sol.fitness()==3); + + std::cout << "[t-moFullEvalByCopy] => OK" << std::endl; + + return EXIT_SUCCESS; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFullEvalByModif.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFullEvalByModif.cpp new file mode 100644 index 000000000..b52813c37 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFullEvalByModif.cpp @@ -0,0 +1,63 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 +*/ + +#include "moTestClass.h" +#include + +#include +#include + +int main() { + + //Pas grand chose à faire: le gros du travail est fait par le voisin et l'eval + + std::cout << "[t-moFullEvalByModif] => START" << std::endl; + + Solution sol; + moDummyBackableNeighbor neighbor; + moDummyEvalTest eval; + + //verif constructor + moFullEvalByModif test(eval); + + sol.fitness(3); + + //verif operator() + test(sol,neighbor); + assert(sol.fitness()==3); + + std::cout << "[t-moFullEvalByModif] => OK" << std::endl; + + return EXIT_SUCCESS; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFullEvalContinuator.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFullEvalContinuator.cpp new file mode 100644 index 000000000..78164608a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moFullEvalContinuator.cpp @@ -0,0 +1,70 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moFullEvalContinuator] => START" << std::endl; + + oneMaxEval fullEval; + eoEvalFuncCounter evalCount(fullEval); + moFullEvalContinuator test(evalCount, 3); + + bitVector sol; + sol.push_back(1); + + + test.init(sol); + evalCount(sol); + sol.invalidate(); + assert(test.value()==1); + evalCount(sol); + sol.invalidate(); + assert(test.value()==2); + assert(test(sol)); + evalCount(sol); + sol.invalidate(); + assert(test.value()==3); + assert(!test(sol)); + test.init(sol); + assert(test.value()==0); + assert(test(sol)); + + std::cout << "[t-moFullEvalContinuator] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moHillClimberSampling.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moHillClimberSampling.cpp new file mode 100644 index 000000000..0dcb6d950 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moHillClimberSampling.cpp @@ -0,0 +1,57 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include + +int main() { + + std::cout << "[t-moHillClimberSampling] => START" << std::endl; + + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + dummyInit2 init(4); + + moHillClimberSampling test(init, nh, fullEval, eval, 3); + + test(); + + test.fileExport("outputTestHillClimberSampling"); + + std::cout << "[t-moHillClimberSampling] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moILS.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moILS.cpp new file mode 100644 index 000000000..42f7b3f36 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moILS.cpp @@ -0,0 +1,79 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include +#include "moTestClass.h" +#include +#include +#include +#include +#include +#include + +class dummyMonOp: public eoMonOp { +public: + bool operator()(bitVector&) { + return false; + } +}; + +int main() { + + std::cout << "[t-moILS] => START" << std::endl; + + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + + moTS ts(nh, fullEval, eval, 1, 7); + + dummyMonOp op; + + //basic constructor + moILS test1(ts, fullEval, op, 3); + + //simple constructor + moTrueContinuator > cont; + moILS test2(ts, fullEval, op, cont); + + //general constructor + moMonOpPerturb perturb(op, fullEval); + moAlwaysAcceptCrit accept; + moILS test3(ts, fullEval, cont, perturb, accept); + + std::cout << "[t-moILS] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moILSexplorer.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moILSexplorer.cpp new file mode 100644 index 000000000..ae86ac87c --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moILSexplorer.cpp @@ -0,0 +1,98 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 + */ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include +#include +#include +#include +#include +#include +#include + +class dummyMonOp: public eoMonOp { + + bool operator()(bitVector& _sol) { + _sol[0] = !_sol[0]; + return true; + } + +}; + +int main() { + + std::cout << "[t-moILSexplorer] => START" << std::endl; + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + + bitVector sol(4, true); + fullEval(sol); + + //test first constructor + moSimpleHC ls(nh, fullEval, eval); + + dummyMonOp op; + moMonOpPerturb perturb(op, fullEval); + + moAlwaysAcceptCrit accept; + + moILSexplorer test(ls, perturb, accept); + + assert(test.className() == "moILSexplorer"); + assert(test.isContinue(sol)); + assert(test.accept(sol)); + + test.initParam(sol); + test.moveApplied(true); + test.updateParam(sol); + test.moveApplied(false); + test.updateParam(sol); + test.terminate(sol); + + test.initParam(sol); + test(sol); + test.move(sol); + + for (unsigned int i = 0; i < sol.size(); i++) + assert(!sol[i]); + assert(sol.fitness() == 0); + + test(sol); + + std::cout << "[t-moILSexplorer] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moIndexedVectorTabuList.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moIndexedVectorTabuList.cpp new file mode 100755 index 000000000..d29b3bc3e --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moIndexedVectorTabuList.cpp @@ -0,0 +1,95 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 + */ + +#include +#include "moTestClass.h" + +#include +#include +#include + +int main() { + + std::cout << "[t-moIndexedVectorTabuList] => START" << std::endl; + + moIndexedVectorTabuList test(4, 1); + bitNeighbor n1; + bitNeighbor n2; + bitNeighbor n3; + bitNeighbor n4; + n1.index(0); + n2.index(1); + n3.index(2); + n4.index(3); + + eoBit sol1(4, true); + eoBit sol2(4, true); + sol2[0]=false; + + //init + test.init(sol1); + + //ajout d'un voisin tabu + test.add(sol1, n1); + + //verification des voisins + assert(test.check(sol1, n1)); + assert(!test.check(sol1, n2)); + assert(!test.check(sol1, n3)); + assert(!test.check(sol1, n4)); + + assert(test.check(sol2, n1)); + assert(!test.check(sol2, n2)); + assert(!test.check(sol2, n3)); + assert(!test.check(sol2, n4)); + + test.update(sol1, n1); + test.add(sol1, n2); + test.add(sol1, n3); + test.add(sol1, n4); + + assert(!test.check(sol1, n1)); + assert(test.check(sol1, n2)); + assert(test.check(sol1, n3)); + assert(test.check(sol1, n4)); + + test.update(sol1, n2); + test.update(sol1, n3); + test.update(sol1, n4); + + assert(!test.check(sol1, n2)); + assert(!test.check(sol1, n3)); + assert(!test.check(sol1, n4)); + + + std::cout << "[t-moIndexedVectorTabuList] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moIterContinuator.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moIterContinuator.cpp new file mode 100644 index 000000000..871ffeb90 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moIterContinuator.cpp @@ -0,0 +1,61 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moIterContinuator] => START" << std::endl; + + moIterContinuator test(3, false); + moIterContinuator test2(3); + Solution s; + + test.init(s); + assert(test.value()==0); + assert(test(s)); + assert(test.value()==1); + assert(test(s)); + assert(test.value()==2); + assert(!test(s)); + assert(test.value()==3); + test.init(s); + assert(test.value()==0); + + + std::cout << "[t-moIterContinuator] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moLocalSearch.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moLocalSearch.cpp new file mode 100644 index 000000000..4d3f3753d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moLocalSearch.cpp @@ -0,0 +1,70 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moLocalSearch] => START" << std::endl; + + + + bitNeighborhood nh(8); + oneMaxEval fullEval; + evalOneMax eval(8); + moTrueContinuator cont; + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; + moSimpleHCexplorer explorer(nh, eval, ncomp, sncomp); + moLocalSearch test(explorer, cont, fullEval); + + bitVector sol(8, true); + + test(sol); + + assert(sol.fitness()==0); + for (unsigned int i=0; i OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moLocalSearchInit.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moLocalSearchInit.cpp new file mode 100644 index 000000000..1f23c8724 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moLocalSearchInit.cpp @@ -0,0 +1,58 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include +#include "moTestClass.h" +#include + + +int main() { + + std::cout << "[t-moLocalSearchInit] => START" << std::endl; + + oneMaxEval fullEval; + moDummyLS ls(fullEval); + dummyInit init; + bitVector sol; + sol.fitness(0); + + moLocalSearchInit test(init, ls); + + test(sol); + + std::cout << "[t-moLocalSearchInit] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMetropolisHasting.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMetropolisHasting.cpp new file mode 100644 index 000000000..638c64bd8 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMetropolisHasting.cpp @@ -0,0 +1,65 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include +#include +#include +#include + +int main() { + + std::cout << "[t-moMetropolisHasting] => START" << std::endl; + + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + moTrueContinuator cont; + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; + + //test du 1er constructeur + moMetropolisHasting test1(nh, fullEval, eval, 3); + + //test du 2eme constructeur + moMetropolisHasting test2(nh, fullEval, eval, 3, cont); + + //test du 3eme constructeur + moMetropolisHasting test3(nh, fullEval, eval, 3, cont, ncomp, sncomp); + + std::cout << "[t-moMetropolisHasting] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMetropolisHastingExplorer.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMetropolisHastingExplorer.cpp new file mode 100644 index 000000000..6214465a1 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMetropolisHastingExplorer.cpp @@ -0,0 +1,97 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include "moTestClass.h" + +#include +#include +#include + +int main() { + + std::cout << "[t-moMetropolisHastingExplorer] => START" << std::endl; + + //Instanciation + eoBit sol(4, true); + sol.fitness(4); + bitNeighborhood nh(4); + evalOneMax eval(4); + moNeighborComparator ncomp; + moSolNeighborComparator sncomp; + + moMetropolisHastingExplorer test(nh, eval, ncomp, sncomp, 3); + + //test de l'acceptation d'un voisin améliorant + test.initParam(sol); + test(sol); + assert(test.accept(sol)); + test.move(sol); + assert(sol.fitness()==3); + test.updateParam(sol); + assert(test.isContinue(sol)); + + unsigned int oui=0, non=0; + + //test de l'acceptation d'un voisin non améliorant + for (unsigned int i=0; i<1000; i++) { + test(sol); + if (test.accept(sol)) + oui++; + else + non++; + } + std::cout << "Attention test en fonction d'une proba \"p\" uniforme dans [0,1] , oui si p < 3/4, non sinon -> resultat sur 1000 essai" << std::endl; + std::cout << "oui: " << oui << std::endl; + std::cout << "non: " << non << std::endl; + + assert(oui > 700 && oui < 800); //verification grossiere + + //test du critere d'arret + test.updateParam(sol); + assert(test.isContinue(sol)); + test.updateParam(sol); + assert(!test.isContinue(sol)); + + //test de l'acceptation d'un voisin + sol[0]=false; + sol[1]=false; + sol[2]=false; + sol[3]=false; + sol.fitness(0); + + test.initParam(sol); + test(sol); + assert(!test.accept(sol)); + + std::cout << "[t-moMetropolisHastingExplorer] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMinusOneCounterStat.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMinusOneCounterStat.cpp new file mode 100644 index 000000000..567d610bd --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMinusOneCounterStat.cpp @@ -0,0 +1,64 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include + +int main() { + + std::cout << "[t-moMinusOneCounterStat] => START" << std::endl; + + moMinusOneCounterStat test; + + int a=3; + + test.init(a); + assert(test.value()==0); + a=5; + test(a); + assert(test.value()==0); + a=-3; + test(a); + assert(test.value()==1); + a=-12; + test(a); + assert(test.value()==2); + test.init(a); + assert(test.value()==0); + + assert(test.className()=="moMinusOneCounterStat"); + + std::cout << "[t-moMinusOneCounterStat] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMonOpDiversification.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMonOpDiversification.cpp new file mode 100644 index 000000000..6c83ec08b --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMonOpDiversification.cpp @@ -0,0 +1,74 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include + +#include +#include "moTestClass.h" +#include + + +class dummyMonOp: public eoMonOp { + + bool operator()(bitVector& _sol) { + _sol[0]=!_sol[0]; + return true; + } + +}; + +int main() { + + std::cout << "[t-moMonOpDiversification] => START" << std::endl; + + dummyMonOp op; + oneMaxEval eval; + + bitVector sol; + sol.push_back(1); + sol.push_back(0); + sol.push_back(1); + + sol.fitness(5); + + moMonOpDiversification test(op, eval); + + test(sol); + + assert(sol.fitness()==1); + + std::cout << "[t-moMonOpDiversification] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMonOpPerturb.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMonOpPerturb.cpp new file mode 100644 index 000000000..c56394674 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moMonOpPerturb.cpp @@ -0,0 +1,74 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include +#include + +#include +#include "moTestClass.h" +#include + + +class dummyMonOp: public eoMonOp { + + bool operator()(bitVector& _sol) { + _sol[0]=!_sol[0]; + return true; + } + +}; + +int main() { + + std::cout << "[t-moMonOpPerturb] => START" << std::endl; + + dummyMonOp op; + oneMaxEval eval; + + bitVector sol; + sol.push_back(1); + sol.push_back(0); + sol.push_back(1); + + sol.fitness(5); + + moMonOpPerturb test(op, eval); + + test(sol); + + assert(sol.fitness()==1); + + + std::cout << "[t-moMonOpPerturb] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighbor.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighbor.cpp new file mode 100644 index 000000000..ddf324941 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighbor.cpp @@ -0,0 +1,64 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 +*/ + +#include "moTestClass.h" + +#include +#include + +int main() { + + std::cout << "[t-moNeighbor] => START" << std::endl; + + //test constructor + moDummyNeighborTest test1, test2; + + test1.fitness(3); + //test operateur d'affectation + test2=test1; + assert(test1.fitness()==test2.fitness()); + + //test operateur de copy + moDummyNeighborTest test3(test1); + assert(test1.fitness()==test3.fitness()); + + test1.printOn(std::cout); + test2.printOn(std::cout); + test3.printOn(std::cout); + + assert(test1.className()=="moNeighbor"); + std::cout << "[t-moNeighbor] => OK" << std::endl; + + return EXIT_SUCCESS; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborBestStat.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborBestStat.cpp new file mode 100644 index 000000000..f35f74cdb --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborBestStat.cpp @@ -0,0 +1,74 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moNeighborBestStat] => START" << std::endl; + + bitNeighborhood nh(4); + bitNeighborhood emptyNH(0); + evalOneMax eval(4); + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; + + moNeighborBestStat test1(nh, eval, ncomp, sncomp, 1); + moNeighborBestStat test2(nh, eval); + moNeighborBestStat test3(emptyNH, eval); + + bitVector sol(4, true); + sol.fitness(4); + + test1.init(sol); + assert(test1.value()==3); + + sol[0]=false; + sol.fitness(3); + test1(sol); + assert(test1.value()==4); + + test2(sol); + assert(test2.value()==2); + + test3(sol); + assert(test3.value()==int()); + + assert(test1.className()=="moNeighborBestStat"); + + std::cout << "[t-moNeighborBestStat] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborComparator.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborComparator.cpp new file mode 100644 index 000000000..cbdb3e4df --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborComparator.cpp @@ -0,0 +1,68 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 +*/ + +#include +#include +#include +#include + +#include +#include + +int main() { + + std::cout << "[t-moNeighborComparator] => START" << std::endl; + + + moBitNeighbor neighbor1; + moBitNeighbor neighbor2; + + moNeighborComparator< moBitNeighbor > test; + + neighbor1.fitness(3); + neighbor2.fitness(2); + //test with a minimizing fitness neighbor2 must be better than neighbor1 and reversly + assert(test(neighbor1, neighbor2)); + assert(!test(neighbor2, neighbor1)); + + //test equals + assert(!test.equals(neighbor1,neighbor2)); + + neighbor2.fitness(3); + assert(test.equals(neighbor1,neighbor2)); + + assert(test.className()=="moNeighborComparator"); + std::cout << "[t-moNeighborComparator] => OK" << std::endl; + return EXIT_SUCCESS; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborEvalContinuator.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborEvalContinuator.cpp new file mode 100644 index 000000000..b2671786d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborEvalContinuator.cpp @@ -0,0 +1,69 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moNeighborEvalContinuator] => START" << std::endl; + + evalOneMax moEval(2); + moEvalCounter evalCount(moEval); + moNeighborEvalContinuator test(evalCount, 3); + + bitVector sol; + sol.push_back(true); + sol.push_back(false); + + bitNeighbor n; + sol.fitness(1); + + test.init(sol); + evalCount(sol,n); + assert(test.value()==1); + evalCount(sol,n); + assert(test.value()==2); + assert(test(sol)); + evalCount(sol,n); + assert(test.value()==3); + assert(!test(sol)); + test.init(sol); + assert(test.value()==0); + assert(test(sol)); + + std::cout << "[t-moNeighborEvalContinuator] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborFitnessStat.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborFitnessStat.cpp new file mode 100644 index 000000000..a85408c09 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborFitnessStat.cpp @@ -0,0 +1,66 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moNeighborFitnessStat] => START" << std::endl; + + bitNeighborhood nh(4); + bitNeighborhood nh2(0); + evalOneMax eval(4); + + moNeighborFitnessStat test(nh, eval); + moNeighborFitnessStat test2(nh2, eval); + + bitVector sol(4, true); + sol.fitness(4); + test.init(sol); + assert(test.value()==3); + test(sol); + assert(test.value()==3); + + test2.init(sol); + sol.fitness(3); + test2(sol); + assert(test2.value()==int()); + + assert(test.className()=="moNeighborFitnessStat"); + + std::cout << "[t-moNeighborFitnessStat] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborVectorTabuList.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborVectorTabuList.cpp new file mode 100644 index 000000000..097966002 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborVectorTabuList.cpp @@ -0,0 +1,104 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include "moTestClass.h" + +#include +#include +#include + +int main() { + + std::cout << "[t-moNeighborVectorTabuList] => START" << std::endl; + + //tabu list of size 2 (neighbor are always tabu) + moNeighborVectorTabuList test(2,0); + + + bitVector sol(4,true); + sol.fitness(0); + bitNeighbor n1; + bitNeighbor n2; + bitNeighbor n3; + bitNeighbor n4; + n1.index(0); + n2.index(1); + n3.index(2); + n4.index(3); + + //n1 must be tabu + test.add(sol, n1); + assert(test.check(sol, n1)); + assert(!test.check(sol, n2)); + assert(!test.check(sol, n3)); + assert(!test.check(sol, n4)); + + //n1 and n2 must be tabu + test.add(sol, n2); + assert(test.check(sol, n1)); + assert(test.check(sol, n2)); + assert(!test.check(sol, n3)); + assert(!test.check(sol, n4)); + + //n3 is added, so it replace n1 -> n2 and n3 must be tabu + test.add(sol, n3); + assert(!test.check(sol, n1)); + assert(test.check(sol, n2)); + assert(test.check(sol, n3)); + assert(!test.check(sol, n4)); + + //clear tabu list all neighbor must not be tabu + test.init(sol); + assert(!test.check(sol, n1)); + assert(!test.check(sol, n2)); + assert(!test.check(sol, n3)); + assert(!test.check(sol, n4)); + + //tabu list of size 2 (neighbor are tabu during 2 iterations) + moNeighborVectorTabuList test2(2,2); + + test2.add(sol, n1); + assert(test2.check(sol, n1)); + test2.update(sol, n3); + test2.add(sol,n2); + assert(test2.check(sol, n1)); + assert(test2.check(sol, n2)); + test2.update(sol, n3); + assert(!test2.check(sol, n1)); + assert(test2.check(sol, n2)); + test2.update(sol, n4); + assert(!test2.check(sol, n1)); + assert(!test2.check(sol, n2)); + + std::cout << "[t-moNeighborVectorTabuList] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborhoodPerturb.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborhoodPerturb.cpp new file mode 100644 index 000000000..70a0fb214 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborhoodPerturb.cpp @@ -0,0 +1,91 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include "moTestClass.h" + +#include +#include +#include + +typedef moOrderNeighborhood Neighborhood; + +int main() { + + std::cout << "[t-moNeighborhoodPerturb] => START" << std::endl; + + oneMaxEval eval; + + moFullEvalByCopy moeval(eval); + + bitVector sol; + sol.resize(3); + sol[0]=0; + sol[1]=0; + sol[2]=0; + + sol.fitness(0); + + Neighborhood nh(3); + + bitNeighbor n; + + moNeighborhoodPerturb test(nh, moeval); + + //test update + test.init(sol); + test(sol); + assert(sol[0]==1 && sol[1]==0 && sol[2]==0); + test.update(sol, n); + test(sol); + assert(sol[0]==1 && sol[1]==1 && sol[2]==0); + test.update(sol, n); + test(sol); + assert(sol[0]==1 && sol[1]==1 && sol[2]==1); + test.update(sol, n); + test(sol); + assert(sol[0]==0 && sol[1]==1 && sol[2]==1); + + //test add + + test.add(sol, n); + test(sol); + assert(sol[0]==1 && sol[1]==1 && sol[2]==1); + + test.clearMemory(); + + + std::cout << "[t-moNeighborhoodPerturb] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborhoodStat.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborhoodStat.cpp new file mode 100644 index 000000000..f34320c74 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeighborhoodStat.cpp @@ -0,0 +1,172 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "moTestClass.h" + +#include +#include +#include + +/* + * Tests all classes depending of moNeighborhoodStat.h + */ +int main() { + + //test de moNeighborhoodStat.h + std::cout << "[t-moNeighborhoodStat] => START" << std::endl; + + moNeighborComparator neighborComp; + moSolNeighborComparator solNeighborComp; + evalOneMax eval(10); + + bitNeighborhood n(10); + + bitVector sol; + + sol.push_back(true); + sol.push_back(false); + sol.push_back(true); + sol.push_back(true); + sol.push_back(false); + sol.push_back(true); + sol.push_back(false); + sol.push_back(true); + sol.push_back(true); + sol.push_back(true); + + sol.fitness(7); + + + moNeighborhoodStat test(n, eval, neighborComp, solNeighborComp); + + test(sol); + + assert(test.getMin()==8); + assert(test.getMax()==6); + assert(test.getMean()==6.6); + double sd=test.getSD(); + assert(sd>0.966 && sd<0.967); + assert(test.getSize()==10); + assert(test.getNbSup()==7); + assert(test.getNbInf()==3); + assert(test.getNbEqual()==0); + + assert(test.className()=="moNeighborhoodStat"); + std::cout << "[t-moNeighborhoodStat] => OK" << std::endl; + + //test of moMaxNeighborStat.h + std::cout << "[t-moMaxNeighborStat] => START" << std::endl; + moMaxNeighborStat test2(test); + test2(sol); + assert(test2.value()==6); + assert(test2.className()=="moMaxNeighborStat"); + std::cout << "[t-moMaxNeighborStat] => OK" << std::endl; + + //test of moMinNeighborStat.h + std::cout << "[t-moMinNeighborStat] => START" << std::endl; + moMinNeighborStat test3(test); + test3(sol); + assert(test3.value()==8); + assert(test3.className()=="moMinNeighborStat"); + std::cout << "[t-moMinNeighborStat] => OK" << std::endl; + + //test of moNbInfNeighborStat.h + std::cout << "[t-moNbInfNeighborStat] => START" << std::endl; + moNbInfNeighborStat test4(test); + test4(sol); + assert(test4.value()==3); + assert(test4.className()=="moNbInfNeighborStat"); + std::cout << "[t-moNbInfNeighborStat] => OK" << std::endl; + + //test of moNbSupNeighborStat.h + std::cout << "[t-moNbSupNeighborStat] => START" << std::endl; + moNbSupNeighborStat test5(test); + test5(sol); + assert(test5.value()==7); + assert(test5.className()=="moNbSupNeighborStat"); + std::cout << "[t-moNbSupNeighborStat] => OK" << std::endl; + + //test of moNeutralDegreeNeighborStat.h + std::cout << "[t-moNeutralDegreeNeighborStat] => START" << std::endl; + moNeutralDegreeNeighborStat test6(test); + test6(sol); + assert(test6.value()==0); + assert(test6.className()=="moNeutralDegreeNeighborStat"); + std::cout << "[t-moNeutralDegreeNeighborStat] => OK" << std::endl; + + //test of moSecondMomentNeighborStat.h + std::cout << "[t-moSecondMomentNeighborStat] => START" << std::endl; + moSecondMomentNeighborStat test7(test); + test7.init(sol); + test7(sol); + assert(test7.value().first==6.6); + assert(test7.value().second > 0.966 && test7.value().second < 0.967); + assert(test7.className()=="moSecondMomentNeighborStat"); + std::cout << "[t-moSecondMomentNeighborStat] => OK" << std::endl; + + //test of moSizeNeighborStat.h + std::cout << "[t-moSizeNeighborStat] => START" << std::endl; + moSizeNeighborStat test8(test); + test8(sol); + assert(test8.value()==10); + assert(test8.className()=="moSizeNeighborStat"); + std::cout << "[t-moSizeNeighborStat] => OK" << std::endl; + + //test of moAverageFitnessNeighborStat.h + std::cout << "[t-moAverageFitnessNeighborStat] => START" << std::endl; + moAverageFitnessNeighborStat test9(test); + test9(sol); + assert(test9.value()==6.6); + assert(test9.className()=="moAverageFitnessNeighborStat"); + std::cout << "[t-moAverageFitnessNeighborStat] => OK" << std::endl; + + //test of moStdFitnessNeighborStat.h + std::cout << "[t-moStdFitnessNeighborStat] => START" << std::endl; + moStdFitnessNeighborStat test10(test); + test10(sol); + assert(test10.value()> 0.966 && test10.value() < 0.967); + assert(test10.className()=="moStdFitnessNeighborStat"); + std::cout << "[t-moStdFitnessNeighborStat] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeutralDegreeSampling.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeutralDegreeSampling.cpp new file mode 100644 index 000000000..d48158e0d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeutralDegreeSampling.cpp @@ -0,0 +1,64 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include +#include +#include + + +int main() { + + std::cout << "[t-moNeutralDegreeSampling] => START" << std::endl; + + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + dummyInit2 init(4); + + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; + + moNeutralDegreeSampling test1(init, nh, fullEval, eval, 3); + moNeutralDegreeSampling test2(init, nh, fullEval, eval, ncomp, sncomp, 3); + + test1(); + + test1.fileExport("outputNeutralDegreeSampling"); + + std::cout << "[t-moNeutralDegreeSampling] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeutralHC.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeutralHC.cpp new file mode 100644 index 000000000..84b141d65 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeutralHC.cpp @@ -0,0 +1,65 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include +#include +#include +#include + +int main() { + + std::cout << "[t-moNeutralHC] => START" << std::endl; + + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + moTrueContinuator cont; + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; + + //test du 1er constructeur + moNeutralHC test1(nh, fullEval, eval, 3); + + //test du 2eme constructeur + moNeutralHC test2(nh, fullEval, eval, 3, cont); + + //test du 3eme constructeur + moNeutralHC test3(nh, fullEval, eval, 3, cont, ncomp, sncomp); + + std::cout << "[t-moNeutralHC] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeutralHCexplorer.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeutralHCexplorer.cpp new file mode 100644 index 000000000..f0a69e4f0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeutralHCexplorer.cpp @@ -0,0 +1,92 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include +#include "moTestClass.h" + +#include +#include +#include + +int main() { + + std::cout << "[t-moNeutralHCexplorer] => START" << std::endl; + + //Instanciation + eoBit sol(4, true); + sol.fitness(4); + bitNeighborhood nh(4); + evalOneMax eval(4); + moNeighborComparator ncomp; + moSolNeighborComparator sncomp; + + moNeutralHCexplorer test(nh, eval, ncomp, sncomp,3); + + //on verifie qu'on ameliore bien la solution et que l'exploration dure 3 itérations + + test.initParam(sol); + test(sol); + assert(test.accept(sol)); + test.move(sol); + assert(sol.fitness()==3); + test.updateParam(sol); + assert(test.isContinue(sol)); + + //les affichages permettent de voir qu'on prend pas toujours les mm voisins(lancer plusieurs fois l'exe) + std::cout << sol << std::endl; + + test(sol); + assert(test.accept(sol)); + test.move(sol); + assert(sol.fitness()==2); + test.updateParam(sol); + assert(test.isContinue(sol)); + + + std::cout << sol << std::endl; + + test(sol); + assert(test.accept(sol)); + test.move(sol); + assert(sol.fitness()==1); + test.updateParam(sol); + assert(!test.isContinue(sol)); + + + std::cout << sol << std::endl; + + + + std::cout << "[t-moNeutralHCexplorer] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeutralWalkSampling.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeutralWalkSampling.cpp new file mode 100644 index 000000000..6faf66508 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moNeutralWalkSampling.cpp @@ -0,0 +1,62 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + + +#include +#include "moTestClass.h" +#include +#include + +int main() { + + std::cout << "[t-moNeutralWalkSampling] => START" << std::endl; + + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + dummyInit2 init(4); + bitVector sol(4, true); + sol.fitness(4); + eoHammingDistance dist; + + moNeutralWalkSampling test(sol, nh, fullEval, eval, dist, 3); + + test(); + + test.fileExport("outputTestNeutralWalkSampling"); + + std::cout << "[t-moNeutralWalkSampling] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moOrderNeighborhood.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moOrderNeighborhood.cpp new file mode 100644 index 000000000..a95a5238d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moOrderNeighborhood.cpp @@ -0,0 +1,80 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 +*/ + +#include +#include +#include + +#include +#include + +int main() { + + std::cout << "[t-moOrderNeighborhood] => START" << std::endl; + + //init sol + eoBit sol; + sol.push_back(true); + sol.push_back(false); + sol.push_back(true); + + moBitNeighbor neighbor; + + //verif du constructeur vide + moOrderNeighborhood > test(3); + assert(test.position()==0); + + //verif du hasneighbor + assert(test.hasNeighbor(sol)); + + //verif de init + test.init(sol, neighbor); + assert(neighbor.index()==0); + assert(test.position()==0); + + //verif du next + test.next(sol, neighbor); + assert(neighbor.index()==1); + assert(test.position()==1); + + //verif du cont + assert(test.cont(sol)); + test.next(sol, neighbor); + assert(!test.cont(sol)); + + assert(test.className()=="moOrderNeighborhood"); + + std::cout << "[t-moOrderNeighborhood] => OK" << std::endl; + return EXIT_SUCCESS; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomBestHC.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomBestHC.cpp new file mode 100644 index 000000000..7f2201629 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomBestHC.cpp @@ -0,0 +1,64 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include +#include +#include + +int main() { + + std::cout << "[t-moRandomBestHC] => START" << std::endl; + + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + + //test first constructor + moRandomBestHC test1(nh, fullEval, eval); + + //test second constructor + moTrueContinuator cont; + moRandomBestHC test2(nh, fullEval, eval, cont); + + //test third constructor + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; + moRandomBestHC test3(nh, fullEval, eval, cont, ncomp, sncomp); + + std::cout << "[t-moRandomBestHC] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomBestHCexplorer.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomBestHCexplorer.cpp new file mode 100644 index 000000000..f050fc49e --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomBestHCexplorer.cpp @@ -0,0 +1,101 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include +#include "moTestClass.h" + +#include +#include +#include + +int main() { + + std::cout << "[t-moRandomBestHCexplorer] => START" << std::endl; + + //instanciation + eoBit sol(4, true); + sol.fitness(4); + bitNeighborhood nh(4); + evalOneMax eval(4); + moNeighborComparator ncomp; + moSolNeighborComparator sncomp; + + moRandomBestHCexplorer test(nh, eval, ncomp, sncomp); + + //test qu'on ameliore bien a chaque itération + test.initParam(sol); + test(sol); + assert(test.accept(sol)); + test.move(sol); + assert(sol.fitness()==3); + assert(test.isContinue(sol)); + test.updateParam(sol); + + //les affichages permettent de voir qu'on choisit pas toujours les mm voisins améliorant (lancer plusieurs fois l'exe) + std::cout << sol << std::endl; + + test(sol); + assert(test.accept(sol)); + test.move(sol); + assert(sol.fitness()==2); + assert(test.isContinue(sol)); + test.updateParam(sol); + + std::cout << sol << std::endl; + + test(sol); + assert(test.accept(sol)); + test.move(sol); + assert(sol.fitness()==1); + assert(test.isContinue(sol)); + test.updateParam(sol); + + std::cout << sol << std::endl; + + test(sol); + assert(test.accept(sol)); + test.move(sol); + assert(sol.fitness()==0); + assert(test.isContinue(sol)); + test.updateParam(sol); + + test(sol); + assert(!test.accept(sol)); + assert(sol.fitness()==0); + assert(!test.isContinue(sol)); + test.updateParam(sol); + + + std::cout << "[t-moRandomBestHCexplorer] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomNeutralWalk.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomNeutralWalk.cpp new file mode 100644 index 000000000..39eb158ee --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomNeutralWalk.cpp @@ -0,0 +1,63 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include +#include +#include + +int main() { + + std::cout << "[t-moRandomNeutralWalk] => START" << std::endl; + + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + moTrueContinuator cont; + moSolNeighborComparator sncomp; + + //test du 1er constructeur + moRandomNeutralWalk test1(nh, fullEval, eval, 3); + + //test du 2eme constructeur + moRandomNeutralWalk test2(nh, fullEval, eval, 3, cont); + + //test du 3eme constructeur + moRandomNeutralWalk test3(nh, fullEval, eval, 3, cont, sncomp); + + std::cout << "[t-moRandomNeutralWalk] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomNeutralWalkExplorer.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomNeutralWalkExplorer.cpp new file mode 100644 index 000000000..dd7d52247 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomNeutralWalkExplorer.cpp @@ -0,0 +1,88 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include "moTestClass.h" + +#include +#include +#include + +int main() { + + std::cout << "[t-moRandomNeutralWalkExplorer] => START" << std::endl; + + eoBit sol(4, true); + sol.fitness(4); + bitNeighborhood nh(4); + evalOneMax eval(4); + dummyEvalOneMax eval2(4); + moSolNeighborComparator sncomp; + + //test avec la fonction d'eval classique + //on verifie qu'on ne trouve pas de voisin de mm fitness + moRandomNeutralWalkExplorer test(nh, eval, sncomp, 3); + + test.initParam(sol); + test(sol); + assert(!test.accept(sol)); + assert(!test.isContinue(sol)); + + //test avec une fonction d'eval bidon qui renvoie toujours la mm fitness + //on peut donc verifier qu'on s'arette au bout des 3 itérations. + moRandomNeutralWalkExplorer test2(nh, eval2, sncomp, 3); + + sol.fitness(2); + test2.initParam(sol); + test2(sol); + assert(test2.accept(sol)); + test2.move(sol); + assert(sol.fitness()==2); + test2.updateParam(sol); + assert(test2.isContinue(sol)); + + test2(sol); + assert(test2.accept(sol)); + test2.move(sol); + assert(sol.fitness()==2); + test2.updateParam(sol); + assert(test2.isContinue(sol)); + + test2(sol); + assert(test2.accept(sol)); + test2.move(sol); + assert(sol.fitness()==2); + test2.updateParam(sol); + assert(!test2.isContinue(sol)); + + std::cout << "[t-moRandomNeutralWalkExplorer] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomSearch.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomSearch.cpp new file mode 100644 index 000000000..135689891 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomSearch.cpp @@ -0,0 +1,57 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include +#include + +int main() { + + std::cout << "[t-moRandomSearch] => START" << std::endl; + + oneMaxEval fullEval; + dummyInit init; + moTrueContinuator cont; + //test du 1er constructor + moRandomSearch test1(init, fullEval, 3); + //test du 2e constructor + moRandomSearch test2(init, fullEval, 3, cont); + + assert(test1.className()=="moRandomSearch"); + + std::cout << "[t-moRandomSearch] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomSearchExplorer.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomSearchExplorer.cpp new file mode 100644 index 000000000..7dfbf19ce --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomSearchExplorer.cpp @@ -0,0 +1,65 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include + +int main() { + + std::cout << "[t-moRandomSearchExplorer] => START" << std::endl; + + dummyInit init; + oneMaxEval eval; + bitVector sol(4, true); + + moRandomSearchExplorer test(init, eval, 2); + + test.initParam(sol); + test(sol); + assert(sol.fitness()==4); + test.updateParam(sol); + assert(test.isContinue(sol)); + test.updateParam(sol); + assert(!test.isContinue(sol)); + test.initParam(sol); + assert(test.isContinue(sol)); + test.terminate(sol); + assert(test.accept(sol)); + test.move(sol); + + std::cout << "[t-moRandomSearchExplorer] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomWalk.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomWalk.cpp new file mode 100644 index 000000000..4528f7623 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomWalk.cpp @@ -0,0 +1,63 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include +#include +#include +#include + +int main() { + + std::cout << "[t-moRandomWalk] => START" << std::endl; + + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + moTrueContinuator cont; + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; + + //test du 1er constructeur + moRandomWalk test1(nh, fullEval, eval, 3); + + //test du 2eme constructeur + moRandomWalk test2(nh, fullEval, eval, cont); + + + std::cout << "[t-moRandomWalk] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomWalkExplorer.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomWalkExplorer.cpp new file mode 100644 index 000000000..bd751b1e1 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRandomWalkExplorer.cpp @@ -0,0 +1,79 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include "moTestClass.h" + +#include +#include +#include + +int main() { + + std::cout << "[t-moRandomWalkExplorer] => START" << std::endl; + + eoBit sol(4, true); + sol.fitness(4); + bitNeighborhood nh(4); + evalOneMax eval(4); + + //test avec un neighbordhood ordonné + //Du coup on verifie juste qu'on a bien une evolution de la solution et qu'on fait 3 pas avant d'arreter l'exploration + moRandomWalkExplorer test(nh, eval); + + test.initParam(sol); + + test(sol); + assert(test.accept(sol)); + test.move(sol); + assert(sol.fitness()==3); + test.updateParam(sol); + assert(test.isContinue(sol)); + + + test(sol); + assert(test.accept(sol)); + test.move(sol); + assert(sol.fitness()==4); + test.updateParam(sol); + assert(test.isContinue(sol)); + + test(sol); + assert(test.accept(sol)); + test.move(sol); + assert(sol.fitness()==3); + assert(!sol[0]); + test.updateParam(sol); + assert(test.isContinue(sol)); + + std::cout << "[t-moRandomWalkExplorer] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRestartPerturb.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRestartPerturb.cpp new file mode 100644 index 000000000..f301ceefb --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRestartPerturb.cpp @@ -0,0 +1,117 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include +#include + +#include +#include + +typedef eoInt QUEEN; + +class dummyInit : public eoInit +{ +public: + dummyInit(unsigned int _size):size(_size) {} + + void operator()(QUEEN& _sol) { + _sol.resize(0); + for (unsigned int i=0; i START" << std::endl; + + QUEEN queen; + moShiftNeighbor n; + + dummyInit initializer(4); + + queenEval eval; + + moRestartPerturb > test(initializer, eval, 3); + + queen.resize(4); + queen[0]=1; + queen[1]=2; + queen[2]=0; + queen[3]=3; + + test.init(queen); + + test(queen); + assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); + test.update(queen,n); //first noMove + test(queen); + assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); + test.update(queen,n); //second noMove + test(queen); + assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); + test.update(queen,n); //third noMove + test(queen);//here the perturb should be called + assert(queen[0]==0 && queen[1]==1 && queen[2]==2 && queen[3]==3); + + queen[0]=1; + queen[1]=2; + queen[2]=0; + queen[3]=3; + + //Retry the same test to verify counter is been reinit to 0 + + test(queen); + assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); + test.update(queen,n); //first noMove + test(queen); + assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); + test.update(queen,n); //second noMove + test(queen); + assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); + test.update(queen,n); //third noMove + test(queen); //here the perturb should be called + assert(queen[0]==0 && queen[1]==1 && queen[2]==2 && queen[3]==3); + + std::cout << "[t-moRestartPerturb] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRndIndexedVectorTabuList.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRndIndexedVectorTabuList.cpp new file mode 100755 index 000000000..5da55c117 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRndIndexedVectorTabuList.cpp @@ -0,0 +1,77 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 + */ + +#include +#include "moTestClass.h" + +#include +#include +#include + +int main() { + + std::cout << "[t-moRndIndexedVectorTabuList] => START" << std::endl; + moRndIndexedVectorTabuList test(4, 0,5); + bitNeighbor n1; + bitNeighbor n2; + bitNeighbor n3; + bitNeighbor n4; + n1.index(0); + n2.index(1); + n3.index(2); + n4.index(3); + + eoBit sol1(4, true); + eoBit sol2(4, true); + sol2[0] = false; + + //init + test.init(sol1); + + //ajout d'un voisin tabu + test.add(sol1, n1); + + //verification des voisins + assert(test.check(sol1, n1)); + assert(!test.check(sol1, n2)); + assert(!test.check(sol1, n3)); + assert(!test.check(sol1, n4)); + + assert(test.check(sol2, n1)); + assert(!test.check(sol2, n2)); + assert(!test.check(sol2, n3)); + assert(!test.check(sol2, n4)); + + test.update(sol1, n1); + + std::cout << "[t-moRndIndexedVectorTabuList] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRndWithReplNeighborhood.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRndWithReplNeighborhood.cpp new file mode 100644 index 000000000..d93f9bcdc --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRndWithReplNeighborhood.cpp @@ -0,0 +1,74 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include + +#include "moTestClass.h" +#include +#include +#include + +int main() { + + std::cout << "[t-moRndWithReplNeighborhood] => START" << std::endl; + + unsigned int a, b; + eoBit sol; + moBitNeighbor n; + + moRndWithReplNeighborhood< moBitNeighbor > test(3); + moRndWithReplNeighborhood< moBitNeighbor > test2(0); + + assert(test.hasNeighbor(sol)); + assert(!test2.hasNeighbor(sol)); + + test.init(sol,n); + + //on s'assure qu'on a bien toujours bien l'index 0, 1 ou 2 qui est renvoyé + for (unsigned int i=0; i<100; i++) { + + a=n.index(); + test.next(sol,n); + b=n.index(); + + assert(a==0 || a==1 || a==2); + assert(b==0 || b==1 || b==2); + assert(test.cont(sol)); + assert(!test2.cont(sol)); + assert(test.cont(sol)); + + } + + assert(test.className()=="moRndWithReplNeighborhood"); + + std::cout << "[t-moRndWithReplNeighborhood] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRndWithoutReplNeighborhood.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRndWithoutReplNeighborhood.cpp new file mode 100644 index 000000000..50f8afbe0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moRndWithoutReplNeighborhood.cpp @@ -0,0 +1,75 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include + +#include "moTestClass.h" +#include +#include +#include + +int main() { + + std::cout << "[t-moRndWithoutReplNeighborhood] => START" << std::endl; + + unsigned int a, b, c; + eoBit sol; + moBitNeighbor n; + + //instanciation + moRndWithoutReplNeighborhood< moBitNeighbor > test(3); + moRndWithoutReplNeighborhood< moBitNeighbor > test2(0); + + //on verifie que test a bien des voisins et que test2 n'en a pas + assert(test.hasNeighbor(sol)); + assert(!test2.hasNeighbor(sol)); + + //on recupere successivement les index + test.init(sol, n); + assert(test.cont(sol)); + a=test.position(); + test.next(sol, n); + assert(test.cont(sol)); + b=test.position(); + test.next(sol,n); + assert(!test.cont(sol)); + c=test.position(); + + //on s'assure qu'on a bien 0, 1 et 2 (dans un ordre aléatoire) + assert(a==0 || b==0 || c==0); + assert(a==1 || b==1 || c==1); + assert(a==2 || b==2 || c==2); + + assert(test.className()=="moRndWithoutReplNeighborhood"); + + std::cout << "[t-moRndWithoutReplNeighborhood] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSA.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSA.cpp new file mode 100644 index 000000000..b1cdfeb67 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSA.cpp @@ -0,0 +1,65 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include +#include +#include +#include + +int main() { + + std::cout << "[t-moSA] => START" << std::endl; + + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + + //test first constructor + moSA test1(nh, fullEval, eval); + + //test second constructor + moSimpleCoolingSchedule cool(10, 0.9, 100, 0.01); + moSA test2(nh, fullEval, eval, cool); + + //test third constructor + moTrueContinuator cont; + moSolNeighborComparator comp; + moSA test3(nh, fullEval, eval, cool, comp, cont); + + std::cout << "[t-moSA] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSAexplorer.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSAexplorer.cpp new file mode 100644 index 000000000..4c619ff88 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSAexplorer.cpp @@ -0,0 +1,87 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include "moTestClass.h" +#include +#include + +int main() { + + std::cout << "[t-moSAexplorer] => START" << std::endl; + + eoBit sol(4, true); + sol.fitness(4); + bitNeighborhood nh(4); + bitNeighborhood emptyNH(0); + evalOneMax eval(4); + moSolNeighborComparator sncomp; + moSimpleCoolingSchedule cool(10,0.1,2,0.1); + + moSAexplorer test1(emptyNH, eval, sncomp, cool); + moSAexplorer test2(nh, eval, sncomp, cool); + + //test d'un voisinage vide + test1.initParam(sol); + test1(sol); + assert(!test1.accept(sol)); + assert(test1.getTemperature()==10.0); + + //test d'un voisinage "normal" + test2.initParam(sol); + test2(sol); + assert(test2.accept(sol)); + test2.updateParam(sol); + assert(test2.isContinue(sol)); + test2.move(sol); + assert(sol.fitness()==3); + unsigned int ok=0; + unsigned int ko=0; + for (unsigned int i=0; i<1000; i++) { + test2(sol); + if (test2.isContinue(sol)) + test2.updateParam(sol); + if (test2.accept(sol)) + ok++; + else + ko++; + test2.move(sol); + } + assert((ok>0) && (ko>0)); + + + + std::cout << "[t-moSAexplorer] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSampling.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSampling.cpp new file mode 100644 index 000000000..3864be764 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSampling.cpp @@ -0,0 +1,81 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include +#include +#include +#include +#include + +int main() { + + std::cout << "[t-moSampling] => START" << std::endl; + + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + dummyInit2 init(4); + moIterContinuator cont(3); + + moFirstImprHC hc(nh, fullEval, eval, cont); + moSolutionStat stat1; + moCounterStat stat2; + moSampling test(init, hc, stat1); + + test.add(stat2); + + test(); + + std::vector res; + std::vector res2; + res = test.getValues(1); + res2= test.getSolutions(0); + + for (unsigned int i=0; i OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSimpleCoolingSchedule.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSimpleCoolingSchedule.cpp new file mode 100644 index 000000000..b2f8cca17 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSimpleCoolingSchedule.cpp @@ -0,0 +1,91 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moSimpleCoolingSchedule] => START" << std::endl; + + double temperature; + + bitVector sol; + + moSimpleCoolingSchedule test(100, 0.1, 2, 0.1); + + temperature=test.init(sol); + assert(temperature==100); + + //temperature must not changed 2* + test.update(temperature,0); + assert(temperature==100); + assert(test(temperature)); + test.update(temperature,0); + assert(temperature==100); + assert(test(temperature)); + + //then temperature must be /10 + test.update(temperature,0); + assert(temperature==10); + assert(test(temperature)); + test.update(temperature,0); + assert(temperature==10); + assert(test(temperature)); + test.update(temperature,0); + assert(temperature==10); + assert(test(temperature)); + + test.update(temperature,0); + assert(temperature == 1); + std::cout<< "\n"; + assert(test(temperature)); + test.update(temperature,0); + std::cout<< "\n"; + assert(temperature==1); + assert(test(temperature)); + test.update(temperature,0); + std::cout<< "\n"; + assert(temperature==1); + assert(test(temperature)); + + test.update(temperature,0); + assert(temperature==0.1); + assert(!test(temperature)); + + + std::cout << "[t-moSimpleCoolingSchedule] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSimpleHC.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSimpleHC.cpp new file mode 100644 index 000000000..973e374a4 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSimpleHC.cpp @@ -0,0 +1,65 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include +#include +#include + + +int main() { + + std::cout << "[t-moSimpleHC] => START" << std::endl; + + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + + //test first constructor + moSimpleHC test1(nh, fullEval, eval); + + //test second constructor + moTrueContinuator cont; + moSimpleHC test2(nh, fullEval, eval, cont); + + //test third constructor + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; + moSimpleHC test3(nh, fullEval, eval, cont, ncomp, sncomp); + + std::cout << "[t-moSimpleHC] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSimpleHCexplorer.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSimpleHCexplorer.cpp new file mode 100644 index 000000000..9767ce600 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSimpleHCexplorer.cpp @@ -0,0 +1,93 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 +*/ + +#include "moTestClass.h" +#include +#include +#include +#include + +#include +#include + +int main() { + + //Pas grand chose à faire: le gros du travail est fait par le voisin et l'eval + + std::cout << "[t-moSimpleHCexplorer] => START" << std::endl; + + Solution sol; + moDummyNeighborTest neighbor; + moDummyEvalTest eval; + moDummyNeighborhoodTest nh; + moFullEvalByCopy fulleval(eval); + moNeighborComparator comp; + moSolNeighborComparator solNeighborComp; + + + //verif constructor + moSimpleHCexplorer test(nh, fulleval, comp, solNeighborComp); + + //verif operator() et accept: le neigorhood est construit pour qu'on tombe dans les 3 cas suivants: + //hasNeighbor() retourne faux a l'entrée de l'operator() donc on doit pas continuer + sol.fitness(3); + test(sol); + test.accept(sol); + assert(!test.isContinue(sol)); + + //hasNeighbor() retourne faux a l'entrée de accept() donc on doit pas continuer + test(sol); + test.accept(sol); + assert(!test.isContinue(sol)); + + //hasNeighbor() retourne vrai et on ameliore la fitness donc on doit continuer + test(sol); + test.accept(sol); + assert(test.isContinue(sol)); + + //verif de move -> on affecte la fitness du best d'avant + test.move(sol); + + //hasNeighbor() retourne vrai et on ameliore pas la fitness donc on doit pas continuer + test(sol); + test(sol); + test.accept(sol); + assert(!test.isContinue(sol)); + + assert(test.className()=="moSimpleHCexplorer"); + + std::cout << "[t-moSimpleHCexplorer] => OK" << std::endl; + + return EXIT_SUCCESS; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolComparator.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolComparator.cpp new file mode 100644 index 000000000..086f6be13 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolComparator.cpp @@ -0,0 +1,61 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include +#include + +int main() { + + std::cout << "[t-moSolComparator] => START" << std::endl; + + eoBit sol1, sol2, sol3; + + moSolComparator< eoBit > test; + + sol1.fitness(3); + sol2.fitness(4); + sol3.fitness(4); + + assert(!test(sol1,sol2)); + assert(test(sol2,sol1)); + assert(!test.equals(sol1,sol2)); + assert(test.equals(sol2,sol3)); + + assert(test.className()=="moSolComparator"); + + std::cout << "[t-moSolComparator] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolInit.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolInit.cpp new file mode 100644 index 000000000..ce8ef3cb7 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolInit.cpp @@ -0,0 +1,56 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include + +int main() { + + std::cout << "[t-moSolInit] => START" << std::endl; + + int a=3; + + int b=5; + + moSolInit test(a); + + test(b); + assert(b==3); + a=4; + test(b); + assert(b==4); + + std::cout << "[t-moSolInit] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolNeighborComparator.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolNeighborComparator.cpp new file mode 100644 index 000000000..b98996141 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolNeighborComparator.cpp @@ -0,0 +1,72 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 +*/ + +#include +#include +#include +#include + +#include +#include + +int main() { + + std::cout << "[t-moSolNeighborComparator] => START" << std::endl; + + moBitNeighbor neighbor; + eoBit sol; + + moSolNeighborComparator< moBitNeighbor > test; + + neighbor.fitness(3); + sol.fitness(2); + //test with a minimizing fitness, neighbor must not be better than sol + assert(!test(sol, neighbor)); + + //reversly + neighbor.fitness(2); + sol.fitness(3); + assert(test(sol, neighbor)); + + //test equals + assert(!test.equals(sol, neighbor)); + + neighbor.fitness(3); + assert(test.equals(sol, neighbor)); + + assert(test.className()=="moSolNeighborComparator"); + + std::cout << "[t-moSolNeighborComparator] => OK" << std::endl; + return EXIT_SUCCESS; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolVectorTabuList.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolVectorTabuList.cpp new file mode 100644 index 000000000..cf883d369 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolVectorTabuList.cpp @@ -0,0 +1,154 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include "moTestClass.h" + +#include +#include +#include + +int main() { + + std::cout << "[t-moSolVectorTabuList] => START" << std::endl; + + //test without countdown + moSolVectorTabuList test(2,0); + bitNeighbor n1; + bitNeighbor n2; + bitNeighbor n3; + bitNeighbor n4; + n1.index(0); + n2.index(1); + n3.index(2); + n4.index(3); + + eoBit sol1(4, true); + eoBit sol2(4, true); + eoBit sol3(4, true); + eoBit sol4(4, true); + + sol2[0]=false; + sol3[1]=false; + sol4[0]=false; + sol4[1]=false; + + //init + test.init(sol1); + + //ajout d'une sol tabu + test.add(sol1,n1); + + //verification des voisins de chaques sol + assert(test.check(sol2,n1)); + assert(!test.check(sol2,n2)); + assert(!test.check(sol2,n3)); + assert(!test.check(sol2,n4)); + + assert(!test.check(sol3,n1)); + assert(test.check(sol3,n2)); + assert(!test.check(sol3,n3)); + assert(!test.check(sol3,n4)); + + assert(!test.check(sol4,n1)); + assert(!test.check(sol4,n2)); + assert(!test.check(sol4,n3)); + assert(!test.check(sol4,n4)); + + test.init(sol1); + assert(!test.check(sol2,n1)); + assert(!test.check(sol3,n2)); + + test.update(sol1,n1); + + test.add(sol1,n1); + test.add(sol2,n1); + assert(test.check(sol2,n1)); + test.add(sol4,n1); + assert(!test.check(sol2,n1)); + assert(test.check(sol2,n2)); + + //test with a countdown at 3 + moSolVectorTabuList test2(2,2); + test2.init(sol1); + test2.add(sol1,n1); + assert(test2.check(sol2,n1)); + assert(!test2.check(sol2,n2)); + assert(!test2.check(sol2,n3)); + assert(!test2.check(sol2,n4)); + + assert(!test2.check(sol3,n1)); + assert(test2.check(sol3,n2)); + assert(!test2.check(sol3,n3)); + assert(!test2.check(sol3,n4)); + + assert(!test2.check(sol4,n1)); + assert(!test2.check(sol4,n2)); + assert(!test2.check(sol4,n3)); + assert(!test2.check(sol4,n4)); + + //coutdown sol1 -> 1 + test2.update(sol1,n1); + assert(test2.check(sol2,n1)); + assert(!test2.check(sol2,n2)); + assert(!test2.check(sol2,n3)); + assert(!test2.check(sol2,n4)); + + assert(!test2.check(sol3,n1)); + assert(test2.check(sol3,n2)); + assert(!test2.check(sol3,n3)); + assert(!test2.check(sol3,n4)); + + assert(!test2.check(sol4,n1)); + assert(!test2.check(sol4,n2)); + assert(!test2.check(sol4,n3)); + assert(!test2.check(sol4,n4)); + + //coutdown sol1 -> 0 : sol1 is no longer tabu + test2.update(sol1,n1); + assert(!test2.check(sol2,n1)); + assert(!test2.check(sol2,n2)); + assert(!test2.check(sol2,n3)); + assert(!test2.check(sol2,n4)); + + assert(!test2.check(sol3,n1)); + assert(!test2.check(sol3,n2)); + assert(!test2.check(sol3,n3)); + assert(!test2.check(sol3,n4)); + + assert(!test2.check(sol4,n1)); + assert(!test2.check(sol4,n2)); + assert(!test2.check(sol4,n3)); + assert(!test2.check(sol4,n4)); + + std::cout << "[t-moSolVectorTabuList] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolutionStat.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolutionStat.cpp new file mode 100644 index 000000000..2ebe777da --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moSolutionStat.cpp @@ -0,0 +1,64 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include "moTestClass.h" + +#include +#include +#include + +int main() { + + std::cout << "[t-moSolutionStat] => START" << std::endl; + + eoBit s(3); + s[0]=true; + s[1]=true; + s[2]=false; + + s.fitness(17); + + moSolutionStat< eoBit > test; + + test(s); + //on verifie que la solution est bien enregistré + + assert(test.value()[0]); + assert(test.value()[1]); + assert(!test.value()[2]); + assert(test.value().fitness()==17); + + assert(test.className()=="moSolutionStat"); + + std::cout << "[t-moSolutionStat] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moStatistics.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moStatistics.cpp new file mode 100644 index 000000000..98cd1e4f3 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moStatistics.cpp @@ -0,0 +1,112 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include + +int main() { + + std::cout << "[t-moStatistics] => START" << std::endl; + + moStatistics test; + + double min; + double max; + double avg; + double std; + + //test des stats basic + std::vector sampling; + sampling.push_back(3); + sampling.push_back(5); + sampling.push_back(2); + sampling.push_back(4); + + + test.basic(sampling, min, max, avg, std); + assert(min==2); + assert(max==5); + assert(avg==3.5); + assert(std*std==1.25); + + + sampling.resize(0); + test.basic(sampling, min, max, avg, std); + assert(min==0); + assert(max==0); + assert(avg==0); + assert(std==0); + + //test de la distance + std::vector data; + eoHammingDistance dist; + bitVector tmp(4,true); + data.push_back(tmp); + tmp[0]=false; + data.push_back(tmp); + tmp[2]=false; + data.push_back(tmp); + + std::vector< std::vector > matrix; + + test.distances(data, dist, matrix); + + assert(matrix[0][0]==0.0); + assert(matrix[0][1]==1.0); + assert(matrix[0][2]==2.0); + + assert(matrix[1][0]==1.0); + assert(matrix[1][1]==0.0); + assert(matrix[1][2]==1.0); + + assert(matrix[2][0]==2.0); + assert(matrix[2][1]==1.0); + assert(matrix[2][2]==0.0); + + //test de l'autocorrelation + std::vector rho, phi; + test.autocorrelation(sampling, 2, rho, phi); + + sampling.push_back(3); + sampling.push_back(5); + sampling.push_back(2); + sampling.push_back(4); + + test.autocorrelation(sampling, 2, rho, phi); + + std::cout << "[t-moStatistics] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moTS.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moTS.cpp new file mode 100644 index 000000000..b27d0d390 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moTS.cpp @@ -0,0 +1,72 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include +#include +#include +#include +#include + +int main() { + + std::cout << "[t-moTS] => START" << std::endl; + + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + + //test first constructor + moTS test1(nh, fullEval, eval, 1, 7); + + //test second constructor + moSolVectorTabuList tl(7,0); + moTS test2(nh, fullEval, eval, 1, tl); + + //test third constructor + moTrueContinuator cont; + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; + moDummyIntensification intens; + moDummyDiversification div; + moBestImprAspiration aspir; + + moTS test3(nh, fullEval, eval, ncomp, sncomp, cont, tl, intens, div, aspir); + + + std::cout << "[t-moTS] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moTSexplorer.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moTSexplorer.cpp new file mode 100644 index 000000000..dcce178ec --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moTSexplorer.cpp @@ -0,0 +1,165 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include +#include +#include +#include "moTestClass.h" + +#include +#include +#include + +int main() { + + std::cout << "[t-moTSexplorer] => START" << std::endl; + + //instansiation + eoBit sol(4, true); + sol.fitness(4); + bitNeighborhood nh(4); + bitNeighborhood emptyNH(0); + evalOneMax eval(4); + moNeighborComparator ncomp; + moSolNeighborComparator sncomp; + moDummyIntensification intens; + moDummyDiversification diver; + moSolVectorTabuList tabuList(4,0); + moBestImprAspiration aspir; + + moTSexplorer test(nh, eval, ncomp, sncomp, tabuList, intens, diver, aspir); + moTSexplorer test2(emptyNH, eval, ncomp, sncomp, tabuList, intens, diver, aspir); + + //test d'un voisinage vide + test2.initParam(sol); + test2(sol); + assert(!test2.accept(sol)); + + //test le comportement classique de la taboo + test.initParam(sol); + assert(aspir.getBest()==sol); + + test(sol); + test.updateParam(sol); + assert(aspir.getBest()==sol); + + //on ameliore et on stock une sol tabou 0111 + test(sol); + test.move(sol); + test.moveApplied(true); + test.updateParam(sol); + assert(aspir.getBest()==sol); + + //on ameliore et on stock une autre sol tabou 0011 + test(sol); + test.move(sol); + test.moveApplied(true); + test.updateParam(sol); + assert(aspir.getBest()==sol); + + //pareil on stock 0001 met pdt la recherche on se rend compte que 0111 est tabou + test(sol); + test.move(sol); + test.moveApplied(true); + test.updateParam(sol); + assert(aspir.getBest()==sol); + + //on modifie la sol en 1001(fitness 2) pour que la 1er sol exploré(0001) soit tabou + //De plus on change la solution mais elle est pas meilleure que la best so Far + sol[0]=true; + std::cout << sol << std::endl; + sol.fitness(2); + test(sol); + test.move(sol); + test.moveApplied(true); + test.updateParam(sol); + assert( sol[0] && !sol[1] && !sol[2] && !sol[3]); + sol[0]=false; + sol[3]=true; + assert(aspir.getBest()==sol); + + //test du isContinue + assert(test.isContinue(sol)); + + //test du terminate + test.initParam(sol); + sol[0]=true; + sol[1]=true; + sol[2]=true; + sol[3]=true; + sol.fitness(4); + test(sol); + test.move(sol); + test.moveApplied(true); + test.updateParam(sol); + assert( !sol[0] && sol[1] && sol[2] && sol[3]); + test.terminate(sol); + assert( !sol[0] && !sol[1] && !sol[2] && sol[3]); + + //test pour avoir que des mouvement taboo + eoBit sol2(2, true); + sol2.fitness(2); + bitNeighborhood nh2(2); + evalOneMax eval2(2); + + moTSexplorer test3(nh2, eval2, ncomp, sncomp, tabuList, intens, diver, aspir); + + test3.initParam(sol2); + test3(sol2); + test3.move(sol2); + test3.moveApplied(true); + test3.updateParam(sol2); + + test3(sol2); + test3.move(sol2); + test3.moveApplied(true); + test3.updateParam(sol2); + + test3(sol2); + test3.move(sol2); + test3.moveApplied(true); + test3.updateParam(sol2); + + test3(sol2); + test3.move(sol2); + test3.moveApplied(true); + test3.updateParam(sol2); + + //on a rempli la liste tabu pour que tout les voisins soit tabu + test3(sol2); + assert(!test3.accept(sol2)); + + + std::cout << "[t-moTSexplorer] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moTimeContinuator.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moTimeContinuator.cpp new file mode 100644 index 000000000..ccd47e1f9 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moTimeContinuator.cpp @@ -0,0 +1,71 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" +#include + +void wait ( int seconds ) +{ + clock_t endwait; + endwait = clock () + seconds * CLOCKS_PER_SEC ; + while (clock() < endwait) {} +} + + +int main() { + + std::cout << "[t-moTimeContinuator] => START" << std::endl; + + moTimeContinuator test(2, false); + moTimeContinuator test2(3); + Solution s; + + test.init(s); + assert(test(s)); + wait(1); + assert(test(s)); + wait(1); + assert(!test(s)); + test.init(s); + assert(test(s)); + wait(2); + assert(!test(s)); + + assert(test.className()=="moTimeContinuator"); + + std::cout << "[t-moTimeContinuator] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moTrueContinuator.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moTrueContinuator.cpp new file mode 100644 index 000000000..2a0ca7d27 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moTrueContinuator.cpp @@ -0,0 +1,53 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + + 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 +*/ + +#include +#include "moTestClass.h" + +#include +#include + + +int main() { + + std::cout << "[t-moTrueContinuator] => START" << std::endl; + + moTrueContinuator test; + Solution s; + + assert(test(s)); + + std::cout << "[t-moTrueContinuator] => OK" << std::endl; + return EXIT_SUCCESS; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moVectorMonitor.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moVectorMonitor.cpp new file mode 100644 index 000000000..53edcd310 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/test/t-moVectorMonitor.cpp @@ -0,0 +1,112 @@ +/* + +Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + +Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau + +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 +*/ + +#include +#include +#include + +#include +#include "moTestClass.h" + +int main() { + + std::cout << "[t-moVectorMonitor] => START" << std::endl; + + + eoValueParam doubleParam; + eoValueParam intParam; + eoValueParam eotParam; + eoValueParam stringParam; + doubleParam.value()= 3.1; + intParam.value()=6; + bitVector sol(4,true); + sol.fitness(0); + eotParam.value()=sol; + + moVectorMonitor test1(doubleParam); + moVectorMonitor test2(intParam); + moVectorMonitor test3(eotParam); + moVectorMonitor test4(stringParam); + + assert(!test1.solutionType()); + assert(!test2.solutionType()); + assert(test3.solutionType()); + + test1(); + test2(); + test3(); + doubleParam.value()= 3.3; + intParam.value()=7; + sol.fitness(1); + eotParam.value()=sol; + test1(); + test2(); + test3(); + doubleParam.value()= 3.6; + intParam.value()=8; + sol.fitness(2); + eotParam.value()=sol; + test1(); + test2(); + test3(); + doubleParam.value()= 3.001; + intParam.value()=9; + test1(); + test2(); + + assert(test1.size()==4); + assert(test2.size()==4); + assert(test3.size()==3); + assert(test1.getValue(1)=="3.3"); + assert(test2.getValue(2)=="8"); + std::cout << test3.getValue(2) << std::endl; + assert(test1.getValues()[0]==3.1); + assert(test2.getValues()[2]==8); + assert(test3.getSolutions()[0].fitness()==0); + + test1.fileExport("outputTestVectorMonitor.txt"); + + test1.clear(); + test2.clear(); + test3.clear(); + assert(test1.size()==0); + assert(test2.size()==0); + assert(test3.size()==0); + + + + assert(test1.className()=="moVectorMonitor"); + + + + std::cout << "[t-moVectorMonitor] => OK" << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/CMakeLists.txt b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/CMakeLists.txt new file mode 100644 index 000000000..0cd922e91 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/CMakeLists.txt @@ -0,0 +1,405 @@ +IF(ENABLE_CMAKE_EXAMPLE OR CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_simpleHC.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_simpleHC.param + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_firstImprHC.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_firstImprHC.param + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_randomBestHC.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_randomBestHC.param + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_neutralHC.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_neutralHC.param + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_iterContinuator.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_iterContinuator.param + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_fitContinuator.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_fitContinuator.param + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_fullEvalContinuator.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_fullEvalContinuator.param + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_evalContinuator.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_evalContinuator.param + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_combinedContinuator.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_combinedContinuator.param + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/firstImprHC_maxSAT.param + ${MO_BIN_DIR}/tutorial/Lesson1/firstImprHC_maxSAT.param + ) + + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson2/testNeighborhood.param + ${MO_BIN_DIR}/tutorial/Lesson2/testNeighborhood.param + + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson3/testSimulatedAnnealing.param + ${MO_BIN_DIR}/tutorial/Lesson3/testSimulatedAnnealing.param + + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson4/testSimpleTS.param + ${MO_BIN_DIR}/tutorial/Lesson4/testSimpleTS.param + + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson5/testILS.param + ${MO_BIN_DIR}/tutorial/Lesson5/testILS.param + + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/testRandomWalk.param + ${MO_BIN_DIR}/tutorial/Lesson6/testRandomWalk.param + + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/testMetropolisHasting.param + ${MO_BIN_DIR}/tutorial/Lesson6/testMetropolisHasting.param + + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/testRandomNeutralWalk.param + ${MO_BIN_DIR}/tutorial/Lesson6/testRandomNeutralWalk.param + + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/sampling.param + ${MO_BIN_DIR}/tutorial/Lesson6/sampling.param + + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/densityOfStates.param + ${MO_BIN_DIR}/tutorial/Lesson6/densityOfStates.param + + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/autocorrelation.param + ${MO_BIN_DIR}/tutorial/Lesson6/autocorrelation.param + + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/adaptiveWalks.param + ${MO_BIN_DIR}/tutorial/Lesson6/adaptiveWalks.param + + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/fdc.param + ${MO_BIN_DIR}/tutorial/Lesson6/fdc.param + + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/neutralDegree.param + ${MO_BIN_DIR}/tutorial/Lesson6/neutralDegree.param + + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/fitnessCloud.param + ${MO_BIN_DIR}/tutorial/Lesson6/fitnessCloud.param + + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/neutralWalk.param + ${MO_BIN_DIR}/tutorial/Lesson6/neutralWalk.param + + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson7/hybridAlgo.param + ${MO_BIN_DIR}/tutorial/Lesson7/hybridAlgo.param + + ) + + +ENDIF(ENABLE_CMAKE_EXAMPLE OR CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + +MACRO(ADD_COMMANDS_NEWMO) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_simpleHC.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_simpleHC.param + ${MO_BIN_DIR}/tutorial/Lesson1 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_firstImprHC.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_firstImprHC.param + ${MO_BIN_DIR}/tutorial/Lesson1 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_randomBestHC.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_randomBestHC.param + ${MO_BIN_DIR}/tutorial/Lesson1 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_neutralHC.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_neutralHC.param + ${MO_BIN_DIR}/tutorial/Lesson1 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_iterContinuator.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_iterContinuator.param + ${MO_BIN_DIR}/tutorial/Lesson1 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_fitContinuator.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_fitContinuator.param + ${MO_BIN_DIR}/tutorial/Lesson1 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_fullEvalContinuator.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_fullEvalContinuator.param + ${MO_BIN_DIR}/tutorial/Lesson1 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_evalContinuator.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_evalContinuator.param + ${MO_BIN_DIR}/tutorial/Lesson1 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_combinedContinuator.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/lesson1_combinedContinuator.param + ${MO_BIN_DIR}/tutorial/Lesson1 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson1/firstImprHC_maxSAT.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson1/firstImprHC_maxSAT.param + ${MO_BIN_DIR}/tutorial/Lesson1 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson2/testNeighborhood.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson2/testNeighborhood.param + ${MO_BIN_DIR}/tutorial/Lesson2 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson3/testSimulatedAnnealing.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson3/testSimulatedAnnealing.param + ${MO_BIN_DIR}/tutorial/Lesson3 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson4/testSimpleTS.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson4/testSimpleTS.param + ${MO_BIN_DIR}/tutorial/Lesson4 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson5/testILS.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson5/testILS.param + ${MO_BIN_DIR}/tutorial/Lesson5 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson6/testRandomWalk.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/testRandomWalk.param + ${MO_BIN_DIR}/tutorial/Lesson6 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson6/testMetropolisHasting.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/testMetropolisHasting.param + ${MO_BIN_DIR}/tutorial/Lesson6 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson6/testRandomNeutralWalk.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/testRandomNeutralWalk.param + ${MO_BIN_DIR}/tutorial/Lesson6 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson6/sampling.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/sampling.param + ${MO_BIN_DIR}/tutorial/Lesson6 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson6/densityOfStates.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/densityOfStates.param + ${MO_BIN_DIR}/tutorial/Lesson6 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson6/fitnessCloud.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/fitnessCloud.param + ${MO_BIN_DIR}/tutorial/Lesson6 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson6/neutralWalk.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/neutralWalk.param + ${MO_BIN_DIR}/tutorial/Lesson6 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson6/autocorrelation.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/autocorrelation.param + ${MO_BIN_DIR}/tutorial/Lesson6 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson6/adaptiveWalks.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/adaptiveWalks.param + ${MO_BIN_DIR}/tutorial/Lesson6 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson6/fdc.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/fdc.param + ${MO_BIN_DIR}/tutorial/Lesson6 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson6/neutralDegree.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson6/neutralDegree.param + ${MO_BIN_DIR}/tutorial/Lesson6 + ) + ADD_CUSTOM_COMMAND( + OUTPUT ${MO_BIN_DIR}/tutorial/Lesson7/hybridAlgo.param + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${MO_SRC_DIR}/tutorial/Lesson7/hybridAlgo.param + ${MO_BIN_DIR}/tutorial/Lesson7 + ) + + +ENDMACRO(ADD_COMMANDS_NEWMO) + +MACRO(ADD_TARGET_NEWMO n) + IF(${n} STREQUAL "lesson1") + ADD_CUSTOM_TARGET(lesson1 DEPENDS + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_simpleHC + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_simpleHC.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_firstImprHC + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_firstImprHC.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_randomBestHC + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_randomBestHC.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_neutralHC + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_neutralHC.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_iterContinuator + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_iterContinuator.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_fitContinuator + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_fitContinuator.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_fullEvalContinuator + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_fullEvalContinuator.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_evalContinuator + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_evalContinuator.param + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_combinedContinuator + ${MO_BIN_DIR}/tutorial/Lesson1/lesson1_combinedContinuator.param + ${MO_BIN_DIR}/tutorial/Lesson1/firstImprHC_maxSAT + ${MO_BIN_DIR}/tutorial/Lesson1/firstImprHC_maxSAT.param + ) + ELSEIF(${n} STREQUAL "lesson2") + ADD_CUSTOM_TARGET(lesson2 DEPENDS + ${MO_BIN_DIR}/tutorial/Lesson2/testNeighborhood + ${MO_BIN_DIR}/tutorial/Lesson2/testNeighborhood.param + ) + ELSEIF(${n} STREQUAL "lesson3") + ADD_CUSTOM_TARGET(lesson3 DEPENDS + ${MO_BIN_DIR}/tutorial/Lesson3/testSimulatedAnnealing + ${MO_BIN_DIR}/tutorial/Lesson3/testSimulatedAnnealing.param + ) + ELSEIF(${n} STREQUAL "lesson4") + ADD_CUSTOM_TARGET(lesson4 DEPENDS + ${MO_BIN_DIR}/tutorial/Lesson4/testSimpleTS + ${MO_BIN_DIR}/tutorial/Lesson4/testSimpleTS.param + ) + ELSEIF(${n} STREQUAL "lesson5") + ADD_CUSTOM_TARGET(lesson5 DEPENDS + ${MO_BIN_DIR}/tutorial/Lesson5/testILS + ${MO_BIN_DIR}/tutorial/Lesson5/testILS.param + ) + ELSEIF(${n} STREQUAL "lesson6") + ADD_CUSTOM_TARGET(lesson6 DEPENDS + ${MO_BIN_DIR}/tutorial/Lesson6/testRandomWalk + ${MO_BIN_DIR}/tutorial/Lesson6/testRandomWalk.param + ${MO_BIN_DIR}/tutorial/Lesson6/testMetropolisHasting + ${MO_BIN_DIR}/tutorial/Lesson6/testMetropolisHasting.param + ${MO_BIN_DIR}/tutorial/Lesson6/testRandomNeutralWalk + ${MO_BIN_DIR}/tutorial/Lesson6/testRandomNeutralWalk.param + ${MO_BIN_DIR}/tutorial/Lesson6/sampling + ${MO_BIN_DIR}/tutorial/Lesson6/sampling.param + ${MO_BIN_DIR}/tutorial/Lesson6/densityOfStates + ${MO_BIN_DIR}/tutorial/Lesson6/densityOfStates.param + ${MO_BIN_DIR}/tutorial/Lesson6/autocorrelation + ${MO_BIN_DIR}/tutorial/Lesson6/autocorrelation.param + ${MO_BIN_DIR}/tutorial/Lesson6/adaptiveWalks + ${MO_BIN_DIR}/tutorial/Lesson6/adaptiveWalks.param + ${MO_BIN_DIR}/tutorial/Lesson6/fdc + ${MO_BIN_DIR}/tutorial/Lesson6/fdc.param + ${MO_BIN_DIR}/tutorial/Lesson6/neutralDegree + ${MO_BIN_DIR}/tutorial/Lesson6/neutralDegree.param + ${MO_BIN_DIR}/tutorial/Lesson6/fitnessCloud + ${MO_BIN_DIR}/tutorial/Lesson6/fitnessCloud.param + ${MO_BIN_DIR}/tutorial/Lesson6/neutralWalk + ${MO_BIN_DIR}/tutorial/Lesson6/neutralWalk.param + + ) + ELSEIF(${n} STREQUAL "lesson7") + ADD_CUSTOM_TARGET(lesson7 DEPENDS + ${MO_BIN_DIR}/tutorial/Lesson7/hybridAlgo + ${MO_BIN_DIR}/tutorial/Lesson7/hybridAlgo.param + ) + ENDIF(${n} STREQUAL "lesson1") + +ENDMACRO(ADD_TARGET_NEWMO) + +ADD_SUBDIRECTORY(Lesson1) +ADD_SUBDIRECTORY(Lesson2) +ADD_SUBDIRECTORY(Lesson3) +ADD_SUBDIRECTORY(Lesson4) +ADD_SUBDIRECTORY(Lesson5) +ADD_SUBDIRECTORY(Lesson6) +ADD_SUBDIRECTORY(Lesson7) + + +IF(NOT CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" AND NOT CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + ADD_COMMANDS_NEWMO() + ADD_TARGET_NEWMO(install) +ENDIF(NOT CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" AND NOT CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/CMakeLists.txt b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/CMakeLists.txt new file mode 100644 index 000000000..bb705f7a5 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/CMakeLists.txt @@ -0,0 +1,113 @@ +###################################################################################### +### 1) Include the sources +###################################################################################### + +INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src + ${MO_SRC_DIR}/src + ${PROBLEMS_SRC_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../src) + +###################################################################################### +### 2) Specify where CMake can find the libraries +###################################################################################### + +LINK_DIRECTORIES(${EO_BIN_DIR}/lib) + + +###################################################################################### +### 3) Define your target(s): just an executable here +###################################################################################### + +IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + SOURCE_GROUP(src FILES lesson1_simpleHC.cpp + lesson1_firstImprHC.cpp + lesson1_randomBestHC.cpp + lesson1_neutralHC.cpp + lesson1_iterContinuator.cpp + lesson1_fitContinuator.cpp + lesson1_fullEvalContinuator.cpp + lesson1_evalContinuator.cpp + lesson1_combinedContinuator.cpp + firstImprHC_maxSAT.cpp) + ADD_EXECUTABLE(lesson1_simpleHC + lesson1_simpleHC.cpp + ${MO_BIN_DIR}/tutorial/lesson1/lesson1_simpleHC.param + ) + ADD_EXECUTABLE(lesson1_firstImprHC + lesson1_firstImprHC.cpp + ${MO_BIN_DIR}/tutorial/lesson1/lesson1_firstImprHC.param + ) + ADD_EXECUTABLE(lesson1_randomBestHC + lesson1_randomBestHC.cpp + ${MO_BIN_DIR}/tutorial/lesson1/lesson1_randomBestHC.param + ) + ADD_EXECUTABLE(lesson1_neutralHC + lesson1_neutralHC.cpp + ${MO_BIN_DIR}/tutorial/lesson1/lesson1_neutralHC.param + ) + ADD_EXECUTABLE(lesson1_iterContinuator + lesson1_iterContinuator.cpp + ${MO_BIN_DIR}/tutorial/lesson1/lesson1_iterContinuator.param + ) + ADD_EXECUTABLE(lesson1_fitContinuator + lesson1_fitContinuator.cpp + ${MO_BIN_DIR}/tutorial/lesson1/lesson1_fitContinuator.param + ) + ADD_EXECUTABLE(lesson1_fullEvalContinuator + lesson1_fullEvalContinuator.cpp + ${MO_BIN_DIR}/tutorial/lesson1/lesson1_fullEvalContinuator.param + ) + ADD_EXECUTABLE(lesson1_evalContinuator + lesson1_evalContinuator.cpp + ${MO_BIN_DIR}/tutorial/lesson1/lesson1_evalContinuator.param + ) + ADD_EXECUTABLE(lesson1_combinedContinuator + lesson1_combinedContinuator.cpp + ${MO_BIN_DIR}/tutorial/lesson1/lesson1_combinedContinuator.param + ) + ADD_EXECUTABLE(firstImprHC_maxSAT + firstImprHC_maxSAT.cpp + ${MO_BIN_DIR}/tutorial/lesson1/firstImprHC_maxSAT.param + ) +ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + ADD_COMMANDS_NEWMO() + ADD_TARGET_NEWMO(lesson1) + IF(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(lesson1_simpleHC lesson1_simpleHC.cpp) + ADD_EXECUTABLE(lesson1_firstImprHC lesson1_firstImprHC.cpp) + ADD_EXECUTABLE(lesson1_randomBestHC lesson1_randomBestHC.cpp) + ADD_EXECUTABLE(lesson1_neutralHC lesson1_neutralHC.cpp) + ADD_EXECUTABLE(lesson1_iterContinuator lesson1_iterContinuator.cpp) + ADD_EXECUTABLE(lesson1_fitContinuator lesson1_fitContinuator.cpp) + ADD_EXECUTABLE(lesson1_fullEvalContinuator lesson1_fullEvalContinuator.cpp) + ADD_EXECUTABLE(lesson1_evalContinuator lesson1_evalContinuator.cpp) + ADD_EXECUTABLE(lesson1_combinedContinuator lesson1_combinedContinuator.cpp) + ADD_EXECUTABLE(firstImprHC_maxSAT firstImprHC_maxSAT.cpp) + ELSE(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(lesson1_simpleHC EXCLUDE_FROM_ALL lesson1_simpleHC.cpp) + ADD_EXECUTABLE(lesson1_firstImprHC EXCLUDE_FROM_ALL lesson1_firstImprHC.cpp) + ADD_EXECUTABLE(lesson1_randomBestHC EXCLUDE_FROM_ALL lesson1_randomBestHC.cpp) + ADD_EXECUTABLE(lesson1_neutralHC EXCLUDE_FROM_ALL lesson1_neutralHC.cpp) + ADD_EXECUTABLE(lesson1_iterContinuator EXCLUDE_FROM_ALL lesson1_iterContinuator.cpp) + ADD_EXECUTABLE(lesson1_fitContinuator EXCLUDE_FROM_ALL lesson1_fitContinuator.cpp) + ADD_EXECUTABLE(lesson1_fullEvalContinuator EXCLUDE_FROM_ALL lesson1_fullEvalContinuator.cpp) + ADD_EXECUTABLE(lesson1_evalContinuator EXCLUDE_FROM_ALL lesson1_evalContinuator.cpp) + ADD_EXECUTABLE(lesson1_combinedContinuator EXCLUDE_FROM_ALL lesson1_combinedContinuator.cpp) + ADD_EXECUTABLE(firstImprHC_maxSAT EXCLUDE_FROM_ALL firstImprHC_maxSAT.cpp) + ENDIF(ENABLE_CMAKE_EXAMPLE) +ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + +###################################################################################### +### 4) Link the librairies for your target(s) +###################################################################################### + +TARGET_LINK_LIBRARIES(lesson1_simpleHC eoutils ga eo) +TARGET_LINK_LIBRARIES(lesson1_firstImprHC eoutils ga eo) +TARGET_LINK_LIBRARIES(lesson1_randomBestHC eoutils ga eo) +TARGET_LINK_LIBRARIES(lesson1_neutralHC eoutils ga eo) +TARGET_LINK_LIBRARIES(lesson1_iterContinuator eoutils ga eo) +TARGET_LINK_LIBRARIES(lesson1_fitContinuator eoutils ga eo) +TARGET_LINK_LIBRARIES(lesson1_fullEvalContinuator eoutils ga eo) +TARGET_LINK_LIBRARIES(lesson1_evalContinuator eoutils ga eo) +TARGET_LINK_LIBRARIES(lesson1_combinedContinuator eoutils ga eo) +TARGET_LINK_LIBRARIES(firstImprHC_maxSAT eoutils ga eo) diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/firstImprHC_maxSAT.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/firstImprHC_maxSAT.cpp new file mode 100644 index 000000000..97f48ae31 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/firstImprHC_maxSAT.cpp @@ -0,0 +1,222 @@ +//----------------------------------------------------------------------------- +/** firstImprHC_maxSAT.cpp + * + * SV - 05/05/10 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include +#include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit all neighbors in random order without repeating any neighbor + +//----------------------------------------------------------------------------- +// the first improvement Hill-Climbing local search +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +// Main function +//----------------------------------------------------------------------------- +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters from parser + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // Number of clauses of the max SAT problem + eoValueParam ncParam(10, "nbClauses", "Number of clauses", 'm'); + parser.processParam( ncParam, "Representation" ); + unsigned nbClause = ncParam.value(); + + // Number of litteral by clauses + eoValueParam kParam(3, "nbLitt", "Number of litteral by clauses", 'k'); + parser.processParam( kParam, "Representation" ); + unsigned nbLitteral = kParam.value(); + + // the name of the instance file + string str_in = "" ; // default value + eoValueParam inParam(str_in.c_str(), "in", "Input file of the file in ncf format", 'f'); + parser.processParam(inParam, "Persistence" ); + str_in = inParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the max SAT evaluation + MaxSATeval * fullEval; + + if (str_in.compare("") == 0) + fullEval = new MaxSATeval(vecSize, nbClause, nbLitteral); + else { + fullEval = new MaxSATeval(str_in); + vecSize = fullEval->nbVar ; + } + + // string out = "cnf.dat"; + // fullEval->save(out); + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + // Use it if there is no incremental evaluation: a neighbor is evaluated by the full evaluation of a solution + // moFullEvalByModif neighborEval(*fullEval); + + // Incremental evaluation of the neighbor: + moMaxSATincrEval neighborEval(*fullEval); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + // Exploration of the neighborhood in random order of the neigbor's index: + // each neighbor is visited only once + moRndWithoutReplNeighborhood neighborhood(vecSize); + + /* ========================================================= + * + * the local search algorithm + * + * ========================================================= */ + + moFirstImprHC hc(neighborhood, *fullEval, neighborEval); + + /* ========================================================= + * + * executes the local search from a random solution + * + * ========================================================= */ + + // The current solution + Indi solution; + + // Apply random initialization + random(solution); + + // Evaluation of the initial solution: + // can be evaluated here, or else it will be done at the beginning of the local search + (*fullEval)(solution); + + // Output: the intial solution + std::cout << "initial: " << solution << std::endl ; + + // Apply the local search on the solution ! + hc(solution); + + // Output: the final solution + std::cout << "final: " << solution << std::endl ; + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/firstImprHC_maxSAT.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/firstImprHC_maxSAT.param new file mode 100644 index 000000000..742e824e1 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/firstImprHC_maxSAT.param @@ -0,0 +1,14 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179091 # -S : Random number seed + +###### Persistence ###### +# --in= # -f : Input file of the file in ncf format +# --status=./firstImprHC_maxSAT.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size +# --nbClauses=10 # -m : Number of clauses +# --nbLitt=3 # -k : Number of litteral by clauses diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_combinedContinuator.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_combinedContinuator.cpp new file mode 100644 index 000000000..ba2d3de30 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_combinedContinuator.cpp @@ -0,0 +1,251 @@ +//----------------------------------------------------------------------------- +/** lesson1_combinedContinuator.cpp + * + * SV - 27/04/10 - version 1 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include +#include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit all neighbors in increasing order of bit index + +//----------------------------------------------------------------------------- +// the continuators +#include // to import the fitness counter +#include // to import the neighbor evaluation counter +#include +#include +#include +#include +#include + +//----------------------------------------------------------------------------- +// the simple Hill-Climbing local search +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +// Main function +//----------------------------------------------------------------------------- +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters from parser + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // maximum number of full evaluation + eoValueParam fevalParam(2, "fulleval", "Maximum number of full evaluation"); + parser.processParam( fevalParam, "Representation" ); + unsigned fullevalMax = fevalParam.value(); + + // maximum number of full evaluation + eoValueParam evalParam(30, "eval", "Maximum number of neighbor evaluation", 'e'); + parser.processParam( evalParam, "Representation" ); + unsigned evalMax = evalParam.value(); + + // maximum fitness to reach + eoValueParam fitParam(16, "fitness", "Maximum fitness value to reach", 'f'); + parser.processParam( fitParam, "Representation" ); + unsigned fitnessMax = fitParam.value(); + + // maximum number of iterations + eoValueParam iterParam(10, "iter", "Maximum number of iterations", 'i'); + parser.processParam( iterParam, "Representation" ); + unsigned iterMax = iterParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is just the number of 1 in the bit string + oneMaxEval fullEvalTmp; + + // to count the number of full evaluation + eoEvalFuncCounter fullEval(fullEvalTmp); + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + // Use it if there is no incremental evaluation: a neighbor is evaluated by the full evaluation of a solution + // moFullEvalByModif neighborEval(fullEval); + + // Incremental evaluation of the neighbor: fitness is modified by +/- 1 + moOneMaxIncrEval neighborEvalTmp; + + // to count the number of neighbor evaluation + moEvalCounter neighborEval(neighborEvalTmp); + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + // Exploration of the neighborhood in increasing order of the neigbor's index: + // bit-flip from bit 0 to bit (vecSize - 1) + moOrderNeighborhood neighborhood(vecSize); + + /* ========================================================= + * + * the external continuators + * + * ========================================================= */ + + moIterContinuator iterCont(iterMax); + moFitContinuator fitCont(fitnessMax); + moFullEvalContinuator fullevalCont(fullEval, fullevalMax); + moNeighborEvalContinuator evalCont(neighborEval, evalMax); + + moCombinedContinuator continuator(iterCont); + continuator.add(fitCont); + continuator.add(fullevalCont); + continuator.add(evalCont); + + /* ========================================================= + * + * the local search algorithm + * + * ========================================================= */ + + moSimpleHC hc(neighborhood, fullEval, neighborEval, continuator); + + /* ========================================================= + * + * executes the local search from a random solution + * + * ========================================================= */ + + // The current solution + Indi solution; + + // Apply random initialization + random(solution); + + // Evaluation of the initial solution: + // can be evaluated here, or else it will be done at the beginning of the local search + fullEval(solution); + + // Output: the intial solution + std::cout << "initial: " << solution << std::endl ; + + // Apply the local search on the solution ! + hc(solution); + + // Output: the final solution + std::cout << "final: " << solution << std::endl ; + std::cout << "number of iteration: " << iterCont.value() << std::endl ; + std::cout << "Number of full evaluations during the local search: " << fullevalCont.value() << std::endl ; + std::cout << "Number of neighbor evaluations during the local search: " << evalCont.value() << std::endl ; + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_combinedContinuator.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_combinedContinuator.param new file mode 100644 index 000000000..1a871312f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_combinedContinuator.param @@ -0,0 +1,15 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276174177 # -S : Random number seed + +###### Persistence ###### +# --status=./lesson1_combinedContinuator.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size +# --fulleval=2 # Maximum number of full evaluation +# --eval=30 # -e : Maximum number of neighbor evaluation +# --fitness=16 # -f : Maximum fitness value to reach +# --iter=10 # -i : Maximum number of iterations diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_evalContinuator.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_evalContinuator.cpp new file mode 100644 index 000000000..69cc1a3a7 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_evalContinuator.cpp @@ -0,0 +1,218 @@ +//----------------------------------------------------------------------------- +/** lesson1_continuator.cpp + * + * SV - 27/04/10 - version 1 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include +#include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit all neighbors in increasing order of bit index + +//----------------------------------------------------------------------------- +// the continuator based on the number of neighbor evaluations +#include // to import the neighbor evaluation counter +#include + +//----------------------------------------------------------------------------- +// the simple Hill-Climbing local search +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +// Main function +//----------------------------------------------------------------------------- +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters from parser + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // maximum number of full evaluation + eoValueParam evalParam(30, "eval", "Maximum number of neighbor evaluation", 'e'); + parser.processParam( evalParam, "Representation" ); + unsigned evalMax = evalParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is just the number of 1 in the bit string + oneMaxEval fullEval; + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + // Use it if there is no incremental evaluation: a neighbor is evaluated by the full evaluation of a solution + // moFullEvalByModif neighborEval(fullEval); + + // Incremental evaluation of the neighbor: fitness is modified by +/- 1 + moOneMaxIncrEval neighborEvalTmp; + + // to count the number of neighbor evaluation + moEvalCounter neighborEval(neighborEvalTmp); + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + // Exploration of the neighborhood in increasing order of the neigbor's index: + // bit-flip from bit 0 to bit (vecSize - 1) + moOrderNeighborhood neighborhood(vecSize); + + /* ========================================================= + * + * the external continuators + * + * ========================================================= */ + + moNeighborEvalContinuator continuator(neighborEval, evalMax); + + /* ========================================================= + * + * the local search algorithm + * + * ========================================================= */ + + moSimpleHC hc(neighborhood, fullEval, neighborEval, continuator); + + /* ========================================================= + * + * executes the local search from a random solution + * + * ========================================================= */ + + // The current solution + Indi solution; + + // Apply random initialization + random(solution); + + // Evaluation of the initial solution: + // can be evaluated here, or else it will be done at the beginning of the local search + fullEval(solution); + + // Output: the intial solution + std::cout << "initial: " << solution << std::endl ; + + // Apply the local search on the solution ! + hc(solution); + + // Output: the final solution + std::cout << "final: " << solution << std::endl ; + std::cout << "Number of neighbor evaluations during the local search: " << continuator.value() << std::endl ; + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_evalContinuator.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_evalContinuator.param new file mode 100644 index 000000000..5ad2daae6 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_evalContinuator.param @@ -0,0 +1,12 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179018 # -S : Random number seed + +###### Persistence ###### +# --status=./lesson1_evalContinuator.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size +# --eval=30 # -e : Maximum number of neighbor evaluation diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_firstImprHC.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_firstImprHC.cpp new file mode 100644 index 000000000..db0158fce --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_firstImprHC.cpp @@ -0,0 +1,196 @@ +//----------------------------------------------------------------------------- +/** lesson1_firstImprHC.cpp + * + * SV - 27/04/10 - version 1 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include +#include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit all neighbors in random order without repeating any neighbor + +//----------------------------------------------------------------------------- +// the first improvement Hill-Climbing local search +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +// Main function +//----------------------------------------------------------------------------- +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters from parser + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is just the number of 1 in the bit string + oneMaxEval fullEval; + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + // Use it if there is no incremental evaluation: a neighbor is evaluated by the full evaluation of a solution + // moFullEvalByModif neighborEval(fullEval); + + // Incremental evaluation of the neighbor: fitness is modified by +/- 1 + moOneMaxIncrEval neighborEval; + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + // Exploration of the neighborhood in random order of the neigbor's index: + // each neighbor is visited only once + moRndWithoutReplNeighborhood neighborhood(vecSize); + + /* ========================================================= + * + * the local search algorithm + * + * ========================================================= */ + + moFirstImprHC hc(neighborhood, fullEval, neighborEval); + + /* ========================================================= + * + * executes the local search from a random solution + * + * ========================================================= */ + + // The current solution + Indi solution; + + // Apply random initialization + random(solution); + + // Evaluation of the initial solution: + // can be evaluated here, or else it will be done at the beginning of the local search + fullEval(solution); + + // Output: the intial solution + std::cout << "initial: " << solution << std::endl ; + + // Apply the local search on the solution ! + hc(solution); + + // Output: the final solution + std::cout << "final: " << solution << std::endl ; + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_firstImprHC.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_firstImprHC.param new file mode 100644 index 000000000..2bd60fadb --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_firstImprHC.param @@ -0,0 +1,11 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179046 # -S : Random number seed + +###### Persistence ###### +# --status=./lesson1_firstImprHC.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_fitContinuator.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_fitContinuator.cpp new file mode 100644 index 000000000..a72ca7963 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_fitContinuator.cpp @@ -0,0 +1,213 @@ +//----------------------------------------------------------------------------- +/** lesson1_fitContinuator.cpp + * + * SV - 27/04/10 - version 1 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include +#include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit all neighbors in increasing order of bit index + +//----------------------------------------------------------------------------- +// the continuator based on fitness +#include + +//----------------------------------------------------------------------------- +// the simple Hill-Climbing local search +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +// Main function +//----------------------------------------------------------------------------- +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters from parser + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // maximum fitness to reach + eoValueParam fitParam(16, "fitness", "Maximum fitness value to reach", 'f'); + parser.processParam( fitParam, "Representation" ); + unsigned fitnessMax = fitParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is just the number of 1 in the bit string + oneMaxEval fullEval; + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + // Use it if there is no incremental evaluation: a neighbor is evaluated by the full evaluation of a solution + // moFullEvalByModif neighborEval(fullEval); + + // Incremental evaluation of the neighbor: fitness is modified by +/- 1 + moOneMaxIncrEval neighborEval; + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + // Exploration of the neighborhood in increasing order of the neigbor's index: + // bit-flip from bit 0 to bit (vecSize - 1) + moOrderNeighborhood neighborhood(vecSize); + + /* ========================================================= + * + * the external continuators + * + * ========================================================= */ + + moFitContinuator continuator(fitnessMax); + + /* ========================================================= + * + * the local search algorithm + * + * ========================================================= */ + + moSimpleHC hc(neighborhood, fullEval, neighborEval, continuator); + + /* ========================================================= + * + * executes the local search from a random solution + * + * ========================================================= */ + + // The current solution + Indi solution; + + // Apply random initialization + random(solution); + + // Evaluation of the initial solution: + // can be evaluated here, or else it will be done at the beginning of the local search + fullEval(solution); + + // Output: the intial solution + std::cout << "initial: " << solution << std::endl ; + + // Apply the local search on the solution ! + hc(solution); + + // Output: the final solution + std::cout << "final: " << solution << std::endl ; + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_fitContinuator.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_fitContinuator.param new file mode 100644 index 000000000..c838e34cc --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_fitContinuator.param @@ -0,0 +1,12 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179024 # -S : Random number seed + +###### Persistence ###### +# --status=./lesson1_fitContinuator.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size +# --fitness=16 # -f : Maximum fitness value to reach diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_fullEvalContinuator.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_fullEvalContinuator.cpp new file mode 100644 index 000000000..34ec620e0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_fullEvalContinuator.cpp @@ -0,0 +1,218 @@ +//----------------------------------------------------------------------------- +/** lesson1_fullEvalContinuator.cpp + * + * SV - 27/04/10 - version 1 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include +#include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit all neighbors in increasing order of bit index + +//----------------------------------------------------------------------------- +// the continuator based on full eval number +#include // to import the fitness counter +#include + +//----------------------------------------------------------------------------- +// the simple Hill-Climbing local search +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +// Main function +//----------------------------------------------------------------------------- +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters from parser + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // maximum number of full evaluation + eoValueParam evalParam(2, "fulleval", "Maximum number of full evaluation", 'e'); + parser.processParam( evalParam, "Representation" ); + unsigned fullevalMax = evalParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is just the number of 1 in the bit string + oneMaxEval fullEvalTmp; + + // to count the number of full evaluation + eoEvalFuncCounter fullEval(fullEvalTmp); + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + // Use it if there is no incremental evaluation: a neighbor is evaluated by the full evaluation of a solution + // moFullEvalByModif neighborEval(fullEval); + + // Incremental evaluation of the neighbor: fitness is modified by +/- 1 + moOneMaxIncrEval neighborEval; + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + // Exploration of the neighborhood in increasing order of the neigbor's index: + // bit-flip from bit 0 to bit (vecSize - 1) + moOrderNeighborhood neighborhood(vecSize); + + /* ========================================================= + * + * the external continuators + * + * ========================================================= */ + + moFullEvalContinuator continuator(fullEval, fullevalMax); + + /* ========================================================= + * + * the local search algorithm + * + * ========================================================= */ + + moSimpleHC hc(neighborhood, fullEval, neighborEval, continuator); + + /* ========================================================= + * + * executes the local search from a random solution + * + * ========================================================= */ + + // The current solution + Indi solution; + + // Apply random initialization + random(solution); + + // Evaluation of the initial solution: + // can be evaluated here, or else it will be done at the beginning of the local search + fullEval(solution); + + // Output: the intial solution + std::cout << "initial: " << solution << std::endl ; + + // Apply the local search on the solution ! + hc(solution); + + // Output: the final solution + std::cout << "final: " << solution << std::endl ; + std::cout << "Number of full evaluations during the local search: " << continuator.value() << std::endl ; + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_fullEvalContinuator.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_fullEvalContinuator.param new file mode 100644 index 000000000..45385b29e --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_fullEvalContinuator.param @@ -0,0 +1,12 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179068 # -S : Random number seed + +###### Persistence ###### +# --status=./lesson1_fullEvalContinuator.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size +# --fulleval=2 # -e : Maximum number of full evaluation diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_iterContinuator.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_iterContinuator.cpp new file mode 100644 index 000000000..01671a8b7 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_iterContinuator.cpp @@ -0,0 +1,215 @@ +//----------------------------------------------------------------------------- +/** lesson1_iterContinuator.cpp + * + * SV - 27/04/10 - version 1 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include +#include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit all neighbors in increasing order of bit index + +//----------------------------------------------------------------------------- +// the iteration continuators +#include + +//----------------------------------------------------------------------------- +// the simple Hill-Climbing local search +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +// Main function +//----------------------------------------------------------------------------- +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters from parser + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // maximum number of iterations + eoValueParam iterParam(10, "iter", "Maximum number of iterations", 'i'); + parser.processParam( iterParam, "Representation" ); + unsigned iterMax = iterParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is just the number of 1 in the bit string + oneMaxEval fullEval; + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + // Use it if there is no incremental evaluation: a neighbor is evaluated by the full evaluation of a solution + // moFullEvalByModif neighborEval(fullEval); + + // Incremental evaluation of the neighbor: fitness is modified by +/- 1 + moOneMaxIncrEval neighborEval; + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + // Exploration of the neighborhood in increasing order of the neigbor's index: + // bit-flip from bit 0 to bit (vecSize - 1) + moOrderNeighborhood neighborhood(vecSize); + + /* ========================================================= + * + * the external continuators + * + * ========================================================= */ + + moIterContinuator continuator(iterMax); + + /* ========================================================= + * + * the local search algorithm + * + * ========================================================= */ + + moSimpleHC hc(neighborhood, fullEval, neighborEval, continuator); + + /* ========================================================= + * + * executes the local search from a random solution + * + * ========================================================= */ + + // The current solution + Indi solution; + + // Apply random initialization + random(solution); + + // Evaluation of the initial solution: + // can be evaluated here, or else it will be done at the beginning of the local search + fullEval(solution); + + // Output: the intial solution + std::cout << "initial: " << solution << std::endl ; + + // Apply the local search on the solution ! + hc(solution); + + // Output: the final solution + std::cout << "final: " << solution << std::endl ; + + std::cout << "number of iteration: " << continuator.value() << std::endl ; + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_iterContinuator.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_iterContinuator.param new file mode 100644 index 000000000..88f2421d3 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_iterContinuator.param @@ -0,0 +1,12 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179030 # -S : Random number seed + +###### Persistence ###### +# --status=./lesson1_iterContinuator.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size +# --iter=10 # -i : Maximum number of iterations diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_neutralHC.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_neutralHC.cpp new file mode 100644 index 000000000..f00439209 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_neutralHC.cpp @@ -0,0 +1,200 @@ +//----------------------------------------------------------------------------- +/** lesson1_neutralHC.cpp + * + * SV - 27/04/10 - version 1 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include +#include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit all neighbors in increasing order of bit index + +//----------------------------------------------------------------------------- +// the neutral Hill-Climbing local search: move one of random best solution even it is the same fitness +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +// Main function +//----------------------------------------------------------------------------- +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters from parser + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + eoValueParam stepParam(10, "nbStepMax", "Number of steps of the random walk", 'n'); + parser.processParam( stepParam, "Representation" ); + unsigned nbStepMax = stepParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is just the number of 1 in the bit string + oneMaxEval fullEval; + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + // Use it if there is no incremental evaluation: a neighbor is evaluated by the full evaluation of a solution + // moFullEvalByModif neighborEval(fullEval); + + // Incremental evaluation of the neighbor: fitness is modified by +/- 1 + moOneMaxIncrEval neighborEval; + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + // Exploration of the neighborhood in increasing order of the neigbor's index: + // bit-flip from bit 0 to bit (vecSize - 1) + moOrderNeighborhood neighborhood(vecSize); + + /* ========================================================= + * + * the local search algorithm + * + * ========================================================= */ + + moNeutralHC hc(neighborhood, fullEval, neighborEval, nbStepMax); + + /* ========================================================= + * + * executes the local search from a random solution + * + * ========================================================= */ + + // The current solution + Indi solution; + + // Apply random initialization + random(solution); + + // Evaluation of the initial solution: + // can be evaluated here, or else it will be done at the beginning of the local search + fullEval(solution); + + // Output: the intial solution + std::cout << "initial: " << solution << std::endl ; + + // Apply the local search on the solution ! + hc(solution); + + // Output: the final solution + std::cout << "final: " << solution << std::endl ; + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_neutralHC.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_neutralHC.param new file mode 100644 index 000000000..d6756ce82 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_neutralHC.param @@ -0,0 +1,12 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179072 # -S : Random number seed + +###### Persistence ###### +# --status=./lesson1_neutralHC.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size +# --nbStepMax=10 # -n : Number of steps of the random walk diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_randomBestHC.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_randomBestHC.cpp new file mode 100644 index 000000000..868033b31 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_randomBestHC.cpp @@ -0,0 +1,196 @@ +//----------------------------------------------------------------------------- +/** first_randomBestHC.cpp + * + * SV - 27/04/10 - version 1 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include +#include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit all neighbors in increasing order of bit index + +//----------------------------------------------------------------------------- +// the Hill-Climbing local search which randomly one of the best solution +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +// Main function +//----------------------------------------------------------------------------- +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters from parser + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is just the number of 1 in the bit string + oneMaxEval fullEval; + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + // Use it if there is no incremental evaluation: a neighbor is evaluated by the full evaluation of a solution + // moFullEvalByModif neighborEval(fullEval); + + // Incremental evaluation of the neighbor: fitness is modified by +/- 1 + moOneMaxIncrEval neighborEval; + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + // Exploration of the neighborhood in increasing order of the neigbor's index: + // bit-flip from bit 0 to bit (vecSize - 1) + moOrderNeighborhood neighborhood(vecSize); + + /* ========================================================= + * + * the local search algorithm + * + * ========================================================= */ + + moRandomBestHC hc(neighborhood, fullEval, neighborEval); + + /* ========================================================= + * + * executes the local search from a random solution + * + * ========================================================= */ + + // The current solution + Indi solution; + + // Apply random initialization + random(solution); + + // Evaluation of the initial solution: + // can be evaluated here, or else it will be done at the beginning of the local search + fullEval(solution); + + // Output: the intial solution + std::cout << "initial: " << solution << std::endl ; + + // Apply the local search on the solution ! + hc(solution); + + // Output: the final solution + std::cout << "final: " << solution << std::endl ; + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_randomBestHC.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_randomBestHC.param new file mode 100644 index 000000000..40f5ae287 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_randomBestHC.param @@ -0,0 +1,11 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179038 # -S : Random number seed + +###### Persistence ###### +# --status=./lesson1_randomBestHC.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_simpleHC.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_simpleHC.cpp new file mode 100644 index 000000000..199b0556c --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_simpleHC.cpp @@ -0,0 +1,196 @@ +//----------------------------------------------------------------------------- +/** lesson1_simpleHC.cpp + * + * SV - 27/04/10 - version 1 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include +#include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit all neighbors in increasing order of bit index + +//----------------------------------------------------------------------------- +// the simple Hill-Climbing local search +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +// Main function +//----------------------------------------------------------------------------- +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters from parser + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is just the number of 1 in the bit string + oneMaxEval fullEval; + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + // Use it if there is no incremental evaluation: a neighbor is evaluated by the full evaluation of a solution + // moFullEvalByModif neighborEval(fullEval); + + // Incremental evaluation of the neighbor: fitness is modified by +/- 1 + moOneMaxIncrEval neighborEval; + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + // Exploration of the neighborhood in increasing order of the neigbor's index: + // bit-flip from bit 0 to bit (vecSize - 1) + moOrderNeighborhood neighborhood(vecSize); + + /* ========================================================= + * + * the local search algorithm + * + * ========================================================= */ + + moSimpleHC hc(neighborhood, fullEval, neighborEval); + + /* ========================================================= + * + * executes the local search from a random solution + * + * ========================================================= */ + + // The current solution + Indi solution; + + // Apply random initialization + random(solution); + + // Evaluation of the initial solution: + // can be evaluated here, or else it will be done at the beginning of the local search + fullEval(solution); + + // Output: the intial solution + std::cout << "initial: " << solution << std::endl ; + + // Apply the local search on the solution ! + hc(solution); + + // Output: the final solution + std::cout << "final: " << solution << std::endl ; + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_simpleHC.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_simpleHC.param new file mode 100644 index 000000000..e9cd285cc --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson1/lesson1_simpleHC.param @@ -0,0 +1,11 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179075 # -S : Random number seed + +###### Persistence ###### +# --status=./lesson1_simpleHC.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson2/CMakeLists.txt b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson2/CMakeLists.txt new file mode 100644 index 000000000..ad7d7c408 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson2/CMakeLists.txt @@ -0,0 +1,41 @@ +###################################################################################### +### 1) Include the sources +###################################################################################### + +INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src + ${MO_SRC_DIR}/src + ${PROBLEMS_SRC_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../src) + +###################################################################################### +### 2) Specify where CMake can find the libraries +###################################################################################### + +LINK_DIRECTORIES(${EO_BIN_DIR}/lib) + + +###################################################################################### +### 3) Define your target(s): just an executable here +###################################################################################### + +IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + SOURCE_GROUP(src FILES testNeighborhood.cpp) + ADD_EXECUTABLE(testNeighborhood + testNeighborhood.cpp + ${MO_BIN_DIR}/tutorial/Lesson2/testNeighborhood.param + ) +ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + ADD_COMMANDS_NEWMO() + ADD_TARGET_NEWMO(lesson2) + IF(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(testNeighborhood testNeighborhood.cpp) + ELSE(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(testNeighborhood EXCLUDE_FROM_ALL testNeighborhood.cpp) + ENDIF(ENABLE_CMAKE_EXAMPLE) +ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + +###################################################################################### +### 4) Link the librairies for your target(s) +###################################################################################### + +TARGET_LINK_LIBRARIES(testNeighborhood eoutils ga eo) diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson2/testNeighborhood.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson2/testNeighborhood.cpp new file mode 100644 index 000000000..fbc99827a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson2/testNeighborhood.cpp @@ -0,0 +1,241 @@ +//----------------------------------------------------------------------------- +/** testNeighborhood.cpp + * + * JH - 09/04/10 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include +#include + +using namespace std; + +//---------------------------------------------------------------------------- + +//Representation and initializer +#include +#include + +// fitness function +#include +#include +#include + +//Neighbors and Neighborhoods +#include +#include +#include +#include +#include +#include + + +// Define types of the representation solution, different neighbors and neighborhoods +//----------------------------------------------------------------------------- +typedef eoInt Queen; //Permutation (Queen's problem representation) + +typedef moSwapNeighbor swapNeighbor ; //swap Neighbor +typedef moSwapNeighborhood swapNeighborhood; //classical swap Neighborhood + +typedef moShiftNeighbor shiftNeighbor; //shift Neighbor +typedef moOrderNeighborhood orderShiftNeighborhood; //order shift Neighborhood (Indexed) +typedef moRndWithoutReplNeighborhood rndWithoutReplShiftNeighborhood; //random without replacement shift Neighborhood (Indexed) +typedef moRndWithReplNeighborhood rndWithReplShiftNeighborhood; //random with replacement shift Neighborhood (Indexed) + +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters + * + * ========================================================= */ + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // description of genotype + eoValueParam vecSizeParam(8, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + //reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + rng.reseed(seed); + + + /* ========================================================= + * + * Eval fitness function + * + * ========================================================= */ + + queenEval fullEval; + + + /* ========================================================= + * + * Initializer of the solution + * + * ========================================================= */ + + eoInitPermutation init(vecSize); + + + /* ========================================================= + * + * evaluation operators of a neighbor solution + * + * ========================================================= */ + + moFullEvalByModif swapEval(fullEval); + moFullEvalByCopy shiftEval(fullEval); + + + /* ========================================================= + * + * Neighbors and Neighborhoods + * + * ========================================================= */ + + swapNeighborhood swapNH; + orderShiftNeighborhood orderShiftNH((vecSize-1) * (vecSize-1)); + rndWithoutReplShiftNeighborhood rndNoReplShiftNH((vecSize-1) * (vecSize-1)); + rndWithReplShiftNeighborhood rndReplShiftNH((vecSize-1) * (vecSize-1)); + + + /* ========================================================= + * + * Init and eval a Queen + * + * ========================================================= */ + + Queen solution; + + init(solution); + + fullEval(solution); + + std::cout << "Initial Solution:" << std::endl; + std::cout << solution << std::endl << std::endl; + + /* ========================================================= + * + * Use classical Neighbor and Neighborhood (swap) + * + * ========================================================= */ + + std::cout << "SWAP NEIGHBORHOOD" << std::endl; + std::cout << "-----------------" << std::endl; + std::cout << "Neighbors List: (Neighbor -> fitness)" << std::endl; + + swapNeighbor n1; + swapNH.init(solution, n1); + swapEval(solution,n1); + n1.print(); + while (swapNH.cont(solution)) { + swapNH.next(solution, n1); + swapEval(solution,n1); + n1.print(); + } + + /* ========================================================= + * + * Use indexed Neighborhood with shift operator + * + * ========================================================= */ + + std::cout << "\nSHIFT ORDER NEIGHBORHOOD" << std::endl; + std::cout << "------------------------" << std::endl; + std::cout << "Neighbors List: (key: Neighbor -> fitness)" << std::endl; + + shiftNeighbor n2; + + orderShiftNH.init(solution, n2); + shiftEval(solution,n2); + n2.print(); + while (orderShiftNH.cont(solution)) { + orderShiftNH.next(solution, n2); + shiftEval(solution,n2); + n2.print(); + } + + std::cout << "\nSHIFT RANDOM WITHOUT REPLACEMENT NEIGHBORHOOD" << std::endl; + std::cout << "---------------------------------------------" << std::endl; + std::cout << "Neighbors List: (key: Neighbor -> fitness)" << std::endl; + + rndNoReplShiftNH.init(solution, n2); + shiftEval(solution,n2); + n2.print(); + while (rndNoReplShiftNH.cont(solution)) { + rndNoReplShiftNH.next(solution, n2); + shiftEval(solution,n2); + n2.print(); + } + + std::cout << "\nSHIFT RANDOM WITH REPLACEMENT NEIGHBORHOOD" << std::endl; + std::cout << "---------------------------------------------" << std::endl; + std::cout << "Neighbors List: (key: Neighbor -> fitness)" << std::endl; + + rndReplShiftNH.init(solution, n2); + shiftEval(solution,n2); + n2.print(); + for (unsigned int i=0; i<100; i++) { + rndReplShiftNH.next(solution, n2); + shiftEval(solution,n2); + n2.print(); + } + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson2/testNeighborhood.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson2/testNeighborhood.param new file mode 100644 index 000000000..2aa974cd9 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson2/testNeighborhood.param @@ -0,0 +1,11 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276172025 # -S : Random number seed + +###### Persistence ###### +# --status=./testNeighborhood.status # Status file + +###### Representation ###### +# --vecSize=8 # -V : Genotype size diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson3/CMakeLists.txt b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson3/CMakeLists.txt new file mode 100644 index 000000000..457b953c5 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson3/CMakeLists.txt @@ -0,0 +1,41 @@ +###################################################################################### +### 1) Include the sources +###################################################################################### + +INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src + ${MO_SRC_DIR}/src + ${PROBLEMS_SRC_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../src) + +###################################################################################### +### 2) Specify where CMake can find the libraries +###################################################################################### + +LINK_DIRECTORIES(${EO_BIN_DIR}/lib) + + +###################################################################################### +### 3) Define your target(s): just an executable here +###################################################################################### + +IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + SOURCE_GROUP(src FILES testSimulatedAnnealing.cpp) + ADD_EXECUTABLE(testSimulatedAnnealing + testSimulatedAnnealing.cpp + ${MO_BIN_DIR}/tutorial/Lesson3/testSimulatedAnnealing.param + ) +ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + ADD_COMMANDS_NEWMO() + ADD_TARGET_NEWMO(lesson3) + IF(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(testSimulatedAnnealing testSimulatedAnnealing.cpp) + ELSE(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(testSimulatedAnnealing EXCLUDE_FROM_ALL testSimulatedAnnealing.param) + ENDIF(ENABLE_CMAKE_EXAMPLE) +ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + +###################################################################################### +### 4) Link the librairies for your target(s) +###################################################################################### + +TARGET_LINK_LIBRARIES(testSimulatedAnnealing eoutils ga eo) \ No newline at end of file diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson3/testSimulatedAnnealing.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson3/testSimulatedAnnealing.cpp new file mode 100644 index 000000000..661657c7b --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson3/testSimulatedAnnealing.cpp @@ -0,0 +1,232 @@ +//----------------------------------------------------------------------------- +/** testSimulatedAnnealing.cpp + * + * SV - 29/03/10 + * JH - 20/04/10 + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include +#include + +using namespace std; + +//----------------------------------------------------------------------------- +//Representation and initializer +#include +#include +#include + +// fitness function +#include +#include +#include + +//Neighbors and Neighborhoods +#include +#include + +//Algorithm and its components +#include +#include + +//comparator +#include + +//continuators +#include +#include +#include +#include +#include + + +//----------------------------------------------------------------------------- +// Define types of the representation solution, different neighbors and neighborhoods +//----------------------------------------------------------------------------- +typedef eoInt Queen; //Permutation (Queen's problem representation) + +typedef moShiftNeighbor shiftNeighbor; //shift Neighbor +typedef moRndWithReplNeighborhood rndShiftNeighborhood; //rnd shift Neighborhood (Indexed) + +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters + * + * ========================================================= */ + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // description of genotype + eoValueParam vecSizeParam(8, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + //reproducible random seed: if you don't change SEED above, + // you'll always get the same result, NOT a random run + rng.reseed(seed); + + + /* ========================================================= + * + * Eval fitness function + * + * ========================================================= */ + + queenEval fullEval; + + + /* ========================================================= + * + * Initilisation of the solution + * + * ========================================================= */ + + eoInitPermutation init(vecSize); + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + moFullEvalByCopy shiftEval(fullEval); + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + rndShiftNeighborhood rndShiftNH((vecSize-1) * (vecSize-1)); + + /* ========================================================= + * + * the local search algorithm + * + * ========================================================= */ + + moSA localSearch1(rndShiftNH, fullEval, shiftEval); + + /* ========================================================= + * + * execute the local search from random solution + * + * ========================================================= */ + + Queen solution1, solution2; + + init(solution1); + + fullEval(solution1); + + std::cout << "#########################################" << std::endl; + std::cout << "initial solution1: " << solution1 << std::endl ; + + localSearch1(solution1); + + std::cout << "final solution1: " << solution1 << std::endl ; + std::cout << "#########################################" << std::endl; + + + /* ========================================================= + * + * the cooling schedule of the process + * + * ========================================================= */ + + // initial temp, factor of decrease, number of steps without decrease, final temp. + moSimpleCoolingSchedule coolingSchedule(1, 0.9, 100, 0.01); + + /* ========================================================= + * + * Comparator of neighbors + * + * ========================================================= */ + + moSolNeighborComparator solComparator; + + /* ========================================================= + * + * Example of Checkpointing + * + * ========================================================= */ + + moTrueContinuator continuator;//always continue + moCheckpoint checkpoint(continuator); + moFitnessStat fitStat; + checkpoint.add(fitStat); + eoFileMonitor monitor("fitness.out", ""); + moCounterMonitorSaver countMon(100, monitor); + checkpoint.add(countMon); + monitor.add(fitStat); + + moSA localSearch2(rndShiftNH, fullEval, shiftEval, coolingSchedule, solComparator, checkpoint); + + init(solution2); + + fullEval(solution2); + + std::cout << "#########################################" << std::endl; + std::cout << "initial solution2: " << solution2 << std::endl ; + + localSearch2(solution2); + + std::cout << "final solution2: " << solution2 << std::endl ; + std::cout << "#########################################" << std::endl; +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson3/testSimulatedAnnealing.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson3/testSimulatedAnnealing.param new file mode 100644 index 000000000..5ebc2663c --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson3/testSimulatedAnnealing.param @@ -0,0 +1,11 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276172057 # -S : Random number seed + +###### Persistence ###### +# --status=./testSimulatedAnnealing.status # Status file + +###### Representation ###### +# --vecSize=8 # -V : Genotype size diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson4/CMakeLists.txt b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson4/CMakeLists.txt new file mode 100644 index 000000000..714193b2d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson4/CMakeLists.txt @@ -0,0 +1,42 @@ +###################################################################################### +### 1) Include the sources +###################################################################################### + +INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src + ${MO_SRC_DIR}/src + ${PROBLEMS_SRC_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../src) + +###################################################################################### +### 2) Specify where CMake can find the libraries +###################################################################################### + +LINK_DIRECTORIES(${EO_BIN_DIR}/lib) + + +###################################################################################### +### 3) Define your target(s): just an executable here +###################################################################################### + +IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + SOURCE_GROUP(src FILES testSimpleTS.cpp) + ADD_EXECUTABLE(testSimpleTS + testSimpleTS.cpp + ${MO_BIN_DIR}/tutorial/lesson4/testSimpleTS.param + ) +ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + ADD_COMMANDS_NEWMO() + ADD_TARGET_NEWMO(lesson4) + IF(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(testSimpleTS testSimpleTS.cpp) + ELSE(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(testSimpleTS EXCLUDE_FROM_ALL testSimpleTS.cpp) + ENDIF(ENABLE_CMAKE_EXAMPLE) +ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + +###################################################################################### +### 4) Link the librairies for your target(s) +###################################################################################### + +TARGET_LINK_LIBRARIES(testSimpleTS eoutils ga eo) + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson4/testSimpleTS.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson4/testSimpleTS.cpp new file mode 100644 index 000000000..767c5834d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson4/testSimpleTS.cpp @@ -0,0 +1,266 @@ +//----------------------------------------------------------------------------- +/** testSimpleHC.cpp + * + * SV - 12/01/10 + * JH - 03/05/10 + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include +#include + +using namespace std; + +//----------------------------------------------------------------------------- +//Representation and initializer +#include +#include +#include + +// fitness function +#include +#include +#include + +//Neighbors and Neighborhoods +#include +#include + +//Algorithm and its components +#include + +//mo eval +#include +#include + + +// REPRESENTATION +//----------------------------------------------------------------------------- +typedef eoInt Queen; //Permutation (Queen's problem representation) + +typedef moShiftNeighbor shiftNeighbor; //shift Neighbor +typedef moOrderNeighborhood orderShiftNeighborhood; //order shift Neighborhood (Indexed) + +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters + * + * ========================================================= */ + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // seed + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // description of genotype + eoValueParam vecSizeParam(8, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // size tabu list + eoValueParam sizeTabuListParam(7, "sizeTabuList", "size of the tabu list", 'T'); + parser.processParam( sizeTabuListParam, "Search Parameters" ); + unsigned sizeTabuList = sizeTabuListParam.value(); + + // time Limit + eoValueParam timeLimitParam(1, "timeLimit", "time limits", 'T'); + parser.processParam( timeLimitParam, "Search Parameters" ); + unsigned timeLimit = timeLimitParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + //reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + rng.reseed(seed); + + + /* ========================================================= + * + * Full evaluation fitness function + * + * ========================================================= */ + + queenEval fullEval; + + + /* ========================================================= + * + * Initializer of a solution + * + * ========================================================= */ + + eoInitPermutation init(vecSize); + + + /* ========================================================= + * + * Declare and init solutions + * + * ========================================================= */ + + Queen sol1; + Queen sol2; + Queen sol3; + + //random initialization + init(sol1); + init(sol2); + init(sol3); + + //evaluation + fullEval(sol1); + fullEval(sol2); + fullEval(sol3); + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + moFullEvalByCopy shiftEval(fullEval); + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + orderShiftNeighborhood orderShiftNH((vecSize-1) * (vecSize-1)); + + /* ========================================================= + * + * Comparator of neighbors and solutions + * + * ========================================================= */ + + moSolNeighborComparator solComparator; + moNeighborComparator comparator; + + /* ========================================================= + * + * tabu list + * + * ========================================================= */ + + moNeighborVectorTabuList tl(sizeTabuList,0); + + /* ========================================================= + * + * Memories + * + * ========================================================= */ + + moDummyIntensification inten; + moDummyDiversification div; + moBestImprAspiration asp; + + /* ========================================================= + * + * continuator + * + * ========================================================= */ + + moTimeContinuator continuator(timeLimit); + + + /* ========================================================= + * + * the local search algorithms + * + * ========================================================= */ + + //Basic Constructor + moTS localSearch1(orderShiftNH, fullEval, shiftEval, 2, 7); + + //Simple Constructor + moTS localSearch2(orderShiftNH, fullEval, shiftEval, 3, tl); + + //General Constructor + moTS localSearch3(orderShiftNH, fullEval, shiftEval, comparator, solComparator, continuator, tl, inten, div, asp); + + /* ========================================================= + * + * execute the local search from random solution + * + * ========================================================= */ + + + + + + //Can be eval here, else it will be done at the beginning of the localSearch + //fullEval(solution); + + + //Run the three Tabu Search and print initial and final solutions + std::cout << "Tabu Search 1:" << std::endl; + std::cout << "--------------" << std::endl; + std::cout << "initial: " << sol1 << std::endl ; + localSearch1(sol1); + std::cout << "final: " << sol1 << std::endl << std::endl; + + std::cout << "Tabu Search 2:" << std::endl; + std::cout << "--------------" << std::endl; + std::cout << "initial: " << sol2 << std::endl ; + localSearch2(sol2); + std::cout << "final: " << sol2 << std::endl << std::endl; + + std::cout << "Tabu Search 3:" << std::endl; + std::cout << "--------------" << std::endl; + std::cout << "initial: " << sol3 << std::endl ; + localSearch3(sol3); + std::cout << "final: " << sol3 << std::endl ; + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson4/testSimpleTS.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson4/testSimpleTS.param new file mode 100644 index 000000000..fe342ba1d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson4/testSimpleTS.param @@ -0,0 +1,15 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276172081 # -S : Random number seed + +###### Persistence ###### +# --status=./testSimpleTS.status # Status file + +###### Representation ###### +# --vecSize=8 # -V : Genotype size + +###### Search Parameters ###### +# --sizeTabuList=7 # -T : size of the tabu list +# --timeLimit=1 # -T : time limits diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson5/CMakeLists.txt b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson5/CMakeLists.txt new file mode 100644 index 000000000..e78b3fb5a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson5/CMakeLists.txt @@ -0,0 +1,42 @@ +###################################################################################### +### 1) Include the sources +###################################################################################### + +INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src + ${MO_SRC_DIR}/src + ${PROBLEMS_SRC_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../src) + +###################################################################################### +### 2) Specify where CMake can find the libraries +###################################################################################### + +LINK_DIRECTORIES(${EO_BIN_DIR}/lib) + + +###################################################################################### +### 3) Define your target(s): just an executable here +###################################################################################### + +IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + SOURCE_GROUP(src FILES testILS.cpp) + ADD_EXECUTABLE(testILS + testILS.cpp + ${MO_BIN_DIR}/tutorial/lesson5/testILS.param + ) +ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + ADD_COMMANDS_NEWMO() + ADD_TARGET_NEWMO(lesson5) + IF(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(testILS testILS.cpp) + ELSE(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(testILS EXCLUDE_FROM_ALL testILS.cpp) + ENDIF(ENABLE_CMAKE_EXAMPLE) +ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + +###################################################################################### +### 4) Link the librairies for your target(s) +###################################################################################### + +TARGET_LINK_LIBRARIES(testILS eoutils ga eo) + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson5/testILS.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson5/testILS.cpp new file mode 100644 index 000000000..2efbc1144 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson5/testILS.cpp @@ -0,0 +1,230 @@ +//----------------------------------------------------------------------------- +/** testILS.cpp + * + * SV - 12/01/10 + * JH - 04/05/10 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include +#include +#include + +using namespace std; + +//----------------------------------------------------------------------------- +//Representation and initializer +#include +#include +#include + +// fitness function +#include +#include +#include + +//Neighbors and Neighborhoods +#include +#include + +//Mutation +#include + +//Algorithm and its components +#include +#include + +//mo eval +#include + +#include +#include +#include +#include +#include + +#include + +// REPRESENTATION +//----------------------------------------------------------------------------- +typedef eoInt Queen; //Permutation (Queen's problem representation) + +typedef moShiftNeighbor shiftNeighbor; //shift Neighbor +typedef moOrderNeighborhood orderShiftNeighborhood; //order shift Neighborhood (Indexed) + +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters + * + * ========================================================= */ + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // description of genotype + eoValueParam vecSizeParam(8, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + //reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + rng.reseed(seed); + + + /* ========================================================= + * + * Full evaluation fitness function + * + * ========================================================= */ + + queenEval fullEval; + + + /* ========================================================= + * + * Initializer of a solution + * + * ========================================================= */ + + eoInitPermutation init(vecSize); + + + /* ========================================================= + * + * Declare and init solutions + * + * ========================================================= */ + + Queen sol1; + Queen sol2; + Queen sol3; + + //random initialization + init(sol1); + init(sol2); + init(sol3); + + //evaluation + fullEval(sol1); + fullEval(sol2); + fullEval(sol3); + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + moFullEvalByCopy shiftEval(fullEval); + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + orderShiftNeighborhood orderShiftNH((vecSize-1) * (vecSize-1)); + + + /* ========================================================= + * + * the local search algorithms + * + * ========================================================= */ + + //Basic Constructor of the Tabu Search + moTS ts(orderShiftNH, fullEval, shiftEval, 1, 7); + + eoSwapMutation mut; + + //Basic Constructor of the Iterated Local Search + moILS localSearch1(ts, fullEval, mut, 3); + + + //Simple Constructor of the Iterated Local Search + //Be carefull, template of the continuator must be a dummyNeighbor!!! + moIterContinuator > cont(4, false); + moILS localSearch2(ts, fullEval, mut, cont); + + //General Constructor of the Iterated Local Search + moMonOpPerturb perturb(mut, fullEval); + + moSolComparator solComp; + moBetterAcceptCrit accept(solComp); + + moILS localSearch3(ts, fullEval, cont, perturb, accept); + + std::cout << "Iterated Local Search 1:" << std::endl; + std::cout << "--------------" << std::endl; + std::cout << "initial: " << sol1 << std::endl ; + localSearch1(sol1); + std::cout << "final: " << sol1 << std::endl << std::endl; + + std::cout << "Iterated Local Search 2:" << std::endl; + std::cout << "--------------" << std::endl; + std::cout << "initial: " << sol2 << std::endl ; + localSearch2(sol2); + std::cout << "final: " << sol2 << std::endl << std::endl; + + std::cout << "Iterated Local Search 3:" << std::endl; + std::cout << "--------------" << std::endl; + std::cout << "initial: " << sol3 << std::endl ; + localSearch3(sol3); + std::cout << "final: " << sol3 << std::endl << std::endl; + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson5/testILS.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson5/testILS.param new file mode 100644 index 000000000..519e7c498 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson5/testILS.param @@ -0,0 +1,11 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276172246 # -S : Random number seed + +###### Persistence ###### +# --status=./testILS.status # Status file + +###### Representation ###### +# --vecSize=8 # -V : Genotype size diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/CMakeLists.txt b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/CMakeLists.txt new file mode 100644 index 000000000..6130dac52 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/CMakeLists.txt @@ -0,0 +1,122 @@ +###################################################################################### +### 1) Include the sources +###################################################################################### + +INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src + ${MO_SRC_DIR}/src + ${PROBLEMS_SRC_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../src) + +###################################################################################### +### 2) Specify where CMake can find the libraries +###################################################################################### + +LINK_DIRECTORIES(${EO_BIN_DIR}/lib) + + +###################################################################################### +### 3) Define your target(s): just an executable here +###################################################################################### + +IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + SOURCE_GROUP(src FILES testRandomWalk.cpp + testMetropolisHasting.cpp + testRandomNeutralWalk.cpp + sampling.cpp + densityOfStates.cpp + autocorrelation.cpp + adaptiveWalks.cpp + fdc.cpp + neutralDegree.cpp + fitnessCloud.cpp + neutralWalk.cpp) + ADD_EXECUTABLE(testRandomWalk + testRandomWalk.cpp + ${MO_BIN_DIR}/tutorial/lesson6/testRandomWalk.param + ) + ADD_EXECUTABLE(testMetropolisHasting + testMetropolisHasting.cpp + ${MO_BIN_DIR}/tutorial/lesson6/testMetropolisHasting.param + ) + ADD_EXECUTABLE(testRandomNeutralWalk + testRandomNeutralWalk.cpp + ${MO_BIN_DIR}/tutorial/lesson6/testRandomNeutralWalk.param + ) + ADD_EXECUTABLE(sampling + sampling.cpp + ${MO_BIN_DIR}/tutorial/lesson6/sampling.param + ) + ADD_EXECUTABLE(densityOfStates + densityOfStates.cpp + ${MO_BIN_DIR}/tutorial/lesson6/densityOfStates.param + ) + ADD_EXECUTABLE(autocorrelation + autocorrelation.cpp + ${MO_BIN_DIR}/tutorial/lesson6/autocorrelation.param + ) + ADD_EXECUTABLE(adaptiveWalks + adaptiveWalks.cpp + ${MO_BIN_DIR}/tutorial/lesson6/adaptiveWalks.param + ) + ADD_EXECUTABLE(fdc + fdc.cpp + ${MO_BIN_DIR}/tutorial/lesson6/fdc.param + ) + ADD_EXECUTABLE(neutralDegree + neutralDegree.cpp + ${MO_BIN_DIR}/tutorial/lesson6/neutralDegree.param + ) + ADD_EXECUTABLE(fitnessCloud + fitnessCloud.cpp + ${MO_BIN_DIR}/tutorial/lesson6/fitnessCloud.param + ) + ADD_EXECUTABLE(neutralWalk + neutralWalk.cpp + ${MO_BIN_DIR}/tutorial/lesson6/neutralWalk.param + ) + +ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + ADD_COMMANDS_NEWMO() + ADD_TARGET_NEWMO(lesson6) + IF(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(testRandomWalk testRandomWalk.cpp) + ADD_EXECUTABLE(testMetropolisHasting testMetropolisHasting.cpp) + ADD_EXECUTABLE(testRandomNeutralWalk testRandomNeutralWalk.cpp) + ADD_EXECUTABLE(sampling sampling.cpp) + ADD_EXECUTABLE(densityOfStates densityOfStates.cpp) + ADD_EXECUTABLE(autocorrelation autocorrelation.cpp) + ADD_EXECUTABLE(adaptiveWalks adaptiveWalks.cpp) + ADD_EXECUTABLE(fdc fdc.cpp) + ADD_EXECUTABLE(neutralDegree neutralDegree.cpp) + ADD_EXECUTABLE(fitnessCloud fitnessCloud.cpp) + ADD_EXECUTABLE(neutralWalk neutralWalk.cpp) + ELSE(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(testRandomWalk EXCLUDE_FROM_ALL testRandomWalk.cpp) + ADD_EXECUTABLE(testMetropolisHasting EXCLUDE_FROM_ALL testMetropolisHasting.cpp) + ADD_EXECUTABLE(testRandomNeutralWalk EXCLUDE_FROM_ALL testRandomNeutralWalk.cpp) + ADD_EXECUTABLE(sampling EXCLUDE_FROM_ALL sampling.cpp) + ADD_EXECUTABLE(densityOfStates EXCLUDE_FROM_ALL densityOfStates.cpp) + ADD_EXECUTABLE(autocorrelation EXCLUDE_FROM_ALL autocorrelation.cpp) + ADD_EXECUTABLE(adaptiveWalks EXCLUDE_FROM_ALL adaptiveWalks.cpp) + ADD_EXECUTABLE(fdc EXCLUDE_FROM_ALL fdc.cpp) + ADD_EXECUTABLE(neutralDegree EXCLUDE_FROM_ALL neutralDegree.cpp) + ADD_EXECUTABLE(fitnessCloud EXCLUDE_FROM_ALL fitnessCloud.cpp) + ADD_EXECUTABLE(neutralWalk EXCLUDE_FROM_ALL neutralWalk.cpp) + ENDIF(ENABLE_CMAKE_EXAMPLE) +ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + +###################################################################################### +### 4) Link the librairies for your target(s) +###################################################################################### + +TARGET_LINK_LIBRARIES(testRandomWalk eoutils ga eo) +TARGET_LINK_LIBRARIES(testMetropolisHasting eoutils ga eo) +TARGET_LINK_LIBRARIES(testRandomNeutralWalk eoutils ga eo) +TARGET_LINK_LIBRARIES(sampling eoutils ga eo) +TARGET_LINK_LIBRARIES(densityOfStates eoutils ga eo) +TARGET_LINK_LIBRARIES(autocorrelation eoutils ga eo) +TARGET_LINK_LIBRARIES(adaptiveWalks eoutils ga eo) +TARGET_LINK_LIBRARIES(fdc eoutils ga eo) +TARGET_LINK_LIBRARIES(neutralDegree eoutils ga eo) +TARGET_LINK_LIBRARIES(fitnessCloud eoutils ga eo) +TARGET_LINK_LIBRARIES(neutralWalk eoutils ga eo) diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/adaptiveWalks.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/adaptiveWalks.cpp new file mode 100644 index 000000000..36ab47ca0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/adaptiveWalks.cpp @@ -0,0 +1,210 @@ +//----------------------------------------------------------------------------- +/** adaptiveWalks.cpp + * + * SV - 05/05/10 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include +#include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit all the neighbors + +//----------------------------------------------------------------------------- +// the sampling class +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // the number of adaptive walks + eoValueParam solParam(100, "nbSol", "Number of adaptive walks", 'n'); + parser.processParam( solParam, "Representation" ); + unsigned nbSol = solParam.value(); + + // the name of the output file + string str_out = "out.dat"; // default value + eoValueParam outParam(str_out.c_str(), "out", "Output file of the sampling", 'o'); + parser.processParam(outParam, "Persistence" ); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is just the number of 1 in the bit string + oneMaxEval fullEval; + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + // Use it if there is no incremental evaluation: a neighbor is evaluated by the full evaluation of a solution + // moFullEvalByModif neighborEval(fullEval); + + // Incremental evaluation of the neighbor: fitness is modified by +/- 1 + moOneMaxIncrEval neighborEval; + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + // Exploration of the neighborhood in order + // from bit 0 to bit vecSize-1 + moOrderNeighborhood neighborhood(vecSize); + + /* ========================================================= + * + * The sampling of the search space + * + * ========================================================= */ + + // sampling object : + // - random initialization + // - local search to sample the search space + // - one statistic to compute + moHillClimberSampling sampling(random, neighborhood, fullEval, neighborEval, nbSol); + + /* ========================================================= + * + * execute the sampling + * + * ========================================================= */ + + sampling(); + + /* ========================================================= + * + * export the sampling + * + * ========================================================= */ + + // to export the statistics into file + sampling.fileExport(str_out); + + // to get the values of statistics + // so, you can compute some statistics in c++ from the data + const std::vector & lengthValues = sampling.getValues(0); + + std::cout << "First values:" << std::endl; + std::cout << "Length " << lengthValues[0] << std::endl; + + std::cout << "Last values:" << std::endl; + std::cout << "Length " << lengthValues[lengthValues.size() - 1] << std::endl; + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/adaptiveWalks.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/adaptiveWalks.param new file mode 100644 index 000000000..83c8dab95 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/adaptiveWalks.param @@ -0,0 +1,13 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179853 # -S : Random number seed + +###### Persistence ###### +# --out=out.dat # -o : Output file of the sampling +# --status=./adaptiveWalks.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size +# --nbSol=100 # -n : Number of adaptive walks diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/autocorrelation.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/autocorrelation.cpp new file mode 100644 index 000000000..6f07d8ae7 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/autocorrelation.cpp @@ -0,0 +1,225 @@ +//----------------------------------------------------------------------------- +/** autocorrelation.cpp + * + * SV - 03/05/10 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include +#include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit one random neighbor possibly the same one several times + +//----------------------------------------------------------------------------- +// the sampling class +#include + +//----------------------------------------------------------------------------- +// the statistics class +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // the number of steps of the random walk + eoValueParam stepParam(100, "nbStep", "Number of steps of the random walk", 'n'); + parser.processParam( stepParam, "Representation" ); + unsigned nbStep = stepParam.value(); + + // the name of the output file + string str_out = "out.dat"; // default value + eoValueParam outParam(str_out.c_str(), "out", "Output file of the sampling", 'o'); + parser.processParam(outParam, "Persistence" ); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is just the number of 1 in the bit string + oneMaxEval fullEval; + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + // Use it if there is no incremental evaluation: a neighbor is evaluated by the full evaluation of a solution + // moFullEvalByModif neighborEval(fullEval); + + // Incremental evaluation of the neighbor: fitness is modified by +/- 1 + moOneMaxIncrEval neighborEval; + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + // Exploration of the neighborhood in random order + // at each step one bit is randomly generated + moRndWithReplNeighborhood neighborhood(vecSize); + + /* ========================================================= + * + * The sampling of the search space + * + * ========================================================= */ + + // sampling object : + // - random initialization + // - neighborhood to compute the next step + // - fitness function + // - neighbor evaluation + // - number of steps of the walk + moAutocorrelationSampling sampling(random, neighborhood, fullEval, neighborEval, nbStep); + + /* ========================================================= + * + * execute the sampling + * + * ========================================================= */ + + sampling(); + + /* ========================================================= + * + * export the sampling + * + * ========================================================= */ + + // to export the statistics into file + sampling.fileExport(str_out); + + // to get the values of statistics + // so, you can compute some statistics in c++ from the data + const std::vector & fitnessValues = sampling.getValues(0); + + std::cout << "First values:" << std::endl; + std::cout << "Fitness " << fitnessValues[0] << std::endl; + + std::cout << "Last values:" << std::endl; + std::cout << "Fitness " << fitnessValues[fitnessValues.size() - 1] << std::endl; + + // more basic statistics on the distribution: + moStatistics statistics; + + vector rho, phi; + + statistics.autocorrelation(fitnessValues, 10, rho, phi); + + for (unsigned s = 0; s < rho.size(); s++) + std::cout << s << " " << "rho=" << rho[s] << ", phi=" << phi[s] << std::endl; +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/autocorrelation.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/autocorrelation.param new file mode 100644 index 000000000..0a65e1203 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/autocorrelation.param @@ -0,0 +1,13 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179858 # -S : Random number seed + +###### Persistence ###### +# --out=out.dat # -o : Output file of the sampling +# --status=./autocorrelation.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size +# --nbStep=100 # -n : Number of steps of the random walk diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/densityOfStates.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/densityOfStates.cpp new file mode 100644 index 000000000..a47323423 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/densityOfStates.cpp @@ -0,0 +1,193 @@ +//----------------------------------------------------------------------------- +/** densityOfStates.cpp + * + * SV - 03/05/10 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include + +//----------------------------------------------------------------------------- +// the sampling class +#include + +//----------------------------------------------------------------------------- +// the statistics class +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // the number of solution sampled + eoValueParam solParam(100, "nbSol", "Number of random solution", 'n'); + parser.processParam( solParam, "Representation" ); + unsigned nbSol = solParam.value(); + + // the name of the output file + string str_out = "out.dat"; // default value + eoValueParam outParam(str_out.c_str(), "out", "Output file of the sampling", 'o'); + parser.processParam(outParam, "Persistence" ); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is just the number of 1 in the bit string + oneMaxEval fullEval; + + /* ========================================================= + * + * The sampling of the search space + * + * ========================================================= */ + + // sampling object : + // - random initialization + // - fitness function + // - number of solutions to sample + moDensityOfStatesSampling sampling(random, fullEval, nbSol); + + /* ========================================================= + * + * execute the sampling + * + * ========================================================= */ + + sampling(); + + /* ========================================================= + * + * export the sampling + * + * ========================================================= */ + + // to export the statistics into file + sampling.fileExport(str_out); + + // to get the values of statistics + // so, you can compute some statistics in c++ from the data + const std::vector & fitnessValues = sampling.getValues(0); + + std::cout << "First values:" << std::endl; + std::cout << "Fitness " << fitnessValues[0] << std::endl; + + std::cout << "Last values:" << std::endl; + std::cout << "Fitness " << fitnessValues[fitnessValues.size() - 1] << std::endl; + + // more basic statistics on the distribution: + double min, max, avg, std; + + moStatistics statistics; + + statistics.basic(fitnessValues, min, max, avg, std); + std::cout << "min=" << min << ", max=" << max << ", average=" << avg << ", std dev=" << std << std::endl; +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/densityOfStates.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/densityOfStates.param new file mode 100644 index 000000000..c282a76c0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/densityOfStates.param @@ -0,0 +1,13 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179907 # -S : Random number seed + +###### Persistence ###### +# --out=out.dat # -o : Output file of the sampling +# --status=./densityOfStates.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size +# --nbSol=100 # -n : Number of random solution diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/fdc.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/fdc.cpp new file mode 100644 index 000000000..a066e70ad --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/fdc.cpp @@ -0,0 +1,192 @@ +//----------------------------------------------------------------------------- +/** fdc.cpp + * + * SV - 06/05/10 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include + +//----------------------------------------------------------------------------- +// the distance defined over the search space +#include + +//----------------------------------------------------------------------------- +// the sampling class +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // the number of solution sampled + eoValueParam solParam(100, "nbSol", "Number of random solution", 'n'); + parser.processParam( solParam, "Representation" ); + unsigned nbSol = solParam.value(); + + // the name of the output file + string str_out = "out.dat"; // default value + eoValueParam outParam(str_out.c_str(), "out", "Output file of the sampling", 'o'); + parser.processParam(outParam, "Persistence" ); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is just the number of 1 in the bit string + oneMaxEval fullEval; + + /* ========================================================= + * + * The sampling of the search space + * + * ========================================================= */ + + // Hamming distance to the global optimum + eoHammingDistance distance; // Hamming distance + Indi bestSolution(vecSize, true); // global optimum + + // sampling object : + // - random initialization + // - fitness function + // - number of solutions to sample + moFDCsampling sampling(random, fullEval, distance, bestSolution, nbSol); + + /* ========================================================= + * + * execute the sampling + * + * ========================================================= */ + + sampling(); + + /* ========================================================= + * + * export the sampling + * + * ========================================================= */ + + // to export the statistics into file + sampling.fileExport(str_out); + + // to get the values of statistics + // so, you can compute some statistics in c++ from the data + const std::vector & fitnessValues = sampling.getValues(0); + const std::vector & distValues = sampling.getValues(1); + + std::cout << "First values:" << std::endl; + std::cout << "Fitness " << fitnessValues[0] << std::endl; + std::cout << "Distance " << distValues[0] << std::endl; + + std::cout << "Last values:" << std::endl; + std::cout << "Fitness " << fitnessValues[fitnessValues.size() - 1] << std::endl; + std::cout << "Distance " << distValues[distValues.size() - 1] << std::endl; +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/fdc.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/fdc.param new file mode 100644 index 000000000..4c5ac0da5 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/fdc.param @@ -0,0 +1,13 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179837 # -S : Random number seed + +###### Persistence ###### +# --out=out.dat # -o : Output file of the sampling +# --status=./fdc.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size +# --nbSol=100 # -n : Number of random solution diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/fitnessCloud.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/fitnessCloud.cpp new file mode 100644 index 000000000..ad92e9502 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/fitnessCloud.cpp @@ -0,0 +1,217 @@ +//----------------------------------------------------------------------------- +/** fitnessCloud.cpp + * + * SV - 06/05/10 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit one random neighbor possibly the same one several times + +//----------------------------------------------------------------------------- +// the sampling class +#include +#include +#include +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // the number of solution sampled + eoValueParam solParam(100, "nbSol", "Number of random solution", 'n'); + parser.processParam( solParam, "Representation" ); + unsigned nbSol = solParam.value(); + + // the name of the output file + string str_out = "out.dat"; // default value + eoValueParam outParam(str_out.c_str(), "out", "Output file of the sampling", 'o'); + parser.processParam(outParam, "Persistence" ); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is just the number of 1 in the bit string + oneMaxEval fullEval; + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + // Incremental evaluation of the neighbor: fitness is modified by +/- 1 + moOneMaxIncrEval neighborEval; + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + // Exploration of the neighborhood in random order + // at each step one bit is randomly generated + moRndWithoutReplNeighborhood neighborhood(vecSize); + + /* ========================================================= + * + * The sampling of the search space + * + * ========================================================= */ + + // sampling object : + // - random initialization + // - neighborhood to compute one random neighbor + // - fitness function + // - neighbor evaluation + // - number of solutions to sample + + // moRndRndFitnessCloudSampling sampling(random, neighborhood, fullEval, neighborEval, nbSol); + // moMHRndFitnessCloudSampling sampling(random, neighborhood, fullEval, neighborEval, nbSol); + // moRndBestFitnessCloudSampling sampling(random, neighborhood, fullEval, neighborEval, nbSol); + moMHBestFitnessCloudSampling sampling(random, neighborhood, fullEval, neighborEval, nbSol); + + /* ========================================================= + * + * execute the sampling + * + * ========================================================= */ + + sampling(); + + /* ========================================================= + * + * export the sampling + * + * ========================================================= */ + + // to export the statistics into file + sampling.fileExport(str_out); + + // to get the values of statistics + // so, you can compute some statistics in c++ from the data + const std::vector & fitnessValues = sampling.getValues(0); + const std::vector & neighborFitnessValues = sampling.getValues(1); + + std::cout << "First values:" << std::endl; + std::cout << "Fitness " << fitnessValues[0] << std::endl; + std::cout << "Neighbor Fitness " << neighborFitnessValues[0] << std::endl; + + std::cout << "Last values:" << std::endl; + std::cout << "Fitness " << fitnessValues[fitnessValues.size() - 1] << std::endl; + std::cout << "Neighbor Fitness " << neighborFitnessValues[neighborFitnessValues.size() - 1] << std::endl; +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/fitnessCloud.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/fitnessCloud.param new file mode 100644 index 000000000..0907b73da --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/fitnessCloud.param @@ -0,0 +1,13 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179868 # -S : Random number seed + +###### Persistence ###### +# --out=out.dat # -o : Output file of the sampling +# --status=./fitnessCloud.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size +# --nbSol=100 # -n : Number of random solution diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/neutralDegree.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/neutralDegree.cpp new file mode 100644 index 000000000..55a346a11 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/neutralDegree.cpp @@ -0,0 +1,215 @@ +//----------------------------------------------------------------------------- +/** neutralDegree.cpp + * + * SV - 03/05/10 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit all neighbor in order of their bit-flip + +//----------------------------------------------------------------------------- +// the sampling class +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // size of the block + eoValueParam blockSizeParam(4, "blockSize", "Block size of the Royal Road", 'k'); + parser.processParam( blockSizeParam, "Representation" ); + unsigned blockSize = blockSizeParam.value(); + + // the number of solution sampled + eoValueParam solParam(100, "nbSol", "Number of random solution", 'n'); + parser.processParam( solParam, "Representation" ); + unsigned nbSol = solParam.value(); + + // the name of the output file + string str_out = "out.dat"; // default value + eoValueParam outParam(str_out.c_str(), "out", "Output file of the sampling", 'o'); + parser.processParam(outParam, "Persistence" ); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is the royal function (oneMax is a Royal Road with block of 1) + RoyalRoadEval fullEval(blockSize); + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + // Incremental evaluation of the neighbor: fitness is modified by +1 , 0 or -1 + moRoyalRoadIncrEval neighborEval(fullEval); + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + // Exploration of the neighborhood in increasing order of the neigbor's index: + // bit-flip from bit 0 to bit (vecSize - 1) + moOrderNeighborhood neighborhood(vecSize); + + /* ========================================================= + * + * The sampling of the search space + * + * ========================================================= */ + + // sampling object : + // - random initialization + // - neighborhood to compute the neutral degree + // - fitness function + // - neighbor evaluation + // - number of solutions to sample + moNeutralDegreeSampling sampling(random, neighborhood, fullEval, neighborEval, nbSol); + + /* ========================================================= + * + * execute the sampling + * + * ========================================================= */ + + sampling(); + + /* ========================================================= + * + * export the sampling + * + * ========================================================= */ + + // to export the statistics into file + sampling.fileExport(str_out); + + // to get the values of statistics + // so, you can compute some statistics in c++ from the data + const std::vector & fitnessValues = sampling.getValues(0); + const std::vector & ndValues = sampling.getValues(1); + + std::cout << "First values:" << std::endl; + std::cout << "Fitness " << fitnessValues[0] << std::endl; + std::cout << "N. Degree " << ndValues[0] << std::endl; + + std::cout << "Last values:" << std::endl; + std::cout << "Fitness " << fitnessValues[fitnessValues.size() - 1] << std::endl; + std::cout << "N. Degree " << ndValues[fitnessValues.size() - 1] << std::endl; +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/neutralDegree.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/neutralDegree.param new file mode 100644 index 000000000..f2bf7fac6 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/neutralDegree.param @@ -0,0 +1,14 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179874 # -S : Random number seed + +###### Persistence ###### +# --out=out.dat # -o : Output file of the sampling +# --status=./neutralDegree.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size +# --blockSize=4 # -k : Block size of the Royal Road +# --nbSol=100 # -n : Number of random solution diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/neutralWalk.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/neutralWalk.cpp new file mode 100644 index 000000000..a94a20bca --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/neutralWalk.cpp @@ -0,0 +1,251 @@ +//----------------------------------------------------------------------------- +/** neutralWalk.cpp + * + * SV - 07/05/10 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit one random neighbor possibly the same one several times + +//----------------------------------------------------------------------------- +// the sampling class +#include +#include + +//----------------------------------------------------------------------------- +// the statistics class +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // size of the block + eoValueParam blockSizeParam(4, "blockSize", "Block size of the Royal Road", 'k'); + parser.processParam( blockSizeParam, "Representation" ); + unsigned blockSize = blockSizeParam.value(); + + // the number of steps of the random walk + eoValueParam stepParam(100, "nbStep", "Number of steps of the random walk", 'n'); + parser.processParam( stepParam, "Representation" ); + unsigned nbStep = stepParam.value(); + + // the name of the output file + string str_out = "out.dat"; // default value + eoValueParam outParam(str_out.c_str(), "out", "Output file of the sampling", 'o'); + parser.processParam(outParam, "Persistence" ); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is the royal function (oneMax is a Royal Road with block of 1) + RoyalRoadEval fullEval(blockSize); + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + // Incremental evaluation of the neighbor: fitness is modified by +1 , 0 or -1 + moRoyalRoadIncrEval neighborEval(fullEval); + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + // Exploration of the neighborhood in random order + // at each step one bit is randomly generated + moRndWithoutReplNeighborhood neighborhood(vecSize); + + /* ========================================================= + * + * The sampling of the search space + * + * ========================================================= */ + + // Initial Solution of the random neutral walk + Indi initialSol(vecSize, false); + + // nearly 2 blocks are complete + for (unsigned i = 0; i < blockSize - 1; i++) { + initialSol[i] = true; + initialSol[blockSize + i] = true; + initialSol[2 * blockSize + i] = true; + } + // first block is complete + initialSol[blockSize - 1] = true; + + // evaluation of the initial solution + fullEval(initialSol); + + // Hamming distance + eoHammingDistance distance; + + // sampling object : + // - random initialization + // - neighborhood to compute the next step + // - fitness function + // - neighbor evaluation + // - number of steps of the walk + moNeutralWalkSampling sampling(initialSol, neighborhood, fullEval, neighborEval, distance, nbStep); + + /* ========================================================= + * + * execute the sampling + * + * ========================================================= */ + + std::cout << "Initial Solution: " << initialSol << std::endl; + + // the sampling + sampling(); + + /* ========================================================= + * + * export the sampling + * + * ========================================================= */ + + // to export the statistics into file + sampling.fileExport(str_out); + + // to get the values of statistics + // so, you can compute some statistics in c++ from the data + const std::vector & solutions = sampling.getSolutions(0); + + std::cout << "First values:" << std::endl; + std::cout << "Solution " << solutions[0] << std::endl; + + std::cout << "Last values:" << std::endl; + std::cout << "Solution " << solutions[solutions.size() - 1] << std::endl; + + // export only the solution into file + sampling.fileExport(0, str_out + "_sol"); + + // more basic statistics on the distribution: + moStatistics statistics; + + vector< vector > dist; + vector v; + + statistics.distances(solutions, distance, dist); + + for (unsigned i = 0; i < dist.size(); i++) { + for (unsigned j = 0; j < dist.size(); j++) { + std::cout << dist[i][j] << " " ; + if (j < i) + v.push_back(dist[i][j]); + } + std::cout << std::endl; + } + + double min, max, avg, std; + statistics.basic(v, min, max, avg, std); + std::cout << "min=" << min << ", max=" << max << ", average=" << avg << ", std dev=" << std << std::endl; +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/neutralWalk.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/neutralWalk.param new file mode 100644 index 000000000..9f57bee42 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/neutralWalk.param @@ -0,0 +1,14 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179843 # -S : Random number seed + +###### Persistence ###### +# --out=out.dat # -o : Output file of the sampling +# --status=./neutralWalk.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size +# --blockSize=4 # -k : Block size of the Royal Road +# --nbStep=100 # -n : Number of steps of the random walk diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/sampling.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/sampling.cpp new file mode 100644 index 000000000..77c5fef66 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/sampling.cpp @@ -0,0 +1,256 @@ +//----------------------------------------------------------------------------- +/** sampling.cpp + * + * SV - 03/05/10 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include + +// declaration of the namespace +using namespace std; + +//----------------------------------------------------------------------------- +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp +#include // neighbor of bit string + +//----------------------------------------------------------------------------- +// fitness function, and evaluation of neighbors +#include +#include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit one random neighbor possibly the same one several times + +//----------------------------------------------------------------------------- +// the random walk local search: heuristic to sample the search space +#include + +//----------------------------------------------------------------------------- +// the statistics to compute during the sampling +#include +#include +#include +#include + +//----------------------------------------------------------------------------- +// the sampling class +#include + +// Declaration of types +//----------------------------------------------------------------------------- +// Indi is the typedef of the solution type like in paradisEO-eo +typedef eoBit Indi; // bit string with unsigned fitness type +// Neighbor is the typedef of the neighbor type, +// Neighbor = How to compute the neighbor from the solution + information on it (i.e. fitness) +// all classes from paradisEO-mo use this template type +typedef moBitNeighbor Neighbor ; // bit string neighbor with unsigned fitness type + + +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters + * + * ========================================================= */ + // more information on the input parameters: see EO tutorial lesson 3 + // but don't care at first it just read the parameters of the bit string size and the random seed. + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + // random seed parameter + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // length of the bit string + eoValueParam vecSizeParam(20, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // the number of steps of the random walk + eoValueParam stepParam(100, "nbStep", "Number of steps of the random walk", 'n'); + parser.processParam( stepParam, "Representation" ); + unsigned nbStep = stepParam.value(); + + // the name of the output file + string str_out = "out.dat"; // default value + eoValueParam outParam(str_out.c_str(), "out", "Output file of the sampling", 'o'); + parser.processParam(outParam, "Persistence" ); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + // reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + rng.reseed(seed); + + /* ========================================================= + * + * Initialization of the solution + * + * ========================================================= */ + + // a Indi random initializer: each bit is random + // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + /* ========================================================= + * + * Eval fitness function (full evaluation) + * + * ========================================================= */ + + // the fitness function is just the number of 1 in the bit string + oneMaxEval fullEval; + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + // Use it if there is no incremental evaluation: a neighbor is evaluated by the full evaluation of a solution + // moFullEvalByModif neighborEval(fullEval); + + // Incremental evaluation of the neighbor: fitness is modified by +/- 1 + moOneMaxIncrEval neighborEval; + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + // Exploration of the neighborhood in random order + // at each step one bit is randomly generated + moRndWithReplNeighborhood neighborhood(vecSize); + + /* ========================================================= + * + * the local search algorithm to sample the search space + * + * ========================================================= */ + + moRandomWalk walk(neighborhood, fullEval, neighborEval, nbStep); + + /* ========================================================= + * + * the statistics to compute + * + * ========================================================= */ + + // fitness of the solution at each step + moFitnessStat fStat; + + // Hamming distance to the global optimum + eoHammingDistance distance; // Hamming distance + Indi bestSolution(vecSize, true); // global optimum + + moDistanceStat distStat(distance, bestSolution); // statistic + + // "statistic" of the solution + moSolutionStat solStat; + + /* ========================================================= + * + * The sampling of the search space + * + * ========================================================= */ + + // sampling object : + // - random initialization + // - local search to sample the search space + // - one statistic to compute + moSampling sampling(random, walk, fStat); + + // to add another statistics + sampling.add(distStat); // distance + sampling.add(solStat); // solutions + + /* ========================================================= + * + * execute the sampling + * + * ========================================================= */ + + sampling(); + + /* ========================================================= + * + * export the sampling + * + * ========================================================= */ + + // to export the statistics into file + sampling.fileExport(str_out); + + // to get the values of statistics + // so, you can compute some statistics in c++ from the data + const std::vector & fitnessValues = sampling.getValues(0); + const std::vector & distValues = sampling.getValues(1); + const std::vector & solutions = sampling.getSolutions(2); + + std::cout << "First values:" << std::endl; + std::cout << "Fitness " << fitnessValues[0] << std::endl; + std::cout << "Distance " << distValues[0] << std::endl; + std::cout << "Solution " << solutions[0] << std::endl << std::endl; + + std::cout << "Last values:" << std::endl; + std::cout << "Fitness " << fitnessValues[fitnessValues.size() - 1] << std::endl; + std::cout << "Distance " << distValues[distValues.size() - 1] << std::endl; + std::cout << "Solution " << solutions[solutions.size() - 1] << std::endl; +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/sampling.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/sampling.param new file mode 100644 index 000000000..5c4e75f06 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/sampling.param @@ -0,0 +1,13 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179904 # -S : Random number seed + +###### Persistence ###### +# --out=out.dat # -o : Output file of the sampling +# --status=./sampling.status # Status file + +###### Representation ###### +# --vecSize=20 # -V : Genotype size +# --nbStep=100 # -n : Number of steps of the random walk diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testMetropolisHasting.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testMetropolisHasting.cpp new file mode 100644 index 000000000..d70858714 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testMetropolisHasting.cpp @@ -0,0 +1,201 @@ +//----------------------------------------------------------------------------- +/** testMetropolisHasting.cpp + * + * SV - 22/01/10 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include +#include + +using namespace std; + +//----------------------------------------------------------------------------- +// fitness function +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +// REPRESENTATION +//----------------------------------------------------------------------------- +typedef eoBit Indi; +typedef moBitNeighbor Neighbor ; // incremental evaluation +typedef moRndWithReplNeighborhood Neighborhood ; + +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters + * + * ========================================================= */ + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // description of genotype + eoValueParam vecSizeParam(8, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + eoValueParam stepParam(10, "nbStep", "Number of steps of the random walk", 'n'); + parser.processParam( stepParam, "Representation" ); + unsigned nbStep = stepParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + //reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + rng.reseed(seed); + + + /* ========================================================= + * + * Eval fitness function + * + * ========================================================= */ + + oneMaxEval eval; + + + /* ========================================================= + * + * Initilisation of the solution + * + * ========================================================= */ + + // a Indi random initializer + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + moFullEvalByModif fulleval(eval); + + //An eval by copy can be used instead of the eval by modif + //moFullEvalByCopy fulleval(eval); + + + /* ========================================================= + * + * Comparator of neighbors + * + * ========================================================= */ + + moNeighborComparator comparator; + moSolNeighborComparator solComparator; + + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + Neighborhood neighborhood(vecSize); + + + /* ========================================================= + * + * a neighborhood explorer solution + * + * ========================================================= */ + + moMetropolisHastingExplorer explorer(neighborhood, fulleval, comparator, solComparator, nbStep); + + + /* ========================================================= + * + * the local search algorithm + * + * ========================================================= */ + + moTrueContinuator continuator;//always continue + + moLocalSearch localSearch(explorer, continuator, eval); + + /* ========================================================= + * + * execute the local search from random sollution + * + * ========================================================= */ + + Indi solution; + + random(solution); + + //Can be eval here, else it will be done at the beginning of the localSearch + //eval(solution); + + std::cout << "initial: " << solution << std::endl ; + + localSearch(solution); + + std::cout << "final: " << solution << std::endl ; + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testMetropolisHasting.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testMetropolisHasting.param new file mode 100644 index 000000000..95faf04d8 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testMetropolisHasting.param @@ -0,0 +1,12 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179886 # -S : Random number seed + +###### Persistence ###### +# --status=./testMetropolisHasting.status # Status file + +###### Representation ###### +# --vecSize=8 # -V : Genotype size +# --nbStep=10 # -n : Number of steps of the random walk diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testRandomNeutralWalk.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testRandomNeutralWalk.cpp new file mode 100644 index 000000000..596501f5e --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testRandomNeutralWalk.cpp @@ -0,0 +1,278 @@ +//----------------------------------------------------------------------------- +/** testRandomNeutralWalk.cpp + * + * SV - 22/02/10 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include +#include + +using namespace std; + +//----------------------------------------------------------------------------- +// fitness function +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// REPRESENTATION +//----------------------------------------------------------------------------- +typedef eoBit Indi; +typedef moBitNeighbor Neighbor ; // incremental evaluation +typedef moRndWithoutReplNeighborhood Neighborhood ; + +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters + * + * ========================================================= */ + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // description of genotype + eoValueParam vecSizeParam(8, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + eoValueParam blockSizeParam(2, "blockSize", "Size of block in the royal road", 'k'); + parser.processParam( blockSizeParam, "Representation" ); + unsigned blockSize = blockSizeParam.value(); + + eoValueParam stepParam(10, "nbStep", "Number of steps of the random walk", 'n'); + parser.processParam( stepParam, "Representation" ); + unsigned nbStep = stepParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + //reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + rng.reseed(seed); + + + /* ========================================================= + * + * Eval fitness function + * + * ========================================================= */ + + RoyalRoadEval eval(blockSize); + + + /* ========================================================= + * + * Initilisazor of the solution + * + * ========================================================= */ + + // a Indi random initializer + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + + /* ========================================================= + * + * Evaluation of a neighbor solution + * + * ========================================================= */ + + moFullEvalByModif nhEval(eval); + + //An eval by copy can be used instead of the eval by modif + //moFullEvalByCopy nhEval(eval); + + + /* ========================================================= + * + * Comparator of neighbors + * + * ========================================================= */ + + moNeighborComparator comparator; + moSolNeighborComparator solComparator; + + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + Neighborhood neighborhood(vecSize); + + + /* ========================================================= + * + * a neighborhood explorer solution + * + * ========================================================= */ + + moRandomNeutralWalkExplorer explorer(neighborhood, nhEval, solComparator, nbStep); + + + /* ========================================================= + * + * initial random solution + * + * ========================================================= */ + + Indi solution; + + random(solution); + + //Can be eval here, else it will be done at the beginning of the localSearch + eval(solution); + + /* ========================================================= + * + * the continuator and the checkpoint + * + * ========================================================= */ + + moTrueContinuator continuator;//always continue + + moCheckpoint checkpoint(continuator); + + moFitnessStat fStat; + + eoHammingDistance distance; + moDistanceStat distStat(distance, solution); // distance from the intial solution + + moOrderNeighborhood nh(vecSize); + moNeighborhoodStat< Neighbor > neighborhoodStat(nh, nhEval, comparator, solComparator); + moMinNeighborStat< Neighbor > minStat(neighborhoodStat); + moSecondMomentNeighborStat< Neighbor > secondMomentStat(neighborhoodStat); + moMaxNeighborStat< Neighbor > maxStat(neighborhoodStat); + + moNbSupNeighborStat< Neighbor > nbSupStat(neighborhoodStat); + moNbInfNeighborStat< Neighbor > nbInfStat(neighborhoodStat); + moNeutralDegreeNeighborStat< Neighbor > ndStat(neighborhoodStat); + moSizeNeighborStat< Neighbor > sizeStat(neighborhoodStat); + + eoValueParam genCounter(-1,"Gen"); + eoIncrementor increm(genCounter.value()); + + checkpoint.add(fStat); + checkpoint.add(distStat); + checkpoint.add(neighborhoodStat); + checkpoint.add(minStat); + checkpoint.add(secondMomentStat); + checkpoint.add(maxStat); + checkpoint.add(nbInfStat); + checkpoint.add(ndStat); + checkpoint.add(nbSupStat); + checkpoint.add(sizeStat); + checkpoint.add(increm); + + eoFileMonitor outputfile("out.dat", " "); + checkpoint.add(outputfile); + + outputfile.add(genCounter); + outputfile.add(fStat); + outputfile.add(distStat); + outputfile.add(minStat); + outputfile.add(secondMomentStat); + outputfile.add(maxStat); + outputfile.add(nbInfStat); + outputfile.add(ndStat); + outputfile.add(nbSupStat); + outputfile.add(sizeStat); + + /* ========================================================= + * + * the local search algorithm + * + * ========================================================= */ + + moLocalSearch localSearch(explorer, checkpoint, eval); + + /* ========================================================= + * + * execute the local search from random sollution + * + * ========================================================= */ + + std::cout << "initial: " << solution << std::endl ; + + localSearch(solution); + + std::cout << "final: " << solution << std::endl ; + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testRandomNeutralWalk.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testRandomNeutralWalk.param new file mode 100644 index 000000000..09c81d010 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testRandomNeutralWalk.param @@ -0,0 +1,13 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179899 # -S : Random number seed + +###### Persistence ###### +# --status=./testRandomNeutralWalk.status # Status file + +###### Representation ###### +# --vecSize=8 # -V : Genotype size +# --blockSize=2 # -k : Size of block in the royal road +# --nbStep=10 # -n : Number of steps of the random walk diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testRandomWalk.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testRandomWalk.cpp new file mode 100644 index 000000000..cfae94ece --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testRandomWalk.cpp @@ -0,0 +1,243 @@ +//----------------------------------------------------------------------------- +/** testRandomWalk.cpp + * + * SV - 22/01/10 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include +#include + +using namespace std; + +//----------------------------------------------------------------------------- +// fitness function +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +// REPRESENTATION +//----------------------------------------------------------------------------- +typedef eoBit Indi; +typedef moBitNeighbor Neighbor ; // incremental evaluation +typedef moRndWithReplNeighborhood Neighborhood ; + +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters + * + * ========================================================= */ + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // description of genotype + eoValueParam vecSizeParam(8, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + eoValueParam stepParam(10, "nbStep", "Number of steps of the random walk", 'n'); + parser.processParam( stepParam, "Representation" ); + unsigned nbStep = stepParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + //reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + rng.reseed(seed); + + + /* ========================================================= + * + * Eval fitness function + * + * ========================================================= */ + + oneMaxEval eval; + + + /* ========================================================= + * + * Initilisation of the solution + * + * ========================================================= */ + + // a Indi random initializer + eoUniformGenerator uGen; + eoInitFixedLength random(vecSize, uGen); + + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + moFullEvalByModif nhEval(eval); + + //An eval by copy can be used instead of the eval by modif + //moFullEvalByCopy nhEval(eval); + + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + Neighborhood neighborhood(vecSize); + + + /* ========================================================= + * + * a neighborhood explorer solution + * + * ========================================================= */ + + moRandomWalkExplorer explorer(neighborhood, nhEval); + + + /* ========================================================= + * + * the continuator and the checkpoint + * + * ========================================================= */ + + moIterContinuator continuator(nbStep); + + moCheckpoint checkpoint(continuator); + + moFitnessStat fStat; + eoHammingDistance distance; + Indi bestSolution(vecSize, true); + moDistanceStat distStat(distance, bestSolution); + // moSolutionStat solStat; + + checkpoint.add(fStat); + checkpoint.add(distStat); + // checkpoint.add(solStat); + + eoValueParam genCounter(-1,"Gen"); + eoIncrementor increm(genCounter.value()); + checkpoint.add(increm); + + eoFileMonitor outputfile("out.dat", " "); + checkpoint.add(outputfile); + + outputfile.add(genCounter); + outputfile.add(fStat); + outputfile.add(distStat); + // outputfile.add(solStat); + + Indi solution; // current solution of the search process + + /* + // to save the solution at each iteration + eoState outState; + + // Register the algorithm into the state (so it has something to save!! + + outState.registerObject(solution); + + // and feed the state to state savers + // save state every 10th iteration + eoCountedStateSaver stateSaver(10, outState, "iteration"); + + // Don't forget to add the two savers to the checkpoint + checkpoint.add(stateSaver); + */ + + /* ========================================================= + * + * the local search algorithm + * + * ========================================================= */ + + moLocalSearch localSearch(explorer, checkpoint, eval); + + /* ========================================================= + * + * execute the local search from random sollution + * + * ========================================================= */ + + random(solution); + + //Can be eval here, else it will be done at the beginning of the localSearch + //eval(solution); + + std::cout << "initial: " << solution << std::endl ; + + localSearch(solution); + + std::cout << "final: " << solution << std::endl ; + +} + +// A main that catches the exceptions + +int main(int argc, char **argv) +{ + try { + main_function(argc, argv); + } + catch (exception& e) { + cout << "Exception: " << e.what() << '\n'; + } + return 1; +} diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testRandomWalk.param b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testRandomWalk.param new file mode 100644 index 000000000..53da52140 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson6/testRandomWalk.param @@ -0,0 +1,12 @@ + +###### General ###### +# --help=0 # -h : Prints this message +# --stopOnUnknownParam=1 # Stop if unkown param entered +# --seed=1276179894 # -S : Random number seed + +###### Persistence ###### +# --status=./testRandomWalk.status # Status file + +###### Representation ###### +# --vecSize=8 # -V : Genotype size +# --nbStep=10 # -n : Number of steps of the random walk diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson7/CMakeLists.txt b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson7/CMakeLists.txt new file mode 100644 index 000000000..556f73553 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson7/CMakeLists.txt @@ -0,0 +1,42 @@ +###################################################################################### +### 1) Include the sources +###################################################################################### + +INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src + ${MO_SRC_DIR}/src + ${PROBLEMS_SRC_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../src) + +###################################################################################### +### 2) Specify where CMake can find the libraries +###################################################################################### + +LINK_DIRECTORIES(${EO_BIN_DIR}/lib) + + +###################################################################################### +### 3) Define your target(s): just an executable here +###################################################################################### + +IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + SOURCE_GROUP(src FILES hybridAlgo.cpp) + ADD_EXECUTABLE(hybridAlgo + hybridAlgo.cpp + ${MO_BIN_DIR}/tutorial/lesson7/hybridAlgo.param + ) +ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + ADD_COMMANDS_NEWMO() + ADD_TARGET_NEWMO(lesson7) + IF(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(hybridAlgo hybridAlgo.cpp) + ELSE(ENABLE_CMAKE_EXAMPLE) + ADD_EXECUTABLE(hybridAlgo EXCLUDE_FROM_ALL hybridAlgo.cpp) + ENDIF(ENABLE_CMAKE_EXAMPLE) +ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10") + +###################################################################################### +### 4) Link the librairies for your target(s) +###################################################################################### + +TARGET_LINK_LIBRARIES(hybridAlgo eoutils ga eo) + diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson7/hybridAlgo.cpp b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson7/hybridAlgo.cpp new file mode 100644 index 000000000..fb0667d03 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo1/tutorial/Lesson7/hybridAlgo.cpp @@ -0,0 +1,222 @@ +//----------------------------------------------------------------------------- +/** testILS.cpp + * + * SV - 12/01/10 + * JH - 06/05/10 + * + */ +//----------------------------------------------------------------------------- + +// standard includes +#define HAVE_SSTREAM + +#include // runtime_error +#include // cout +#include // ostrstream, istrstream +#include +#include + +// the general include for eo +#include +#include +#include + +using namespace std; + +//----------------------------------------------------------------------------- +//Representation and initializer +#include +#include +#include + +// fitness function +#include +#include +#include + +//Neighbors and Neighborhoods +#include +#include + +//Mutation +#include +#include + +//Algorithm and its components +#include + +//mo eval +#include + +#include + +// REPRESENTATION +//----------------------------------------------------------------------------- +typedef eoInt Queen; //Permutation (Queen's problem representation) + +typedef moShiftNeighbor shiftNeighbor; //shift Neighbor +typedef moOrderNeighborhood orderShiftNeighborhood; //order shift Neighborhood (Indexed) + +void main_function(int argc, char **argv) +{ + /* ========================================================= + * + * Parameters + * + * ========================================================= */ + + // First define a parser from the command-line arguments + eoParser parser(argc, argv); + + // For each parameter, define Parameter, read it through the parser, + // and assign the value to the variable + + eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); + parser.processParam( seedParam ); + unsigned seed = seedParam.value(); + + // description of genotype + eoValueParam vecSizeParam(8, "vecSize", "Genotype size", 'V'); + parser.processParam( vecSizeParam, "Representation" ); + unsigned vecSize = vecSizeParam.value(); + + // the name of the "status" file where all actual parameter values will be saved + string str_status = parser.ProgramName() + ".status"; // default value + eoValueParam statusParam(str_status.c_str(), "status", "Status file"); + parser.processParam( statusParam, "Persistence" ); + + // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED + // i.e. in case you need parameters somewhere else, postpone these + if (parser.userNeedsHelp()) { + parser.printHelp(cout); + exit(1); + } + if (statusParam.value() != "") { + ofstream os(statusParam.value().c_str()); + os << parser;// and you can use that file as parameter file + } + + /* ========================================================= + * + * Random seed + * + * ========================================================= */ + + //reproducible random seed: if you don't change SEED above, + // you'll aways get the same result, NOT a random run + rng.reseed(seed); + + /* ========================================================= + * + * Full evaluation fitness function + * + * ========================================================= */ + + queenEval fullEval; + + + /* ========================================================= + * + * Initializer of a solution + * + * ========================================================= */ + + eoInitPermutation init(vecSize); + + /* ========================================================= + * + * Declare and init a population + * + * ========================================================= */ + + eoPop pop; + + Queen tmp; + + for (unsigned int i=0; i<20; i++) { + init(tmp); + fullEval(tmp); + pop.push_back(tmp); + } + + /* ========================================================= + * + * evaluation of a neighbor solution + * + * ========================================================= */ + + moFullEvalByCopy shiftEval(fullEval); + + /* ========================================================= + * + * the neighborhood of a solution + * + * ========================================================= */ + + orderShiftNeighborhood orderShiftNH((vecSize-1) * (vecSize-1)); + + /* ========================================================= + * + * the local search algorithm + * + * ========================================================= */ + + //Basic Constructor a first improvement hill climber + moFirstImprHC hc(orderShiftNH, fullEval, shiftEval); + + /* ========================================================= + * + * the evolutionary algorithm + * + * ========================================================= */ + + //continuator + eoGenContinue EAcont(50); + + //selection + eoDetTournamentSelect selectOne(2); + eoSelectMany select(selectOne, 1); + + //crossover + eoOrderXover cross; + + //transform operator (the hill climber replace the mutation operator) + eoSGATransform transform(cross, 0.3, hc, 0.7); + + //replacement + eoGenerationalReplacement repl; + + //easyEA + eoEasyEA hybridAlgo(EAcont, fullEval, select, transform, repl); + + + std::cout << "INITIAL POPULATION:" << std::endl; + std::cout << "-------------------" << std::endl; + + for (unsigned int i=0; i