diff --git a/trunk/paradiseo-mo/test/t-moAlwaysAcceptCrit.cpp b/trunk/paradiseo-mo/test/t-moAlwaysAcceptCrit.cpp index ef043c54e..ab50c5f10 100644 --- a/trunk/paradiseo-mo/test/t-moAlwaysAcceptCrit.cpp +++ b/trunk/paradiseo-mo/test/t-moAlwaysAcceptCrit.cpp @@ -34,18 +34,18 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moAlwaysAcceptCrit] => START" << std::endl; + std::cout << "[t-moAlwaysAcceptCrit] => START" << std::endl; - bitVector sol1, sol2; + bitVector sol1, sol2; - moAlwaysAcceptCrit test; + moAlwaysAcceptCrit test; - assert(test(sol1,sol2)); + assert(test(sol1,sol2)); - std::cout << "[t-moAlwaysAcceptCrit] => OK" << std::endl; + std::cout << "[t-moAlwaysAcceptCrit] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moAutocorrelationSampling.cpp b/trunk/paradiseo-mo/test/t-moAutocorrelationSampling.cpp index 0019d7959..77733bbd2 100644 --- a/trunk/paradiseo-mo/test/t-moAutocorrelationSampling.cpp +++ b/trunk/paradiseo-mo/test/t-moAutocorrelationSampling.cpp @@ -35,24 +35,24 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include "moTestClass.h" #include -int main(){ +int main() { - std::cout << "[t-moAutocorrelationSampling] => START" << std::endl; + std::cout << "[t-moAutocorrelationSampling] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); - dummyInit2 init(4); + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + dummyInit2 init(4); - moAutocorrelationSampling test(init, nh, fullEval, eval, 3); + moAutocorrelationSampling test(init, nh, fullEval, eval, 3); - test(); + test(); - test.fileExport("outputTestAutocorrelationSampling"); + test.fileExport("outputTestAutocorrelationSampling"); - std::cout << "[t-moAutocorrelationSampling] => OK" << std::endl; + std::cout << "[t-moAutocorrelationSampling] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moBetterAcceptCrit.cpp b/trunk/paradiseo-mo/test/t-moBetterAcceptCrit.cpp index 862c83d35..acd528598 100644 --- a/trunk/paradiseo-mo/test/t-moBetterAcceptCrit.cpp +++ b/trunk/paradiseo-mo/test/t-moBetterAcceptCrit.cpp @@ -35,27 +35,27 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moBetterAcceptCrit] => START" << std::endl; + std::cout << "[t-moBetterAcceptCrit] => START" << std::endl; - bitVector sol1, sol2, sol3; + bitVector sol1, sol2, sol3; - sol1.fitness(2); - sol2.fitness(3); - sol3.fitness(3); + sol1.fitness(2); + sol2.fitness(3); + sol3.fitness(3); - moSolComparator comparator; + moSolComparator comparator; - moBetterAcceptCrit test(comparator); + moBetterAcceptCrit test(comparator); - assert(test(sol2, sol1)); - assert(!test(sol1, sol2)); - assert(!test(sol2, sol3)); + assert(test(sol2, sol1)); + assert(!test(sol1, sol2)); + assert(!test(sol2, sol3)); - std::cout << "[t-moBetterAcceptCrit] => OK" << std::endl; + std::cout << "[t-moBetterAcceptCrit] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moCombinedContinuator.cpp b/trunk/paradiseo-mo/test/t-moCombinedContinuator.cpp index afeec68c2..7cbeb1229 100644 --- a/trunk/paradiseo-mo/test/t-moCombinedContinuator.cpp +++ b/trunk/paradiseo-mo/test/t-moCombinedContinuator.cpp @@ -37,9 +37,9 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moCombinedContinuator] => START" << std::endl; + std::cout << "[t-moCombinedContinuator] => START" << std::endl; moIterContinuator cont1(3, false); moTrueContinuator cont2; @@ -58,8 +58,8 @@ int main(){ assert(test(s)); assert(!test(s)); - std::cout << "[t-moCombinedContinuator] => OK" << std::endl; + std::cout << "[t-moCombinedContinuator] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moCountMoveMemory.cpp b/trunk/paradiseo-mo/test/t-moCountMoveMemory.cpp index 93b88389e..403970835 100644 --- a/trunk/paradiseo-mo/test/t-moCountMoveMemory.cpp +++ b/trunk/paradiseo-mo/test/t-moCountMoveMemory.cpp @@ -34,58 +34,58 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moCountMoveMemory] => START" << std::endl; + std::cout << "[t-moCountMoveMemory] => START" << std::endl; - bitVector sol; - bitNeighbor n; + bitVector sol; + bitNeighbor n; - moCountMoveMemory test; + moCountMoveMemory test; - test.init(sol); - assert(test.getNbMove()==0); - assert(test.getNbNoMove()==0); - assert(test.getCounter()==0); + test.init(sol); + assert(test.getNbMove()==0); + assert(test.getNbNoMove()==0); + assert(test.getCounter()==0); - test.add(sol,n); - assert(test.getNbMove()==1); - assert(test.getNbNoMove()==0); - assert(test.getCounter()==0); + test.add(sol,n); + assert(test.getNbMove()==1); + assert(test.getNbNoMove()==0); + assert(test.getCounter()==0); - test.add(sol,n); - assert(test.getNbMove()==2); - assert(test.getNbNoMove()==0); - assert(test.getCounter()==0); + test.add(sol,n); + assert(test.getNbMove()==2); + assert(test.getNbNoMove()==0); + assert(test.getCounter()==0); - test.update(sol,n); - assert(test.getNbMove()==2); - assert(test.getNbNoMove()==1); - assert(test.getCounter()==1); + test.update(sol,n); + assert(test.getNbMove()==2); + assert(test.getNbNoMove()==1); + assert(test.getCounter()==1); - test.add(sol,n); - assert(test.getNbMove()==3); - assert(test.getNbNoMove()==1); - assert(test.getCounter()==0); + test.add(sol,n); + assert(test.getNbMove()==3); + assert(test.getNbNoMove()==1); + assert(test.getCounter()==0); - test.update(sol,n); - assert(test.getNbMove()==3); - assert(test.getNbNoMove()==2); - assert(test.getCounter()==1); + test.update(sol,n); + assert(test.getNbMove()==3); + assert(test.getNbNoMove()==2); + assert(test.getCounter()==1); - test.update(sol,n); - assert(test.getNbMove()==3); - assert(test.getNbNoMove()==3); - assert(test.getCounter()==2); + test.update(sol,n); + assert(test.getNbMove()==3); + assert(test.getNbNoMove()==3); + assert(test.getCounter()==2); - test.clearMemory(); - assert(test.getNbMove()==0); - assert(test.getNbNoMove()==0); - assert(test.getCounter()==0); + test.clearMemory(); + assert(test.getNbMove()==0); + assert(test.getNbNoMove()==0); + assert(test.getCounter()==0); - std::cout << "[t-moCountMoveMemory] => OK" << std::endl; + std::cout << "[t-moCountMoveMemory] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moCounterStat.cpp b/trunk/paradiseo-mo/test/t-moCounterStat.cpp index f722bb74d..08ce62b8e 100644 --- a/trunk/paradiseo-mo/test/t-moCounterStat.cpp +++ b/trunk/paradiseo-mo/test/t-moCounterStat.cpp @@ -33,30 +33,30 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include -int main(){ +int main() { - std::cout << "[t-moCounterStat] => START" << std::endl; + std::cout << "[t-moCounterStat] => START" << std::endl; - moCounterStat test; + moCounterStat test; - int a=3; + int a=3; - test.init(a); - assert(test.value()==0); - a=5; - test(a); - assert(test.value()==1); - a=-3; - test(a); - assert(test.value()==2); - a=-12; - test.init(a); - assert(test.value()==0); + test.init(a); + assert(test.value()==0); + a=5; + test(a); + assert(test.value()==1); + a=-3; + test(a); + assert(test.value()==2); + a=-12; + test.init(a); + assert(test.value()==0); - assert(test.className()=="moCounterStat"); + assert(test.className()=="moCounterStat"); - std::cout << "[t-moCounterStat] => OK" << std::endl; + std::cout << "[t-moCounterStat] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moDensityOfStatesSampling.cpp b/trunk/paradiseo-mo/test/t-moDensityOfStatesSampling.cpp index a4d35273f..adc97bb27 100644 --- a/trunk/paradiseo-mo/test/t-moDensityOfStatesSampling.cpp +++ b/trunk/paradiseo-mo/test/t-moDensityOfStatesSampling.cpp @@ -35,20 +35,20 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include "moTestClass.h" #include -int main(){ +int main() { - std::cout << "[t-moDensityOfStatesSampling] => START" << std::endl; + std::cout << "[t-moDensityOfStatesSampling] => START" << std::endl; - oneMaxEval fullEval; - dummyInit2 init(4); + oneMaxEval fullEval; + dummyInit2 init(4); - moDensityOfStatesSampling test(init, fullEval, 3); - test(); + moDensityOfStatesSampling test(init, fullEval, 3); + test(); - test.fileExport("outputTestDensityOfState"); + test.fileExport("outputTestDensityOfState"); - std::cout << "[t-moDensityOfStatesSampling] => OK" << std::endl; + std::cout << "[t-moDensityOfStatesSampling] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moDummyEval.cpp b/trunk/paradiseo-mo/test/t-moDummyEval.cpp index bbd04e3fc..5f618b4e5 100644 --- a/trunk/paradiseo-mo/test/t-moDummyEval.cpp +++ b/trunk/paradiseo-mo/test/t-moDummyEval.cpp @@ -33,14 +33,14 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moDummyEval] => START" << std::endl; + std::cout << "[t-moDummyEval] => START" << std::endl; - moDummyEval test; + moDummyEval test; - std::cout << "[t-moDummyEval] => OK" << std::endl; + std::cout << "[t-moDummyEval] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moDummyExplorer.cpp b/trunk/paradiseo-mo/test/t-moDummyExplorer.cpp index f6b53da2f..8a3791698 100644 --- a/trunk/paradiseo-mo/test/t-moDummyExplorer.cpp +++ b/trunk/paradiseo-mo/test/t-moDummyExplorer.cpp @@ -34,16 +34,16 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moDummyExplorer] => START" << std::endl; + std::cout << "[t-moDummyExplorer] => START" << std::endl; - moDummyExplorer test; + moDummyExplorer test; - assert(test.className()=="moDummyExplorer"); + assert(test.className()=="moDummyExplorer"); - std::cout << "[t-moDummyExplorer] => OK" << std::endl; + std::cout << "[t-moDummyExplorer] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moDummyLS.cpp b/trunk/paradiseo-mo/test/t-moDummyLS.cpp index b752e178a..c1204757f 100644 --- a/trunk/paradiseo-mo/test/t-moDummyLS.cpp +++ b/trunk/paradiseo-mo/test/t-moDummyLS.cpp @@ -35,17 +35,17 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include "moTestClass.h" #include -int main(){ +int main() { - std::cout << "[t-moDummyLS] => START" << std::endl; + std::cout << "[t-moDummyLS] => START" << std::endl; - oneMaxEval fullEval; - moDummyLS test(fullEval); + oneMaxEval fullEval; + moDummyLS test(fullEval); - assert(test.className()=="moDummyLS"); + assert(test.className()=="moDummyLS"); - std::cout << "[t-moDummyLS] => OK" << std::endl; + std::cout << "[t-moDummyLS] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moDummyNeighbor.cpp b/trunk/paradiseo-mo/test/t-moDummyNeighbor.cpp index 8d1326e6b..cd60ddb01 100644 --- a/trunk/paradiseo-mo/test/t-moDummyNeighbor.cpp +++ b/trunk/paradiseo-mo/test/t-moDummyNeighbor.cpp @@ -33,14 +33,14 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moDummyNeighbor] => START" << std::endl; + std::cout << "[t-moDummyNeighbor] => START" << std::endl; - moDummyNeighbor test; + moDummyNeighbor test; - std::cout << "[t-moDummyNeighbor] => OK" << std::endl; + std::cout << "[t-moDummyNeighbor] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moDummyNeighborhood.cpp b/trunk/paradiseo-mo/test/t-moDummyNeighborhood.cpp index 111610a3c..c38083873 100644 --- a/trunk/paradiseo-mo/test/t-moDummyNeighborhood.cpp +++ b/trunk/paradiseo-mo/test/t-moDummyNeighborhood.cpp @@ -34,23 +34,23 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moDummyNeighborhood] => START" << std::endl; + std::cout << "[t-moDummyNeighborhood] => START" << std::endl; - bitVector sol; - moDummyNeighbor n; + bitVector sol; + moDummyNeighbor n; - moDummyNeighborhood > test; + moDummyNeighborhood > test; - assert(!test.hasNeighbor(sol)); - assert(!test.cont(sol)); - test.init(sol,n); - test.next(sol,n); + assert(!test.hasNeighbor(sol)); + assert(!test.cont(sol)); + test.init(sol,n); + test.next(sol,n); - std::cout << "[t-moDummyNeighborhood] => OK" << std::endl; + std::cout << "[t-moDummyNeighborhood] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moEvalCounter.cpp b/trunk/paradiseo-mo/test/t-moEvalCounter.cpp index 96afb67bd..000a6d5ba 100644 --- a/trunk/paradiseo-mo/test/t-moEvalCounter.cpp +++ b/trunk/paradiseo-mo/test/t-moEvalCounter.cpp @@ -34,33 +34,33 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moEvalCounter] => START" << std::endl; + std::cout << "[t-moEvalCounter] => START" << std::endl; - evalOneMax eval(4); - bitVector sol; - sol.resize(4); - sol[0]=true; - sol[1]=false; - sol[2]=true; - sol[3]=true; - sol.fitness(3); - bitNeighbor n; - n.index(2); + evalOneMax eval(4); + bitVector sol; + sol.resize(4); + sol[0]=true; + sol[1]=false; + sol[2]=true; + sol[3]=true; + sol.fitness(3); + bitNeighbor n; + n.index(2); - moEvalCounter test(eval); + moEvalCounter test(eval); - test(sol,n); - assert(test.value()==1); - assert(n.fitness()==2); - n.index(1); - test(sol,n); - assert(test.value()==2); - assert(n.fitness()==4); + test(sol,n); + assert(test.value()==1); + assert(n.fitness()==2); + n.index(1); + test(sol,n); + assert(test.value()==2); + assert(n.fitness()==4); - std::cout << "[t-moEvalCounter] => OK" << std::endl; + std::cout << "[t-moEvalCounter] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moFDCsampling.cpp b/trunk/paradiseo-mo/test/t-moFDCsampling.cpp index 94455582a..34da40c43 100644 --- a/trunk/paradiseo-mo/test/t-moFDCsampling.cpp +++ b/trunk/paradiseo-mo/test/t-moFDCsampling.cpp @@ -37,25 +37,25 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -int main(){ +int main() { - std::cout << "[t-moFDCsampling] => START" << std::endl; + std::cout << "[t-moFDCsampling] => START" << std::endl; - oneMaxEval fullEval; - dummyInit2 init(4); - eoHammingDistance dist; - bitVector sol(4, false); - sol.fitness(0); + oneMaxEval fullEval; + dummyInit2 init(4); + eoHammingDistance dist; + bitVector sol(4, false); + sol.fitness(0); - moFDCsampling test(init, fullEval, dist, sol, 3); + moFDCsampling test(init, fullEval, dist, sol, 3); - test(); + test(); - test.fileExport("outputTestFDCsampling"); + test.fileExport("outputTestFDCsampling"); - std::cout << "[t-moFDCsampling] => OK" << std::endl; + std::cout << "[t-moFDCsampling] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moFirstImprHC.cpp b/trunk/paradiseo-mo/test/t-moFirstImprHC.cpp index 2a60128ae..e92984567 100644 --- a/trunk/paradiseo-mo/test/t-moFirstImprHC.cpp +++ b/trunk/paradiseo-mo/test/t-moFirstImprHC.cpp @@ -37,28 +37,28 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -int main(){ +int main() { - std::cout << "[t-moFirstImprHC] => START" << std::endl; + std::cout << "[t-moFirstImprHC] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); - //test first constructor - moFirstImprHC test1(nh, fullEval, eval); + //test first constructor + moFirstImprHC test1(nh, fullEval, eval); - //test second constructor - moTrueContinuator cont; - moFirstImprHC test2(nh, fullEval, eval, cont); + //test second constructor + moTrueContinuator cont; + moFirstImprHC test2(nh, fullEval, eval, cont); - //test third constructor - moSolNeighborComparator sncomp; - moNeighborComparator ncomp; - moFirstImprHC test3(nh, fullEval, eval, cont, ncomp, sncomp); + //test third constructor + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; + moFirstImprHC test3(nh, fullEval, eval, cont, ncomp, sncomp); - std::cout << "[t-moFirstImprHC] => OK" << std::endl; + std::cout << "[t-moFirstImprHC] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moFitContinuator.cpp b/trunk/paradiseo-mo/test/t-moFitContinuator.cpp index 4837fbabf..34e686444 100644 --- a/trunk/paradiseo-mo/test/t-moFitContinuator.cpp +++ b/trunk/paradiseo-mo/test/t-moFitContinuator.cpp @@ -34,28 +34,28 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moFitContinuator] => START" << std::endl; + std::cout << "[t-moFitContinuator] => START" << std::endl; - moFitContinuator test1(3); - moFitContinuator test2(5); + moFitContinuator test1(3); + moFitContinuator test2(5); - bitVector sol1; - Solution sol2; + bitVector sol1; + Solution sol2; - sol1.fitness(4); - assert(test1(sol1)); - sol1.fitness(3); - assert(!test1(sol1)); + sol1.fitness(4); + assert(test1(sol1)); + sol1.fitness(3); + assert(!test1(sol1)); - sol2.fitness(3); - assert(test2(sol2)); - sol2.fitness(5); - assert(!test2(sol2)); + sol2.fitness(3); + assert(test2(sol2)); + sol2.fitness(5); + assert(!test2(sol2)); - std::cout << "[t-moFitContinuator] => OK" << std::endl; + std::cout << "[t-moFitContinuator] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moFitnessCloudSampling.cpp b/trunk/paradiseo-mo/test/t-moFitnessCloudSampling.cpp index 378c689bc..ae2392d5a 100644 --- a/trunk/paradiseo-mo/test/t-moFitnessCloudSampling.cpp +++ b/trunk/paradiseo-mo/test/t-moFitnessCloudSampling.cpp @@ -40,36 +40,36 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include -int main(){ +int main() { - std::cout << "[t-moFitnessCloudSampling] => START" << std::endl; + std::cout << "[t-moFitnessCloudSampling] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); - dummyInit2 init(4); + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + dummyInit2 init(4); - moFitnessCloudSampling test1(init, nh, fullEval, eval, 3); + moFitnessCloudSampling test1(init, nh, fullEval, eval, 3); - moRndRndFitnessCloudSampling test2(init, nh, fullEval, eval, 3); + moRndRndFitnessCloudSampling test2(init, nh, fullEval, eval, 3); - moRndBestFitnessCloudSampling test3(init, nh, fullEval, eval, 3); + moRndBestFitnessCloudSampling test3(init, nh, fullEval, eval, 3); - moMHRndFitnessCloudSampling test4(init, nh, fullEval, eval, 3); + moMHRndFitnessCloudSampling test4(init, nh, fullEval, eval, 3); - moMHBestFitnessCloudSampling test5(init, nh, fullEval, eval, 3); + moMHBestFitnessCloudSampling test5(init, nh, fullEval, eval, 3); - test1(); - test2(); - test3(); - test4(); - test5(); + test1(); + test2(); + test3(); + test4(); + test5(); - test1.fileExport("outputTestFitnessCloudSampling"); + test1.fileExport("outputTestFitnessCloudSampling"); - std::cout << "[t-moFitnessCloudSampling] => OK" << std::endl; + std::cout << "[t-moFitnessCloudSampling] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moForwardVariableNeighborhood.cpp b/trunk/paradiseo-mo/test/t-moForwardVariableNeighborhood.cpp index 904202d09..538532e0e 100644 --- a/trunk/paradiseo-mo/test/t-moForwardVariableNeighborhood.cpp +++ b/trunk/paradiseo-mo/test/t-moForwardVariableNeighborhood.cpp @@ -37,19 +37,19 @@ Contact: paradiseo-help@lists.gforge.inria.fr -int main(){ +int main() { - std::cout << "[t-moForwardVariableNeighborhood] => START" << std::endl; + std::cout << "[t-moForwardVariableNeighborhood] => START" << std::endl; - moRndWithoutReplNeighborhood rndNH(8); - moOrderNeighborhood > >orderNH(8); + moRndWithoutReplNeighborhood rndNH(8); + moOrderNeighborhood > >orderNH(8); - //moForwardVariableNeighborhood, eoMinimizingFitness> test(orderNH); + //moForwardVariableNeighborhood, eoMinimizingFitness> test(orderNH); - std::cout << "[t-moForwardVariableNeighborhood] => OK" << std::endl; + std::cout << "[t-moForwardVariableNeighborhood] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moFullEvalContinuator.cpp b/trunk/paradiseo-mo/test/t-moFullEvalContinuator.cpp index d81f80d3f..78164608a 100644 --- a/trunk/paradiseo-mo/test/t-moFullEvalContinuator.cpp +++ b/trunk/paradiseo-mo/test/t-moFullEvalContinuator.cpp @@ -35,36 +35,36 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moFullEvalContinuator] => START" << std::endl; + std::cout << "[t-moFullEvalContinuator] => START" << std::endl; - oneMaxEval fullEval; - eoEvalFuncCounter evalCount(fullEval); - moFullEvalContinuator test(evalCount, 3); + oneMaxEval fullEval; + eoEvalFuncCounter evalCount(fullEval); + moFullEvalContinuator test(evalCount, 3); - bitVector sol; - sol.push_back(1); + bitVector sol; + sol.push_back(1); - test.init(sol); - evalCount(sol); - sol.invalidate(); - assert(test.value()==1); - evalCount(sol); - sol.invalidate(); - assert(test.value()==2); - assert(test(sol)); - evalCount(sol); - sol.invalidate(); - assert(test.value()==3); - assert(!test(sol)); - test.init(sol); - assert(test.value()==0); - assert(test(sol)); + test.init(sol); + evalCount(sol); + sol.invalidate(); + assert(test.value()==1); + evalCount(sol); + sol.invalidate(); + assert(test.value()==2); + assert(test(sol)); + evalCount(sol); + sol.invalidate(); + assert(test.value()==3); + assert(!test(sol)); + test.init(sol); + assert(test.value()==0); + assert(test(sol)); - std::cout << "[t-moFullEvalContinuator] => OK" << std::endl; + std::cout << "[t-moFullEvalContinuator] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moHillClimberSampling.cpp b/trunk/paradiseo-mo/test/t-moHillClimberSampling.cpp index eb15f52b3..0dcb6d950 100644 --- a/trunk/paradiseo-mo/test/t-moHillClimberSampling.cpp +++ b/trunk/paradiseo-mo/test/t-moHillClimberSampling.cpp @@ -35,23 +35,23 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include "moTestClass.h" #include -int main(){ +int main() { - std::cout << "[t-moHillClimberSampling] => START" << std::endl; + std::cout << "[t-moHillClimberSampling] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); - dummyInit2 init(4); + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + dummyInit2 init(4); - moHillClimberSampling test(init, nh, fullEval, eval, 3); + moHillClimberSampling test(init, nh, fullEval, eval, 3); - test(); + test(); - test.fileExport("outputTestHillClimberSampling"); + test.fileExport("outputTestHillClimberSampling"); - std::cout << "[t-moHillClimberSampling] => OK" << std::endl; + std::cout << "[t-moHillClimberSampling] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moILS.cpp b/trunk/paradiseo-mo/test/t-moILS.cpp index 25643d48d..42f7b3f36 100644 --- a/trunk/paradiseo-mo/test/t-moILS.cpp +++ b/trunk/paradiseo-mo/test/t-moILS.cpp @@ -41,37 +41,39 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -class dummyMonOp: public eoMonOp{ - public: - bool operator()(bitVector&){return false;} +class dummyMonOp: public eoMonOp { +public: + bool operator()(bitVector&) { + return false; + } }; -int main(){ +int main() { - std::cout << "[t-moILS] => START" << std::endl; + std::cout << "[t-moILS] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); - moTS ts(nh, fullEval, eval, 1, 7); + moTS ts(nh, fullEval, eval, 1, 7); - dummyMonOp op; + dummyMonOp op; - //basic constructor - moILS test1(ts, fullEval, op, 3); + //basic constructor + moILS test1(ts, fullEval, op, 3); - //simple constructor - moTrueContinuator > cont; - moILS test2(ts, fullEval, op, cont); + //simple constructor + moTrueContinuator > cont; + moILS test2(ts, fullEval, op, cont); - //general constructor - moMonOpPerturb perturb(op, fullEval); - moAlwaysAcceptCrit accept; - moILS test3(ts, fullEval, cont, perturb, accept); + //general constructor + moMonOpPerturb perturb(op, fullEval); + moAlwaysAcceptCrit accept; + moILS test3(ts, fullEval, cont, perturb, accept); - std::cout << "[t-moILS] => OK" << std::endl; + std::cout << "[t-moILS] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moILSexplorer.cpp b/trunk/paradiseo-mo/test/t-moILSexplorer.cpp index 2c75320a1..fab42a797 100644 --- a/trunk/paradiseo-mo/test/t-moILSexplorer.cpp +++ b/trunk/paradiseo-mo/test/t-moILSexplorer.cpp @@ -42,59 +42,59 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include -class dummyMonOp: public eoMonOp{ +class dummyMonOp: public eoMonOp { - bool operator()(bitVector& _sol){ - _sol[0]=!_sol[0]; - return true; - } + bool operator()(bitVector& _sol) { + _sol[0]=!_sol[0]; + return true; + } }; -int main(){ +int main() { - std::cout << "[t-moILSexplorer] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); + std::cout << "[t-moILSexplorer] => START" << std::endl; + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); - bitVector sol(4, true); - fullEval(sol); + bitVector sol(4, true); + fullEval(sol); - //test first constructor - moSimpleHC ls(nh, fullEval, eval); + //test first constructor + moSimpleHC ls(nh, fullEval, eval); - dummyMonOp op; - moMonOpPerturb perturb(op, fullEval); + dummyMonOp op; + moMonOpPerturb perturb(op, fullEval); - moAlwaysAcceptCrit accept; + moAlwaysAcceptCrit accept; - moILSexplorer test(ls, perturb, accept); + moILSexplorer test(ls, perturb, accept); - assert(test.className()=="moILSexplorer"); - assert(test.isContinue(sol)); - assert(test.accept(sol)); + assert(test.className()=="moILSexplorer"); + assert(test.isContinue(sol)); + assert(test.accept(sol)); - test.initParam(sol); - test.moveApplied(true); - test.updateParam(sol); - test.moveApplied(false); - test.updateParam(sol); - test.terminate(sol); + test.initParam(sol); + test.moveApplied(true); + test.updateParam(sol); + test.moveApplied(false); + test.updateParam(sol); + test.terminate(sol); - test.initParam(sol); - test(sol); - test.move(sol); + test.initParam(sol); + test(sol); + test.move(sol); - for(unsigned int i=0; i OK" << std::endl; + std::cout << "[t-moILSexplorer] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moIterContinuator.cpp b/trunk/paradiseo-mo/test/t-moIterContinuator.cpp index 7bedb7b75..871ffeb90 100644 --- a/trunk/paradiseo-mo/test/t-moIterContinuator.cpp +++ b/trunk/paradiseo-mo/test/t-moIterContinuator.cpp @@ -34,9 +34,9 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moIterContinuator] => START" << std::endl; + std::cout << "[t-moIterContinuator] => START" << std::endl; moIterContinuator test(3, false); moIterContinuator test2(3); @@ -54,8 +54,8 @@ int main(){ assert(test.value()==0); - std::cout << "[t-moIterContinuator] => OK" << std::endl; + std::cout << "[t-moIterContinuator] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moLocalSearch.cpp b/trunk/paradiseo-mo/test/t-moLocalSearch.cpp index 7b7ade4ab..4d3f3753d 100644 --- a/trunk/paradiseo-mo/test/t-moLocalSearch.cpp +++ b/trunk/paradiseo-mo/test/t-moLocalSearch.cpp @@ -39,32 +39,32 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moLocalSearch] => START" << std::endl; + std::cout << "[t-moLocalSearch] => START" << std::endl; - bitNeighborhood nh(8); - oneMaxEval fullEval; - evalOneMax eval(8); - moTrueContinuator cont; - moSolNeighborComparator sncomp; - moNeighborComparator ncomp; - moSimpleHCexplorer explorer(nh, eval, ncomp, sncomp); - moLocalSearch test(explorer, cont, fullEval); + bitNeighborhood nh(8); + oneMaxEval fullEval; + evalOneMax eval(8); + moTrueContinuator cont; + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; + moSimpleHCexplorer explorer(nh, eval, ncomp, sncomp); + moLocalSearch test(explorer, cont, fullEval); - bitVector sol(8, true); + bitVector sol(8, true); - test(sol); + test(sol); - assert(sol.fitness()==0); - for(unsigned int i=0; i OK" << std::endl; + std::cout << "[t-moLocalSearch] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moLocalSearchInit.cpp b/trunk/paradiseo-mo/test/t-moLocalSearchInit.cpp index 43d2e9d0b..1f23c8724 100644 --- a/trunk/paradiseo-mo/test/t-moLocalSearchInit.cpp +++ b/trunk/paradiseo-mo/test/t-moLocalSearchInit.cpp @@ -37,22 +37,22 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include -int main(){ +int main() { - std::cout << "[t-moLocalSearchInit] => START" << std::endl; + std::cout << "[t-moLocalSearchInit] => START" << std::endl; - oneMaxEval fullEval; - moDummyLS ls(fullEval); - dummyInit init; - bitVector sol; - sol.fitness(0); + oneMaxEval fullEval; + moDummyLS ls(fullEval); + dummyInit init; + bitVector sol; + sol.fitness(0); - moLocalSearchInit test(init, ls); + moLocalSearchInit test(init, ls); - test(sol); + test(sol); - std::cout << "[t-moLocalSearchInit] => OK" << std::endl; + std::cout << "[t-moLocalSearchInit] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moMetropolisHasting.cpp b/trunk/paradiseo-mo/test/t-moMetropolisHasting.cpp index d94eee0b1..638c64bd8 100644 --- a/trunk/paradiseo-mo/test/t-moMetropolisHasting.cpp +++ b/trunk/paradiseo-mo/test/t-moMetropolisHasting.cpp @@ -38,28 +38,28 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -int main(){ +int main() { - std::cout << "[t-moMetropolisHasting] => START" << std::endl; + std::cout << "[t-moMetropolisHasting] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); - moTrueContinuator cont; - moSolNeighborComparator sncomp; - moNeighborComparator ncomp; + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + moTrueContinuator cont; + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; - //test du 1er constructeur - moMetropolisHasting test1(nh, fullEval, eval, 3); + //test du 1er constructeur + moMetropolisHasting test1(nh, fullEval, eval, 3); - //test du 2eme constructeur - moMetropolisHasting test2(nh, fullEval, eval, 3, cont); + //test du 2eme constructeur + moMetropolisHasting test2(nh, fullEval, eval, 3, cont); - //test du 3eme constructeur - moMetropolisHasting test3(nh, fullEval, eval, 3, cont, ncomp, sncomp); + //test du 3eme constructeur + moMetropolisHasting test3(nh, fullEval, eval, 3, cont, ncomp, sncomp); - std::cout << "[t-moMetropolisHasting] => OK" << std::endl; + std::cout << "[t-moMetropolisHasting] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moMinusOneCounterStat.cpp b/trunk/paradiseo-mo/test/t-moMinusOneCounterStat.cpp index 923e63df7..567d610bd 100644 --- a/trunk/paradiseo-mo/test/t-moMinusOneCounterStat.cpp +++ b/trunk/paradiseo-mo/test/t-moMinusOneCounterStat.cpp @@ -33,32 +33,32 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include -int main(){ +int main() { - std::cout << "[t-moMinusOneCounterStat] => START" << std::endl; + std::cout << "[t-moMinusOneCounterStat] => START" << std::endl; - moMinusOneCounterStat test; + moMinusOneCounterStat test; - int a=3; + int a=3; - test.init(a); - assert(test.value()==0); - a=5; - test(a); - assert(test.value()==0); - a=-3; - test(a); - assert(test.value()==1); - a=-12; - test(a); - assert(test.value()==2); - test.init(a); - assert(test.value()==0); + test.init(a); + assert(test.value()==0); + a=5; + test(a); + assert(test.value()==0); + a=-3; + test(a); + assert(test.value()==1); + a=-12; + test(a); + assert(test.value()==2); + test.init(a); + assert(test.value()==0); - assert(test.className()=="moMinusOneCounterStat"); + assert(test.className()=="moMinusOneCounterStat"); - std::cout << "[t-moMinusOneCounterStat] => OK" << std::endl; + std::cout << "[t-moMinusOneCounterStat] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moMonOpDiversification.cpp b/trunk/paradiseo-mo/test/t-moMonOpDiversification.cpp index f4db062e6..6c83ec08b 100644 --- a/trunk/paradiseo-mo/test/t-moMonOpDiversification.cpp +++ b/trunk/paradiseo-mo/test/t-moMonOpDiversification.cpp @@ -38,37 +38,37 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include -class dummyMonOp: public eoMonOp{ +class dummyMonOp: public eoMonOp { - bool operator()(bitVector& _sol){ - _sol[0]=!_sol[0]; - return true; - } + bool operator()(bitVector& _sol) { + _sol[0]=!_sol[0]; + return true; + } }; -int main(){ +int main() { - std::cout << "[t-moMonOpDiversification] => START" << std::endl; + std::cout << "[t-moMonOpDiversification] => START" << std::endl; - dummyMonOp op; - oneMaxEval eval; + dummyMonOp op; + oneMaxEval eval; - bitVector sol; - sol.push_back(1); - sol.push_back(0); - sol.push_back(1); + bitVector sol; + sol.push_back(1); + sol.push_back(0); + sol.push_back(1); - sol.fitness(5); + sol.fitness(5); - moMonOpDiversification test(op, eval); + moMonOpDiversification test(op, eval); - test(sol); + test(sol); - assert(sol.fitness()==1); + assert(sol.fitness()==1); - std::cout << "[t-moMonOpDiversification] => OK" << std::endl; + std::cout << "[t-moMonOpDiversification] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moMonOpPerturb.cpp b/trunk/paradiseo-mo/test/t-moMonOpPerturb.cpp index 5e5b627d3..c56394674 100644 --- a/trunk/paradiseo-mo/test/t-moMonOpPerturb.cpp +++ b/trunk/paradiseo-mo/test/t-moMonOpPerturb.cpp @@ -37,38 +37,38 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include -class dummyMonOp: public eoMonOp{ +class dummyMonOp: public eoMonOp { - bool operator()(bitVector& _sol){ - _sol[0]=!_sol[0]; - return true; - } + bool operator()(bitVector& _sol) { + _sol[0]=!_sol[0]; + return true; + } }; -int main(){ +int main() { - std::cout << "[t-moMonOpPerturb] => START" << std::endl; + std::cout << "[t-moMonOpPerturb] => START" << std::endl; - dummyMonOp op; - oneMaxEval eval; + dummyMonOp op; + oneMaxEval eval; - bitVector sol; - sol.push_back(1); - sol.push_back(0); - sol.push_back(1); + bitVector sol; + sol.push_back(1); + sol.push_back(0); + sol.push_back(1); - sol.fitness(5); + sol.fitness(5); - moMonOpPerturb test(op, eval); + moMonOpPerturb test(op, eval); - test(sol); + test(sol); - assert(sol.fitness()==1); + assert(sol.fitness()==1); - std::cout << "[t-moMonOpPerturb] => OK" << std::endl; + std::cout << "[t-moMonOpPerturb] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moNeighborBestStat.cpp b/trunk/paradiseo-mo/test/t-moNeighborBestStat.cpp index 80a6050d2..f35f74cdb 100644 --- a/trunk/paradiseo-mo/test/t-moNeighborBestStat.cpp +++ b/trunk/paradiseo-mo/test/t-moNeighborBestStat.cpp @@ -34,41 +34,41 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moNeighborBestStat] => START" << std::endl; + std::cout << "[t-moNeighborBestStat] => START" << std::endl; - bitNeighborhood nh(4); - bitNeighborhood emptyNH(0); - evalOneMax eval(4); - moSolNeighborComparator sncomp; - moNeighborComparator ncomp; + bitNeighborhood nh(4); + bitNeighborhood emptyNH(0); + evalOneMax eval(4); + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; - moNeighborBestStat test1(nh, eval, ncomp, sncomp, 1); - moNeighborBestStat test2(nh, eval); - moNeighborBestStat test3(emptyNH, eval); + moNeighborBestStat test1(nh, eval, ncomp, sncomp, 1); + moNeighborBestStat test2(nh, eval); + moNeighborBestStat test3(emptyNH, eval); - bitVector sol(4, true); - sol.fitness(4); + bitVector sol(4, true); + sol.fitness(4); - test1.init(sol); - assert(test1.value()==3); + test1.init(sol); + assert(test1.value()==3); - sol[0]=false; - sol.fitness(3); - test1(sol); - assert(test1.value()==4); + sol[0]=false; + sol.fitness(3); + test1(sol); + assert(test1.value()==4); - test2(sol); - assert(test2.value()==2); + test2(sol); + assert(test2.value()==2); - test3(sol); - assert(test3.value()==int()); + test3(sol); + assert(test3.value()==int()); - assert(test1.className()=="moNeighborBestStat"); + assert(test1.className()=="moNeighborBestStat"); - std::cout << "[t-moNeighborBestStat] => OK" << std::endl; + std::cout << "[t-moNeighborBestStat] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moNeighborEvalContinuator.cpp b/trunk/paradiseo-mo/test/t-moNeighborEvalContinuator.cpp index dcff8249c..b2671786d 100644 --- a/trunk/paradiseo-mo/test/t-moNeighborEvalContinuator.cpp +++ b/trunk/paradiseo-mo/test/t-moNeighborEvalContinuator.cpp @@ -34,36 +34,36 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moNeighborEvalContinuator] => START" << std::endl; + std::cout << "[t-moNeighborEvalContinuator] => START" << std::endl; - evalOneMax moEval(2); - moEvalCounter evalCount(moEval); - moNeighborEvalContinuator test(evalCount, 3); + evalOneMax moEval(2); + moEvalCounter evalCount(moEval); + moNeighborEvalContinuator test(evalCount, 3); - bitVector sol; - sol.push_back(true); - sol.push_back(false); + bitVector sol; + sol.push_back(true); + sol.push_back(false); - bitNeighbor n; - sol.fitness(1); + bitNeighbor n; + sol.fitness(1); - test.init(sol); - evalCount(sol,n); - assert(test.value()==1); - evalCount(sol,n); - assert(test.value()==2); - assert(test(sol)); - evalCount(sol,n); - assert(test.value()==3); - assert(!test(sol)); - test.init(sol); - assert(test.value()==0); - assert(test(sol)); + test.init(sol); + evalCount(sol,n); + assert(test.value()==1); + evalCount(sol,n); + assert(test.value()==2); + assert(test(sol)); + evalCount(sol,n); + assert(test.value()==3); + assert(!test(sol)); + test.init(sol); + assert(test.value()==0); + assert(test(sol)); - std::cout << "[t-moNeighborEvalContinuator] => OK" << std::endl; + std::cout << "[t-moNeighborEvalContinuator] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moNeighborFitnessStat.cpp b/trunk/paradiseo-mo/test/t-moNeighborFitnessStat.cpp index 5408d2b91..a85408c09 100644 --- a/trunk/paradiseo-mo/test/t-moNeighborFitnessStat.cpp +++ b/trunk/paradiseo-mo/test/t-moNeighborFitnessStat.cpp @@ -34,33 +34,33 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moNeighborFitnessStat] => START" << std::endl; + std::cout << "[t-moNeighborFitnessStat] => START" << std::endl; - bitNeighborhood nh(4); - bitNeighborhood nh2(0); - evalOneMax eval(4); + bitNeighborhood nh(4); + bitNeighborhood nh2(0); + evalOneMax eval(4); - moNeighborFitnessStat test(nh, eval); - moNeighborFitnessStat test2(nh2, eval); + moNeighborFitnessStat test(nh, eval); + moNeighborFitnessStat test2(nh2, eval); - bitVector sol(4, true); - sol.fitness(4); - test.init(sol); - assert(test.value()==3); - test(sol); - assert(test.value()==3); + bitVector sol(4, true); + sol.fitness(4); + test.init(sol); + assert(test.value()==3); + test(sol); + assert(test.value()==3); - test2.init(sol); - sol.fitness(3); - test2(sol); - assert(test2.value()==int()); + test2.init(sol); + sol.fitness(3); + test2(sol); + assert(test2.value()==int()); - assert(test.className()=="moNeighborFitnessStat"); + assert(test.className()=="moNeighborFitnessStat"); - std::cout << "[t-moNeighborFitnessStat] => OK" << std::endl; + std::cout << "[t-moNeighborFitnessStat] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moNeighborVectorTabuList.cpp b/trunk/paradiseo-mo/test/t-moNeighborVectorTabuList.cpp index 2b53ee190..097966002 100644 --- a/trunk/paradiseo-mo/test/t-moNeighborVectorTabuList.cpp +++ b/trunk/paradiseo-mo/test/t-moNeighborVectorTabuList.cpp @@ -34,11 +34,11 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -int main(){ +int main() { - std::cout << "[t-moNeighborVectorTabuList] => START" << std::endl; + std::cout << "[t-moNeighborVectorTabuList] => START" << std::endl; - //tabu list of size 2 (neighbor are always tabu) + //tabu list of size 2 (neighbor are always tabu) moNeighborVectorTabuList test(2,0); @@ -81,7 +81,7 @@ int main(){ assert(!test.check(sol, n3)); assert(!test.check(sol, n4)); - //tabu list of size 2 (neighbor are tabu during 2 iterations) + //tabu list of size 2 (neighbor are tabu during 2 iterations) moNeighborVectorTabuList test2(2,2); test2.add(sol, n1); @@ -97,8 +97,8 @@ int main(){ assert(!test2.check(sol, n1)); assert(!test2.check(sol, n2)); - std::cout << "[t-moNeighborVectorTabuList] => OK" << std::endl; + std::cout << "[t-moNeighborVectorTabuList] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moNeighborhoodPerturb.cpp b/trunk/paradiseo-mo/test/t-moNeighborhoodPerturb.cpp index fb85a1edb..70a0fb214 100644 --- a/trunk/paradiseo-mo/test/t-moNeighborhoodPerturb.cpp +++ b/trunk/paradiseo-mo/test/t-moNeighborhoodPerturb.cpp @@ -39,53 +39,53 @@ Contact: paradiseo-help@lists.gforge.inria.fr typedef moOrderNeighborhood Neighborhood; -int main(){ +int main() { - std::cout << "[t-moNeighborhoodPerturb] => START" << std::endl; + std::cout << "[t-moNeighborhoodPerturb] => START" << std::endl; - oneMaxEval eval; + oneMaxEval eval; - moFullEvalByCopy moeval(eval); + moFullEvalByCopy moeval(eval); - bitVector sol; - sol.resize(3); - sol[0]=0; - sol[1]=0; - sol[2]=0; + bitVector sol; + sol.resize(3); + sol[0]=0; + sol[1]=0; + sol[2]=0; - sol.fitness(0); + sol.fitness(0); - Neighborhood nh(3); + Neighborhood nh(3); - bitNeighbor n; + bitNeighbor n; - moNeighborhoodPerturb test(nh, moeval); + moNeighborhoodPerturb test(nh, moeval); - //test update - test.init(sol); - test(sol); - assert(sol[0]==1 && sol[1]==0 && sol[2]==0); - test.update(sol, n); - test(sol); - assert(sol[0]==1 && sol[1]==1 && sol[2]==0); - test.update(sol, n); - test(sol); - assert(sol[0]==1 && sol[1]==1 && sol[2]==1); - test.update(sol, n); - test(sol); - assert(sol[0]==0 && sol[1]==1 && sol[2]==1); + //test update + test.init(sol); + test(sol); + assert(sol[0]==1 && sol[1]==0 && sol[2]==0); + test.update(sol, n); + test(sol); + assert(sol[0]==1 && sol[1]==1 && sol[2]==0); + test.update(sol, n); + test(sol); + assert(sol[0]==1 && sol[1]==1 && sol[2]==1); + test.update(sol, n); + test(sol); + assert(sol[0]==0 && sol[1]==1 && sol[2]==1); - //test add + //test add - test.add(sol, n); - test(sol); - assert(sol[0]==1 && sol[1]==1 && sol[2]==1); + test.add(sol, n); + test(sol); + assert(sol[0]==1 && sol[1]==1 && sol[2]==1); - test.clearMemory(); + test.clearMemory(); - std::cout << "[t-moNeighborhoodPerturb] => OK" << std::endl; + std::cout << "[t-moNeighborhoodPerturb] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moNeutralDegreeSampling.cpp b/trunk/paradiseo-mo/test/t-moNeutralDegreeSampling.cpp index 3bf56deda..d48158e0d 100644 --- a/trunk/paradiseo-mo/test/t-moNeutralDegreeSampling.cpp +++ b/trunk/paradiseo-mo/test/t-moNeutralDegreeSampling.cpp @@ -38,27 +38,27 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include -int main(){ +int main() { - std::cout << "[t-moNeutralDegreeSampling] => START" << std::endl; + std::cout << "[t-moNeutralDegreeSampling] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); - dummyInit2 init(4); + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + dummyInit2 init(4); - moSolNeighborComparator sncomp; - moNeighborComparator ncomp; + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; - moNeutralDegreeSampling test1(init, nh, fullEval, eval, 3); - moNeutralDegreeSampling test2(init, nh, fullEval, eval, ncomp, sncomp, 3); + moNeutralDegreeSampling test1(init, nh, fullEval, eval, 3); + moNeutralDegreeSampling test2(init, nh, fullEval, eval, ncomp, sncomp, 3); - test1(); + test1(); - test1.fileExport("outputNeutralDegreeSampling"); + test1.fileExport("outputNeutralDegreeSampling"); - std::cout << "[t-moNeutralDegreeSampling] => OK" << std::endl; + std::cout << "[t-moNeutralDegreeSampling] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moNeutralHC.cpp b/trunk/paradiseo-mo/test/t-moNeutralHC.cpp index 1aa68253b..84b141d65 100644 --- a/trunk/paradiseo-mo/test/t-moNeutralHC.cpp +++ b/trunk/paradiseo-mo/test/t-moNeutralHC.cpp @@ -38,28 +38,28 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -int main(){ +int main() { - std::cout << "[t-moNeutralHC] => START" << std::endl; + std::cout << "[t-moNeutralHC] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); - moTrueContinuator cont; - moSolNeighborComparator sncomp; - moNeighborComparator ncomp; + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + moTrueContinuator cont; + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; - //test du 1er constructeur - moNeutralHC test1(nh, fullEval, eval, 3); + //test du 1er constructeur + moNeutralHC test1(nh, fullEval, eval, 3); - //test du 2eme constructeur - moNeutralHC test2(nh, fullEval, eval, 3, cont); + //test du 2eme constructeur + moNeutralHC test2(nh, fullEval, eval, 3, cont); - //test du 3eme constructeur - moNeutralHC test3(nh, fullEval, eval, 3, cont, ncomp, sncomp); + //test du 3eme constructeur + moNeutralHC test3(nh, fullEval, eval, 3, cont, ncomp, sncomp); - std::cout << "[t-moNeutralHC] => OK" << std::endl; + std::cout << "[t-moNeutralHC] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moNeutralWalkSampling.cpp b/trunk/paradiseo-mo/test/t-moNeutralWalkSampling.cpp index 14e92d69d..6faf66508 100644 --- a/trunk/paradiseo-mo/test/t-moNeutralWalkSampling.cpp +++ b/trunk/paradiseo-mo/test/t-moNeutralWalkSampling.cpp @@ -37,26 +37,26 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -int main(){ +int main() { - std::cout << "[t-moNeutralWalkSampling] => START" << std::endl; + std::cout << "[t-moNeutralWalkSampling] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); - dummyInit2 init(4); - bitVector sol(4, true); - sol.fitness(4); - eoHammingDistance dist; + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + dummyInit2 init(4); + bitVector sol(4, true); + sol.fitness(4); + eoHammingDistance dist; - moNeutralWalkSampling test(sol, nh, fullEval, eval, dist, 3); + moNeutralWalkSampling test(sol, nh, fullEval, eval, dist, 3); - test(); + test(); - test.fileExport("outputTestNeutralWalkSampling"); + test.fileExport("outputTestNeutralWalkSampling"); - std::cout << "[t-moNeutralWalkSampling] => OK" << std::endl; + std::cout << "[t-moNeutralWalkSampling] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moRandomBestHC.cpp b/trunk/paradiseo-mo/test/t-moRandomBestHC.cpp index 4e821f345..7f2201629 100644 --- a/trunk/paradiseo-mo/test/t-moRandomBestHC.cpp +++ b/trunk/paradiseo-mo/test/t-moRandomBestHC.cpp @@ -37,28 +37,28 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -int main(){ +int main() { - std::cout << "[t-moRandomBestHC] => START" << std::endl; + std::cout << "[t-moRandomBestHC] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); - //test first constructor - moRandomBestHC test1(nh, fullEval, eval); + //test first constructor + moRandomBestHC test1(nh, fullEval, eval); - //test second constructor - moTrueContinuator cont; - moRandomBestHC test2(nh, fullEval, eval, cont); + //test second constructor + moTrueContinuator cont; + moRandomBestHC test2(nh, fullEval, eval, cont); - //test third constructor - moSolNeighborComparator sncomp; - moNeighborComparator ncomp; - moRandomBestHC test3(nh, fullEval, eval, cont, ncomp, sncomp); + //test third constructor + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; + moRandomBestHC test3(nh, fullEval, eval, cont, ncomp, sncomp); - std::cout << "[t-moRandomBestHC] => OK" << std::endl; + std::cout << "[t-moRandomBestHC] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moRandomNeutralWalk.cpp b/trunk/paradiseo-mo/test/t-moRandomNeutralWalk.cpp index d93cea255..39eb158ee 100644 --- a/trunk/paradiseo-mo/test/t-moRandomNeutralWalk.cpp +++ b/trunk/paradiseo-mo/test/t-moRandomNeutralWalk.cpp @@ -37,27 +37,27 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -int main(){ +int main() { - std::cout << "[t-moRandomNeutralWalk] => START" << std::endl; + std::cout << "[t-moRandomNeutralWalk] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); - moTrueContinuator cont; - moSolNeighborComparator sncomp; + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + moTrueContinuator cont; + moSolNeighborComparator sncomp; - //test du 1er constructeur - moRandomNeutralWalk test1(nh, fullEval, eval, 3); + //test du 1er constructeur + moRandomNeutralWalk test1(nh, fullEval, eval, 3); - //test du 2eme constructeur - moRandomNeutralWalk test2(nh, fullEval, eval, 3, cont); + //test du 2eme constructeur + moRandomNeutralWalk test2(nh, fullEval, eval, 3, cont); - //test du 3eme constructeur - moRandomNeutralWalk test3(nh, fullEval, eval, 3, cont, sncomp); + //test du 3eme constructeur + moRandomNeutralWalk test3(nh, fullEval, eval, 3, cont, sncomp); - std::cout << "[t-moRandomNeutralWalk] => OK" << std::endl; + std::cout << "[t-moRandomNeutralWalk] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moRandomSearch.cpp b/trunk/paradiseo-mo/test/t-moRandomSearch.cpp index 3a196874c..135689891 100644 --- a/trunk/paradiseo-mo/test/t-moRandomSearch.cpp +++ b/trunk/paradiseo-mo/test/t-moRandomSearch.cpp @@ -36,22 +36,22 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -int main(){ +int main() { - std::cout << "[t-moRandomSearch] => START" << std::endl; + std::cout << "[t-moRandomSearch] => START" << std::endl; - oneMaxEval fullEval; - dummyInit init; - moTrueContinuator cont; - //test du 1er constructor - moRandomSearch test1(init, fullEval, 3); - //test du 2e constructor - moRandomSearch test2(init, fullEval, 3, cont); + oneMaxEval fullEval; + dummyInit init; + moTrueContinuator cont; + //test du 1er constructor + moRandomSearch test1(init, fullEval, 3); + //test du 2e constructor + moRandomSearch test2(init, fullEval, 3, cont); - assert(test1.className()=="moRandomSearch"); + assert(test1.className()=="moRandomSearch"); - std::cout << "[t-moRandomSearch] => OK" << std::endl; + std::cout << "[t-moRandomSearch] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moRandomSearchExplorer.cpp b/trunk/paradiseo-mo/test/t-moRandomSearchExplorer.cpp index dd65bcfdd..7dfbf19ce 100644 --- a/trunk/paradiseo-mo/test/t-moRandomSearchExplorer.cpp +++ b/trunk/paradiseo-mo/test/t-moRandomSearchExplorer.cpp @@ -35,31 +35,31 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include "moTestClass.h" #include -int main(){ +int main() { - std::cout << "[t-moRandomSearchExplorer] => START" << std::endl; + std::cout << "[t-moRandomSearchExplorer] => START" << std::endl; - dummyInit init; - oneMaxEval eval; - bitVector sol(4, true); + dummyInit init; + oneMaxEval eval; + bitVector sol(4, true); - moRandomSearchExplorer test(init, eval, 2); + moRandomSearchExplorer test(init, eval, 2); - test.initParam(sol); - test(sol); - assert(sol.fitness()==4); - test.updateParam(sol); - assert(test.isContinue(sol)); - test.updateParam(sol); - assert(!test.isContinue(sol)); - test.initParam(sol); - assert(test.isContinue(sol)); - test.terminate(sol); - assert(test.accept(sol)); - test.move(sol); + test.initParam(sol); + test(sol); + assert(sol.fitness()==4); + test.updateParam(sol); + assert(test.isContinue(sol)); + test.updateParam(sol); + assert(!test.isContinue(sol)); + test.initParam(sol); + assert(test.isContinue(sol)); + test.terminate(sol); + assert(test.accept(sol)); + test.move(sol); - std::cout << "[t-moRandomSearchExplorer] => OK" << std::endl; + std::cout << "[t-moRandomSearchExplorer] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moRandomWalk.cpp b/trunk/paradiseo-mo/test/t-moRandomWalk.cpp index d2a58f47d..fcd71035b 100644 --- a/trunk/paradiseo-mo/test/t-moRandomWalk.cpp +++ b/trunk/paradiseo-mo/test/t-moRandomWalk.cpp @@ -38,26 +38,26 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -int main(){ +int main() { - std::cout << "[t-moRandomWalk] => START" << std::endl; + std::cout << "[t-moRandomWalk] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); - moTrueContinuator cont; - moSolNeighborComparator sncomp; - moNeighborComparator ncomp; + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + moTrueContinuator cont; + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; - //test du 1er constructeur - moRandomWalk test1(nh, fullEval, eval, 3); + //test du 1er constructeur + moRandomWalk test1(nh, fullEval, eval, 3); - //test du 2eme constructeur - moRandomWalk test2(nh, fullEval, eval, 3, cont); + //test du 2eme constructeur + moRandomWalk test2(nh, fullEval, eval, 3, cont); - std::cout << "[t-moRandomWalk] => OK" << std::endl; + std::cout << "[t-moRandomWalk] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moRestartPerturb.cpp b/trunk/paradiseo-mo/test/t-moRestartPerturb.cpp index a3a77c4b5..f301ceefb 100644 --- a/trunk/paradiseo-mo/test/t-moRestartPerturb.cpp +++ b/trunk/paradiseo-mo/test/t-moRestartPerturb.cpp @@ -43,75 +43,75 @@ typedef eoInt QUEEN; class dummyInit : public eoInit { public: - dummyInit(unsigned int _size):size(_size){} + dummyInit(unsigned int _size):size(_size) {} - void operator()(QUEEN& _sol){ - _sol.resize(0); - for(unsigned int i=0; i START" << std::endl; + std::cout << "[t-moRestartPerturb] => START" << std::endl; - QUEEN queen; - moShiftNeighbor n; + QUEEN queen; + moShiftNeighbor n; - dummyInit initializer(4); + dummyInit initializer(4); - queenEval eval; + queenEval eval; - moRestartPerturb > test(initializer, eval, 3); + moRestartPerturb > test(initializer, eval, 3); - queen.resize(4); - queen[0]=1; - queen[1]=2; - queen[2]=0; - queen[3]=3; + queen.resize(4); + queen[0]=1; + queen[1]=2; + queen[2]=0; + queen[3]=3; - test.init(queen); + test.init(queen); - test(queen); - assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); - test.update(queen,n); //first noMove - test(queen); - assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); - test.update(queen,n); //second noMove - test(queen); - assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); - test.update(queen,n); //third noMove - test(queen);//here the perturb should be called - assert(queen[0]==0 && queen[1]==1 && queen[2]==2 && queen[3]==3); + test(queen); + assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); + test.update(queen,n); //first noMove + test(queen); + assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); + test.update(queen,n); //second noMove + test(queen); + assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); + test.update(queen,n); //third noMove + test(queen);//here the perturb should be called + assert(queen[0]==0 && queen[1]==1 && queen[2]==2 && queen[3]==3); - queen[0]=1; - queen[1]=2; - queen[2]=0; - queen[3]=3; + queen[0]=1; + queen[1]=2; + queen[2]=0; + queen[3]=3; - //Retry the same test to verify counter is been reinit to 0 + //Retry the same test to verify counter is been reinit to 0 - test(queen); - assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); - test.update(queen,n); //first noMove - test(queen); - assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); - test.update(queen,n); //second noMove - test(queen); - assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); - test.update(queen,n); //third noMove - test(queen); //here the perturb should be called - assert(queen[0]==0 && queen[1]==1 && queen[2]==2 && queen[3]==3); + test(queen); + assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); + test.update(queen,n); //first noMove + test(queen); + assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); + test.update(queen,n); //second noMove + test(queen); + assert(queen[0]==1 && queen[1]==2 && queen[2]==0 && queen[3]==3); + test.update(queen,n); //third noMove + test(queen); //here the perturb should be called + assert(queen[0]==0 && queen[1]==1 && queen[2]==2 && queen[3]==3); - std::cout << "[t-moRestartPerturb] => OK" << std::endl; + std::cout << "[t-moRestartPerturb] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moSA.cpp b/trunk/paradiseo-mo/test/t-moSA.cpp index f4ddbe2e9..b1cdfeb67 100644 --- a/trunk/paradiseo-mo/test/t-moSA.cpp +++ b/trunk/paradiseo-mo/test/t-moSA.cpp @@ -38,28 +38,28 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -int main(){ +int main() { - std::cout << "[t-moSA] => START" << std::endl; + std::cout << "[t-moSA] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); - //test first constructor - moSA test1(nh, fullEval, eval); + //test first constructor + moSA test1(nh, fullEval, eval); - //test second constructor - moSimpleCoolingSchedule cool(10, 0.9, 100, 0.01); - moSA test2(nh, fullEval, eval, cool); + //test second constructor + moSimpleCoolingSchedule cool(10, 0.9, 100, 0.01); + moSA test2(nh, fullEval, eval, cool); - //test third constructor - moTrueContinuator cont; - moSolNeighborComparator comp; - moSA test3(nh, fullEval, eval, cool, comp, cont); + //test third constructor + moTrueContinuator cont; + moSolNeighborComparator comp; + moSA test3(nh, fullEval, eval, cool, comp, cont); - std::cout << "[t-moSA] => OK" << std::endl; + std::cout << "[t-moSA] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moSAexplorer.cpp b/trunk/paradiseo-mo/test/t-moSAexplorer.cpp index 793f4ff9d..4c619ff88 100644 --- a/trunk/paradiseo-mo/test/t-moSAexplorer.cpp +++ b/trunk/paradiseo-mo/test/t-moSAexplorer.cpp @@ -35,9 +35,9 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -int main(){ +int main() { - std::cout << "[t-moSAexplorer] => START" << std::endl; + std::cout << "[t-moSAexplorer] => START" << std::endl; eoBit sol(4, true); sol.fitness(4); @@ -66,22 +66,22 @@ int main(){ assert(sol.fitness()==3); unsigned int ok=0; unsigned int ko=0; - for(unsigned int i=0; i<1000; i++){ - test2(sol); - if(test2.isContinue(sol)) - test2.updateParam(sol); - if(test2.accept(sol)) - ok++; - else - ko++; + for (unsigned int i=0; i<1000; i++) { + test2(sol); + if (test2.isContinue(sol)) + test2.updateParam(sol); + if (test2.accept(sol)) + ok++; + else + ko++; test2.move(sol); } assert((ok>0) && (ko>0)); - std::cout << "[t-moSAexplorer] => OK" << std::endl; + std::cout << "[t-moSAexplorer] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moSampling.cpp b/trunk/paradiseo-mo/test/t-moSampling.cpp index 334e82701..3864be764 100644 --- a/trunk/paradiseo-mo/test/t-moSampling.cpp +++ b/trunk/paradiseo-mo/test/t-moSampling.cpp @@ -39,43 +39,43 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -int main(){ +int main() { - std::cout << "[t-moSampling] => START" << std::endl; + std::cout << "[t-moSampling] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); - dummyInit2 init(4); - moIterContinuator cont(3); + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); + dummyInit2 init(4); + moIterContinuator cont(3); - moFirstImprHC hc(nh, fullEval, eval, cont); - moSolutionStat stat1; - moCounterStat stat2; - moSampling test(init, hc, stat1); + moFirstImprHC hc(nh, fullEval, eval, cont); + moSolutionStat stat1; + moCounterStat stat2; + moSampling test(init, hc, stat1); - test.add(stat2); + test.add(stat2); - test(); + test(); - std::vector res; - std::vector res2; - res = test.getValues(1); - res2= test.getSolutions(0); + std::vector res; + std::vector res2; + res = test.getValues(1); + res2= test.getSolutions(0); - for(unsigned int i=0; i OK" << std::endl; + std::cout << "[t-moSampling] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moSimpleCoolingSchedule.cpp b/trunk/paradiseo-mo/test/t-moSimpleCoolingSchedule.cpp index 03eb8d7a3..fb5d3f4ff 100644 --- a/trunk/paradiseo-mo/test/t-moSimpleCoolingSchedule.cpp +++ b/trunk/paradiseo-mo/test/t-moSimpleCoolingSchedule.cpp @@ -34,55 +34,55 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moSimpleCoolingSchedule] => START" << std::endl; + std::cout << "[t-moSimpleCoolingSchedule] => START" << std::endl; - double temperature; + double temperature; - bitVector sol; + bitVector sol; - moSimpleCoolingSchedule test(100, 0.1, 2, 0.1); + moSimpleCoolingSchedule test(100, 0.1, 2, 0.1); - temperature=test.init(sol); - assert(temperature==100); + temperature=test.init(sol); + assert(temperature==100); - //temperature must not changed 2* - test.update(temperature); - assert(temperature==100); - assert(test(temperature)); - test.update(temperature); - assert(temperature==100); - assert(test(temperature)); + //temperature must not changed 2* + test.update(temperature); + assert(temperature==100); + assert(test(temperature)); + test.update(temperature); + assert(temperature==100); + assert(test(temperature)); - //then temperature must be /10 - test.update(temperature); - assert(temperature==10); - assert(test(temperature)); - test.update(temperature); - assert(temperature==10); - assert(test(temperature)); - test.update(temperature); - assert(temperature==10); - assert(test(temperature)); + //then temperature must be /10 + test.update(temperature); + assert(temperature==10); + assert(test(temperature)); + test.update(temperature); + assert(temperature==10); + assert(test(temperature)); + test.update(temperature); + assert(temperature==10); + assert(test(temperature)); - test.update(temperature); - assert(temperature==1); - assert(test(temperature)); - test.update(temperature); - assert(temperature==1); - assert(test(temperature)); - test.update(temperature); - assert(temperature==1); - assert(test(temperature)); + test.update(temperature); + assert(temperature==1); + assert(test(temperature)); + test.update(temperature); + assert(temperature==1); + assert(test(temperature)); + test.update(temperature); + assert(temperature==1); + assert(test(temperature)); - test.update(temperature); - assert(temperature==0.1); - assert(!test(temperature)); + test.update(temperature); + assert(temperature==0.1); + assert(!test(temperature)); - std::cout << "[t-moSimpleCoolingSchedule] => OK" << std::endl; + std::cout << "[t-moSimpleCoolingSchedule] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moSimpleHC.cpp b/trunk/paradiseo-mo/test/t-moSimpleHC.cpp index aab4a2013..973e374a4 100644 --- a/trunk/paradiseo-mo/test/t-moSimpleHC.cpp +++ b/trunk/paradiseo-mo/test/t-moSimpleHC.cpp @@ -38,28 +38,28 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include -int main(){ +int main() { - std::cout << "[t-moSimpleHC] => START" << std::endl; + std::cout << "[t-moSimpleHC] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); - //test first constructor - moSimpleHC test1(nh, fullEval, eval); + //test first constructor + moSimpleHC test1(nh, fullEval, eval); - //test second constructor - moTrueContinuator cont; - moSimpleHC test2(nh, fullEval, eval, cont); + //test second constructor + moTrueContinuator cont; + moSimpleHC test2(nh, fullEval, eval, cont); - //test third constructor - moSolNeighborComparator sncomp; - moNeighborComparator ncomp; - moSimpleHC test3(nh, fullEval, eval, cont, ncomp, sncomp); + //test third constructor + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; + moSimpleHC test3(nh, fullEval, eval, cont, ncomp, sncomp); - std::cout << "[t-moSimpleHC] => OK" << std::endl; + std::cout << "[t-moSimpleHC] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moSolComparator.cpp b/trunk/paradiseo-mo/test/t-moSolComparator.cpp index b24abb426..086f6be13 100644 --- a/trunk/paradiseo-mo/test/t-moSolComparator.cpp +++ b/trunk/paradiseo-mo/test/t-moSolComparator.cpp @@ -35,9 +35,9 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -int main(){ +int main() { - std::cout << "[t-moSolComparator] => START" << std::endl; + std::cout << "[t-moSolComparator] => START" << std::endl; eoBit sol1, sol2, sol3; @@ -54,8 +54,8 @@ int main(){ assert(test.className()=="moSolComparator"); - std::cout << "[t-moSolComparator] => OK" << std::endl; + std::cout << "[t-moSolComparator] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moSolInit.cpp b/trunk/paradiseo-mo/test/t-moSolInit.cpp index e1770738c..ce8ef3cb7 100644 --- a/trunk/paradiseo-mo/test/t-moSolInit.cpp +++ b/trunk/paradiseo-mo/test/t-moSolInit.cpp @@ -33,24 +33,24 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include -int main(){ +int main() { - std::cout << "[t-moSolInit] => START" << std::endl; + std::cout << "[t-moSolInit] => START" << std::endl; - int a=3; + int a=3; - int b=5; + int b=5; - moSolInit test(a); + moSolInit test(a); - test(b); - assert(b==3); - a=4; - test(b); - assert(b==4); + test(b); + assert(b==3); + a=4; + test(b); + assert(b==4); - std::cout << "[t-moSolInit] => OK" << std::endl; + std::cout << "[t-moSolInit] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moStatistics.cpp b/trunk/paradiseo-mo/test/t-moStatistics.cpp index 6459f4326..c59034e06 100644 --- a/trunk/paradiseo-mo/test/t-moStatistics.cpp +++ b/trunk/paradiseo-mo/test/t-moStatistics.cpp @@ -35,77 +35,77 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include "moTestClass.h" #include -int main(){ +int main() { - std::cout << "[t-moStatistics] => START" << std::endl; + std::cout << "[t-moStatistics] => START" << std::endl; - moStatistics test; + moStatistics test; - double min; - double max; - double avg; - double std; + double min; + double max; + double avg; + double std; - //test des stats basic - std::vector sampling; - sampling.push_back(3); - sampling.push_back(5); - sampling.push_back(2); - sampling.push_back(4); + //test des stats basic + std::vector sampling; + sampling.push_back(3); + sampling.push_back(5); + sampling.push_back(2); + sampling.push_back(4); - test.basic(sampling, min, max, avg, std); - assert(min==2); - assert(max==5); - assert(avg==3.5); - assert(std==sqrt(1.25)); + test.basic(sampling, min, max, avg, std); + assert(min==2); + assert(max==5); + assert(avg==3.5); + assert(std==sqrt(1.25)); - sampling.resize(0); - test.basic(sampling, min, max, avg, std); - assert(min==0); - assert(max==0); - assert(avg==0); - assert(std==0); + sampling.resize(0); + test.basic(sampling, min, max, avg, std); + assert(min==0); + assert(max==0); + assert(avg==0); + assert(std==0); - //test de la distance - std::vector data; - eoHammingDistance dist; - bitVector tmp(4,true); - data.push_back(tmp); - tmp[0]=false; - data.push_back(tmp); - tmp[2]=false; - data.push_back(tmp); + //test de la distance + std::vector data; + eoHammingDistance dist; + bitVector tmp(4,true); + data.push_back(tmp); + tmp[0]=false; + data.push_back(tmp); + tmp[2]=false; + data.push_back(tmp); - std::vector< std::vector > matrix; + std::vector< std::vector > matrix; - test.distances(data, dist, matrix); + test.distances(data, dist, matrix); - assert(matrix[0][0]==0.0); - assert(matrix[0][1]==1.0); - assert(matrix[0][2]==2.0); + assert(matrix[0][0]==0.0); + assert(matrix[0][1]==1.0); + assert(matrix[0][2]==2.0); - assert(matrix[1][0]==1.0); - assert(matrix[1][1]==0.0); - assert(matrix[1][2]==1.0); + assert(matrix[1][0]==1.0); + assert(matrix[1][1]==0.0); + assert(matrix[1][2]==1.0); - assert(matrix[2][0]==2.0); - assert(matrix[2][1]==1.0); - assert(matrix[2][2]==0.0); + assert(matrix[2][0]==2.0); + assert(matrix[2][1]==1.0); + assert(matrix[2][2]==0.0); - //test de l'autocorrelation - std::vector rho, phi; - test.autocorrelation(sampling, 2, rho, phi); + //test de l'autocorrelation + std::vector rho, phi; + test.autocorrelation(sampling, 2, rho, phi); - sampling.push_back(3); - sampling.push_back(5); - sampling.push_back(2); - sampling.push_back(4); + sampling.push_back(3); + sampling.push_back(5); + sampling.push_back(2); + sampling.push_back(4); - test.autocorrelation(sampling, 2, rho, phi); + test.autocorrelation(sampling, 2, rho, phi); - std::cout << "[t-moStatistics] => OK" << std::endl; + std::cout << "[t-moStatistics] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moTS.cpp b/trunk/paradiseo-mo/test/t-moTS.cpp index a91827942..b27d0d390 100644 --- a/trunk/paradiseo-mo/test/t-moTS.cpp +++ b/trunk/paradiseo-mo/test/t-moTS.cpp @@ -39,34 +39,34 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include -int main(){ +int main() { - std::cout << "[t-moTS] => START" << std::endl; + std::cout << "[t-moTS] => START" << std::endl; - bitNeighborhood nh(4); - oneMaxEval fullEval; - evalOneMax eval(4); + bitNeighborhood nh(4); + oneMaxEval fullEval; + evalOneMax eval(4); - //test first constructor - moTS test1(nh, fullEval, eval, 1, 7); + //test first constructor + moTS test1(nh, fullEval, eval, 1, 7); - //test second constructor - moSolVectorTabuList tl(7,0); - moTS test2(nh, fullEval, eval, 1, tl); + //test second constructor + moSolVectorTabuList tl(7,0); + moTS test2(nh, fullEval, eval, 1, tl); - //test third constructor - moTrueContinuator cont; - moSolNeighborComparator sncomp; - moNeighborComparator ncomp; - moDummyIntensification intens; - moDummyDiversification div; - moBestImprAspiration aspir; + //test third constructor + moTrueContinuator cont; + moSolNeighborComparator sncomp; + moNeighborComparator ncomp; + moDummyIntensification intens; + moDummyDiversification div; + moBestImprAspiration aspir; - moTS test3(nh, fullEval, eval, ncomp, sncomp, cont, tl, intens, div, aspir); + moTS test3(nh, fullEval, eval, ncomp, sncomp, cont, tl, intens, div, aspir); - std::cout << "[t-moTS] => OK" << std::endl; + std::cout << "[t-moTS] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moTimeContinuator.cpp b/trunk/paradiseo-mo/test/t-moTimeContinuator.cpp index 0b7ea2254..ccd47e1f9 100644 --- a/trunk/paradiseo-mo/test/t-moTimeContinuator.cpp +++ b/trunk/paradiseo-mo/test/t-moTimeContinuator.cpp @@ -37,15 +37,15 @@ Contact: paradiseo-help@lists.gforge.inria.fr void wait ( int seconds ) { - clock_t endwait; - endwait = clock () + seconds * CLOCKS_PER_SEC ; - while (clock() < endwait) {} + clock_t endwait; + endwait = clock () + seconds * CLOCKS_PER_SEC ; + while (clock() < endwait) {} } -int main(){ +int main() { - std::cout << "[t-moTimeContinuator] => START" << std::endl; + std::cout << "[t-moTimeContinuator] => START" << std::endl; moTimeContinuator test(2, false); moTimeContinuator test2(3); @@ -64,8 +64,8 @@ int main(){ assert(test.className()=="moTimeContinuator"); - std::cout << "[t-moTimeContinuator] => OK" << std::endl; + std::cout << "[t-moTimeContinuator] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/test/t-moVectorMonitor.cpp b/trunk/paradiseo-mo/test/t-moVectorMonitor.cpp index e0fe6d656..53edcd310 100644 --- a/trunk/paradiseo-mo/test/t-moVectorMonitor.cpp +++ b/trunk/paradiseo-mo/test/t-moVectorMonitor.cpp @@ -34,79 +34,79 @@ Contact: paradiseo-help@lists.gforge.inria.fr #include #include "moTestClass.h" -int main(){ +int main() { - std::cout << "[t-moVectorMonitor] => START" << std::endl; + std::cout << "[t-moVectorMonitor] => START" << std::endl; - eoValueParam doubleParam; - eoValueParam intParam; - eoValueParam eotParam; - eoValueParam stringParam; - doubleParam.value()= 3.1; - intParam.value()=6; - bitVector sol(4,true); - sol.fitness(0); - eotParam.value()=sol; + eoValueParam doubleParam; + eoValueParam intParam; + eoValueParam eotParam; + eoValueParam stringParam; + doubleParam.value()= 3.1; + intParam.value()=6; + bitVector sol(4,true); + sol.fitness(0); + eotParam.value()=sol; - moVectorMonitor test1(doubleParam); - moVectorMonitor test2(intParam); - moVectorMonitor test3(eotParam); - moVectorMonitor test4(stringParam); + moVectorMonitor test1(doubleParam); + moVectorMonitor test2(intParam); + moVectorMonitor test3(eotParam); + moVectorMonitor test4(stringParam); - assert(!test1.solutionType()); - assert(!test2.solutionType()); - assert(test3.solutionType()); + assert(!test1.solutionType()); + assert(!test2.solutionType()); + assert(test3.solutionType()); - test1(); - test2(); - test3(); - doubleParam.value()= 3.3; - intParam.value()=7; - sol.fitness(1); - eotParam.value()=sol; - test1(); - test2(); - test3(); - doubleParam.value()= 3.6; - intParam.value()=8; - sol.fitness(2); - eotParam.value()=sol; - test1(); - test2(); - test3(); - doubleParam.value()= 3.001; - intParam.value()=9; - test1(); - test2(); + test1(); + test2(); + test3(); + doubleParam.value()= 3.3; + intParam.value()=7; + sol.fitness(1); + eotParam.value()=sol; + test1(); + test2(); + test3(); + doubleParam.value()= 3.6; + intParam.value()=8; + sol.fitness(2); + eotParam.value()=sol; + test1(); + test2(); + test3(); + doubleParam.value()= 3.001; + intParam.value()=9; + test1(); + test2(); - assert(test1.size()==4); - assert(test2.size()==4); - assert(test3.size()==3); - assert(test1.getValue(1)=="3.3"); - assert(test2.getValue(2)=="8"); - std::cout << test3.getValue(2) << std::endl; - assert(test1.getValues()[0]==3.1); - assert(test2.getValues()[2]==8); - assert(test3.getSolutions()[0].fitness()==0); + assert(test1.size()==4); + assert(test2.size()==4); + assert(test3.size()==3); + assert(test1.getValue(1)=="3.3"); + assert(test2.getValue(2)=="8"); + std::cout << test3.getValue(2) << std::endl; + assert(test1.getValues()[0]==3.1); + assert(test2.getValues()[2]==8); + assert(test3.getSolutions()[0].fitness()==0); - test1.fileExport("outputTestVectorMonitor.txt"); + test1.fileExport("outputTestVectorMonitor.txt"); - test1.clear(); - test2.clear(); - test3.clear(); - assert(test1.size()==0); - assert(test2.size()==0); - assert(test3.size()==0); + test1.clear(); + test2.clear(); + test3.clear(); + assert(test1.size()==0); + assert(test2.size()==0); + assert(test3.size()==0); - assert(test1.className()=="moVectorMonitor"); + assert(test1.className()=="moVectorMonitor"); - std::cout << "[t-moVectorMonitor] => OK" << std::endl; + std::cout << "[t-moVectorMonitor] => OK" << std::endl; - return EXIT_SUCCESS; + return EXIT_SUCCESS; } diff --git a/trunk/paradiseo-mo/tutorial/Lesson6/testRandomNeutralWalk.cpp b/trunk/paradiseo-mo/tutorial/Lesson6/testRandomNeutralWalk.cpp index 6c4aac11f..596501f5e 100644 --- a/trunk/paradiseo-mo/tutorial/Lesson6/testRandomNeutralWalk.cpp +++ b/trunk/paradiseo-mo/tutorial/Lesson6/testRandomNeutralWalk.cpp @@ -23,7 +23,7 @@ using namespace std; //----------------------------------------------------------------------------- // fitness function -#include "../oneMax/src/funcRoyalRoad.h" +#include #include #include #include @@ -120,7 +120,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - FuncRoyalRoad eval(vecSize / blockSize, blockSize); + RoyalRoadEval eval(blockSize); /* ========================================================= diff --git a/trunk/paradiseo-mo/tutorial/oneMax/CMakeLists.txt b/trunk/paradiseo-mo/tutorial/oneMax/CMakeLists.txt deleted file mode 100644 index 8bf58768d..000000000 --- a/trunk/paradiseo-mo/tutorial/oneMax/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -ADD_SUBDIRECTORY(application) \ No newline at end of file diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/CMakeLists.txt b/trunk/paradiseo-mo/tutorial/oneMax/application/CMakeLists.txt deleted file mode 100644 index 9a8125924..000000000 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src - ${MO_SRC_DIR}/src - ${CMAKE_CURRENT_SOURCE_DIR}/../src) - -LINK_DIRECTORIES(${EO_BIN_DIR}/lib) - -ADD_EXECUTABLE(testSimpleHC testSimpleHC.cpp) -ADD_EXECUTABLE(testFirstImpr testFirstImpr.cpp) -ADD_EXECUTABLE(testRandomWalk testRandomWalk.cpp) -ADD_EXECUTABLE(testRandomBestHC testRandomBestHC.cpp) -ADD_EXECUTABLE(testHCneutral testHCneutral.cpp) -ADD_EXECUTABLE(testMetropolisHasting testMetropolisHasting.cpp) -#ADD_EXECUTABLE(testWithMove testWithMove.cpp) -ADD_EXECUTABLE(testSimpleTS testSimpleTS.cpp) -ADD_EXECUTABLE(testRandomNeutralWalk testRandomNeutralWalk.cpp) -ADD_EXECUTABLE(testILS testILS.cpp) -ADD_EXECUTABLE(testSimulatedAnnealing testSimulatedAnnealing.cpp) - -TARGET_LINK_LIBRARIES(testSimpleHC eoutils ga eo) -TARGET_LINK_LIBRARIES(testFirstImpr eoutils ga eo) -TARGET_LINK_LIBRARIES(testRandomWalk eoutils ga eo) -TARGET_LINK_LIBRARIES(testRandomBestHC eoutils ga eo) -TARGET_LINK_LIBRARIES(testHCneutral eoutils ga eo) -TARGET_LINK_LIBRARIES(testMetropolisHasting eoutils ga eo) -#TARGET_LINK_LIBRARIES(testWithMove eoutils ga eo) -TARGET_LINK_LIBRARIES(testSimpleTS eoutils ga eo) -TARGET_LINK_LIBRARIES(testRandomNeutralWalk eoutils ga eo) -TARGET_LINK_LIBRARIES(testILS eoutils ga eo) -TARGET_LINK_LIBRARIES(testSimulatedAnnealing eoutils ga eo) - - diff --git a/trunk/paradiseo-mo/tutorial/oneMax/application/testWithMove.cpp b/trunk/paradiseo-mo/tutorial/oneMax/application/testWithMove.cpp deleted file mode 100644 index 9259d7b81..000000000 --- a/trunk/paradiseo-mo/tutorial/oneMax/application/testWithMove.cpp +++ /dev/null @@ -1,214 +0,0 @@ -//----------------------------------------------------------------------------- -/** testSimpleHC.cpp - * - * SV - 12/01/10 - * - */ -//----------------------------------------------------------------------------- - -// standard includes -#define HAVE_SSTREAM - -#include // runtime_error -#include // cout -#include // ostrstream, istrstream -#include -#include - -// the general include for eo -#include -#include "ga.h" - -using namespace std; - -//----------------------------------------------------------------------------- -// fitness function -#include - -//#include -//#include - -#include - -// local search algorithm -#include - -// the simple HC explorer -#include - -// explore the neighborhood of a bit string in order -#include - -//#include - -#include - -#include -#include -#include -#include - -// REPRESENTATION -//----------------------------------------------------------------------------- -// define your individuals -typedef eoBit Indi; -//typedef OneMaxBitNeighbor Neighbor ; // incremental evaluation -typedef moMoveNeighbor, unsigned> Neighbor ; // full evaluation -typedef moMoveNeighborhood, unsigned> Neighborhood ; - -// GENERAL -//----------------------------------------------------------------------------- - -void main_function(int argc, char **argv) -{ - /* ========================================================= - * - * Parameters - * - * ========================================================= */ - - // First define a parser from the command-line arguments - eoParser parser(argc, argv); - - // For each parameter, define Parameter, read it through the parser, - // and assign the value to the variable - - eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); - parser.processParam( seedParam ); - unsigned seed = seedParam.value(); - - // description of genotype - eoValueParam vecSizeParam(8, "vecSize", "Genotype size", 'V'); - parser.processParam( vecSizeParam, "Representation" ); - unsigned vecSize = vecSizeParam.value(); - - string fileOut("out.dat"); - eoValueParam fileStatParam(fileOut.c_str(), "out", "A file to export results", 'o'); - parser.processParam( fileStatParam, "Persistence" ); - fileOut = fileStatParam.value(); - - // the name of the "status" file where all actual parameter values will be saved - string str_status = parser.ProgramName() + ".status"; // default value - eoValueParam statusParam(str_status.c_str(), "status", "Status file"); - parser.processParam( statusParam, "Persistence" ); - - // do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED - // i.e. in case you need parameters somewhere else, postpone these - if (parser.userNeedsHelp()) - { - parser.printHelp(cout); - exit(1); - } - if (statusParam.value() != "") - { - ofstream os(statusParam.value().c_str()); - os << parser; // and you can use that file as parameter file - } - - - /* ========================================================= - * - * Random seed - * - * ========================================================= */ - - //reproducible random seed: if you don't change SEED above, - // you'll aways get the same result, NOT a random run - rng.reseed(seed); - - - /* ========================================================= - * - * Eval fitness function - * - * ========================================================= */ - - FuncOneMax eval(vecSize); - - OneMaxIncrEval incrEval; - Neighbor::setIncrEval(incrEval); - - /* ========================================================= - * - * Initilisation of the solution - * - * ========================================================= */ - - // a Indi random initializer - eoUniformGenerator uGen; - eoInitFixedLength random(vecSize, uGen); - - /* ========================================================= - * - * evaluation of a neighbor solution - * - * ========================================================= */ - - // no need if incremental evaluation with OneMaxBitNeighbor - // Neighbor::setFullEvalFunc(eval); - - /* ========================================================= - * - * the neighborhood of a solution - * - * ========================================================= */ - BitMove_init init; - BitMove_next next; - - - Neighborhood neighborhood(init, next); - - /* ========================================================= - * - * a neighborhood explorator solution - * - * ========================================================= */ - - moSimpleHCexplorer explorer(neighborhood); - - /* ========================================================= - * - * the local search algorithm - * - * ========================================================= */ - - moTrueContinuator continuator; - - moLocalSearch< moSimpleHCexplorer > localSearch(explorer, continuator); - - /* ========================================================= - * - * execute the local search from random sollution - * - * ========================================================= */ - - Indi solution; - - random(solution); - - eval(solution); - - std::cout << "initial: " << solution << std::endl ; - - localSearch(solution); - - std::cout << "final: " << solution << std::endl ; - -} - -// A main that catches the exceptions - -int main(int argc, char **argv) -{ - - try - { - main_function(argc, argv); - } - catch (exception& e) - { - cout << "Exception: " << e.what() << '\n'; - } - - return 1; -} diff --git a/trunk/paradiseo-mo/tutorial/oneMax/src/bitMove.h b/trunk/paradiseo-mo/tutorial/oneMax/src/bitMove.h deleted file mode 100644 index 0a5b2638b..000000000 --- a/trunk/paradiseo-mo/tutorial/oneMax/src/bitMove.h +++ /dev/null @@ -1,34 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "bitMove.h" - -#ifndef __bitMove -#define __bitMove - -#include -#include - -template -class BitMove : public moMove { - -public : - - typedef EOT EOType; - - unsigned bit; - - BitMove() { - bit = 0; - } - - BitMove(unsigned _bit) : bit(_bit) { } - - - void operator () (EOT & chrom) - { - chrom[bit] = !chrom[bit]; - }; - -} ; - -#endif diff --git a/trunk/paradiseo-mo/tutorial/oneMax/src/bitMoveIncrEval.h b/trunk/paradiseo-mo/tutorial/oneMax/src/bitMoveIncrEval.h deleted file mode 100644 index 1aa460a4c..000000000 --- a/trunk/paradiseo-mo/tutorial/oneMax/src/bitMoveIncrEval.h +++ /dev/null @@ -1,27 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "incrEval_funcNK.h" - -#ifndef __incr_eval_funcNK_h -#define __incr_eval_funcNK_h - -#include -#include "bitMove.h" - -template -class OneMaxIncrEval : public moMoveIncrEval < BitMove > { - -public : - OneMaxIncrEval() { }; - - typename EOT::Fitness operator () (const BitMove & move, const EOT & chrom) { - if (chrom[move.bit]==0) { - return chrom.fitness()+1; - } - else { - return chrom.fitness()-1; - } - }; -}; - -#endif diff --git a/trunk/paradiseo-mo/tutorial/oneMax/src/bitMove_init.h b/trunk/paradiseo-mo/tutorial/oneMax/src/bitMove_init.h deleted file mode 100644 index 4fca0995a..000000000 --- a/trunk/paradiseo-mo/tutorial/oneMax/src/bitMove_init.h +++ /dev/null @@ -1,21 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "bitMove_init.h" -#ifndef __bitMove_init -#define __bitMove_init - -#include -#include "bitMove.h" - -template -class BitMove_init : public moMoveInit < BitMove > { - -public : - - void operator () (BitMove & __move, const EOT & genome) { - __move.bit = 0 ; - }; - -} ; - -#endif diff --git a/trunk/paradiseo-mo/tutorial/oneMax/src/bitMove_next.h b/trunk/paradiseo-mo/tutorial/oneMax/src/bitMove_next.h deleted file mode 100644 index 28017e65a..000000000 --- a/trunk/paradiseo-mo/tutorial/oneMax/src/bitMove_next.h +++ /dev/null @@ -1,33 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -// "bitMove_next.h" - -#ifndef __bitMove_next_h -#define __bitMove_next_h - -#include -#include "bitMove.h" - -template -class BitMove_next : public moNextMove < BitMove > { - -public: - BitMove_next() - { - }; - - bool operator () (BitMove & __move, const EOT & genome) { - - if (__move.bit >= (genome.size() - 1)) { - return false ; - } - else { - __move.bit++; - return true ; - } - }; - - -} ; - -#endif diff --git a/trunk/paradiseo-mo/tutorial/oneMax/src/funcNK.h b/trunk/paradiseo-mo/tutorial/oneMax/src/funcNK.h deleted file mode 100644 index 4a3beb3e5..000000000 --- a/trunk/paradiseo-mo/tutorial/oneMax/src/funcNK.h +++ /dev/null @@ -1,328 +0,0 @@ -#ifndef __funcNK -#define __funcNK - -#include -#include -#include - -using namespace std; - -template< class EOT > -class FuncNK : public eoEvalFunc { -public: - // tables des contributions - double ** tables; - - // liste des liens epistatiques en fonction du bit i - // pour chaque contribution, donne la liste des variables consernés - unsigned ** links; - - // liste inverse - // pour chaque variable, donne la liste indices des contributions - vector * knils; - - unsigned N; - unsigned K; - - // constructeur vide - FuncNK() : N(0), K(0) - { - tables = NULL; - links = NULL; - }; - - FuncNK(unsigned _n) : N(_n), K(0) - { - tables = NULL; - links = NULL; - }; - - // construction de tables aléatoirement - FuncNK(int n, int k, bool consecutive = false) : N(n), K(k) - { - if (consecutive) - consecutiveTables(); - else - randomTables(); - }; - - // construction à partir d'un fichier des tables et des liens - FuncNK(const char * fichier = "") - { - load(fichier); - }; - - ~FuncNK() - { - deleteTables(); - }; - - void buildTables() - { - links = new unsigned*[N]; - knils = new vector[N]; - tables = new double*[N]; - for(unsigned i = 0; i < N; i++) { - tables[i] = new double[1<<(K+1)]; - links[i] = new unsigned[K+1]; - knils[i].clear(); - } - }; - - void deleteTables() - { - if (links != NULL) { - for(int i = 0; i < N; i++) { - delete [] (links[i]); - } - delete [] links; - links = NULL; - } - - if (knils != NULL) { - /* - for(int i = 0; i < N; i++) { - knils[i].clear(); - } - */ - delete [] knils; - knils = NULL; - } - - if (tables != NULL) { - for(int i = 0; i < N; i++) { - delete [] (tables[i]); - } - delete [] tables; - tables = NULL; - } - }; - - virtual void load(const char * nomTables) - { - fstream file; - file.open(nomTables, ios::in); - - if (file.is_open()) { - //cout <<"loadTables: chargement des tables " <> s; - while (s[0] == 'c') { - getline(file,line,'\n'); - file >> s; - } - - // lecture des parametres - if (s[0] != 'p') { - cerr <<"loadTables: erreur de lecture de paramètre pour " << nomTables <> s; - if (s != "NK") { - cerr <<"erreur " <> N >> K; - buildTables(); - - // lecture des liens - if (s[0] != 'p') { - cerr <<"loadTables: erreur de lecture de paramètre 'links' pour " << nomTables <> s; - if (s == "links") { - loadLinks(file); - } else { - cerr <<"loadTables: erreur de lecture de paramètre 'links' pour " << nomTables <> s; - - if (s == "tables") { - loadTables(file); - } else { - cerr << "loadTables: erreur de lecture de paramètre 'tables' pour " << nomTables <> links[i][j]; - knils[links[i][j]].push_back(i); - } - } - - void loadTables(fstream & file) { - for(int j = 0; j < (1<<(K+1)); j++) - for(int i = 0; i < N; i++) - file >> tables[i][j]; - } - - virtual void save(const char * nomTables) - { - // cout <<"saveTables: sauvegarde de la table " <=0; j--) - perm(tabTirage, t[j], N-1-j); - }; - - void consecutiveLinks(int i) { - for(int j=0; j -class FuncOneMax : public eoEvalFunc -{ -private: - unsigned int N; - -public: - FuncOneMax(unsigned int n) : N(n) {}; - - ~FuncOneMax(void) {} ; - - void operator() (EOT & genome) { - unsigned int sum = 0; - - for (unsigned int i = 0; i < N; i++) - sum += genome[i]; - - genome.fitness(sum); - } - -}; - -#endif diff --git a/trunk/paradiseo-mo/tutorial/oneMax/src/funcRoyalRoad.h b/trunk/paradiseo-mo/tutorial/oneMax/src/funcRoyalRoad.h deleted file mode 100644 index d0b2af486..000000000 --- a/trunk/paradiseo-mo/tutorial/oneMax/src/funcRoyalRoad.h +++ /dev/null @@ -1,40 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -#ifndef __funcRoyalRoad -#define __funcRoyalRoad - -#include - -template< class EOT > -class FuncRoyalRoad : public eoEvalFunc -{ - // number of blocks - unsigned n; - - // size of a block - unsigned k; - -public: - FuncRoyalRoad(unsigned _n, unsigned _k) : n(_n), k(_k) {}; - - ~FuncRoyalRoad(void) {} ; - - virtual void operator() (EOT & _solution) - { - unsigned sum = 0; - unsigned i, j; - - for (i = 0; i < n; i++) { - j = 0; - while (_solution[i * n + j] && j < k) j++; - - if (j == k) - sum++; - } - - _solution.fitness(sum); - }; - -}; - -#endif diff --git a/trunk/paradiseo-mo/tutorial/oneMax/src/oneMaxBitNeighbor.h b/trunk/paradiseo-mo/tutorial/oneMax/src/oneMaxBitNeighbor.h deleted file mode 100644 index 910ae7c30..000000000 --- a/trunk/paradiseo-mo/tutorial/oneMax/src/oneMaxBitNeighbor.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef _oneMaxBitNeighbor_h -#define _oneMaxBitNeighbor_h - -#include -#include - -/* - contener of the neighbor information -*/ -template< class Fitness > -class OneMaxBitNeighbor : public moBitNeighbor -{ -public: - typedef eoBit EOType ; - - using moBitNeighbor::bit ; - - /* - * incremental evaluation of the solution for the oneMax problem - */ - virtual void eval(EOType & solution) { - if (solution[bit] == 0) - fitness(solution.fitness() + 1); - else - fitness(solution.fitness() - 1); - }; -}; - -#endif - - -// Local Variables: -// coding: iso-8859-1 -// mode: C++ -// c-file-offsets: ((c . 0)) -// c-file-style: "Stroustrup" -// fill-column: 80 -// End: