test added
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1742 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
2ca3863503
commit
5955b14f80
11 changed files with 419 additions and 1 deletions
|
|
@ -58,7 +58,8 @@ public:
|
|||
|
||||
/**
|
||||
* Initial temperature
|
||||
* @param _solution initial solution
|
||||
* @param _solution initial solution
|
||||
* @return the initial temperature
|
||||
*/
|
||||
double init(EOT & _solution) {
|
||||
// number of iteration with the same temperature
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@
|
|||
#include <eval/moEval.h>
|
||||
#include <eval/moFullEvalByCopy.h>
|
||||
#include <eval/moFullEvalByModif.h>
|
||||
#include <eval/moDummyEval.h>
|
||||
|
||||
#include <explorer/moFirstImprExplorer.h>
|
||||
#include <explorer/moHCneutralExplorer.h>
|
||||
|
|
@ -91,6 +92,8 @@
|
|||
#include <memory/moCountMoveMemory.h>
|
||||
|
||||
#include <neighborhood/moBackableNeighbor.h>
|
||||
#include <neighborhood/moDummyNeighbor.h>
|
||||
#include <neighborhood/moDummyNeighborhood.h>
|
||||
#include <neighborhood/moIndexNeighbor.h>
|
||||
#include <neighborhood/moIndexNeighborhood.h>
|
||||
#include <neighborhood/moNeighbor.h>
|
||||
|
|
@ -113,6 +116,11 @@
|
|||
#include <coolingSchedule/moSimpleCoolingSchedule.h>
|
||||
|
||||
#include <problems/bitString/moBitNeighbor.h>
|
||||
#include <problems/eval/oneMaxFullEval.h>
|
||||
#include <problems/eval/queenFullEval.h>
|
||||
#include <problems/permutation/moShiftNeighbor.h>
|
||||
#include <problems/permutation/moSwapNeighbor.h>
|
||||
#include <problems/permutation/moSwapNeighborhood.h>
|
||||
|
||||
//#include <old/moMove.h>
|
||||
//#include <old/moMoveIncrEval.h>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#define _moDummyNeighborhood_h
|
||||
|
||||
#include <neighborhood/moDummyNeighbor.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
|
||||
/**
|
||||
* Dummy Neighborhood
|
||||
|
|
|
|||
|
|
@ -59,6 +59,13 @@ SET (TEST_LIST
|
|||
t-moRandomNeutralWalkExplorer
|
||||
t-moTSExplorer
|
||||
t-moForwardVariableNeighborhood
|
||||
t-moSolComparator
|
||||
t-moDummyEval
|
||||
t-moDummyNeighbor
|
||||
t-moDummyNeighborhood
|
||||
t-moSimpleCoolingSchedule
|
||||
t-moAlwaysAcceptCrit
|
||||
t-moBetterAcceptCrit
|
||||
)
|
||||
|
||||
FOREACH (test ${TEST_LIST})
|
||||
|
|
|
|||
51
trunk/paradiseo-mo/test/t-moAlwaysAcceptCrit.cpp
Normal file
51
trunk/paradiseo-mo/test/t-moAlwaysAcceptCrit.cpp
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
<t-moAlwaysAcceptCrit.cpp>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include <acceptCrit/moAlwaysAcceptCrit.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moAlwaysAcceptCrit] => START" << std::endl;
|
||||
|
||||
bitVector sol1, sol2;
|
||||
|
||||
moAlwaysAcceptCrit<bitNeighbor> test;
|
||||
|
||||
assert(test(sol1,sol2));
|
||||
|
||||
std::cout << "[t-moAlwaysAcceptCrit] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
61
trunk/paradiseo-mo/test/t-moBetterAcceptCrit.cpp
Normal file
61
trunk/paradiseo-mo/test/t-moBetterAcceptCrit.cpp
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
<t-moBetterAcceptCrit.cpp>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include <comparator/moSolComparator.h>
|
||||
#include <acceptCrit/moBetterAcceptCrit.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moBetterAcceptCrit] => START" << std::endl;
|
||||
|
||||
bitVector sol1, sol2, sol3;
|
||||
|
||||
sol1.fitness(2);
|
||||
sol2.fitness(3);
|
||||
sol3.fitness(3);
|
||||
|
||||
moSolComparator<bitVector> comparator;
|
||||
|
||||
moBetterAcceptCrit<bitNeighbor> test(comparator);
|
||||
|
||||
assert(test(sol2, sol1));
|
||||
assert(!test(sol1, sol2));
|
||||
assert(!test(sol2, sol3));
|
||||
|
||||
|
||||
std::cout << "[t-moBetterAcceptCrit] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
46
trunk/paradiseo-mo/test/t-moDummyEval.cpp
Normal file
46
trunk/paradiseo-mo/test/t-moDummyEval.cpp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
<t-moDummyEval.cpp>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <eval/moDummyEval.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moDummyEval] => START" << std::endl;
|
||||
|
||||
moDummyEval<bitNeighbor> test;
|
||||
|
||||
std::cout << "[t-moDummyEval] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
47
trunk/paradiseo-mo/test/t-moDummyNeighbor.cpp
Normal file
47
trunk/paradiseo-mo/test/t-moDummyNeighbor.cpp
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
<t-moDummyNeighbor.cpp>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <neighborhood/moDummyNeighbor.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moDummyNeighbor] => START" << std::endl;
|
||||
|
||||
|
||||
moDummyNeighbor<bitVector> test;
|
||||
|
||||
std::cout << "[t-moDummyNeighbor] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
47
trunk/paradiseo-mo/test/t-moDummyNeighborhood.cpp
Normal file
47
trunk/paradiseo-mo/test/t-moDummyNeighborhood.cpp
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
<t-moDummyNeighborhood.cpp>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <neighborhood/moDummyNeighbor.h>
|
||||
#include <neighborhood/moDummyNeighborhood.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moDummyNeighborhood] => START" << std::endl;
|
||||
|
||||
moDummyNeighborhood<moDummyNeighbor<bitVector> > test;
|
||||
|
||||
std::cout << "[t-moDummyNeighborhood] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
88
trunk/paradiseo-mo/test/t-moSimpleCoolingSchedule.cpp
Normal file
88
trunk/paradiseo-mo/test/t-moSimpleCoolingSchedule.cpp
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
<t-moSimpleCoolingSchedule.cpp>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include <coolingSchedule/moSimpleCoolingSchedule.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moSimpleCoolingSchedule] => START" << std::endl;
|
||||
|
||||
double temperature;
|
||||
|
||||
bitVector sol;
|
||||
|
||||
moSimpleCoolingSchedule<bitVector> test(100, 0.1, 2, 0.1);
|
||||
|
||||
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));
|
||||
|
||||
//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==0.1);
|
||||
assert(!test(temperature));
|
||||
|
||||
|
||||
std::cout << "[t-moSimpleCoolingSchedule] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
61
trunk/paradiseo-mo/test/t-moSolComparator.cpp
Normal file
61
trunk/paradiseo-mo/test/t-moSolComparator.cpp
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
<t-moSolComparator.cpp>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include <eoScalarFitness.h>
|
||||
#include <comparator/moSolComparator.h>
|
||||
#include <ga/eoBit.h>
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moSolComparator] => START" << std::endl;
|
||||
|
||||
eoBit<eoMinimizingFitness> sol1, sol2, sol3;
|
||||
|
||||
moSolComparator< eoBit<eoMinimizingFitness> > test;
|
||||
|
||||
sol1.fitness(3);
|
||||
sol2.fitness(4);
|
||||
sol3.fitness(4);
|
||||
|
||||
assert(!test(sol1,sol2));
|
||||
assert(test(sol2,sol1));
|
||||
assert(!test.equals(sol1,sol2));
|
||||
assert(test.equals(sol2,sol3));
|
||||
|
||||
assert(test.className()=="moSolComparator");
|
||||
|
||||
std::cout << "[t-moSolComparator] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue