From 56db6b7608bdfb2243300eac65dbc6703cf56ab3 Mon Sep 17 00:00:00 2001 From: boufaras Date: Mon, 30 Jan 2012 09:50:35 +0000 Subject: [PATCH] update git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2697 331e1502-861f-0410-8da2-ba01fb791d7f --- .../paradiseo-mo/CMakeLists.txt | 46 + .../paradiseo-mo/CTestConfig.cmake | 7 + .../paradiseo-mo/CTestCustom.cmake | 7 + .../paradiseo-mo/doc/CMakeLists.txt | 26 + .../paradiseo-mo/doc/index.h | 52 + .../paradiseo-mo/doc/mo.doxyfile.cmake | 1523 +++++++++++++++++ .../paradiseo-mo/install.cmake | 130 ++ .../paradiseo-mo/src/CMakeLists.txt | 3 + .../src/acceptCrit/moAcceptanceCriterion.h | 44 + .../src/acceptCrit/moAlwaysAcceptCrit.h | 57 + .../src/acceptCrit/moBetterAcceptCrit.h | 76 + .../paradiseo-mo/src/algo/eoDummyMonOp.h | 56 + .../paradiseo-mo/src/algo/moDummyLS.h | 71 + .../paradiseo-mo/src/algo/moFirstImprHC.h | 112 ++ .../paradiseo-mo/src/algo/moILS.h | 118 ++ .../paradiseo-mo/src/algo/moLocalSearch.h | 146 ++ .../src/algo/moMetropolisHasting.h | 110 ++ .../paradiseo-mo/src/algo/moNeutralHC.h | 106 ++ .../paradiseo-mo/src/algo/moRandomBestHC.h | 104 ++ .../src/algo/moRandomNeutralWalk.h | 102 ++ .../paradiseo-mo/src/algo/moRandomSearch.h | 90 + .../paradiseo-mo/src/algo/moRandomWalk.h | 87 + .../paradiseo-mo/src/algo/moSA.h | 120 ++ .../paradiseo-mo/src/algo/moSimpleHC.h | 104 ++ .../paradiseo-mo/src/algo/moTS.h | 164 ++ .../paradiseo-mo/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-mo/src/continuator/moStat.h | 61 + .../paradiseo-mo/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-mo/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-mo/src/eval/moDummyEval.h | 53 + .../paradiseo-mo/src/eval/moEval.h | 51 + .../paradiseo-mo/src/eval/moEvalCounter.h | 66 + .../paradiseo-mo/src/eval/moFullEvalByCopy.h | 82 + .../paradiseo-mo/src/eval/moFullEvalByModif.h | 96 ++ .../src/eval/moNeighborhoodEvaluation.h | 56 + .../src/explorer/moDummyExplorer.h | 111 ++ .../src/explorer/moFirstImprHCexplorer.h | 155 ++ .../paradiseo-mo/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-mo/src/explorer/moSAexplorer.h | 182 ++ .../src/explorer/moSimpleHCexplorer.h | 167 ++ .../paradiseo-mo/src/explorer/moTSexplorer.h | 247 +++ .../paradiseo-mo/src/explorer/moVNSexplorer.h | 172 ++ .../paradiseo-mo/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-mo/src/memory/moDummyMemory.h | 67 + .../src/memory/moIndexedVectorTabuList.h | 121 ++ .../src/memory/moIntensification.h | 42 + .../paradiseo-mo/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-mo/src/memory/moTabuList.h | 53 + tags/ParadisEO-GPU-1.1/paradiseo-mo/src/mo | 40 + tags/ParadisEO-GPU-1.1/paradiseo-mo/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 + .../paradiseo-mo/src/perturb/moMonOpPerturb.h | 72 + .../src/perturb/moNeighborhoodPerturb.h | 109 ++ .../paradiseo-mo/src/perturb/moPerturbation.h | 42 + .../src/perturb/moRestartPerturb.h | 77 + .../paradiseo-mo/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 + .../paradiseo-mo/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-mo/src/sampling/moSampling.h | 239 +++ .../paradiseo-mo/src/sampling/moStatistics.h | 226 +++ 169 files changed, 18720 insertions(+) create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/CMakeLists.txt create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/CTestConfig.cmake create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/CTestCustom.cmake create mode 100755 tags/ParadisEO-GPU-1.1/paradiseo-mo/doc/CMakeLists.txt create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/doc/index.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/doc/mo.doxyfile.cmake create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/install.cmake create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/CMakeLists.txt create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/acceptCrit/moAcceptanceCriterion.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/acceptCrit/moAlwaysAcceptCrit.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/acceptCrit/moBetterAcceptCrit.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/eoDummyMonOp.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moDummyLS.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moFirstImprHC.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moILS.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moLocalSearch.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moMetropolisHasting.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moNeutralHC.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moRandomBestHC.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moRandomNeutralWalk.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moRandomSearch.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moRandomWalk.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moSA.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moSimpleHC.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moTS.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moVNS.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/comparator/moComparator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/comparator/moEqualNeighborComparator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/comparator/moEqualSolComparator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/comparator/moEqualSolNeighborComparator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/comparator/moNeighborComparator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/comparator/moSolComparator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/comparator/moSolNeighborComparator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moAverageFitnessNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moBestFitnessStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moBestNoImproveContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moBestSoFarStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moBooleanStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moCheckpoint.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moCombinedContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moCounterMonitorSaver.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moCounterStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moDistanceStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moEvalsContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moFitContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moFitnessStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moFullEvalContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moIterContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moMaxNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moMinNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moMinusOneCounterStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moNbInfNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moNbSupNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moNeighborBestStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moNeighborEvalContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moNeighborFitnessStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moNeighborhoodStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moNeutralDegreeNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moSecondMomentNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moSizeNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moSolutionStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moStatBase.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moStatFromStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moStdFitnessNeighborStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moTimeContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moTrueContinuator.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moUnsignedStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moUpdater.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moValueStat.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moVectorMonitor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/coolingSchedule/moCoolingSchedule.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/coolingSchedule/moDynSpanCoolingSchedule.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/coolingSchedule/moSimpleCoolingSchedule.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/eval/moDoubleIncrEvaluation.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/eval/moDoubleIncrNeighborhoodEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/eval/moDummyEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/eval/moEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/eval/moEvalCounter.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/eval/moFullEvalByCopy.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/eval/moFullEvalByModif.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/eval/moNeighborhoodEvaluation.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moDummyExplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moFirstImprHCexplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moILSexplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moMetropolisHastingExplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moNeighborhoodExplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moNeutralHCexplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moRandomBestHCexplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moRandomNeutralWalkExplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moRandomSearchExplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moRandomWalkExplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moSAexplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moSimpleHCexplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moTSexplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moVNSexplorer.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moAspiration.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moBestImprAspiration.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moCountMoveMemory.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moDiversification.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moDummyDiversification.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moDummyIntensification.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moDummyMemory.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moIndexedVectorTabuList.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moIntensification.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moMemory.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moMonOpDiversification.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moNeighborVectorTabuList.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moRndIndexedVectorTabuList.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moSolVectorTabuList.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moTabuList.h create mode 100755 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/mo create mode 100755 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/mo.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moBackableNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moBackwardVectorVNSelection.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moDummyNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moDummyNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moEvaluatedNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moForwardVectorVNSelection.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moIndexNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moIndexNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moOrderNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moRndNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moRndVectorVNSelection.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moRndWithReplNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moRndWithoutReplNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moVariableNeighborhoodSelection.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moVectorVNSelection.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/perturb/moLocalSearchInit.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/perturb/moMonOpPerturb.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/perturb/moNeighborhoodPerturb.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/perturb/moPerturbation.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/perturb/moRestartPerturb.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/perturb/moSolInit.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/bitString/moBitNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/bitString/moBitsNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/bitString/moBitsNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/bitString/moBitsWithReplNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/bitString/moBitsWithoutReplNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/eval/moMaxSATincrEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/eval/moOneMaxIncrEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/eval/moQAPIncrEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/eval/moRoyalRoadIncrEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/eval/moUBQPBitsIncrEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/eval/moUBQPSimpleIncrEval.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/eval/moUBQPdoubleIncrEvaluation.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/permutation/moIndexedSwapNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/permutation/moShiftNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/permutation/moSwapNeighbor.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/permutation/moSwapNeighborhood.h create mode 100755 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/permutation/moTwoOptExNeighbor.h create mode 100755 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/permutation/moTwoOptExNeighborhood.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moAdaptiveWalkSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moAutocorrelationSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moDensityOfStatesSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moFDCsampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moFitnessCloudSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moHillClimberSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moMHBestFitnessCloudSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moMHRndFitnessCloudSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moNeutralDegreeSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moNeutralWalkSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moRndBestFitnessCloudSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moRndRndFitnessCloudSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moSampling.h create mode 100644 tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moStatistics.h diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo/CMakeLists.txt b/tags/ParadisEO-GPU-1.1/paradiseo-mo/CMakeLists.txt new file mode 100644 index 000000000..3b58ccd7f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/CTestConfig.cmake b/tags/ParadisEO-GPU-1.1/paradiseo-mo/CTestConfig.cmake new file mode 100644 index 000000000..465d208d6 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/CTestCustom.cmake b/tags/ParadisEO-GPU-1.1/paradiseo-mo/CTestCustom.cmake new file mode 100644 index 000000000..61bcd9133 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/doc/CMakeLists.txt b/tags/ParadisEO-GPU-1.1/paradiseo-mo/doc/CMakeLists.txt new file mode 100755 index 000000000..8963a9ba5 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/doc/index.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/doc/index.h new file mode 100644 index 000000000..da6778372 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/doc/mo.doxyfile.cmake b/tags/ParadisEO-GPU-1.1/paradiseo-mo/doc/mo.doxyfile.cmake new file mode 100644 index 000000000..19a13b947 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/install.cmake b/tags/ParadisEO-GPU-1.1/paradiseo-mo/install.cmake new file mode 100644 index 000000000..8113a6dd7 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/CMakeLists.txt b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/CMakeLists.txt new file mode 100644 index 000000000..d41d4587a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/CMakeLists.txt @@ -0,0 +1,3 @@ +############################################################### +# This is a dummy file +############################################################### diff --git a/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/acceptCrit/moAcceptanceCriterion.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/acceptCrit/moAcceptanceCriterion.h new file mode 100644 index 000000000..266b30f45 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/acceptCrit/moAlwaysAcceptCrit.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/acceptCrit/moAlwaysAcceptCrit.h new file mode 100644 index 000000000..777ef0b18 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/acceptCrit/moBetterAcceptCrit.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/acceptCrit/moBetterAcceptCrit.h new file mode 100644 index 000000000..13f2f867c --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/algo/eoDummyMonOp.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/eoDummyMonOp.h new file mode 100644 index 000000000..dba88fa7f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/algo/moDummyLS.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moDummyLS.h new file mode 100644 index 000000000..fd24d3575 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/algo/moFirstImprHC.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moFirstImprHC.h new file mode 100644 index 000000000..67030da6e --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/algo/moILS.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moILS.h new file mode 100644 index 000000000..934335b2d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/algo/moLocalSearch.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moLocalSearch.h new file mode 100644 index 000000000..bf77a8f3f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/algo/moMetropolisHasting.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moMetropolisHasting.h new file mode 100644 index 000000000..5b4292459 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/algo/moNeutralHC.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moNeutralHC.h new file mode 100644 index 000000000..2fd2583d5 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/algo/moRandomBestHC.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moRandomBestHC.h new file mode 100644 index 000000000..3e7a32d62 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/algo/moRandomNeutralWalk.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moRandomNeutralWalk.h new file mode 100644 index 000000000..4f21588c5 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/algo/moRandomSearch.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moRandomSearch.h new file mode 100644 index 000000000..c0a468d6a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/algo/moRandomWalk.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moRandomWalk.h new file mode 100644 index 000000000..dafa3f277 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/algo/moSA.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moSA.h new file mode 100644 index 000000000..c126f31fc --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/algo/moSimpleHC.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moSimpleHC.h new file mode 100644 index 000000000..c334d0629 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/algo/moTS.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moTS.h new file mode 100644 index 000000000..cd1a6dc57 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/algo/moVNS.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/algo/moVNS.h new file mode 100644 index 000000000..050e29593 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/comparator/moComparator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/comparator/moComparator.h new file mode 100644 index 000000000..153e39422 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/comparator/moEqualNeighborComparator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/comparator/moEqualNeighborComparator.h new file mode 100644 index 000000000..6ea148df0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/comparator/moEqualSolComparator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/comparator/moEqualSolComparator.h new file mode 100644 index 000000000..0764d4e21 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/comparator/moEqualSolNeighborComparator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/comparator/moEqualSolNeighborComparator.h new file mode 100644 index 000000000..6f706dc73 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/comparator/moNeighborComparator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/comparator/moNeighborComparator.h new file mode 100644 index 000000000..869adbb5c --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/comparator/moSolComparator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/comparator/moSolComparator.h new file mode 100644 index 000000000..d7f30c2f8 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/comparator/moSolNeighborComparator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/comparator/moSolNeighborComparator.h new file mode 100644 index 000000000..2275a6494 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moAverageFitnessNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moAverageFitnessNeighborStat.h new file mode 100644 index 000000000..4c268d6d3 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moBestFitnessStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moBestFitnessStat.h new file mode 100644 index 000000000..192919c88 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moBestNoImproveContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moBestNoImproveContinuator.h new file mode 100644 index 000000000..86981bef4 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moBestSoFarStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moBestSoFarStat.h new file mode 100644 index 000000000..fa5797139 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moBooleanStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moBooleanStat.h new file mode 100644 index 000000000..a098efc23 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moCheckpoint.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moCheckpoint.h new file mode 100644 index 000000000..37b5cd610 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moCombinedContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moCombinedContinuator.h new file mode 100644 index 000000000..7533bd4fa --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moContinuator.h new file mode 100644 index 000000000..cec268038 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moCounterMonitorSaver.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moCounterMonitorSaver.h new file mode 100644 index 000000000..f57e05d2d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moCounterStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moCounterStat.h new file mode 100644 index 000000000..85534e67e --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moDistanceStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moDistanceStat.h new file mode 100644 index 000000000..06cfe0007 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moEvalsContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moEvalsContinuator.h new file mode 100644 index 000000000..1a020da6c --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moFitContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moFitContinuator.h new file mode 100644 index 000000000..03ac6b686 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moFitnessStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moFitnessStat.h new file mode 100644 index 000000000..d4f2f4bea --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moFullEvalContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moFullEvalContinuator.h new file mode 100644 index 000000000..5239c1dea --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moIterContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moIterContinuator.h new file mode 100644 index 000000000..f10db39f5 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moMaxNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moMaxNeighborStat.h new file mode 100644 index 000000000..d0dbd8136 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moMinNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moMinNeighborStat.h new file mode 100644 index 000000000..bd1cae1f9 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moMinusOneCounterStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moMinusOneCounterStat.h new file mode 100644 index 000000000..dfb9be881 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moNbInfNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moNbInfNeighborStat.h new file mode 100644 index 000000000..1fa6783bb --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moNbSupNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moNbSupNeighborStat.h new file mode 100644 index 000000000..027d8f1e8 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moNeighborBestStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moNeighborBestStat.h new file mode 100644 index 000000000..7aa4b2ed6 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moNeighborEvalContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moNeighborEvalContinuator.h new file mode 100644 index 000000000..ba3a41a9d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moNeighborFitnessStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moNeighborFitnessStat.h new file mode 100644 index 000000000..ab0d3bcb9 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moNeighborhoodStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moNeighborhoodStat.h new file mode 100644 index 000000000..c3fdc278e --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moNeutralDegreeNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moNeutralDegreeNeighborStat.h new file mode 100644 index 000000000..88ab663b4 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moSecondMomentNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moSecondMomentNeighborStat.h new file mode 100644 index 000000000..c5b1009f7 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moSizeNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moSizeNeighborStat.h new file mode 100644 index 000000000..6e7ae60f1 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moSolutionStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moSolutionStat.h new file mode 100644 index 000000000..17a997e25 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moStat.h new file mode 100644 index 000000000..b986166f3 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moStatBase.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moStatBase.h new file mode 100644 index 000000000..f0553ee1f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moStatFromStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moStatFromStat.h new file mode 100644 index 000000000..e8da634ad --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moStdFitnessNeighborStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moStdFitnessNeighborStat.h new file mode 100644 index 000000000..b9a547954 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moTimeContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moTimeContinuator.h new file mode 100644 index 000000000..c393a07ec --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moTrueContinuator.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moTrueContinuator.h new file mode 100644 index 000000000..88feb91a3 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moUnsignedStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moUnsignedStat.h new file mode 100644 index 000000000..c1f8342cd --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moUpdater.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moUpdater.h new file mode 100644 index 000000000..0be846d38 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moValueStat.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moValueStat.h new file mode 100644 index 000000000..6c8806e87 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/continuator/moVectorMonitor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/continuator/moVectorMonitor.h new file mode 100644 index 000000000..b04eb8adf --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/coolingSchedule/moCoolingSchedule.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/coolingSchedule/moCoolingSchedule.h new file mode 100644 index 000000000..9b65cf1b5 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/coolingSchedule/moDynSpanCoolingSchedule.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/coolingSchedule/moDynSpanCoolingSchedule.h new file mode 100644 index 000000000..34b386312 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/coolingSchedule/moSimpleCoolingSchedule.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/coolingSchedule/moSimpleCoolingSchedule.h new file mode 100644 index 000000000..5ff4f4920 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/eval/moDoubleIncrEvaluation.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/eval/moDoubleIncrEvaluation.h new file mode 100644 index 000000000..c7027e2b8 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/eval/moDoubleIncrNeighborhoodEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/eval/moDoubleIncrNeighborhoodEval.h new file mode 100644 index 000000000..61ef09176 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/eval/moDummyEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/eval/moDummyEval.h new file mode 100644 index 000000000..2809f12a3 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/eval/moEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/eval/moEval.h new file mode 100644 index 000000000..835a8ae8e --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/eval/moEvalCounter.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/eval/moEvalCounter.h new file mode 100644 index 000000000..e795f4384 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/eval/moFullEvalByCopy.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/eval/moFullEvalByCopy.h new file mode 100644 index 000000000..701a7b951 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/eval/moFullEvalByModif.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/eval/moFullEvalByModif.h new file mode 100644 index 000000000..80ee94d1c --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/eval/moNeighborhoodEvaluation.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/eval/moNeighborhoodEvaluation.h new file mode 100644 index 000000000..92274c133 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/explorer/moDummyExplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moDummyExplorer.h new file mode 100644 index 000000000..3d58dbb08 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/explorer/moFirstImprHCexplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moFirstImprHCexplorer.h new file mode 100644 index 000000000..4689ca9f0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/explorer/moILSexplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moILSexplorer.h new file mode 100644 index 000000000..761009005 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/explorer/moMetropolisHastingExplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moMetropolisHastingExplorer.h new file mode 100644 index 000000000..3123c4914 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/explorer/moNeighborhoodExplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moNeighborhoodExplorer.h new file mode 100644 index 000000000..8b4113b7a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/explorer/moNeutralHCexplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moNeutralHCexplorer.h new file mode 100644 index 000000000..40443de40 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/explorer/moRandomBestHCexplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moRandomBestHCexplorer.h new file mode 100644 index 000000000..d5e12f087 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/explorer/moRandomNeutralWalkExplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moRandomNeutralWalkExplorer.h new file mode 100644 index 000000000..6db9ad32b --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/explorer/moRandomSearchExplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moRandomSearchExplorer.h new file mode 100644 index 000000000..0b09da1d9 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/explorer/moRandomWalkExplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moRandomWalkExplorer.h new file mode 100644 index 000000000..5f4de7eef --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/explorer/moSAexplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moSAexplorer.h new file mode 100644 index 000000000..3d9f477ee --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/explorer/moSimpleHCexplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moSimpleHCexplorer.h new file mode 100644 index 000000000..573881d2f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/explorer/moTSexplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moTSexplorer.h new file mode 100644 index 000000000..062af93cc --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/explorer/moVNSexplorer.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/explorer/moVNSexplorer.h new file mode 100644 index 000000000..3c9c2ef27 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/memory/moAspiration.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moAspiration.h new file mode 100644 index 000000000..7a9e338e0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/memory/moBestImprAspiration.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moBestImprAspiration.h new file mode 100644 index 000000000..7187ef666 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/memory/moCountMoveMemory.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moCountMoveMemory.h new file mode 100644 index 000000000..22cbba5fd --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/memory/moDiversification.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moDiversification.h new file mode 100644 index 000000000..5df67a3fe --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/memory/moDummyDiversification.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moDummyDiversification.h new file mode 100644 index 000000000..72cd1f686 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/memory/moDummyIntensification.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moDummyIntensification.h new file mode 100644 index 000000000..d6fd9ef3d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/memory/moDummyMemory.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moDummyMemory.h new file mode 100644 index 000000000..c927a30f0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/memory/moIndexedVectorTabuList.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moIndexedVectorTabuList.h new file mode 100644 index 000000000..f01e17f1b --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/memory/moIntensification.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moIntensification.h new file mode 100644 index 000000000..44d6c1bc3 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/memory/moMemory.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moMemory.h new file mode 100644 index 000000000..c45f583af --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/memory/moMonOpDiversification.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moMonOpDiversification.h new file mode 100644 index 000000000..46fa8547b --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/memory/moNeighborVectorTabuList.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moNeighborVectorTabuList.h new file mode 100644 index 000000000..dbf8edb0f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/memory/moRndIndexedVectorTabuList.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moRndIndexedVectorTabuList.h new file mode 100644 index 000000000..82ffc0e04 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/memory/moSolVectorTabuList.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moSolVectorTabuList.h new file mode 100644 index 000000000..ba72ccc43 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/memory/moTabuList.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/memory/moTabuList.h new file mode 100644 index 000000000..018996e8a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/mo b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/mo new file mode 100755 index 000000000..81d1f5305 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/mo.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/mo.h new file mode 100755 index 000000000..45913e3de --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moBackableNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moBackableNeighbor.h new file mode 100644 index 000000000..4a851c451 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moBackwardVectorVNSelection.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moBackwardVectorVNSelection.h new file mode 100644 index 000000000..b3050c439 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moDummyNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moDummyNeighbor.h new file mode 100644 index 000000000..a8cd01087 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moDummyNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moDummyNeighborhood.h new file mode 100644 index 000000000..26c62163c --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moEvaluatedNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moEvaluatedNeighborhood.h new file mode 100644 index 000000000..52f1f54d8 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moForwardVectorVNSelection.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moForwardVectorVNSelection.h new file mode 100644 index 000000000..d7d3546cb --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moIndexNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moIndexNeighbor.h new file mode 100644 index 000000000..52c9ea1b0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moIndexNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moIndexNeighborhood.h new file mode 100644 index 000000000..83d06b267 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moNeighbor.h new file mode 100644 index 000000000..889dd6817 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moNeighborhood.h new file mode 100644 index 000000000..60d11c1f2 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moOrderNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moOrderNeighborhood.h new file mode 100644 index 000000000..7561d143b --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moRndNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moRndNeighborhood.h new file mode 100644 index 000000000..9c7ec2d22 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moRndVectorVNSelection.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moRndVectorVNSelection.h new file mode 100644 index 000000000..3debb85d4 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moRndWithReplNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moRndWithReplNeighborhood.h new file mode 100644 index 000000000..16e9b0211 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moRndWithoutReplNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moRndWithoutReplNeighborhood.h new file mode 100644 index 000000000..8c66ee3f9 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moVariableNeighborhoodSelection.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moVariableNeighborhoodSelection.h new file mode 100644 index 000000000..99af9a98d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/neighborhood/moVectorVNSelection.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/neighborhood/moVectorVNSelection.h new file mode 100644 index 000000000..3070e0e9a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/perturb/moLocalSearchInit.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/perturb/moLocalSearchInit.h new file mode 100644 index 000000000..d91c5c719 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/perturb/moMonOpPerturb.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/perturb/moMonOpPerturb.h new file mode 100644 index 000000000..c056bbf6a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/perturb/moNeighborhoodPerturb.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/perturb/moNeighborhoodPerturb.h new file mode 100644 index 000000000..676f5a828 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/perturb/moPerturbation.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/perturb/moPerturbation.h new file mode 100644 index 000000000..46fb9b0b9 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/perturb/moRestartPerturb.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/perturb/moRestartPerturb.h new file mode 100644 index 000000000..c1b4b78ba --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/perturb/moSolInit.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/perturb/moSolInit.h new file mode 100644 index 000000000..8707d47fa --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/bitString/moBitNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/bitString/moBitNeighbor.h new file mode 100644 index 000000000..f112fe180 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/bitString/moBitsNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/bitString/moBitsNeighbor.h new file mode 100644 index 000000000..e0f1363f1 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/bitString/moBitsNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/bitString/moBitsNeighborhood.h new file mode 100644 index 000000000..5bfb2576d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/bitString/moBitsWithReplNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/bitString/moBitsWithReplNeighborhood.h new file mode 100644 index 000000000..8c833f1a2 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/bitString/moBitsWithoutReplNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/bitString/moBitsWithoutReplNeighborhood.h new file mode 100644 index 000000000..c07bc451c --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/eval/moMaxSATincrEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/eval/moMaxSATincrEval.h new file mode 100644 index 000000000..69dfbdb2e --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/eval/moOneMaxIncrEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/eval/moOneMaxIncrEval.h new file mode 100644 index 000000000..c97b096e2 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/eval/moQAPIncrEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/eval/moQAPIncrEval.h new file mode 100644 index 000000000..3fd529a7f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/eval/moRoyalRoadIncrEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/eval/moRoyalRoadIncrEval.h new file mode 100644 index 000000000..3296ab25f --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/eval/moUBQPBitsIncrEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/eval/moUBQPBitsIncrEval.h new file mode 100644 index 000000000..d6a55c3d7 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/eval/moUBQPSimpleIncrEval.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/eval/moUBQPSimpleIncrEval.h new file mode 100644 index 000000000..78e6be0f5 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/eval/moUBQPdoubleIncrEvaluation.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/eval/moUBQPdoubleIncrEvaluation.h new file mode 100644 index 000000000..d9d149a83 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/permutation/moIndexedSwapNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/permutation/moIndexedSwapNeighbor.h new file mode 100644 index 000000000..0b503ca35 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/permutation/moShiftNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/permutation/moShiftNeighbor.h new file mode 100644 index 000000000..88d48301d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/permutation/moSwapNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/permutation/moSwapNeighbor.h new file mode 100644 index 000000000..55dfcbe8d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/permutation/moSwapNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/permutation/moSwapNeighborhood.h new file mode 100644 index 000000000..8354337e6 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/permutation/moTwoOptExNeighbor.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/permutation/moTwoOptExNeighbor.h new file mode 100755 index 000000000..ed7198574 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/problems/permutation/moTwoOptExNeighborhood.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/problems/permutation/moTwoOptExNeighborhood.h new file mode 100755 index 000000000..9723946bb --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/sampling/moAdaptiveWalkSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moAdaptiveWalkSampling.h new file mode 100644 index 000000000..72101dfcb --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/sampling/moAutocorrelationSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moAutocorrelationSampling.h new file mode 100644 index 000000000..3dbeaf954 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/sampling/moDensityOfStatesSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moDensityOfStatesSampling.h new file mode 100644 index 000000000..571f546de --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/sampling/moFDCsampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moFDCsampling.h new file mode 100644 index 000000000..22a224759 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/sampling/moFitnessCloudSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moFitnessCloudSampling.h new file mode 100644 index 000000000..15817555a --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/sampling/moHillClimberSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moHillClimberSampling.h new file mode 100644 index 000000000..e3e277bf7 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/sampling/moMHBestFitnessCloudSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moMHBestFitnessCloudSampling.h new file mode 100644 index 000000000..d68044498 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/sampling/moMHRndFitnessCloudSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moMHRndFitnessCloudSampling.h new file mode 100644 index 000000000..f72d6ff42 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/sampling/moNeutralDegreeSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moNeutralDegreeSampling.h new file mode 100644 index 000000000..bc7386ba2 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/sampling/moNeutralWalkSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moNeutralWalkSampling.h new file mode 100644 index 000000000..258792fe0 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/sampling/moRndBestFitnessCloudSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moRndBestFitnessCloudSampling.h new file mode 100644 index 000000000..12826c512 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/sampling/moRndRndFitnessCloudSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moRndRndFitnessCloudSampling.h new file mode 100644 index 000000000..ab778d69d --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/sampling/moSampling.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moSampling.h new file mode 100644 index 000000000..b118b9d48 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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-mo/src/sampling/moStatistics.h b/tags/ParadisEO-GPU-1.1/paradiseo-mo/src/sampling/moStatistics.h new file mode 100644 index 000000000..7c74cbc16 --- /dev/null +++ b/tags/ParadisEO-GPU-1.1/paradiseo-mo/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