test added
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1809 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
a2cf7f781d
commit
c60f80b480
28 changed files with 701 additions and 53 deletions
|
|
@ -104,6 +104,15 @@ SET (TEST_LIST
|
|||
t-moMinusOneCounterStat
|
||||
t-moVectorMonitor
|
||||
t-moRandomSearchExplorer
|
||||
t-moSampling
|
||||
t-moDensityOfStatesSampling
|
||||
t-moAutocorrelationSampling
|
||||
t-moHillClimberSampling
|
||||
t-moFDCsampling
|
||||
t-moNeutralDegreeSampling
|
||||
t-moFitnessCloudSampling
|
||||
t-moNeutralWalkSampling
|
||||
t-moStatistics
|
||||
)
|
||||
|
||||
FOREACH (test ${TEST_LIST})
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
typedef eoBit<eoMinimizingFitness> bitVector;
|
||||
typedef moBitNeighbor<eoMinimizingFitness> bitNeighbor;
|
||||
|
||||
class moDummyRndNeighborhood: public moOrderNeighborhood<bitNeighbor>/*, public moRndNeighborhood<bitNeighbor>*/ {
|
||||
class moDummyRndNeighborhood: public moOrderNeighborhood<bitNeighbor>, public moRndNeighborhood<bitNeighbor> {
|
||||
public:
|
||||
moDummyRndNeighborhood(unsigned int a): moOrderNeighborhood<bitNeighbor>(a) {}
|
||||
};
|
||||
|
|
@ -205,8 +205,24 @@ private:
|
|||
};
|
||||
|
||||
class dummyInit: public eoInit<bitVector>{
|
||||
public:
|
||||
void operator()(bitVector& sol){
|
||||
}
|
||||
};
|
||||
|
||||
class dummyInit2: public eoInit<bitVector>{
|
||||
|
||||
public:
|
||||
dummyInit2(unsigned int _size):size(_size){}
|
||||
|
||||
void operator()(bitVector& sol){
|
||||
sol.resize(0);
|
||||
for(unsigned int i=0; i< size; i++)
|
||||
sol.push_back(true);
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int size;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
58
trunk/paradiseo-mo/test/t-moAutocorrelationSampling.cpp
Normal file
58
trunk/paradiseo-mo/test/t-moAutocorrelationSampling.cpp
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
<t-moAutocorrelationSampling.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 <sampling/moAutocorrelationSampling.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moAutocorrelationSampling] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
dummyInit2 init(4);
|
||||
|
||||
moAutocorrelationSampling<bitNeighbor> test(init, nh, fullEval, eval, 3);
|
||||
|
||||
test();
|
||||
|
||||
test.fileExport("outputTestAutocorrelationSampling");
|
||||
|
||||
|
||||
std::cout << "[t-moAutocorrelationSampling] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
54
trunk/paradiseo-mo/test/t-moDensityOfStatesSampling.cpp
Normal file
54
trunk/paradiseo-mo/test/t-moDensityOfStatesSampling.cpp
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
<t-moDensityOfStatesSampling.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 <sampling/moDensityOfStatesSampling.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moDensityOfStatesSampling] => START" << std::endl;
|
||||
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
dummyInit2 init(4);
|
||||
|
||||
moDensityOfStatesSampling<bitNeighbor> test(init, fullEval, 3);
|
||||
test();
|
||||
|
||||
test.fileExport("outputTestDensityOfState");
|
||||
|
||||
std::cout << "[t-moDensityOfStatesSampling] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
61
trunk/paradiseo-mo/test/t-moFDCsampling.cpp
Normal file
61
trunk/paradiseo-mo/test/t-moFDCsampling.cpp
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
<t-moFDCsampling.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 <sampling/moFDCsampling.h>
|
||||
#include "moTestClass.h"
|
||||
#include <utils/eoDistance.h>
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moFDCsampling] => START" << std::endl;
|
||||
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
dummyInit2 init(4);
|
||||
eoHammingDistance<bitVector> dist;
|
||||
bitVector sol(4, false);
|
||||
sol.fitness(0);
|
||||
|
||||
|
||||
moFDCsampling<bitNeighbor> test(init, fullEval, dist, sol, 3);
|
||||
|
||||
test();
|
||||
|
||||
test.fileExport("outputTestFDCsampling");
|
||||
|
||||
std::cout << "[t-moFDCsampling] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
75
trunk/paradiseo-mo/test/t-moFitnessCloudSampling.cpp
Normal file
75
trunk/paradiseo-mo/test/t-moFitnessCloudSampling.cpp
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
<t-moFitnessCloudSampling.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 <sampling/moFitnessCloudSampling.h>
|
||||
#include <sampling/moRndRndFitnessCloudSampling.h>
|
||||
#include <sampling/moRndBestFitnessCloudSampling.h>
|
||||
#include <sampling/moMHRndFitnessCloudSampling.h>
|
||||
#include <sampling/moMHBestFitnessCloudSampling.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moFitnessCloudSampling] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
dummyInit2 init(4);
|
||||
|
||||
moFitnessCloudSampling<bitNeighbor> test1(init, nh, fullEval, eval, 3);
|
||||
|
||||
moRndRndFitnessCloudSampling<bitNeighbor> test2(init, nh, fullEval, eval, 3);
|
||||
|
||||
moRndBestFitnessCloudSampling<bitNeighbor> test3(init, nh, fullEval, eval, 3);
|
||||
|
||||
moMHRndFitnessCloudSampling<bitNeighbor> test4(init, nh, fullEval, eval, 3);
|
||||
|
||||
moMHBestFitnessCloudSampling<bitNeighbor> test5(init, nh, fullEval, eval, 3);
|
||||
|
||||
test1();
|
||||
test2();
|
||||
test3();
|
||||
test4();
|
||||
test5();
|
||||
|
||||
test1.fileExport("outputTestFitnessCloudSampling");
|
||||
|
||||
|
||||
std::cout << "[t-moFitnessCloudSampling] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
57
trunk/paradiseo-mo/test/t-moHillClimberSampling.cpp
Normal file
57
trunk/paradiseo-mo/test/t-moHillClimberSampling.cpp
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
<t-moHillClimberSampling.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 <sampling/moHillClimberSampling.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moHillClimberSampling] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
dummyInit2 init(4);
|
||||
|
||||
moHillClimberSampling<bitNeighbor> test(init, nh, fullEval, eval, 3);
|
||||
|
||||
test();
|
||||
|
||||
test.fileExport("outputTestHillClimberSampling");
|
||||
|
||||
std::cout << "[t-moHillClimberSampling] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -42,7 +42,8 @@ int main(){
|
|||
moNeighborVectorTabuList<bitNeighbor> test(2,0);
|
||||
|
||||
|
||||
bitVector sol;
|
||||
bitVector sol(4,true);
|
||||
sol.fitness(0);
|
||||
bitNeighbor n1;
|
||||
bitNeighbor n2;
|
||||
bitNeighbor n3;
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ int main() {
|
|||
//test of moSecondMomentNeighborStat.h
|
||||
std::cout << "[t-moSecondMomentNeighborStat] => START" << std::endl;
|
||||
moSecondMomentNeighborStat<bitNeighbor> test7(test);
|
||||
test7.init(sol);
|
||||
test7(sol);
|
||||
assert(test7.value().first==6.6);
|
||||
assert(test7.value().second > 0.966 && test7.value().second < 0.967);
|
||||
|
|
|
|||
64
trunk/paradiseo-mo/test/t-moNeutralDegreeSampling.cpp
Normal file
64
trunk/paradiseo-mo/test/t-moNeutralDegreeSampling.cpp
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
<t-moNeutralDegreeSampling.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 <sampling/moNeutralDegreeSampling.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moNeutralDegreeSampling] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
dummyInit2 init(4);
|
||||
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
|
||||
moNeutralDegreeSampling<bitNeighbor> test1(init, nh, fullEval, eval, 3);
|
||||
moNeutralDegreeSampling<bitNeighbor> test2(init, nh, fullEval, eval, ncomp, sncomp, 3);
|
||||
|
||||
test1();
|
||||
|
||||
test1.fileExport("outputNeutralDegreeSampling");
|
||||
|
||||
std::cout << "[t-moNeutralDegreeSampling] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
62
trunk/paradiseo-mo/test/t-moNeutralWalkSampling.cpp
Normal file
62
trunk/paradiseo-mo/test/t-moNeutralWalkSampling.cpp
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
<t-moNeutralWalkSampling.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 <sampling/moNeutralWalkSampling.h>
|
||||
#include "moTestClass.h"
|
||||
#include <utils/eoDistance.h>
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
int main(){
|
||||
|
||||
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;
|
||||
|
||||
moNeutralWalkSampling<bitNeighbor> test(sol, nh, fullEval, eval, dist, 3);
|
||||
|
||||
test();
|
||||
|
||||
test.fileExport("outputTestNeutralWalkSampling");
|
||||
|
||||
std::cout << "[t-moNeutralWalkSampling] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
81
trunk/paradiseo-mo/test/t-moSampling.cpp
Normal file
81
trunk/paradiseo-mo/test/t-moSampling.cpp
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
<t-moSampling.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 <sampling/moSampling.h>
|
||||
#include "moTestClass.h"
|
||||
#include <algo/moFirstImprHC.h>
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include <continuator/moSolutionStat.h>
|
||||
#include <continuator/moCounterStat.h>
|
||||
#include <continuator/moIterContinuator.h>
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moSampling] => START" << std::endl;
|
||||
|
||||
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);
|
||||
|
||||
test.add(stat2);
|
||||
|
||||
test();
|
||||
|
||||
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<res.size(); i++)
|
||||
assert(res[i]==i);
|
||||
|
||||
test.fileExport("outputTestSampling1");
|
||||
test.fileExport(1, "outputTestSampling2");
|
||||
|
||||
assert(test.className()=="moSampling");
|
||||
|
||||
std::cout << "[t-moSampling] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -55,6 +55,7 @@ int main() {
|
|||
moNeighborComparator<moDummyNeighborTest> comp;
|
||||
moSolNeighborComparator<moDummyNeighborTest> solNeighborComp;
|
||||
|
||||
|
||||
//verif constructor
|
||||
moSimpleHCexplorer<moDummyNeighborTest> test(nh, fulleval, comp, solNeighborComp);
|
||||
|
||||
|
|
|
|||
111
trunk/paradiseo-mo/test/t-moStatistics.cpp
Normal file
111
trunk/paradiseo-mo/test/t-moStatistics.cpp
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
<t-moStatistics.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 <sampling/moStatistics.h>
|
||||
#include "moTestClass.h"
|
||||
#include <utils/eoDistance.h>
|
||||
|
||||
int main(){
|
||||
|
||||
std::cout << "[t-moStatistics] => START" << std::endl;
|
||||
|
||||
moStatistics test;
|
||||
|
||||
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.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);
|
||||
|
||||
//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;
|
||||
|
||||
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[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);
|
||||
|
||||
//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);
|
||||
|
||||
test.autocorrelation(sampling, 2, rho, phi);
|
||||
|
||||
std::cout << "[t-moStatistics] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue