Encore du nettoyage
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1814 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
3d8057ac4d
commit
02e5cfb6c0
66 changed files with 987 additions and 1785 deletions
|
|
@ -34,18 +34,18 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <acceptCrit/moAlwaysAcceptCrit.h>
|
||||
#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<bitNeighbor> test;
|
||||
moAlwaysAcceptCrit<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,24 +35,24 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moAutocorrelationSampling] => START" << std::endl;
|
||||
std::cout << "[t-moAutocorrelationSampling] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
dummyInit2 init(4);
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
dummyInit2 init(4);
|
||||
|
||||
moAutocorrelationSampling<bitNeighbor> test(init, nh, fullEval, eval, 3);
|
||||
moAutocorrelationSampling<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,27 +35,27 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <acceptCrit/moBetterAcceptCrit.h>
|
||||
#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<bitVector> comparator;
|
||||
moSolComparator<bitVector> comparator;
|
||||
|
||||
moBetterAcceptCrit<bitNeighbor> test(comparator);
|
||||
moBetterAcceptCrit<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<moDummyNeighborTest> cont1(3, false);
|
||||
moTrueContinuator<moDummyNeighborTest> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,58 +34,58 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <memory/moCountMoveMemory.h>
|
||||
#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<bitNeighbor> test;
|
||||
moCountMoveMemory<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,30 +33,30 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
|
||||
#include <continuator/moCounterStat.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moCounterStat] => START" << std::endl;
|
||||
std::cout << "[t-moCounterStat] => START" << std::endl;
|
||||
|
||||
moCounterStat<int> test;
|
||||
moCounterStat<int> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,20 +35,20 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moDensityOfStatesSampling] => START" << std::endl;
|
||||
std::cout << "[t-moDensityOfStatesSampling] => START" << std::endl;
|
||||
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
dummyInit2 init(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
dummyInit2 init(4);
|
||||
|
||||
moDensityOfStatesSampling<bitNeighbor> test(init, fullEval, 3);
|
||||
test();
|
||||
moDensityOfStatesSampling<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,14 +33,14 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <eval/moDummyEval.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moDummyEval] => START" << std::endl;
|
||||
std::cout << "[t-moDummyEval] => START" << std::endl;
|
||||
|
||||
moDummyEval<bitNeighbor> test;
|
||||
moDummyEval<bitNeighbor> test;
|
||||
|
||||
std::cout << "[t-moDummyEval] => OK" << std::endl;
|
||||
std::cout << "[t-moDummyEval] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,16 +34,16 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <explorer/moDummyExplorer.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moDummyExplorer] => START" << std::endl;
|
||||
std::cout << "[t-moDummyExplorer] => START" << std::endl;
|
||||
|
||||
moDummyExplorer<bitNeighbor> test;
|
||||
moDummyExplorer<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,17 +35,17 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moDummyLS] => START" << std::endl;
|
||||
std::cout << "[t-moDummyLS] => START" << std::endl;
|
||||
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
moDummyLS<bitNeighbor> test(fullEval);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
moDummyLS<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,14 +33,14 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <neighborhood/moDummyNeighbor.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moDummyNeighbor] => START" << std::endl;
|
||||
std::cout << "[t-moDummyNeighbor] => START" << std::endl;
|
||||
|
||||
moDummyNeighbor<bitVector> test;
|
||||
moDummyNeighbor<bitVector> test;
|
||||
|
||||
std::cout << "[t-moDummyNeighbor] => OK" << std::endl;
|
||||
std::cout << "[t-moDummyNeighbor] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,23 +34,23 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <neighborhood/moDummyNeighborhood.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moDummyNeighborhood] => START" << std::endl;
|
||||
std::cout << "[t-moDummyNeighborhood] => START" << std::endl;
|
||||
|
||||
bitVector sol;
|
||||
moDummyNeighbor<bitVector> n;
|
||||
bitVector sol;
|
||||
moDummyNeighbor<bitVector> n;
|
||||
|
||||
moDummyNeighborhood<moDummyNeighbor<bitVector> > test;
|
||||
moDummyNeighborhood<moDummyNeighbor<bitVector> > 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,33 +34,33 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <eval/moEvalCounter.h>
|
||||
#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<bitNeighbor> test(eval);
|
||||
moEvalCounter<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,25 +37,25 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <utils/eoDistance.h>
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moFDCsampling] => START" << std::endl;
|
||||
std::cout << "[t-moFDCsampling] => START" << std::endl;
|
||||
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
dummyInit2 init(4);
|
||||
eoHammingDistance<bitVector> dist;
|
||||
bitVector sol(4, false);
|
||||
sol.fitness(0);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
dummyInit2 init(4);
|
||||
eoHammingDistance<bitVector> dist;
|
||||
bitVector sol(4, false);
|
||||
sol.fitness(0);
|
||||
|
||||
|
||||
moFDCsampling<bitNeighbor> test(init, fullEval, dist, sol, 3);
|
||||
moFDCsampling<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,28 +37,28 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <continuator/moTrueContinuator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moFirstImprHC] => START" << std::endl;
|
||||
std::cout << "[t-moFirstImprHC] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
|
||||
//test first constructor
|
||||
moFirstImprHC<bitNeighbor> test1(nh, fullEval, eval);
|
||||
//test first constructor
|
||||
moFirstImprHC<bitNeighbor> test1(nh, fullEval, eval);
|
||||
|
||||
//test second constructor
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moFirstImprHC<bitNeighbor> test2(nh, fullEval, eval, cont);
|
||||
//test second constructor
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moFirstImprHC<bitNeighbor> test2(nh, fullEval, eval, cont);
|
||||
|
||||
//test third constructor
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
moFirstImprHC<bitNeighbor> test3(nh, fullEval, eval, cont, ncomp, sncomp);
|
||||
//test third constructor
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
moFirstImprHC<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,28 +34,28 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <continuator/moFitContinuator.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moFitContinuator] => START" << std::endl;
|
||||
std::cout << "[t-moFitContinuator] => START" << std::endl;
|
||||
|
||||
moFitContinuator<bitNeighbor> test1(3);
|
||||
moFitContinuator<moDummyNeighborTest> test2(5);
|
||||
moFitContinuator<bitNeighbor> test1(3);
|
||||
moFitContinuator<moDummyNeighborTest> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,36 +40,36 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <eval/oneMaxEval.h>
|
||||
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moFitnessCloudSampling] => START" << std::endl;
|
||||
std::cout << "[t-moFitnessCloudSampling] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
dummyInit2 init(4);
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
dummyInit2 init(4);
|
||||
|
||||
moFitnessCloudSampling<bitNeighbor> test1(init, nh, fullEval, eval, 3);
|
||||
moFitnessCloudSampling<bitNeighbor> test1(init, nh, fullEval, eval, 3);
|
||||
|
||||
moRndRndFitnessCloudSampling<bitNeighbor> test2(init, nh, fullEval, eval, 3);
|
||||
moRndRndFitnessCloudSampling<bitNeighbor> test2(init, nh, fullEval, eval, 3);
|
||||
|
||||
moRndBestFitnessCloudSampling<bitNeighbor> test3(init, nh, fullEval, eval, 3);
|
||||
moRndBestFitnessCloudSampling<bitNeighbor> test3(init, nh, fullEval, eval, 3);
|
||||
|
||||
moMHRndFitnessCloudSampling<bitNeighbor> test4(init, nh, fullEval, eval, 3);
|
||||
moMHRndFitnessCloudSampling<bitNeighbor> test4(init, nh, fullEval, eval, 3);
|
||||
|
||||
moMHBestFitnessCloudSampling<bitNeighbor> test5(init, nh, fullEval, eval, 3);
|
||||
moMHBestFitnessCloudSampling<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<bitNeighbor> rndNH(8);
|
||||
moOrderNeighborhood<moIndexNeighbor<eoBit<eoMinimizingFitness> > >orderNH(8);
|
||||
moRndWithoutReplNeighborhood<bitNeighbor> rndNH(8);
|
||||
moOrderNeighborhood<moIndexNeighbor<eoBit<eoMinimizingFitness> > >orderNH(8);
|
||||
|
||||
|
||||
//moForwardVariableNeighborhood<eoBit<eoMinimizingFitness>, eoMinimizingFitness> test(orderNH);
|
||||
//moForwardVariableNeighborhood<eoBit<eoMinimizingFitness>, eoMinimizingFitness> test(orderNH);
|
||||
|
||||
|
||||
std::cout << "[t-moForwardVariableNeighborhood] => OK" << std::endl;
|
||||
std::cout << "[t-moForwardVariableNeighborhood] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,36 +35,36 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <eval/oneMaxEval.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moFullEvalContinuator] => START" << std::endl;
|
||||
std::cout << "[t-moFullEvalContinuator] => START" << std::endl;
|
||||
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
eoEvalFuncCounter<bitVector> evalCount(fullEval);
|
||||
moFullEvalContinuator<bitNeighbor> test(evalCount, 3);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
eoEvalFuncCounter<bitVector> evalCount(fullEval);
|
||||
moFullEvalContinuator<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,23 +35,23 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moHillClimberSampling] => START" << std::endl;
|
||||
std::cout << "[t-moHillClimberSampling] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
dummyInit2 init(4);
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
dummyInit2 init(4);
|
||||
|
||||
moHillClimberSampling<bitNeighbor> test(init, nh, fullEval, eval, 3);
|
||||
moHillClimberSampling<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,37 +41,39 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <memory/moSolVectorTabuList.h>
|
||||
#include <neighborhood/moDummyNeighbor.h>
|
||||
|
||||
class dummyMonOp: public eoMonOp<bitVector>{
|
||||
public:
|
||||
bool operator()(bitVector&){return false;}
|
||||
class dummyMonOp: public eoMonOp<bitVector> {
|
||||
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<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
|
||||
moTS<bitNeighbor> ts(nh, fullEval, eval, 1, 7);
|
||||
moTS<bitNeighbor> ts(nh, fullEval, eval, 1, 7);
|
||||
|
||||
dummyMonOp op;
|
||||
dummyMonOp op;
|
||||
|
||||
//basic constructor
|
||||
moILS<bitNeighbor> test1(ts, fullEval, op, 3);
|
||||
//basic constructor
|
||||
moILS<bitNeighbor> test1(ts, fullEval, op, 3);
|
||||
|
||||
//simple constructor
|
||||
moTrueContinuator<moDummyNeighbor<bitVector> > cont;
|
||||
moILS<bitNeighbor> test2(ts, fullEval, op, cont);
|
||||
//simple constructor
|
||||
moTrueContinuator<moDummyNeighbor<bitVector> > cont;
|
||||
moILS<bitNeighbor> test2(ts, fullEval, op, cont);
|
||||
|
||||
//general constructor
|
||||
moMonOpPerturb<bitNeighbor> perturb(op, fullEval);
|
||||
moAlwaysAcceptCrit<bitNeighbor> accept;
|
||||
moILS<bitNeighbor> test3(ts, fullEval, cont, perturb, accept);
|
||||
//general constructor
|
||||
moMonOpPerturb<bitNeighbor> perturb(op, fullEval);
|
||||
moAlwaysAcceptCrit<bitNeighbor> accept;
|
||||
moILS<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,59 +42,59 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <acceptCrit/moAlwaysAcceptCrit.h>
|
||||
|
||||
|
||||
class dummyMonOp: public eoMonOp<bitVector>{
|
||||
class dummyMonOp: public eoMonOp<bitVector> {
|
||||
|
||||
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<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
std::cout << "[t-moILSexplorer] => START" << std::endl;
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
|
||||
bitVector sol(4, true);
|
||||
fullEval(sol);
|
||||
bitVector sol(4, true);
|
||||
fullEval(sol);
|
||||
|
||||
//test first constructor
|
||||
moSimpleHC<bitNeighbor> ls(nh, fullEval, eval);
|
||||
//test first constructor
|
||||
moSimpleHC<bitNeighbor> ls(nh, fullEval, eval);
|
||||
|
||||
dummyMonOp op;
|
||||
moMonOpPerturb<bitNeighbor> perturb(op, fullEval);
|
||||
dummyMonOp op;
|
||||
moMonOpPerturb<bitNeighbor> perturb(op, fullEval);
|
||||
|
||||
moAlwaysAcceptCrit<bitNeighbor> accept;
|
||||
moAlwaysAcceptCrit<bitNeighbor> accept;
|
||||
|
||||
moILSexplorer<bitNeighbor> test(ls, perturb, accept);
|
||||
moILSexplorer<bitNeighbor> 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<sol.size(); i++)
|
||||
assert(!sol[i]);
|
||||
assert(sol.fitness()==0);
|
||||
for (unsigned int i=0; i<sol.size(); i++)
|
||||
assert(!sol[i]);
|
||||
assert(sol.fitness()==0);
|
||||
|
||||
test(sol);
|
||||
test(sol);
|
||||
|
||||
|
||||
std::cout << "[t-moILSexplorer] => OK" << std::endl;
|
||||
std::cout << "[t-moILSexplorer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <continuator/moIterContinuator.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moIterContinuator] => START" << std::endl;
|
||||
std::cout << "[t-moIterContinuator] => START" << std::endl;
|
||||
|
||||
moIterContinuator<moDummyNeighborTest> test(3, false);
|
||||
moIterContinuator<moDummyNeighborTest> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<bitVector> fullEval;
|
||||
evalOneMax eval(8);
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
moSimpleHCexplorer<bitNeighbor> explorer(nh, eval, ncomp, sncomp);
|
||||
moLocalSearch<bitNeighbor> test(explorer, cont, fullEval);
|
||||
bitNeighborhood nh(8);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(8);
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
moSimpleHCexplorer<bitNeighbor> explorer(nh, eval, ncomp, sncomp);
|
||||
moLocalSearch<bitNeighbor> 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<sol.size(); i++)
|
||||
assert(!sol[i]);
|
||||
assert(sol.fitness()==0);
|
||||
for (unsigned int i=0; i<sol.size(); i++)
|
||||
assert(!sol[i]);
|
||||
|
||||
|
||||
std::cout << "[t-moLocalSearch] => OK" << std::endl;
|
||||
std::cout << "[t-moLocalSearch] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,22 +37,22 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <eval/oneMaxEval.h>
|
||||
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moLocalSearchInit] => START" << std::endl;
|
||||
std::cout << "[t-moLocalSearchInit] => START" << std::endl;
|
||||
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
moDummyLS<bitNeighbor> ls(fullEval);
|
||||
dummyInit init;
|
||||
bitVector sol;
|
||||
sol.fitness(0);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
moDummyLS<bitNeighbor> ls(fullEval);
|
||||
dummyInit init;
|
||||
bitVector sol;
|
||||
sol.fitness(0);
|
||||
|
||||
moLocalSearchInit<bitNeighbor> test(init, ls);
|
||||
moLocalSearchInit<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,28 +38,28 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moMetropolisHasting] => START" << std::endl;
|
||||
std::cout << "[t-moMetropolisHasting] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
|
||||
//test du 1er constructeur
|
||||
moMetropolisHasting<bitNeighbor> test1(nh, fullEval, eval, 3);
|
||||
//test du 1er constructeur
|
||||
moMetropolisHasting<bitNeighbor> test1(nh, fullEval, eval, 3);
|
||||
|
||||
//test du 2eme constructeur
|
||||
moMetropolisHasting<bitNeighbor> test2(nh, fullEval, eval, 3, cont);
|
||||
//test du 2eme constructeur
|
||||
moMetropolisHasting<bitNeighbor> test2(nh, fullEval, eval, 3, cont);
|
||||
|
||||
//test du 3eme constructeur
|
||||
moMetropolisHasting<bitNeighbor> test3(nh, fullEval, eval, 3, cont, ncomp, sncomp);
|
||||
//test du 3eme constructeur
|
||||
moMetropolisHasting<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,32 +33,32 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
|
||||
#include <continuator/moMinusOneCounterStat.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moMinusOneCounterStat] => START" << std::endl;
|
||||
std::cout << "[t-moMinusOneCounterStat] => START" << std::endl;
|
||||
|
||||
moMinusOneCounterStat<int> test;
|
||||
moMinusOneCounterStat<int> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,37 +38,37 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <eval/oneMaxEval.h>
|
||||
|
||||
|
||||
class dummyMonOp: public eoMonOp<bitVector>{
|
||||
class dummyMonOp: public eoMonOp<bitVector> {
|
||||
|
||||
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<bitVector> eval;
|
||||
dummyMonOp op;
|
||||
oneMaxEval<bitVector> 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<bitNeighbor> test(op, eval);
|
||||
moMonOpDiversification<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,38 +37,38 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <eval/oneMaxEval.h>
|
||||
|
||||
|
||||
class dummyMonOp: public eoMonOp<bitVector>{
|
||||
class dummyMonOp: public eoMonOp<bitVector> {
|
||||
|
||||
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<bitVector> eval;
|
||||
dummyMonOp op;
|
||||
oneMaxEval<bitVector> 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<bitNeighbor> test(op, eval);
|
||||
moMonOpPerturb<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,41 +34,41 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <continuator/moNeighborBestStat.h>
|
||||
#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<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
bitNeighborhood nh(4);
|
||||
bitNeighborhood emptyNH(0);
|
||||
evalOneMax eval(4);
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
|
||||
moNeighborBestStat<bitNeighbor> test1(nh, eval, ncomp, sncomp, 1);
|
||||
moNeighborBestStat<bitNeighbor> test2(nh, eval);
|
||||
moNeighborBestStat<bitNeighbor> test3(emptyNH, eval);
|
||||
moNeighborBestStat<bitNeighbor> test1(nh, eval, ncomp, sncomp, 1);
|
||||
moNeighborBestStat<bitNeighbor> test2(nh, eval);
|
||||
moNeighborBestStat<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,36 +34,36 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <continuator/moNeighborEvalContinuator.h>
|
||||
#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<bitNeighbor> evalCount(moEval);
|
||||
moNeighborEvalContinuator<bitNeighbor> test(evalCount, 3);
|
||||
evalOneMax moEval(2);
|
||||
moEvalCounter<bitNeighbor> evalCount(moEval);
|
||||
moNeighborEvalContinuator<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,33 +34,33 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <continuator/moNeighborFitnessStat.h>
|
||||
#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<bitNeighbor> test(nh, eval);
|
||||
moNeighborFitnessStat<bitNeighbor> test2(nh2, eval);
|
||||
moNeighborFitnessStat<bitNeighbor> test(nh, eval);
|
||||
moNeighborFitnessStat<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
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<bitNeighbor> 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<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,53 +39,53 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
|
||||
typedef moOrderNeighborhood<bitNeighbor> Neighborhood;
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moNeighborhoodPerturb] => START" << std::endl;
|
||||
std::cout << "[t-moNeighborhoodPerturb] => START" << std::endl;
|
||||
|
||||
oneMaxEval<bitVector> eval;
|
||||
oneMaxEval<bitVector> eval;
|
||||
|
||||
moFullEvalByCopy<bitNeighbor> moeval(eval);
|
||||
moFullEvalByCopy<bitNeighbor> 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<bitNeighbor, bitNeighbor> test(nh, moeval);
|
||||
moNeighborhoodPerturb<bitNeighbor, bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,27 +38,27 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <comparator/moNeighborComparator.h>
|
||||
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moNeutralDegreeSampling] => START" << std::endl;
|
||||
std::cout << "[t-moNeutralDegreeSampling] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
dummyInit2 init(4);
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
dummyInit2 init(4);
|
||||
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
|
||||
moNeutralDegreeSampling<bitNeighbor> test1(init, nh, fullEval, eval, 3);
|
||||
moNeutralDegreeSampling<bitNeighbor> test2(init, nh, fullEval, eval, ncomp, sncomp, 3);
|
||||
moNeutralDegreeSampling<bitNeighbor> test1(init, nh, fullEval, eval, 3);
|
||||
moNeutralDegreeSampling<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,28 +38,28 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moNeutralHC] => START" << std::endl;
|
||||
std::cout << "[t-moNeutralHC] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
|
||||
//test du 1er constructeur
|
||||
moNeutralHC<bitNeighbor> test1(nh, fullEval, eval, 3);
|
||||
//test du 1er constructeur
|
||||
moNeutralHC<bitNeighbor> test1(nh, fullEval, eval, 3);
|
||||
|
||||
//test du 2eme constructeur
|
||||
moNeutralHC<bitNeighbor> test2(nh, fullEval, eval, 3, cont);
|
||||
//test du 2eme constructeur
|
||||
moNeutralHC<bitNeighbor> test2(nh, fullEval, eval, 3, cont);
|
||||
|
||||
//test du 3eme constructeur
|
||||
moNeutralHC<bitNeighbor> test3(nh, fullEval, eval, 3, cont, ncomp, sncomp);
|
||||
//test du 3eme constructeur
|
||||
moNeutralHC<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,26 +37,26 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <utils/eoDistance.h>
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moNeutralWalkSampling] => START" << std::endl;
|
||||
std::cout << "[t-moNeutralWalkSampling] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
dummyInit2 init(4);
|
||||
bitVector sol(4, true);
|
||||
sol.fitness(4);
|
||||
eoHammingDistance<bitVector> dist;
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
dummyInit2 init(4);
|
||||
bitVector sol(4, true);
|
||||
sol.fitness(4);
|
||||
eoHammingDistance<bitVector> dist;
|
||||
|
||||
moNeutralWalkSampling<bitNeighbor> test(sol, nh, fullEval, eval, dist, 3);
|
||||
moNeutralWalkSampling<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,28 +37,28 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <continuator/moTrueContinuator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moRandomBestHC] => START" << std::endl;
|
||||
std::cout << "[t-moRandomBestHC] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
|
||||
//test first constructor
|
||||
moRandomBestHC<bitNeighbor> test1(nh, fullEval, eval);
|
||||
//test first constructor
|
||||
moRandomBestHC<bitNeighbor> test1(nh, fullEval, eval);
|
||||
|
||||
//test second constructor
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moRandomBestHC<bitNeighbor> test2(nh, fullEval, eval, cont);
|
||||
//test second constructor
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moRandomBestHC<bitNeighbor> test2(nh, fullEval, eval, cont);
|
||||
|
||||
//test third constructor
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
moRandomBestHC<bitNeighbor> test3(nh, fullEval, eval, cont, ncomp, sncomp);
|
||||
//test third constructor
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
moRandomBestHC<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,27 +37,27 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <continuator/moTrueContinuator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moRandomNeutralWalk] => START" << std::endl;
|
||||
std::cout << "[t-moRandomNeutralWalk] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
|
||||
//test du 1er constructeur
|
||||
moRandomNeutralWalk<bitNeighbor> test1(nh, fullEval, eval, 3);
|
||||
//test du 1er constructeur
|
||||
moRandomNeutralWalk<bitNeighbor> test1(nh, fullEval, eval, 3);
|
||||
|
||||
//test du 2eme constructeur
|
||||
moRandomNeutralWalk<bitNeighbor> test2(nh, fullEval, eval, 3, cont);
|
||||
//test du 2eme constructeur
|
||||
moRandomNeutralWalk<bitNeighbor> test2(nh, fullEval, eval, 3, cont);
|
||||
|
||||
//test du 3eme constructeur
|
||||
moRandomNeutralWalk<bitNeighbor> test3(nh, fullEval, eval, 3, cont, sncomp);
|
||||
//test du 3eme constructeur
|
||||
moRandomNeutralWalk<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,22 +36,22 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <eval/oneMaxEval.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moRandomSearch] => START" << std::endl;
|
||||
std::cout << "[t-moRandomSearch] => START" << std::endl;
|
||||
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
dummyInit init;
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
//test du 1er constructor
|
||||
moRandomSearch<bitNeighbor> test1(init, fullEval, 3);
|
||||
//test du 2e constructor
|
||||
moRandomSearch<bitNeighbor> test2(init, fullEval, 3, cont);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
dummyInit init;
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
//test du 1er constructor
|
||||
moRandomSearch<bitNeighbor> test1(init, fullEval, 3);
|
||||
//test du 2e constructor
|
||||
moRandomSearch<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,31 +35,31 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moRandomSearchExplorer] => START" << std::endl;
|
||||
std::cout << "[t-moRandomSearchExplorer] => START" << std::endl;
|
||||
|
||||
dummyInit init;
|
||||
oneMaxEval<bitVector> eval;
|
||||
bitVector sol(4, true);
|
||||
dummyInit init;
|
||||
oneMaxEval<bitVector> eval;
|
||||
bitVector sol(4, true);
|
||||
|
||||
moRandomSearchExplorer<bitNeighbor> test(init, eval, 2);
|
||||
moRandomSearchExplorer<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,26 +38,26 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moRandomWalk] => START" << std::endl;
|
||||
std::cout << "[t-moRandomWalk] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
|
||||
//test du 1er constructeur
|
||||
moRandomWalk<bitNeighbor> test1(nh, fullEval, eval, 3);
|
||||
//test du 1er constructeur
|
||||
moRandomWalk<bitNeighbor> test1(nh, fullEval, eval, 3);
|
||||
|
||||
//test du 2eme constructeur
|
||||
moRandomWalk<bitNeighbor> test2(nh, fullEval, eval, 3, cont);
|
||||
//test du 2eme constructeur
|
||||
moRandomWalk<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,75 +43,75 @@ typedef eoInt<unsigned int> QUEEN;
|
|||
class dummyInit : public eoInit<QUEEN>
|
||||
{
|
||||
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<size; i++)
|
||||
_sol.push_back(i);
|
||||
_sol.invalidate();
|
||||
}
|
||||
void operator()(QUEEN& _sol) {
|
||||
_sol.resize(0);
|
||||
for (unsigned int i=0; i<size; i++)
|
||||
_sol.push_back(i);
|
||||
_sol.invalidate();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
unsigned int size;
|
||||
unsigned int size;
|
||||
|
||||
};
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moRestartPerturb] => START" << std::endl;
|
||||
std::cout << "[t-moRestartPerturb] => START" << std::endl;
|
||||
|
||||
QUEEN queen;
|
||||
moShiftNeighbor<QUEEN> n;
|
||||
QUEEN queen;
|
||||
moShiftNeighbor<QUEEN> n;
|
||||
|
||||
dummyInit initializer(4);
|
||||
dummyInit initializer(4);
|
||||
|
||||
queenEval<QUEEN> eval;
|
||||
queenEval<QUEEN> eval;
|
||||
|
||||
moRestartPerturb<moShiftNeighbor<QUEEN> > test(initializer, eval, 3);
|
||||
moRestartPerturb<moShiftNeighbor<QUEEN> > 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,28 +38,28 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <continuator/moTrueContinuator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moSA] => START" << std::endl;
|
||||
std::cout << "[t-moSA] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
|
||||
//test first constructor
|
||||
moSA<bitNeighbor> test1(nh, fullEval, eval);
|
||||
//test first constructor
|
||||
moSA<bitNeighbor> test1(nh, fullEval, eval);
|
||||
|
||||
//test second constructor
|
||||
moSimpleCoolingSchedule<bitVector> cool(10, 0.9, 100, 0.01);
|
||||
moSA<bitNeighbor> test2(nh, fullEval, eval, cool);
|
||||
//test second constructor
|
||||
moSimpleCoolingSchedule<bitVector> cool(10, 0.9, 100, 0.01);
|
||||
moSA<bitNeighbor> test2(nh, fullEval, eval, cool);
|
||||
|
||||
//test third constructor
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSolNeighborComparator<bitNeighbor> comp;
|
||||
moSA<bitNeighbor> test3(nh, fullEval, eval, cool, comp, cont);
|
||||
//test third constructor
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSolNeighborComparator<bitNeighbor> comp;
|
||||
moSA<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <explorer/moSAexplorer.h>
|
||||
#include <coolingSchedule/moSimpleCoolingSchedule.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moSAexplorer] => START" << std::endl;
|
||||
std::cout << "[t-moSAexplorer] => START" << std::endl;
|
||||
|
||||
eoBit<eoMinimizingFitness> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,43 +39,43 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <continuator/moCounterStat.h>
|
||||
#include <continuator/moIterContinuator.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moSampling] => START" << std::endl;
|
||||
std::cout << "[t-moSampling] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
dummyInit2 init(4);
|
||||
moIterContinuator<bitNeighbor> cont(3);
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
dummyInit2 init(4);
|
||||
moIterContinuator<bitNeighbor> cont(3);
|
||||
|
||||
moFirstImprHC<bitNeighbor> hc(nh, fullEval, eval, cont);
|
||||
moSolutionStat<bitVector> stat1;
|
||||
moCounterStat<bitVector> stat2;
|
||||
moSampling<bitNeighbor> test(init, hc, stat1);
|
||||
moFirstImprHC<bitNeighbor> hc(nh, fullEval, eval, cont);
|
||||
moSolutionStat<bitVector> stat1;
|
||||
moCounterStat<bitVector> stat2;
|
||||
moSampling<bitNeighbor> test(init, hc, stat1);
|
||||
|
||||
test.add(stat2);
|
||||
test.add(stat2);
|
||||
|
||||
test();
|
||||
test();
|
||||
|
||||
std::vector<double> res;
|
||||
std::vector<bitVector> res2;
|
||||
res = test.getValues(1);
|
||||
res2= test.getSolutions(0);
|
||||
std::vector<double> res;
|
||||
std::vector<bitVector> res2;
|
||||
res = test.getValues(1);
|
||||
res2= test.getSolutions(0);
|
||||
|
||||
for(unsigned int i=0; i<res2.size(); i++)
|
||||
assert(res2[i].fitness()==4-i);
|
||||
for (unsigned int i=0; i<res2.size(); i++)
|
||||
assert(res2[i].fitness()==4-i);
|
||||
|
||||
for(unsigned int i=0; i<res.size(); i++)
|
||||
assert(res[i]==i);
|
||||
for (unsigned int i=0; i<res.size(); i++)
|
||||
assert(res[i]==i);
|
||||
|
||||
test.fileExport("outputTestSampling1");
|
||||
test.fileExport(1, "outputTestSampling2");
|
||||
test.fileExport("outputTestSampling1");
|
||||
test.fileExport(1, "outputTestSampling2");
|
||||
|
||||
assert(test.className()=="moSampling");
|
||||
assert(test.className()=="moSampling");
|
||||
|
||||
std::cout << "[t-moSampling] => OK" << std::endl;
|
||||
std::cout << "[t-moSampling] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,55 +34,55 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <coolingSchedule/moSimpleCoolingSchedule.h>
|
||||
#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<bitVector> test(100, 0.1, 2, 0.1);
|
||||
moSimpleCoolingSchedule<bitVector> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,28 +38,28 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <comparator/moSolNeighborComparator.h>
|
||||
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moSimpleHC] => START" << std::endl;
|
||||
std::cout << "[t-moSimpleHC] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
|
||||
//test first constructor
|
||||
moSimpleHC<bitNeighbor> test1(nh, fullEval, eval);
|
||||
//test first constructor
|
||||
moSimpleHC<bitNeighbor> test1(nh, fullEval, eval);
|
||||
|
||||
//test second constructor
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSimpleHC<bitNeighbor> test2(nh, fullEval, eval, cont);
|
||||
//test second constructor
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSimpleHC<bitNeighbor> test2(nh, fullEval, eval, cont);
|
||||
|
||||
//test third constructor
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
moSimpleHC<bitNeighbor> test3(nh, fullEval, eval, cont, ncomp, sncomp);
|
||||
//test third constructor
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
moSimpleHC<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <comparator/moSolComparator.h>
|
||||
#include <ga/eoBit.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moSolComparator] => START" << std::endl;
|
||||
std::cout << "[t-moSolComparator] => START" << std::endl;
|
||||
|
||||
eoBit<eoMinimizingFitness> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,24 +33,24 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
|
||||
#include <perturb/moSolInit.h>
|
||||
|
||||
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<int> test(a);
|
||||
moSolInit<int> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,77 +35,77 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include "moTestClass.h"
|
||||
#include <utils/eoDistance.h>
|
||||
|
||||
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<double> sampling;
|
||||
sampling.push_back(3);
|
||||
sampling.push_back(5);
|
||||
sampling.push_back(2);
|
||||
sampling.push_back(4);
|
||||
//test des stats basic
|
||||
std::vector<double> 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<bitVector> data;
|
||||
eoHammingDistance<bitVector> 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<bitVector> data;
|
||||
eoHammingDistance<bitVector> 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<double> > matrix;
|
||||
std::vector< std::vector<double> > 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<double> rho, phi;
|
||||
test.autocorrelation(sampling, 2, rho, phi);
|
||||
//test de l'autocorrelation
|
||||
std::vector<double> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,34 +39,34 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <comparator/moNeighborComparator.h>
|
||||
#include <memory/moSolVectorTabuList.h>
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moTS] => START" << std::endl;
|
||||
std::cout << "[t-moTS] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
|
||||
//test first constructor
|
||||
moTS<bitNeighbor> test1(nh, fullEval, eval, 1, 7);
|
||||
//test first constructor
|
||||
moTS<bitNeighbor> test1(nh, fullEval, eval, 1, 7);
|
||||
|
||||
//test second constructor
|
||||
moSolVectorTabuList<bitNeighbor> tl(7,0);
|
||||
moTS<bitNeighbor> test2(nh, fullEval, eval, 1, tl);
|
||||
//test second constructor
|
||||
moSolVectorTabuList<bitNeighbor> tl(7,0);
|
||||
moTS<bitNeighbor> test2(nh, fullEval, eval, 1, tl);
|
||||
|
||||
//test third constructor
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
moDummyIntensification<bitNeighbor> intens;
|
||||
moDummyDiversification<bitNeighbor> div;
|
||||
moBestImprAspiration<bitNeighbor> aspir;
|
||||
//test third constructor
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
moDummyIntensification<bitNeighbor> intens;
|
||||
moDummyDiversification<bitNeighbor> div;
|
||||
moBestImprAspiration<bitNeighbor> aspir;
|
||||
|
||||
moTS<bitNeighbor> test3(nh, fullEval, eval, ncomp, sncomp, cont, tl, intens, div, aspir);
|
||||
moTS<bitNeighbor> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<moDummyNeighborTest> test(2, false);
|
||||
moTimeContinuator<moDummyNeighborTest> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,79 +34,79 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <continuator/moVectorMonitor.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main(){
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moVectorMonitor] => START" << std::endl;
|
||||
std::cout << "[t-moVectorMonitor] => START" << std::endl;
|
||||
|
||||
|
||||
eoValueParam<double> doubleParam;
|
||||
eoValueParam<unsigned int> intParam;
|
||||
eoValueParam<bitVector> eotParam;
|
||||
eoValueParam<std::string> stringParam;
|
||||
doubleParam.value()= 3.1;
|
||||
intParam.value()=6;
|
||||
bitVector sol(4,true);
|
||||
sol.fitness(0);
|
||||
eotParam.value()=sol;
|
||||
eoValueParam<double> doubleParam;
|
||||
eoValueParam<unsigned int> intParam;
|
||||
eoValueParam<bitVector> eotParam;
|
||||
eoValueParam<std::string> stringParam;
|
||||
doubleParam.value()= 3.1;
|
||||
intParam.value()=6;
|
||||
bitVector sol(4,true);
|
||||
sol.fitness(0);
|
||||
eotParam.value()=sol;
|
||||
|
||||
moVectorMonitor<bitVector> test1(doubleParam);
|
||||
moVectorMonitor<bitVector> test2(intParam);
|
||||
moVectorMonitor<bitVector> test3(eotParam);
|
||||
moVectorMonitor<bitVector> test4(stringParam);
|
||||
moVectorMonitor<bitVector> test1(doubleParam);
|
||||
moVectorMonitor<bitVector> test2(intParam);
|
||||
moVectorMonitor<bitVector> test3(eotParam);
|
||||
moVectorMonitor<bitVector> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue