Replace Templates NHE and Neighborhood

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1732 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jhumeau 2010-04-07 15:52:47 +00:00
commit 5f7d120a6e
48 changed files with 236 additions and 227 deletions

View file

@ -52,7 +52,7 @@
#include <utils/eoUpdater.h>
typedef eoBit<eoMinimizingFitness> bitVector;
typedef moBitNeighbor<eoMinimizingFitness> bitNeighbor ;
typedef moBitNeighbor<eoMinimizingFitness> bitNeighbor;
class moDummyRndNeighborhood: public moOrderNeighborhood<bitNeighbor>/*, public moRndNeighborhood<bitNeighbor>*/ {
public:

View file

@ -59,10 +59,10 @@ int main() {
updater1 up2(b);
monitor1 mon1(c);
monitor2 mon2(d);
moTrueContinuator< bitNeighborhood > cont;
moTrueContinuator< bitNeighbor > cont;
moCheckpoint< bitNeighborhood> test1(cont);
moCheckpoint< bitNeighborhood> test2(cont, 3);
moCheckpoint< bitNeighbor > test1(cont);
moCheckpoint< bitNeighbor > test2(cont, 3);
test1.add(up1);
test1.add(up2);

View file

@ -48,7 +48,7 @@ int main() {
moNeighborComparator<bitNeighbor> ncomp;
moSolNeighborComparator<bitNeighbor> sncomp;
moFirstImprExplorer<bitNeighborhood> test(nh, eval, ncomp, sncomp);
moFirstImprExplorer<bitNeighbor> test(nh, eval, ncomp, sncomp);
//on verifie qu'on améliore peut continuer à explorer tant qu'on améliore la solution

View file

@ -48,7 +48,7 @@ int main() {
moNeighborComparator<bitNeighbor> ncomp;
moSolNeighborComparator<bitNeighbor> sncomp;
moHCneutralExplorer<bitNeighborhood> test(nh, eval, ncomp, sncomp,3);
moHCneutralExplorer<bitNeighbor> test(nh, eval, ncomp, sncomp,3);
//on verifie qu'on ameliore bien la solution et que l'exploration dure 3 itérations

View file

@ -46,7 +46,7 @@ int main() {
moNeighborComparator<bitNeighbor> ncomp;
moSolNeighborComparator<bitNeighbor> sncomp;
moMetropolisHastingExplorer<bitNeighborhood> test(nh, eval, ncomp, sncomp, 3);
moMetropolisHastingExplorer<bitNeighbor> test(nh, eval, ncomp, sncomp, 3);
//test de l'acceptation d'un voisin améliorant
test.initParam(sol);

View file

@ -73,7 +73,7 @@ int main() {
sol.fitness(7);
moNeighborhoodStat<bitNeighborhood> test(n, eval, neighborComp, solNeighborComp);
moNeighborhoodStat<bitNeighbor> test(n, eval, neighborComp, solNeighborComp);
test(sol);
@ -92,7 +92,7 @@ int main() {
//test of moMaxNeighborStat.h
std::cout << "[t-moMaxNeighborStat] => START" << std::endl;
moMaxNeighborStat<bitNeighborhood> test2(test);
moMaxNeighborStat<bitNeighbor> test2(test);
test2(sol);
assert(test2.value()==6);
assert(test2.className()=="moMaxNeighborStat");
@ -100,7 +100,7 @@ int main() {
//test of moMinNeighborStat.h
std::cout << "[t-moMinNeighborStat] => START" << std::endl;
moMinNeighborStat<bitNeighborhood> test3(test);
moMinNeighborStat<bitNeighbor> test3(test);
test3(sol);
assert(test3.value()==8);
assert(test3.className()=="moMinNeighborStat");
@ -108,7 +108,7 @@ int main() {
//test of moNbInfNeighborStat.h
std::cout << "[t-moNbInfNeighborStat] => START" << std::endl;
moNbInfNeighborStat<bitNeighborhood> test4(test);
moNbInfNeighborStat<bitNeighbor> test4(test);
test4(sol);
assert(test4.value()==3);
assert(test4.className()=="moNbInfNeighborStat");
@ -116,7 +116,7 @@ int main() {
//test of moNbSupNeighborStat.h
std::cout << "[t-moNbSupNeighborStat] => START" << std::endl;
moNbSupNeighborStat<bitNeighborhood> test5(test);
moNbSupNeighborStat<bitNeighbor> test5(test);
test5(sol);
assert(test5.value()==7);
assert(test5.className()=="moNbSupNeighborStat");
@ -124,7 +124,7 @@ int main() {
//test of moNeutralDegreeNeighborStat.h
std::cout << "[t-moNeutralDegreeNeighborStat] => START" << std::endl;
moNeutralDegreeNeighborStat<bitNeighborhood> test6(test);
moNeutralDegreeNeighborStat<bitNeighbor> test6(test);
test6(sol);
assert(test6.value()==0);
assert(test6.className()=="moNeutralDegreeNeighborStat");
@ -132,7 +132,7 @@ int main() {
//test of moSecondMomentNeighborStat.h
std::cout << "[t-moSecondMomentNeighborStat] => START" << std::endl;
moSecondMomentNeighborStat<bitNeighborhood> test7(test);
moSecondMomentNeighborStat<bitNeighbor> test7(test);
test7(sol);
assert(test7.value().first==6.6);
assert(test7.value().second > 0.966 && test7.value().second < 0.967);
@ -141,7 +141,7 @@ int main() {
//test of moSizeNeighborStat.h
std::cout << "[t-moSizeNeighborStat] => START" << std::endl;
moSizeNeighborStat<bitNeighborhood> test8(test);
moSizeNeighborStat<bitNeighbor> test8(test);
test8(sol);
assert(test8.value()==10);
assert(test8.className()=="moSizeNeighborStat");

View file

@ -47,7 +47,7 @@ int main() {
//test avec la fonction d'eval classique
//on verifie qu'on ne trouve pas de voisin de mm fitness
moRandomNeutralWalkExplorer<bitNeighborhood> test(nh, eval, sncomp, 3);
moRandomNeutralWalkExplorer<bitNeighbor> test(nh, eval, sncomp, 3);
test.initParam(sol);
test(sol);
@ -56,7 +56,7 @@ int main() {
//test avec une fonction d'eval bidon qui renvoie toujours la mm fitness
//on peut donc verifier qu'on s'arette au bout des 3 itérations.
moRandomNeutralWalkExplorer<bitNeighborhood> test2(nh, eval2, sncomp, 3);
moRandomNeutralWalkExplorer<bitNeighbor> test2(nh, eval2, sncomp, 3);
sol.fitness(2);
test2.initParam(sol);

View file

@ -45,7 +45,7 @@ int main() {
//test avec un neighbordhood ordonné
//Du coup on verifie juste qu'on a bien une evolution de la solution et qu'on fait 3 pas avant d'arreter l'exploration
moRandomWalkExplorer<bitNeighborhood> test(nh, eval, 3);
moRandomWalkExplorer<bitNeighbor> test(nh, eval, 3);
test.initParam(sol);

View file

@ -56,7 +56,7 @@ int main() {
moSolNeighborComparator<moDummyNeighborTest> solNeighborComp;
//verif constructor
moSimpleHCexplorer<moDummyNeighborhoodTest> test(nh, fulleval, comp, solNeighborComp);
moSimpleHCexplorer<moDummyNeighborTest> test(nh, fulleval, comp, solNeighborComp);
//verif operator() et accept: le neigorhood est construit pour qu'on tombe dans les 3 cas suivants:
//hasNeighbor() retourne faux a l'entrée de l'operator() donc on doit pas continuer

View file

@ -48,7 +48,7 @@ int main() {
moNeighborComparator<bitNeighbor> ncomp;
moSolNeighborComparator<bitNeighbor> sncomp;
moSimpleHCneutralExplorer<bitNeighborhood> test(nh, eval, ncomp, sncomp);
moSimpleHCneutralExplorer<bitNeighbor> test(nh, eval, ncomp, sncomp);
//test qu'on ameliore bien a chaque itération
test.initParam(sol);

View file

@ -55,8 +55,8 @@ int main() {
moSolVectorTabuList<bitNeighbor> tabuList(4,0);
moBestImprAspiration<bitNeighbor> aspir;
moTSExplorer<bitNeighborhood> test(nh, eval, ncomp, sncomp, tabuList, intens, diver, aspir);
moTSExplorer<bitNeighborhood> test2(emptyNH, eval, ncomp, sncomp, tabuList, intens, diver, aspir);
moTSExplorer<bitNeighbor> test(nh, eval, ncomp, sncomp, tabuList, intens, diver, aspir);
moTSExplorer<bitNeighbor> test2(emptyNH, eval, ncomp, sncomp, tabuList, intens, diver, aspir);
//test d'un voisinage vide
test2.initParam(sol);
@ -130,7 +130,7 @@ int main() {
bitNeighborhood nh2(2);
evalOneMax eval2(2);
moTSExplorer<bitNeighborhood> test3(nh2, eval2, ncomp, sncomp, tabuList, intens, diver, aspir);
moTSExplorer<bitNeighbor> test3(nh2, eval2, ncomp, sncomp, tabuList, intens, diver, aspir);
test3.initParam(sol2);
test3(sol2);

View file

@ -43,7 +43,7 @@ int main() {
std::cout << "[t-moTrueContinuator] => START" << std::endl;
moTrueContinuator<moDummyNeighborhoodTest> test;
moTrueContinuator<moDummyNeighborTest> test;
Solution s;
assert(test(s));