Migration from SVN
This commit is contained in:
parent
d7d6c3a217
commit
8cd56f37db
29069 changed files with 0 additions and 4096888 deletions
112
mo/test/CMakeLists.txt
Normal file
112
mo/test/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
######################################################################################
|
||||
### 0) Include headers
|
||||
######################################################################################
|
||||
|
||||
include_directories(${EO_SRC_DIR}/src)
|
||||
include_directories(${MO_SRC_DIR}/src)
|
||||
include_directories(${PROBLEMS_SRC_DIR})
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
######################################################################################
|
||||
### 1) Define test list
|
||||
######################################################################################
|
||||
|
||||
set (TEST_LIST
|
||||
t-moAdaptiveWalkSampling
|
||||
t-moNeighbor
|
||||
t-moBitNeighbor
|
||||
t-moOrderNeighborhood
|
||||
t-moFullEvalByCopy
|
||||
t-moFullEvalByModif
|
||||
t-moNeighborComparator
|
||||
t-moSolNeighborComparator
|
||||
t-moTrueContinuator
|
||||
t-moRndWithoutReplNeighborhood
|
||||
t-moRndWithReplNeighborhood
|
||||
t-moFitnessStat
|
||||
t-moDistanceStat
|
||||
t-moNeighborhoodStat
|
||||
t-moCounterMonitorSaver
|
||||
t-moSolutionStat
|
||||
t-moCheckpoint
|
||||
t-moDummyMemory
|
||||
t-moSolVectorTabuList
|
||||
t-moBestImprAspiration
|
||||
t-moSimpleHCexplorer
|
||||
t-moRandomBestHCexplorer
|
||||
t-moNeutralHCexplorer
|
||||
t-moFirstImprHCexplorer
|
||||
t-moRandomWalkExplorer
|
||||
t-moMetropolisHastingExplorer
|
||||
t-moRandomNeutralWalkExplorer
|
||||
t-moTSexplorer
|
||||
t-moSolComparator
|
||||
t-moDummyEval
|
||||
t-moDummyNeighbor
|
||||
t-moDummyNeighborhood
|
||||
t-moSimpleCoolingSchedule
|
||||
t-moAlwaysAcceptCrit
|
||||
t-moBetterAcceptCrit
|
||||
t-moCountMoveMemory
|
||||
t-moMonOpPerturb
|
||||
t-moRestartPerturb
|
||||
t-moNeighborhoodPerturb
|
||||
t-moSAexplorer
|
||||
t-moSA
|
||||
t-moLocalSearch
|
||||
t-moILSexplorer
|
||||
t-moSimpleHC
|
||||
t-moFirstImprHC
|
||||
t-moRandomBestHC
|
||||
t-moNeighborVectorTabuList
|
||||
t-moMonOpDiversification
|
||||
t-moTS
|
||||
t-moILS
|
||||
t-moDummyLS
|
||||
t-moRandomSearch
|
||||
t-moMetropolisHasting
|
||||
t-moNeutralHC
|
||||
t-moRandomWalk
|
||||
t-moRandomNeutralWalk
|
||||
t-moIterContinuator
|
||||
t-moFitContinuator
|
||||
t-moCombinedContinuator
|
||||
t-moFullEvalContinuator
|
||||
t-moNeighborEvalContinuator
|
||||
t-moTimeContinuator
|
||||
t-moDummyExplorer
|
||||
t-moLocalSearchInit
|
||||
t-moSolInit
|
||||
t-moEvalCounter
|
||||
t-moNeighborBestStat
|
||||
t-moCounterStat
|
||||
t-moMinusOneCounterStat
|
||||
t-moVectorMonitor
|
||||
t-moRandomSearchExplorer
|
||||
t-moSampling
|
||||
t-moDensityOfStatesSampling
|
||||
t-moAutocorrelationSampling
|
||||
t-moHillClimberSampling
|
||||
t-moFDCsampling
|
||||
t-moNeutralDegreeSampling
|
||||
t-moFitnessCloudSampling
|
||||
t-moNeutralWalkSampling
|
||||
t-moStatistics
|
||||
t-moIndexedVectorTabuList
|
||||
t-moRndIndexedVectorTabuList
|
||||
t-moDynSpanCoolingSchedule
|
||||
)
|
||||
|
||||
######################################################################################
|
||||
### 3) Create each test
|
||||
######################################################################################
|
||||
|
||||
foreach (test ${TEST_LIST})
|
||||
set ("T_${test}_SOURCES" "${test}.cpp")
|
||||
add_executable(${test} ${T_${test}_SOURCES})
|
||||
add_test(${test} ${test})
|
||||
target_link_libraries(${test} ga es eoutils eo)
|
||||
install(TARGETS ${test} RUNTIME DESTINATION local/share${INSTALL_SUB_DIR}/mo/test COMPONENT tests)
|
||||
endforeach (test)
|
||||
|
||||
|
||||
251
mo/test/moTestClass.h
Normal file
251
mo/test/moTestClass.h
Normal file
|
|
@ -0,0 +1,251 @@
|
|||
/*
|
||||
<moTestClass.h>
|
||||
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 use,
|
||||
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".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#ifndef _moTestClass_h
|
||||
#define _moTestClass_h
|
||||
|
||||
#include <EO.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <neighborhood/moNeighbor.h>
|
||||
#include <neighborhood/moBackableNeighbor.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
#include <neighborhood/moRndNeighborhood.h>
|
||||
#include <eval/moEval.h>
|
||||
|
||||
#include <ga/eoBit.h>
|
||||
#include <eoScalarFitness.h>
|
||||
#include <neighborhood/moOrderNeighborhood.h>
|
||||
#include <problems/bitString/moBitNeighbor.h>
|
||||
#include <neighborhood/moIndexNeighbor.h>
|
||||
|
||||
#include <utils/eoMonitor.h>
|
||||
#include <utils/eoUpdater.h>
|
||||
|
||||
#include <eoInit.h>
|
||||
|
||||
typedef eoBit<eoMinimizingFitness> bitVector;
|
||||
typedef moBitNeighbor<eoMinimizingFitness> bitNeighbor;
|
||||
|
||||
class moDummyRndNeighborhood: public moOrderNeighborhood<bitNeighbor> ,
|
||||
public moRndNeighborhood<bitNeighbor> {
|
||||
public:
|
||||
moDummyRndNeighborhood(unsigned int a) :
|
||||
moOrderNeighborhood<bitNeighbor> (a) {
|
||||
}
|
||||
};
|
||||
|
||||
typedef moDummyRndNeighborhood bitNeighborhood;
|
||||
|
||||
typedef EO<int> Solution;
|
||||
|
||||
class moDummyNeighborTest: public moNeighbor<Solution> {
|
||||
public:
|
||||
virtual void move(Solution & _solution) {
|
||||
}
|
||||
};
|
||||
|
||||
class moDummyBackableNeighbor: public moBackableNeighbor<Solution> {
|
||||
public:
|
||||
virtual void move(Solution & _solution) {
|
||||
}
|
||||
virtual void moveBack(Solution & _solution) {
|
||||
}
|
||||
};
|
||||
|
||||
class moDummyNeighborhoodTest: public moNeighborhood<moDummyNeighborTest> {
|
||||
public:
|
||||
typedef moDummyNeighborTest Neighbor;
|
||||
|
||||
moDummyNeighborhoodTest() :
|
||||
i(0), j(0) {
|
||||
}
|
||||
|
||||
virtual bool hasNeighbor(EOT & _solution) {
|
||||
bool res;
|
||||
if (i % 3 == 0 || i == 1)
|
||||
res = false;
|
||||
else
|
||||
res = true;
|
||||
i++;
|
||||
return res;
|
||||
}
|
||||
virtual void init(EOT & _solution, Neighbor & _current) {
|
||||
}
|
||||
virtual void next(EOT & _solution, Neighbor & _current) {
|
||||
}
|
||||
virtual bool cont(EOT & _solution) {
|
||||
j++;
|
||||
return (j % 10 != 0);
|
||||
}
|
||||
|
||||
private:
|
||||
int i, j;
|
||||
};
|
||||
|
||||
class moDummyEvalTest: public eoEvalFunc<Solution> {
|
||||
public:
|
||||
void operator()(Solution& _sol) {
|
||||
if (_sol.invalid())
|
||||
_sol.fitness(100);
|
||||
else
|
||||
_sol.fitness(_sol.fitness() + 50);
|
||||
}
|
||||
};
|
||||
|
||||
class evalOneMax: public moEval<bitNeighbor> {
|
||||
private:
|
||||
unsigned size;
|
||||
|
||||
public:
|
||||
evalOneMax(unsigned _size) :
|
||||
size(_size) {
|
||||
}
|
||||
;
|
||||
|
||||
~evalOneMax(void) {
|
||||
}
|
||||
;
|
||||
|
||||
void operator()(bitVector& _sol, bitNeighbor& _n) {
|
||||
unsigned int fit = _sol.fitness();
|
||||
if (_sol[_n.index()])
|
||||
fit--;
|
||||
else
|
||||
fit++;
|
||||
_n.fitness(fit);
|
||||
}
|
||||
};
|
||||
|
||||
class dummyEvalOneMax: public moEval<bitNeighbor> {
|
||||
private:
|
||||
unsigned size;
|
||||
|
||||
public:
|
||||
dummyEvalOneMax(unsigned _size) :
|
||||
size(_size) {
|
||||
}
|
||||
;
|
||||
|
||||
~dummyEvalOneMax(void) {
|
||||
}
|
||||
;
|
||||
|
||||
void operator()(bitVector& _sol, bitNeighbor& _n) {
|
||||
unsigned int fit = _sol.fitness();
|
||||
_n.fitness(fit);
|
||||
}
|
||||
};
|
||||
|
||||
class monitor1: public eoMonitor {
|
||||
public:
|
||||
|
||||
monitor1(unsigned int& _a) :
|
||||
a(_a) {
|
||||
}
|
||||
|
||||
eoMonitor& operator()() {
|
||||
a++;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void lastCall() {
|
||||
a++;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int& a;
|
||||
};
|
||||
|
||||
class monitor2: public eoMonitor {
|
||||
public:
|
||||
|
||||
monitor2(unsigned int& _a) :
|
||||
a(_a) {
|
||||
}
|
||||
|
||||
eoMonitor& operator()() {
|
||||
a++;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void lastCall() {
|
||||
a++;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int& a;
|
||||
};
|
||||
|
||||
class updater1: public eoUpdater {
|
||||
public:
|
||||
updater1(unsigned int& _a) :
|
||||
a(_a) {
|
||||
}
|
||||
|
||||
void operator()() {
|
||||
a++;
|
||||
}
|
||||
|
||||
void lastCall() {
|
||||
a++;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int& a;
|
||||
};
|
||||
|
||||
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
|
||||
77
mo/test/t-moAdaptiveWalkSampling.cpp
Executable file
77
mo/test/t-moAdaptiveWalkSampling.cpp
Executable file
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
<t-moAdaptiveWalkSampling.cpp>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Boufaras Karima
|
||||
|
||||
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/moAdaptiveWalkSampling.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-moAdaptiveWalkSampling] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(5);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(5);
|
||||
dummyInit2 init(5);
|
||||
moIterContinuator<bitNeighbor> cont(2);
|
||||
|
||||
moAdaptiveWalkSampling<bitNeighbor> test(init,nh,fullEval,eval,3);
|
||||
moCounterStat<bitVector> stat2;
|
||||
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()==5-i);
|
||||
|
||||
for (unsigned int i=0; i<res.size(); i++)
|
||||
assert(res[i]==i);
|
||||
|
||||
test.fileExport("outputTestAdaptativeWalkSampling1");
|
||||
test.fileExport(1, "outputTestAdaptativeWalkSampling2");
|
||||
|
||||
|
||||
std::cout << "[t-moAdaptiveWalkSampling] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
51
mo/test/t-moAlwaysAcceptCrit.cpp
Normal file
51
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;
|
||||
}
|
||||
|
||||
58
mo/test/t-moAutocorrelationSampling.cpp
Normal file
58
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;
|
||||
}
|
||||
|
||||
78
mo/test/t-moBestImprAspiration.cpp
Normal file
78
mo/test/t-moBestImprAspiration.cpp
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
<t-moBestImprAspiration.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 <memory/moBestImprAspiration.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moBestImprAspiration] => START" << std::endl;
|
||||
|
||||
moBestImprAspiration<bitNeighbor> test;
|
||||
eoBit<eoMinimizingFitness> sol1(4);
|
||||
eoBit<eoMinimizingFitness> sol2(4);
|
||||
eoBit<eoMinimizingFitness> sol3(4);
|
||||
eoBit<eoMinimizingFitness> sol4(4);
|
||||
bitNeighbor n1;
|
||||
bitNeighbor n2;
|
||||
bitNeighbor n3;
|
||||
bitNeighbor n4;
|
||||
|
||||
sol3[0]=true;
|
||||
sol4[3]=true;
|
||||
|
||||
sol1.fitness(4);
|
||||
sol2.fitness(5);
|
||||
sol3.fitness(3);
|
||||
sol4.fitness(3);
|
||||
n1.fitness(4);
|
||||
n2.fitness(5);
|
||||
n3.fitness(3);
|
||||
n4.fitness(3);
|
||||
|
||||
|
||||
//verification qu'on update bien le best so far quand il faut
|
||||
test.init(sol1);
|
||||
assert(test.getBest()==sol1);
|
||||
assert(!test(sol2,n2));
|
||||
assert(test(sol3,n3));
|
||||
test.update(sol3,n3);
|
||||
assert(test.getBest()==sol3);
|
||||
assert(!test(sol4,n4));
|
||||
test.update(sol4,n4);
|
||||
assert(test.getBest()==sol3);
|
||||
|
||||
std::cout << "[t-moBestImprAspiration] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
61
mo/test/t-moBetterAcceptCrit.cpp
Normal file
61
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;
|
||||
}
|
||||
|
||||
85
mo/test/t-moBitNeighbor.cpp
Normal file
85
mo/test/t-moBitNeighbor.cpp
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
<t-moBitNeighborh.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 use,
|
||||
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".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
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 <problems/bitString/moBitNeighbor.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moBitNeighbor] => START" << std::endl;
|
||||
|
||||
//init sol
|
||||
eoBit<int> sol;
|
||||
sol.push_back(true);
|
||||
sol.push_back(false);
|
||||
sol.push_back(true);
|
||||
|
||||
//verif du constructeur vide
|
||||
moBitNeighbor<int> test1;
|
||||
assert(test1.index()==0);
|
||||
|
||||
//verif du setter d'index et du constructeur de copy
|
||||
test1.index(6);
|
||||
test1.fitness(2);
|
||||
moBitNeighbor<int> test2(test1);
|
||||
assert(test2.index()==6);
|
||||
assert(test2.fitness()==2);
|
||||
|
||||
//verif du getter
|
||||
assert(test1.index()==6);
|
||||
|
||||
//verif de l'operateur=
|
||||
test1.fitness(8);
|
||||
test1.index(2);
|
||||
test2=test1;
|
||||
assert(test2.fitness()==8);
|
||||
assert(test2.index()==2);
|
||||
|
||||
//verif de move
|
||||
test2.move(sol);
|
||||
assert(!sol[2]);
|
||||
|
||||
//verif de moveBack
|
||||
test2.moveBack(sol);
|
||||
assert(sol[2]);
|
||||
|
||||
test1.printOn(std::cout);
|
||||
test2.printOn(std::cout);
|
||||
|
||||
assert(test1.className()=="moBitNeighbor");
|
||||
std::cout << "[t-moBitNeighbor] => OK" << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
122
mo/test/t-moCheckpoint.cpp
Normal file
122
mo/test/t-moCheckpoint.cpp
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
<t-moCheckpoint.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 <continuator/moCheckpoint.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
#include <continuator/moSolutionStat.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moCheckpoint] => START" << std::endl;
|
||||
|
||||
unsigned int a=2;
|
||||
unsigned int b=15;
|
||||
unsigned int c= 10;
|
||||
unsigned int d= 47;
|
||||
|
||||
eoBit<eoMinimizingFitness> s(3);
|
||||
s[0]=true;
|
||||
s[1]=true;
|
||||
s[2]=false;
|
||||
|
||||
s.fitness(17);
|
||||
|
||||
|
||||
//verification que toutes les operateurs sont bien apellés
|
||||
moSolutionStat< eoBit< eoMinimizingFitness > > stat;
|
||||
updater1 up1(a);
|
||||
updater1 up2(b);
|
||||
monitor1 mon1(c);
|
||||
monitor2 mon2(d);
|
||||
moTrueContinuator< bitNeighbor > cont;
|
||||
|
||||
moCheckpoint< bitNeighbor > test1(cont);
|
||||
moCheckpoint< bitNeighbor > test2(cont, 3);
|
||||
|
||||
test1.add(up1);
|
||||
test1.add(up2);
|
||||
test1.add(mon1);
|
||||
test1.add(mon2);
|
||||
test1.add(stat);
|
||||
|
||||
test2.add(up1);
|
||||
test2.add(up2);
|
||||
test2.add(mon1);
|
||||
test2.add(mon2);
|
||||
test2.add(stat);
|
||||
|
||||
test1.init(s);
|
||||
test1(s);
|
||||
assert(a==3 && b==16 && c==12 && d==49);
|
||||
assert(stat.value()[0]);
|
||||
assert(stat.value()[1]);
|
||||
assert(!stat.value()[2]);
|
||||
assert(stat.value().fitness()==17);
|
||||
|
||||
test1(s);
|
||||
assert(a==4 && b==17 && c==13 && d==50);
|
||||
assert(stat.value()[0]);
|
||||
assert(stat.value()[1]);
|
||||
assert(!stat.value()[2]);
|
||||
assert(stat.value().fitness()==17);
|
||||
|
||||
s.fitness(4);
|
||||
|
||||
test2.init(s);
|
||||
test2(s);
|
||||
assert(a==5 && b==18 && c==15 && d==52);
|
||||
assert(stat.value()[0]);
|
||||
assert(stat.value()[1]);
|
||||
assert(!stat.value()[2]);
|
||||
assert(stat.value().fitness()==4);
|
||||
|
||||
s.fitness(6);
|
||||
test2(s);
|
||||
assert(stat.value().fitness()==4);
|
||||
test2(s);
|
||||
assert(stat.value().fitness()==6);
|
||||
test2(s);
|
||||
assert(stat.value().fitness()==6);
|
||||
|
||||
test1.lastCall(s);
|
||||
assert(a==9 && b==22 && c==19 && d==56);
|
||||
test2.lastCall(s);
|
||||
assert(a==10 && b==23 && c==20 && d==57);
|
||||
|
||||
assert(test1.className()=="moCheckpoint");
|
||||
std::cout << "[t-moCheckpoint] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
65
mo/test/t-moCombinedContinuator.cpp
Normal file
65
mo/test/t-moCombinedContinuator.cpp
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
<t-moCombinedContinuator.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 <continuator/moCombinedContinuator.h>
|
||||
#include <continuator/moIterContinuator.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moCombinedContinuator] => START" << std::endl;
|
||||
|
||||
moIterContinuator<moDummyNeighborTest> cont1(3, false);
|
||||
moTrueContinuator<moDummyNeighborTest> cont2;
|
||||
|
||||
moCombinedContinuator<moDummyNeighborTest> test(cont2);
|
||||
test.add(cont1);
|
||||
|
||||
Solution s;
|
||||
|
||||
test.init(s);
|
||||
assert(test(s));
|
||||
assert(test(s));
|
||||
assert(!test(s));
|
||||
test.init(s);
|
||||
assert(test(s));
|
||||
assert(test(s));
|
||||
assert(!test(s));
|
||||
|
||||
std::cout << "[t-moCombinedContinuator] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
91
mo/test/t-moCountMoveMemory.cpp
Normal file
91
mo/test/t-moCountMoveMemory.cpp
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
<t-moCountMoveMemory.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 <memory/moCountMoveMemory.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moCountMoveMemory] => START" << std::endl;
|
||||
|
||||
bitVector sol;
|
||||
bitNeighbor n;
|
||||
|
||||
|
||||
moCountMoveMemory<bitNeighbor> test;
|
||||
|
||||
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()==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.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()==3);
|
||||
assert(test.getCounter()==2);
|
||||
|
||||
test.clearMemory();
|
||||
assert(test.getNbMove()==0);
|
||||
assert(test.getNbNoMove()==0);
|
||||
assert(test.getCounter()==0);
|
||||
|
||||
std::cout << "[t-moCountMoveMemory] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
71
mo/test/t-moCounterMonitorSaver.cpp
Normal file
71
mo/test/t-moCounterMonitorSaver.cpp
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
<t-moCounterMonitorSaver.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 <continuator/moCounterMonitorSaver.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moCounterMonitorSaver] => START" << std::endl;
|
||||
|
||||
unsigned int a=1;
|
||||
unsigned int b=10;
|
||||
|
||||
monitor1 mon1(a);
|
||||
monitor2 mon2(b);
|
||||
|
||||
moCounterMonitorSaver test(3, mon1);
|
||||
test.add(mon2);
|
||||
|
||||
//on verifie qu'on apelle les moniteurs seulement tout les 3 itération
|
||||
|
||||
test();
|
||||
assert(a==2 && b==11);
|
||||
test();
|
||||
assert(a==2 && b==11);
|
||||
test();
|
||||
assert(a==2 && b==11);
|
||||
test();
|
||||
assert(a==3 && b==12);
|
||||
|
||||
//test du lastCall
|
||||
test.lastCall();
|
||||
assert(a==4 && b==13);
|
||||
|
||||
assert(test.className()=="moCounterMonitorSaver");
|
||||
std::cout << "[t-moCounterMonitorSaver] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
62
mo/test/t-moCounterStat.cpp
Normal file
62
mo/test/t-moCounterStat.cpp
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
<t-moCounterStat.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 <continuator/moCounterStat.h>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moCounterStat] => START" << std::endl;
|
||||
|
||||
moCounterStat<int> test;
|
||||
|
||||
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);
|
||||
|
||||
assert(test.className()=="moCounterStat");
|
||||
|
||||
std::cout << "[t-moCounterStat] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
54
mo/test/t-moDensityOfStatesSampling.cpp
Normal file
54
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;
|
||||
}
|
||||
|
||||
73
mo/test/t-moDistanceStat.cpp
Normal file
73
mo/test/t-moDistanceStat.cpp
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
<t-moDistanceStat.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 <problems/bitString/moBitNeighbor.h>
|
||||
#include <continuator/moDistanceStat.h>
|
||||
#include <utils/eoDistance.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moDistanceStat] => START" << std::endl;
|
||||
|
||||
eoBit<int> sol1;
|
||||
eoBit<int> sol2;
|
||||
eoBit<int> sol3;
|
||||
sol1.push_back(true);
|
||||
sol1.push_back(false);
|
||||
sol1.push_back(true);
|
||||
|
||||
sol2.push_back(true);
|
||||
sol2.push_back(true);
|
||||
sol2.push_back(false);
|
||||
|
||||
sol3.push_back(true);
|
||||
sol3.push_back(true);
|
||||
sol3.push_back(true);
|
||||
|
||||
//verification de la stat avec une distance de Hamming
|
||||
|
||||
eoHammingDistance< eoBit<int> > dist;
|
||||
|
||||
moDistanceStat< eoBit<int> > test(dist, sol1);
|
||||
|
||||
test(sol2);
|
||||
assert(test.value()==2);
|
||||
test(sol3);
|
||||
assert(test.value()==1);
|
||||
|
||||
assert(test.className()=="moDistanceStat");
|
||||
std::cout << "[t-moDistanceStat] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
46
mo/test/t-moDummyEval.cpp
Normal file
46
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;
|
||||
}
|
||||
|
||||
49
mo/test/t-moDummyExplorer.cpp
Normal file
49
mo/test/t-moDummyExplorer.cpp
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
<t-moDummyExplorer.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 <explorer/moDummyExplorer.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moDummyExplorer] => START" << std::endl;
|
||||
|
||||
moDummyExplorer<bitNeighbor> test;
|
||||
|
||||
assert(test.className()=="moDummyExplorer");
|
||||
|
||||
std::cout << "[t-moDummyExplorer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
51
mo/test/t-moDummyLS.cpp
Normal file
51
mo/test/t-moDummyLS.cpp
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
<t-moDummyLS.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 <algo/moDummyLS.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moDummyLS] => START" << std::endl;
|
||||
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
moDummyLS<bitNeighbor> test(fullEval);
|
||||
|
||||
assert(test.className()=="moDummyLS");
|
||||
|
||||
std::cout << "[t-moDummyLS] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
63
mo/test/t-moDummyMemory.cpp
Normal file
63
mo/test/t-moDummyMemory.cpp
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
<t-moDummyMemory.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 <memory/moDummyIntensification.h>
|
||||
#include <memory/moDummyDiversification.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moDummyMemory] => START" << std::endl;
|
||||
|
||||
eoBit<eoMinimizingFitness> sol(4);
|
||||
bitNeighbor n;
|
||||
moDummyDiversification<bitNeighbor> test1;
|
||||
test1.init(sol);
|
||||
test1.add(sol, n);
|
||||
test1.update(sol, n);
|
||||
test1.clearMemory();
|
||||
assert(!test1(sol));
|
||||
|
||||
moDummyIntensification<bitNeighbor> test2;
|
||||
test2.init(sol);
|
||||
test2.add(sol, n);
|
||||
test2.update(sol, n);
|
||||
test2.clearMemory();
|
||||
assert(!test2(sol));
|
||||
|
||||
|
||||
std::cout << "[t-moDummyMemory] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
46
mo/test/t-moDummyNeighbor.cpp
Normal file
46
mo/test/t-moDummyNeighbor.cpp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
<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;
|
||||
}
|
||||
|
||||
56
mo/test/t-moDummyNeighborhood.cpp
Normal file
56
mo/test/t-moDummyNeighborhood.cpp
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
<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;
|
||||
|
||||
bitVector sol;
|
||||
moDummyNeighbor<bitVector> n;
|
||||
|
||||
moDummyNeighborhood<moDummyNeighbor<bitVector> > test;
|
||||
|
||||
assert(!test.hasNeighbor(sol));
|
||||
assert(!test.cont(sol));
|
||||
test.init(sol,n);
|
||||
test.next(sol,n);
|
||||
|
||||
|
||||
std::cout << "[t-moDummyNeighborhood] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
91
mo/test/t-moDynSpanCoolingSchedule.cpp
Executable file
91
mo/test/t-moDynSpanCoolingSchedule.cpp
Executable file
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
<t-moDynSpanCoolingSchedule.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/moDynSpanCoolingSchedule.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moDynSpanCoolingSchedule] => START" << std::endl;
|
||||
|
||||
double temperature;
|
||||
|
||||
bitVector sol;
|
||||
|
||||
moDynSpanCoolingSchedule<bitVector> test(100, 0.1, 3, 2, 2);
|
||||
|
||||
temperature = test.init(sol);
|
||||
assert(temperature == 100);
|
||||
|
||||
//temperature must not changed 2*
|
||||
test.update(temperature, 0);
|
||||
assert(temperature == 100);
|
||||
assert(test(temperature));
|
||||
test.update(temperature, 0);
|
||||
assert(temperature == 100);
|
||||
assert(test(temperature));
|
||||
|
||||
//then temperature must be /10
|
||||
test.update(temperature, 0);
|
||||
assert(temperature == 10);
|
||||
assert(test(temperature));
|
||||
test.update(temperature, 0);
|
||||
assert(temperature == 10);
|
||||
assert(test(temperature));
|
||||
test.update(temperature, 0);
|
||||
assert(temperature == 10);
|
||||
assert(test(temperature));
|
||||
|
||||
test.update(temperature, 0);
|
||||
assert(temperature == 1);
|
||||
std::cout << "\n";
|
||||
assert(test(temperature));
|
||||
test.update(temperature, 0);
|
||||
std::cout << "\n";
|
||||
assert(temperature == 1);
|
||||
assert(test(temperature));
|
||||
test.update(temperature, 0);
|
||||
std::cout << "\n";
|
||||
assert(temperature == 1);
|
||||
assert(test(temperature));
|
||||
|
||||
test.update(temperature, 0);
|
||||
assert(temperature == 0.1);
|
||||
assert(!test(temperature));
|
||||
|
||||
|
||||
std::cout << "[t-moDynSpanCoolingSchedule] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
66
mo/test/t-moEvalCounter.cpp
Normal file
66
mo/test/t-moEvalCounter.cpp
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
<t-moEvalCounter.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/moEvalCounter.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main() {
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
std::cout << "[t-moEvalCounter] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
61
mo/test/t-moFDCsampling.cpp
Normal file
61
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;
|
||||
}
|
||||
|
||||
64
mo/test/t-moFirstImprHC.cpp
Normal file
64
mo/test/t-moFirstImprHC.cpp
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
<t-moFirstImprHC.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 <algo/moFirstImprHC.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moFirstImprHC] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
|
||||
//test first constructor
|
||||
moFirstImprHC<bitNeighbor> test1(nh, fullEval, eval);
|
||||
|
||||
//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);
|
||||
|
||||
std::cout << "[t-moFirstImprHC] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
93
mo/test/t-moFirstImprHCexplorer.cpp
Normal file
93
mo/test/t-moFirstImprHCexplorer.cpp
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
<t-moFirstImprExplorer.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 <comparator/moNeighborComparator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <explorer/moFirstImprHCexplorer.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moFirstImprHCexplorer] => START" << std::endl;
|
||||
|
||||
//Instanciation
|
||||
eoBit<eoMinimizingFitness> sol(4, true);
|
||||
sol.fitness(4);
|
||||
bitNeighborhood nh(4);
|
||||
evalOneMax eval(4);
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
|
||||
moFirstImprHCexplorer<bitNeighbor> test(nh, eval, ncomp, sncomp);
|
||||
|
||||
//on verifie qu'on améliore peut continuer à explorer tant qu'on améliore la solution
|
||||
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==3);
|
||||
assert(!sol[0]);
|
||||
assert(test.isContinue(sol));
|
||||
|
||||
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==2);
|
||||
assert(!sol[1]);
|
||||
assert(test.isContinue(sol));
|
||||
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==1);
|
||||
assert(!sol[2]);
|
||||
assert(test.isContinue(sol));
|
||||
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==0);
|
||||
assert(!sol[3]);
|
||||
assert(test.isContinue(sol));
|
||||
|
||||
test(sol);
|
||||
assert(!test.accept(sol));
|
||||
assert(sol.fitness()==0);
|
||||
assert(!test.isContinue(sol));
|
||||
|
||||
std::cout << "[t-moFirstImprHCexplorer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
61
mo/test/t-moFitContinuator.cpp
Normal file
61
mo/test/t-moFitContinuator.cpp
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
<t-moFitContinuator.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 <continuator/moFitContinuator.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moFitContinuator] => START" << std::endl;
|
||||
|
||||
moFitContinuator<bitNeighbor> test1(3);
|
||||
moFitContinuator<moDummyNeighborTest> test2(5);
|
||||
|
||||
bitVector sol1;
|
||||
Solution sol2;
|
||||
|
||||
sol1.fitness(4);
|
||||
assert(test1(sol1));
|
||||
sol1.fitness(3);
|
||||
assert(!test1(sol1));
|
||||
|
||||
sol2.fitness(3);
|
||||
assert(test2(sol2));
|
||||
sol2.fitness(5);
|
||||
assert(!test2(sol2));
|
||||
|
||||
std::cout << "[t-moFitContinuator] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
75
mo/test/t-moFitnessCloudSampling.cpp
Normal file
75
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
mo/test/t-moFitnessStat.cpp
Normal file
57
mo/test/t-moFitnessStat.cpp
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
<t-moFitnessStat.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 <continuator/moFitnessStat.h>
|
||||
#include <problems/bitString/moBitNeighbor.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moFitnessStat] => START" << std::endl;
|
||||
|
||||
eoBit<int> sol;
|
||||
|
||||
moFitnessStat< eoBit<int> > test;
|
||||
sol.fitness(3);
|
||||
test(sol);
|
||||
assert(test.value()==3);
|
||||
|
||||
sol.fitness(12);
|
||||
test(sol);
|
||||
assert(test.value()==12);
|
||||
|
||||
assert(test.className()=="moFitnessStat");
|
||||
std::cout << "[t-moFitnessStat] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
63
mo/test/t-moFullEvalByCopy.cpp
Normal file
63
mo/test/t-moFullEvalByCopy.cpp
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
<t-moFullEvalByCopy.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 use,
|
||||
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".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
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 "moTestClass.h"
|
||||
#include <eval/moFullEvalByCopy.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
//Pas grand chose à faire: le gros du travail est fait par le voisin et l'eval
|
||||
|
||||
std::cout << "[t-moFullEvalByCopy] => START" << std::endl;
|
||||
|
||||
Solution sol;
|
||||
moDummyNeighborTest neighbor;
|
||||
moDummyEvalTest eval;
|
||||
|
||||
//verif constructor
|
||||
moFullEvalByCopy<moDummyNeighborTest> test(eval);
|
||||
|
||||
sol.fitness(3);
|
||||
|
||||
//verif operator()
|
||||
test(sol,neighbor);
|
||||
assert(sol.fitness()==3);
|
||||
|
||||
std::cout << "[t-moFullEvalByCopy] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
63
mo/test/t-moFullEvalByModif.cpp
Normal file
63
mo/test/t-moFullEvalByModif.cpp
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
<t-moFullEvalByModif.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 use,
|
||||
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".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
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 "moTestClass.h"
|
||||
#include <eval/moFullEvalByModif.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
//Pas grand chose à faire: le gros du travail est fait par le voisin et l'eval
|
||||
|
||||
std::cout << "[t-moFullEvalByModif] => START" << std::endl;
|
||||
|
||||
Solution sol;
|
||||
moDummyBackableNeighbor neighbor;
|
||||
moDummyEvalTest eval;
|
||||
|
||||
//verif constructor
|
||||
moFullEvalByModif<moDummyBackableNeighbor> test(eval);
|
||||
|
||||
sol.fitness(3);
|
||||
|
||||
//verif operator()
|
||||
test(sol,neighbor);
|
||||
assert(sol.fitness()==3);
|
||||
|
||||
std::cout << "[t-moFullEvalByModif] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
70
mo/test/t-moFullEvalContinuator.cpp
Normal file
70
mo/test/t-moFullEvalContinuator.cpp
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
<t-moFullEvalContinuator.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 <continuator/moFullEvalContinuator.h>
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moFullEvalContinuator] => START" << std::endl;
|
||||
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
eoEvalFuncCounter<bitVector> evalCount(fullEval);
|
||||
moFullEvalContinuator<bitNeighbor> test(evalCount, 3);
|
||||
|
||||
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));
|
||||
|
||||
std::cout << "[t-moFullEvalContinuator] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
57
mo/test/t-moHillClimberSampling.cpp
Normal file
57
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;
|
||||
}
|
||||
|
||||
79
mo/test/t-moILS.cpp
Normal file
79
mo/test/t-moILS.cpp
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
<t-moILS.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 <algo/moTS.h>
|
||||
#include <algo/moILS.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
#include <memory/moSolVectorTabuList.h>
|
||||
#include <neighborhood/moDummyNeighbor.h>
|
||||
|
||||
class dummyMonOp: public eoMonOp<bitVector> {
|
||||
public:
|
||||
bool operator()(bitVector&) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moILS] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
|
||||
moTS<bitNeighbor> ts(nh, fullEval, eval, 1, 7);
|
||||
|
||||
dummyMonOp op;
|
||||
|
||||
//basic constructor
|
||||
moILS<bitNeighbor> test1(ts, fullEval, op, 3);
|
||||
|
||||
//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);
|
||||
|
||||
std::cout << "[t-moILS] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
98
mo/test/t-moILSexplorer.cpp
Normal file
98
mo/test/t-moILSexplorer.cpp
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
<t-moILSexplorer.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 <algo/moSimpleHC.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include <coolingSchedule/moSimpleCoolingSchedule.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <explorer/moILSexplorer.h>
|
||||
#include <perturb/moMonOpPerturb.h>
|
||||
#include <acceptCrit/moAlwaysAcceptCrit.h>
|
||||
|
||||
class dummyMonOp: public eoMonOp<bitVector> {
|
||||
|
||||
bool operator()(bitVector& _sol) {
|
||||
_sol[0] = !_sol[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moILSexplorer] => START" << std::endl;
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
|
||||
bitVector sol(4, true);
|
||||
fullEval(sol);
|
||||
|
||||
//test first constructor
|
||||
moSimpleHC<bitNeighbor> ls(nh, fullEval, eval);
|
||||
|
||||
dummyMonOp op;
|
||||
moMonOpPerturb<bitNeighbor> perturb(op, fullEval);
|
||||
|
||||
moAlwaysAcceptCrit<bitNeighbor> accept;
|
||||
|
||||
moILSexplorer<bitNeighbor, bitNeighbor> test(ls, perturb, accept);
|
||||
|
||||
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(sol);
|
||||
test.move(sol);
|
||||
|
||||
for (unsigned int i = 0; i < sol.size(); i++)
|
||||
assert(!sol[i]);
|
||||
assert(sol.fitness() == 0);
|
||||
|
||||
test(sol);
|
||||
|
||||
std::cout << "[t-moILSexplorer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
95
mo/test/t-moIndexedVectorTabuList.cpp
Executable file
95
mo/test/t-moIndexedVectorTabuList.cpp
Executable file
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
<t-moIndexedVectorTabuList.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 <memory/moIndexedVectorTabuList.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moIndexedVectorTabuList] => START" << std::endl;
|
||||
|
||||
moIndexedVectorTabuList<bitNeighbor> test(4, 1);
|
||||
bitNeighbor n1;
|
||||
bitNeighbor n2;
|
||||
bitNeighbor n3;
|
||||
bitNeighbor n4;
|
||||
n1.index(0);
|
||||
n2.index(1);
|
||||
n3.index(2);
|
||||
n4.index(3);
|
||||
|
||||
eoBit<eoMinimizingFitness> sol1(4, true);
|
||||
eoBit<eoMinimizingFitness> sol2(4, true);
|
||||
sol2[0]=false;
|
||||
|
||||
//init
|
||||
test.init(sol1);
|
||||
|
||||
//ajout d'un voisin tabu
|
||||
test.add(sol1, n1);
|
||||
|
||||
//verification des voisins
|
||||
assert(test.check(sol1, n1));
|
||||
assert(!test.check(sol1, n2));
|
||||
assert(!test.check(sol1, n3));
|
||||
assert(!test.check(sol1, n4));
|
||||
|
||||
assert(test.check(sol2, n1));
|
||||
assert(!test.check(sol2, n2));
|
||||
assert(!test.check(sol2, n3));
|
||||
assert(!test.check(sol2, n4));
|
||||
|
||||
test.update(sol1, n1);
|
||||
test.add(sol1, n2);
|
||||
test.add(sol1, n3);
|
||||
test.add(sol1, n4);
|
||||
|
||||
assert(!test.check(sol1, n1));
|
||||
assert(test.check(sol1, n2));
|
||||
assert(test.check(sol1, n3));
|
||||
assert(test.check(sol1, n4));
|
||||
|
||||
test.update(sol1, n2);
|
||||
test.update(sol1, n3);
|
||||
test.update(sol1, n4);
|
||||
|
||||
assert(!test.check(sol1, n2));
|
||||
assert(!test.check(sol1, n3));
|
||||
assert(!test.check(sol1, n4));
|
||||
|
||||
|
||||
std::cout << "[t-moIndexedVectorTabuList] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
61
mo/test/t-moIterContinuator.cpp
Normal file
61
mo/test/t-moIterContinuator.cpp
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
<t-moIterContinuator.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 <continuator/moIterContinuator.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moIterContinuator] => START" << std::endl;
|
||||
|
||||
moIterContinuator<moDummyNeighborTest> test(3, false);
|
||||
moIterContinuator<moDummyNeighborTest> test2(3);
|
||||
Solution s;
|
||||
|
||||
test.init(s);
|
||||
assert(test.value()==0);
|
||||
assert(test(s));
|
||||
assert(test.value()==1);
|
||||
assert(test(s));
|
||||
assert(test.value()==2);
|
||||
assert(!test(s));
|
||||
assert(test.value()==3);
|
||||
test.init(s);
|
||||
assert(test.value()==0);
|
||||
|
||||
|
||||
std::cout << "[t-moIterContinuator] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
70
mo/test/t-moLocalSearch.cpp
Normal file
70
mo/test/t-moLocalSearch.cpp
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
<t-moLocalSearch.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 <algo/moLocalSearch.h>
|
||||
#include <explorer/moSimpleHCexplorer.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main() {
|
||||
|
||||
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);
|
||||
|
||||
bitVector sol(8, true);
|
||||
|
||||
test(sol);
|
||||
|
||||
assert(sol.fitness()==0);
|
||||
for (unsigned int i=0; i<sol.size(); i++)
|
||||
assert(!sol[i]);
|
||||
|
||||
|
||||
std::cout << "[t-moLocalSearch] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
58
mo/test/t-moLocalSearchInit.cpp
Normal file
58
mo/test/t-moLocalSearchInit.cpp
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
<t-moLocalSearchInit.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 <perturb/moLocalSearchInit.h>
|
||||
#include <algo/moDummyLS.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moLocalSearchInit] => START" << std::endl;
|
||||
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
moDummyLS<bitNeighbor> ls(fullEval);
|
||||
dummyInit init;
|
||||
bitVector sol;
|
||||
sol.fitness(0);
|
||||
|
||||
moLocalSearchInit<bitNeighbor> test(init, ls);
|
||||
|
||||
test(sol);
|
||||
|
||||
std::cout << "[t-moLocalSearchInit] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
65
mo/test/t-moMetropolisHasting.cpp
Normal file
65
mo/test/t-moMetropolisHasting.cpp
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
<t-moMetropolisHasting.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 <algo/moMetropolisHasting.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
|
||||
int main() {
|
||||
|
||||
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;
|
||||
|
||||
//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 3eme constructeur
|
||||
moMetropolisHasting<bitNeighbor> test3(nh, fullEval, eval, 3, cont, ncomp, sncomp);
|
||||
|
||||
std::cout << "[t-moMetropolisHasting] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
97
mo/test/t-moMetropolisHastingExplorer.cpp
Normal file
97
mo/test/t-moMetropolisHastingExplorer.cpp
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
<t-moMetropolisHastingExplorer.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 <explorer/moMetropolisHastingExplorer.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moMetropolisHastingExplorer] => START" << std::endl;
|
||||
|
||||
//Instanciation
|
||||
eoBit<eoMinimizingFitness> sol(4, true);
|
||||
sol.fitness(4);
|
||||
bitNeighborhood nh(4);
|
||||
evalOneMax eval(4);
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
|
||||
moMetropolisHastingExplorer<bitNeighbor> test(nh, eval, ncomp, sncomp, 3);
|
||||
|
||||
//test de l'acceptation d'un voisin améliorant
|
||||
test.initParam(sol);
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==3);
|
||||
test.updateParam(sol);
|
||||
assert(test.isContinue(sol));
|
||||
|
||||
unsigned int oui=0, non=0;
|
||||
|
||||
//test de l'acceptation d'un voisin non améliorant
|
||||
for (unsigned int i=0; i<1000; i++) {
|
||||
test(sol);
|
||||
if (test.accept(sol))
|
||||
oui++;
|
||||
else
|
||||
non++;
|
||||
}
|
||||
std::cout << "Attention test en fonction d'une proba \"p\" uniforme dans [0,1] , oui si p < 3/4, non sinon -> resultat sur 1000 essai" << std::endl;
|
||||
std::cout << "oui: " << oui << std::endl;
|
||||
std::cout << "non: " << non << std::endl;
|
||||
|
||||
assert(oui > 700 && oui < 800); //verification grossiere
|
||||
|
||||
//test du critere d'arret
|
||||
test.updateParam(sol);
|
||||
assert(test.isContinue(sol));
|
||||
test.updateParam(sol);
|
||||
assert(!test.isContinue(sol));
|
||||
|
||||
//test de l'acceptation d'un voisin
|
||||
sol[0]=false;
|
||||
sol[1]=false;
|
||||
sol[2]=false;
|
||||
sol[3]=false;
|
||||
sol.fitness(0);
|
||||
|
||||
test.initParam(sol);
|
||||
test(sol);
|
||||
assert(!test.accept(sol));
|
||||
|
||||
std::cout << "[t-moMetropolisHastingExplorer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
64
mo/test/t-moMinusOneCounterStat.cpp
Normal file
64
mo/test/t-moMinusOneCounterStat.cpp
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
<t-moMinusOneCounterStat.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 <continuator/moMinusOneCounterStat.h>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moMinusOneCounterStat] => START" << std::endl;
|
||||
|
||||
moMinusOneCounterStat<int> test;
|
||||
|
||||
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);
|
||||
|
||||
assert(test.className()=="moMinusOneCounterStat");
|
||||
|
||||
std::cout << "[t-moMinusOneCounterStat] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
74
mo/test/t-moMonOpDiversification.cpp
Normal file
74
mo/test/t-moMonOpDiversification.cpp
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
<t-moMonOpDiversification.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 <eoOp.h>
|
||||
|
||||
#include <memory/moMonOpDiversification.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
|
||||
class dummyMonOp: public eoMonOp<bitVector> {
|
||||
|
||||
bool operator()(bitVector& _sol) {
|
||||
_sol[0]=!_sol[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moMonOpDiversification] => START" << std::endl;
|
||||
|
||||
dummyMonOp op;
|
||||
oneMaxEval<bitVector> eval;
|
||||
|
||||
bitVector sol;
|
||||
sol.push_back(1);
|
||||
sol.push_back(0);
|
||||
sol.push_back(1);
|
||||
|
||||
sol.fitness(5);
|
||||
|
||||
moMonOpDiversification<bitNeighbor> test(op, eval);
|
||||
|
||||
test(sol);
|
||||
|
||||
assert(sol.fitness()==1);
|
||||
|
||||
std::cout << "[t-moMonOpDiversification] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
74
mo/test/t-moMonOpPerturb.cpp
Normal file
74
mo/test/t-moMonOpPerturb.cpp
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
<t-moMonOpPerturb.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 <eoOp.h>
|
||||
|
||||
#include <perturb/moMonOpPerturb.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
|
||||
class dummyMonOp: public eoMonOp<bitVector> {
|
||||
|
||||
bool operator()(bitVector& _sol) {
|
||||
_sol[0]=!_sol[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moMonOpPerturb] => START" << std::endl;
|
||||
|
||||
dummyMonOp op;
|
||||
oneMaxEval<bitVector> eval;
|
||||
|
||||
bitVector sol;
|
||||
sol.push_back(1);
|
||||
sol.push_back(0);
|
||||
sol.push_back(1);
|
||||
|
||||
sol.fitness(5);
|
||||
|
||||
moMonOpPerturb<bitNeighbor> test(op, eval);
|
||||
|
||||
test(sol);
|
||||
|
||||
assert(sol.fitness()==1);
|
||||
|
||||
|
||||
std::cout << "[t-moMonOpPerturb] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
64
mo/test/t-moNeighbor.cpp
Normal file
64
mo/test/t-moNeighbor.cpp
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
<t-moNeighbor.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 use,
|
||||
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".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
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 "moTestClass.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moNeighbor] => START" << std::endl;
|
||||
|
||||
//test constructor
|
||||
moDummyNeighborTest test1, test2;
|
||||
|
||||
test1.fitness(3);
|
||||
//test operateur d'affectation
|
||||
test2=test1;
|
||||
assert(test1.fitness()==test2.fitness());
|
||||
|
||||
//test operateur de copy
|
||||
moDummyNeighborTest test3(test1);
|
||||
assert(test1.fitness()==test3.fitness());
|
||||
|
||||
test1.printOn(std::cout);
|
||||
test2.printOn(std::cout);
|
||||
test3.printOn(std::cout);
|
||||
|
||||
assert(test1.className()=="moNeighbor");
|
||||
std::cout << "[t-moNeighbor] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
74
mo/test/t-moNeighborBestStat.cpp
Normal file
74
mo/test/t-moNeighborBestStat.cpp
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
<t-moNeighborBestStat.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 <continuator/moNeighborBestStat.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moNeighborBestStat] => START" << std::endl;
|
||||
|
||||
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);
|
||||
|
||||
bitVector sol(4, true);
|
||||
sol.fitness(4);
|
||||
|
||||
test1.init(sol);
|
||||
assert(test1.value()==3);
|
||||
|
||||
sol[0]=false;
|
||||
sol.fitness(3);
|
||||
test1(sol);
|
||||
assert(test1.value()==4);
|
||||
|
||||
test2(sol);
|
||||
assert(test2.value()==2);
|
||||
|
||||
test3(sol);
|
||||
assert(test3.value()==int());
|
||||
|
||||
assert(test1.className()=="moNeighborBestStat");
|
||||
|
||||
std::cout << "[t-moNeighborBestStat] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
68
mo/test/t-moNeighborComparator.cpp
Normal file
68
mo/test/t-moNeighborComparator.cpp
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
<t-moNeighborComparator.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 use,
|
||||
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".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
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 <problems/bitString/moBitNeighbor.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
#include <ga/eoBit.h>
|
||||
#include <eoScalarFitness.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moNeighborComparator] => START" << std::endl;
|
||||
|
||||
|
||||
moBitNeighbor<eoMinimizingFitness> neighbor1;
|
||||
moBitNeighbor<eoMinimizingFitness> neighbor2;
|
||||
|
||||
moNeighborComparator< moBitNeighbor<eoMinimizingFitness> > test;
|
||||
|
||||
neighbor1.fitness(3);
|
||||
neighbor2.fitness(2);
|
||||
//test with a minimizing fitness neighbor2 must be better than neighbor1 and reversly
|
||||
assert(test(neighbor1, neighbor2));
|
||||
assert(!test(neighbor2, neighbor1));
|
||||
|
||||
//test equals
|
||||
assert(!test.equals(neighbor1,neighbor2));
|
||||
|
||||
neighbor2.fitness(3);
|
||||
assert(test.equals(neighbor1,neighbor2));
|
||||
|
||||
assert(test.className()=="moNeighborComparator");
|
||||
std::cout << "[t-moNeighborComparator] => OK" << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
69
mo/test/t-moNeighborEvalContinuator.cpp
Normal file
69
mo/test/t-moNeighborEvalContinuator.cpp
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
<t-moNeighborEvalContinuator.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 <continuator/moNeighborEvalContinuator.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moNeighborEvalContinuator] => START" << std::endl;
|
||||
|
||||
evalOneMax moEval(2);
|
||||
moEvalCounter<bitNeighbor> evalCount(moEval);
|
||||
moNeighborEvalContinuator<bitNeighbor> test(evalCount, 3);
|
||||
|
||||
bitVector sol;
|
||||
sol.push_back(true);
|
||||
sol.push_back(false);
|
||||
|
||||
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));
|
||||
|
||||
std::cout << "[t-moNeighborEvalContinuator] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
66
mo/test/t-moNeighborFitnessStat.cpp
Normal file
66
mo/test/t-moNeighborFitnessStat.cpp
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
<t-moNeighborFitnessStat.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 <continuator/moNeighborFitnessStat.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moNeighborFitnessStat] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
bitNeighborhood nh2(0);
|
||||
evalOneMax eval(4);
|
||||
|
||||
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);
|
||||
|
||||
test2.init(sol);
|
||||
sol.fitness(3);
|
||||
test2(sol);
|
||||
assert(test2.value()==int());
|
||||
|
||||
assert(test.className()=="moNeighborFitnessStat");
|
||||
|
||||
std::cout << "[t-moNeighborFitnessStat] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
104
mo/test/t-moNeighborVectorTabuList.cpp
Normal file
104
mo/test/t-moNeighborVectorTabuList.cpp
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
<t-moNeighborVectorTabuList.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 <memory/moNeighborVectorTabuList.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moNeighborVectorTabuList] => START" << std::endl;
|
||||
|
||||
//tabu list of size 2 (neighbor are always tabu)
|
||||
moNeighborVectorTabuList<bitNeighbor> test(2,0);
|
||||
|
||||
|
||||
bitVector sol(4,true);
|
||||
sol.fitness(0);
|
||||
bitNeighbor n1;
|
||||
bitNeighbor n2;
|
||||
bitNeighbor n3;
|
||||
bitNeighbor n4;
|
||||
n1.index(0);
|
||||
n2.index(1);
|
||||
n3.index(2);
|
||||
n4.index(3);
|
||||
|
||||
//n1 must be tabu
|
||||
test.add(sol, n1);
|
||||
assert(test.check(sol, n1));
|
||||
assert(!test.check(sol, n2));
|
||||
assert(!test.check(sol, n3));
|
||||
assert(!test.check(sol, n4));
|
||||
|
||||
//n1 and n2 must be tabu
|
||||
test.add(sol, n2);
|
||||
assert(test.check(sol, n1));
|
||||
assert(test.check(sol, n2));
|
||||
assert(!test.check(sol, n3));
|
||||
assert(!test.check(sol, n4));
|
||||
|
||||
//n3 is added, so it replace n1 -> n2 and n3 must be tabu
|
||||
test.add(sol, n3);
|
||||
assert(!test.check(sol, n1));
|
||||
assert(test.check(sol, n2));
|
||||
assert(test.check(sol, n3));
|
||||
assert(!test.check(sol, n4));
|
||||
|
||||
//clear tabu list all neighbor must not be tabu
|
||||
test.init(sol);
|
||||
assert(!test.check(sol, n1));
|
||||
assert(!test.check(sol, n2));
|
||||
assert(!test.check(sol, n3));
|
||||
assert(!test.check(sol, n4));
|
||||
|
||||
//tabu list of size 2 (neighbor are tabu during 2 iterations)
|
||||
moNeighborVectorTabuList<bitNeighbor> test2(2,2);
|
||||
|
||||
test2.add(sol, n1);
|
||||
assert(test2.check(sol, n1));
|
||||
test2.update(sol, n3);
|
||||
test2.add(sol,n2);
|
||||
assert(test2.check(sol, n1));
|
||||
assert(test2.check(sol, n2));
|
||||
test2.update(sol, n3);
|
||||
assert(!test2.check(sol, n1));
|
||||
assert(test2.check(sol, n2));
|
||||
test2.update(sol, n4);
|
||||
assert(!test2.check(sol, n1));
|
||||
assert(!test2.check(sol, n2));
|
||||
|
||||
std::cout << "[t-moNeighborVectorTabuList] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
91
mo/test/t-moNeighborhoodPerturb.cpp
Normal file
91
mo/test/t-moNeighborhoodPerturb.cpp
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
<t-moNeighborhoodPerturb.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 "moTestClass.h"
|
||||
|
||||
#include <perturb/moNeighborhoodPerturb.h>
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include <eval/moFullEvalByCopy.h>
|
||||
|
||||
typedef moOrderNeighborhood<bitNeighbor> Neighborhood;
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moNeighborhoodPerturb] => START" << std::endl;
|
||||
|
||||
oneMaxEval<bitVector> eval;
|
||||
|
||||
moFullEvalByCopy<bitNeighbor> moeval(eval);
|
||||
|
||||
bitVector sol;
|
||||
sol.resize(3);
|
||||
sol[0]=0;
|
||||
sol[1]=0;
|
||||
sol[2]=0;
|
||||
|
||||
sol.fitness(0);
|
||||
|
||||
Neighborhood nh(3);
|
||||
|
||||
bitNeighbor n;
|
||||
|
||||
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 add
|
||||
|
||||
test.add(sol, n);
|
||||
test(sol);
|
||||
assert(sol[0]==1 && sol[1]==1 && sol[2]==1);
|
||||
|
||||
test.clearMemory();
|
||||
|
||||
|
||||
std::cout << "[t-moNeighborhoodPerturb] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
172
mo/test/t-moNeighborhoodStat.cpp
Normal file
172
mo/test/t-moNeighborhoodStat.cpp
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
/*
|
||||
<t-moNeighborhoodStat.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 <continuator/moNeighborhoodStat.h>
|
||||
#include <continuator/moMaxNeighborStat.h>
|
||||
#include <continuator/moMinNeighborStat.h>
|
||||
#include <continuator/moNbInfNeighborStat.h>
|
||||
#include <continuator/moNbSupNeighborStat.h>
|
||||
#include <continuator/moNeutralDegreeNeighborStat.h>
|
||||
#include <continuator/moSecondMomentNeighborStat.h>
|
||||
#include <continuator/moSizeNeighborStat.h>
|
||||
#include <continuator/moAverageFitnessNeighborStat.h>
|
||||
#include <continuator/moStdFitnessNeighborStat.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
/*
|
||||
* Tests all classes depending of moNeighborhoodStat.h
|
||||
*/
|
||||
int main() {
|
||||
|
||||
//test de moNeighborhoodStat.h
|
||||
std::cout << "[t-moNeighborhoodStat] => START" << std::endl;
|
||||
|
||||
moNeighborComparator<bitNeighbor> neighborComp;
|
||||
moSolNeighborComparator<bitNeighbor> solNeighborComp;
|
||||
evalOneMax eval(10);
|
||||
|
||||
bitNeighborhood n(10);
|
||||
|
||||
bitVector sol;
|
||||
|
||||
sol.push_back(true);
|
||||
sol.push_back(false);
|
||||
sol.push_back(true);
|
||||
sol.push_back(true);
|
||||
sol.push_back(false);
|
||||
sol.push_back(true);
|
||||
sol.push_back(false);
|
||||
sol.push_back(true);
|
||||
sol.push_back(true);
|
||||
sol.push_back(true);
|
||||
|
||||
sol.fitness(7);
|
||||
|
||||
|
||||
moNeighborhoodStat<bitNeighbor> test(n, eval, neighborComp, solNeighborComp);
|
||||
|
||||
test(sol);
|
||||
|
||||
assert(test.getMin()==8);
|
||||
assert(test.getMax()==6);
|
||||
assert(test.getMean()==6.6);
|
||||
double sd=test.getSD();
|
||||
assert(sd>0.966 && sd<0.967);
|
||||
assert(test.getSize()==10);
|
||||
assert(test.getNbSup()==7);
|
||||
assert(test.getNbInf()==3);
|
||||
assert(test.getNbEqual()==0);
|
||||
|
||||
assert(test.className()=="moNeighborhoodStat");
|
||||
std::cout << "[t-moNeighborhoodStat] => OK" << std::endl;
|
||||
|
||||
//test of moMaxNeighborStat.h
|
||||
std::cout << "[t-moMaxNeighborStat] => START" << std::endl;
|
||||
moMaxNeighborStat<bitNeighbor> test2(test);
|
||||
test2(sol);
|
||||
assert(test2.value()==6);
|
||||
assert(test2.className()=="moMaxNeighborStat");
|
||||
std::cout << "[t-moMaxNeighborStat] => OK" << std::endl;
|
||||
|
||||
//test of moMinNeighborStat.h
|
||||
std::cout << "[t-moMinNeighborStat] => START" << std::endl;
|
||||
moMinNeighborStat<bitNeighbor> test3(test);
|
||||
test3(sol);
|
||||
assert(test3.value()==8);
|
||||
assert(test3.className()=="moMinNeighborStat");
|
||||
std::cout << "[t-moMinNeighborStat] => OK" << std::endl;
|
||||
|
||||
//test of moNbInfNeighborStat.h
|
||||
std::cout << "[t-moNbInfNeighborStat] => START" << std::endl;
|
||||
moNbInfNeighborStat<bitNeighbor> test4(test);
|
||||
test4(sol);
|
||||
assert(test4.value()==3);
|
||||
assert(test4.className()=="moNbInfNeighborStat");
|
||||
std::cout << "[t-moNbInfNeighborStat] => OK" << std::endl;
|
||||
|
||||
//test of moNbSupNeighborStat.h
|
||||
std::cout << "[t-moNbSupNeighborStat] => START" << std::endl;
|
||||
moNbSupNeighborStat<bitNeighbor> test5(test);
|
||||
test5(sol);
|
||||
assert(test5.value()==7);
|
||||
assert(test5.className()=="moNbSupNeighborStat");
|
||||
std::cout << "[t-moNbSupNeighborStat] => OK" << std::endl;
|
||||
|
||||
//test of moNeutralDegreeNeighborStat.h
|
||||
std::cout << "[t-moNeutralDegreeNeighborStat] => START" << std::endl;
|
||||
moNeutralDegreeNeighborStat<bitNeighbor> test6(test);
|
||||
test6(sol);
|
||||
assert(test6.value()==0);
|
||||
assert(test6.className()=="moNeutralDegreeNeighborStat");
|
||||
std::cout << "[t-moNeutralDegreeNeighborStat] => OK" << std::endl;
|
||||
|
||||
//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);
|
||||
assert(test7.className()=="moSecondMomentNeighborStat");
|
||||
std::cout << "[t-moSecondMomentNeighborStat] => OK" << std::endl;
|
||||
|
||||
//test of moSizeNeighborStat.h
|
||||
std::cout << "[t-moSizeNeighborStat] => START" << std::endl;
|
||||
moSizeNeighborStat<bitNeighbor> test8(test);
|
||||
test8(sol);
|
||||
assert(test8.value()==10);
|
||||
assert(test8.className()=="moSizeNeighborStat");
|
||||
std::cout << "[t-moSizeNeighborStat] => OK" << std::endl;
|
||||
|
||||
//test of moAverageFitnessNeighborStat.h
|
||||
std::cout << "[t-moAverageFitnessNeighborStat] => START" << std::endl;
|
||||
moAverageFitnessNeighborStat<bitNeighbor> test9(test);
|
||||
test9(sol);
|
||||
assert(test9.value()==6.6);
|
||||
assert(test9.className()=="moAverageFitnessNeighborStat");
|
||||
std::cout << "[t-moAverageFitnessNeighborStat] => OK" << std::endl;
|
||||
|
||||
//test of moStdFitnessNeighborStat.h
|
||||
std::cout << "[t-moStdFitnessNeighborStat] => START" << std::endl;
|
||||
moStdFitnessNeighborStat<bitNeighbor> test10(test);
|
||||
test10(sol);
|
||||
assert(test10.value()> 0.966 && test10.value() < 0.967);
|
||||
assert(test10.className()=="moStdFitnessNeighborStat");
|
||||
std::cout << "[t-moStdFitnessNeighborStat] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
64
mo/test/t-moNeutralDegreeSampling.cpp
Normal file
64
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;
|
||||
}
|
||||
|
||||
65
mo/test/t-moNeutralHC.cpp
Normal file
65
mo/test/t-moNeutralHC.cpp
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
<t-moNeutralHC.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 <algo/moNeutralHC.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
|
||||
int main() {
|
||||
|
||||
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;
|
||||
|
||||
//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 3eme constructeur
|
||||
moNeutralHC<bitNeighbor> test3(nh, fullEval, eval, 3, cont, ncomp, sncomp);
|
||||
|
||||
std::cout << "[t-moNeutralHC] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
92
mo/test/t-moNeutralHCexplorer.cpp
Normal file
92
mo/test/t-moNeutralHCexplorer.cpp
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
<t-moNeutralHCexplorer.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 <comparator/moNeighborComparator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <explorer/moNeutralHCexplorer.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moNeutralHCexplorer] => START" << std::endl;
|
||||
|
||||
//Instanciation
|
||||
eoBit<eoMinimizingFitness> sol(4, true);
|
||||
sol.fitness(4);
|
||||
bitNeighborhood nh(4);
|
||||
evalOneMax eval(4);
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
|
||||
moNeutralHCexplorer<bitNeighbor> test(nh, eval, ncomp, sncomp,3);
|
||||
|
||||
//on verifie qu'on ameliore bien la solution et que l'exploration dure 3 itérations
|
||||
|
||||
test.initParam(sol);
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==3);
|
||||
test.updateParam(sol);
|
||||
assert(test.isContinue(sol));
|
||||
|
||||
//les affichages permettent de voir qu'on prend pas toujours les mm voisins(lancer plusieurs fois l'exe)
|
||||
std::cout << sol << std::endl;
|
||||
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==2);
|
||||
test.updateParam(sol);
|
||||
assert(test.isContinue(sol));
|
||||
|
||||
|
||||
std::cout << sol << std::endl;
|
||||
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==1);
|
||||
test.updateParam(sol);
|
||||
assert(!test.isContinue(sol));
|
||||
|
||||
|
||||
std::cout << sol << std::endl;
|
||||
|
||||
|
||||
|
||||
std::cout << "[t-moNeutralHCexplorer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
62
mo/test/t-moNeutralWalkSampling.cpp
Normal file
62
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;
|
||||
}
|
||||
|
||||
80
mo/test/t-moOrderNeighborhood.cpp
Normal file
80
mo/test/t-moOrderNeighborhood.cpp
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
<t-moOrderNeighborhood.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 use,
|
||||
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".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
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 <neighborhood/moOrderNeighborhood.h>
|
||||
#include <problems/bitString/moBitNeighbor.h>
|
||||
#include <ga/eoBit.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moOrderNeighborhood] => START" << std::endl;
|
||||
|
||||
//init sol
|
||||
eoBit<int> sol;
|
||||
sol.push_back(true);
|
||||
sol.push_back(false);
|
||||
sol.push_back(true);
|
||||
|
||||
moBitNeighbor<int> neighbor;
|
||||
|
||||
//verif du constructeur vide
|
||||
moOrderNeighborhood<moBitNeighbor<int> > test(3);
|
||||
assert(test.position()==0);
|
||||
|
||||
//verif du hasneighbor
|
||||
assert(test.hasNeighbor(sol));
|
||||
|
||||
//verif de init
|
||||
test.init(sol, neighbor);
|
||||
assert(neighbor.index()==0);
|
||||
assert(test.position()==0);
|
||||
|
||||
//verif du next
|
||||
test.next(sol, neighbor);
|
||||
assert(neighbor.index()==1);
|
||||
assert(test.position()==1);
|
||||
|
||||
//verif du cont
|
||||
assert(test.cont(sol));
|
||||
test.next(sol, neighbor);
|
||||
assert(!test.cont(sol));
|
||||
|
||||
assert(test.className()=="moOrderNeighborhood");
|
||||
|
||||
std::cout << "[t-moOrderNeighborhood] => OK" << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
64
mo/test/t-moRandomBestHC.cpp
Normal file
64
mo/test/t-moRandomBestHC.cpp
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
<t-moRandomBestHC.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 <algo/moRandomBestHC.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moRandomBestHC] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
|
||||
//test first constructor
|
||||
moRandomBestHC<bitNeighbor> test1(nh, fullEval, eval);
|
||||
|
||||
//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);
|
||||
|
||||
std::cout << "[t-moRandomBestHC] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
101
mo/test/t-moRandomBestHCexplorer.cpp
Normal file
101
mo/test/t-moRandomBestHCexplorer.cpp
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
<t-moRandomBestHCExplorer.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 <comparator/moNeighborComparator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <explorer/moRandomBestHCexplorer.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moRandomBestHCexplorer] => START" << std::endl;
|
||||
|
||||
//instanciation
|
||||
eoBit<eoMinimizingFitness> sol(4, true);
|
||||
sol.fitness(4);
|
||||
bitNeighborhood nh(4);
|
||||
evalOneMax eval(4);
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
|
||||
moRandomBestHCexplorer<bitNeighbor> test(nh, eval, ncomp, sncomp);
|
||||
|
||||
//test qu'on ameliore bien a chaque itération
|
||||
test.initParam(sol);
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==3);
|
||||
assert(test.isContinue(sol));
|
||||
test.updateParam(sol);
|
||||
|
||||
//les affichages permettent de voir qu'on choisit pas toujours les mm voisins améliorant (lancer plusieurs fois l'exe)
|
||||
std::cout << sol << std::endl;
|
||||
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==2);
|
||||
assert(test.isContinue(sol));
|
||||
test.updateParam(sol);
|
||||
|
||||
std::cout << sol << std::endl;
|
||||
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==1);
|
||||
assert(test.isContinue(sol));
|
||||
test.updateParam(sol);
|
||||
|
||||
std::cout << sol << std::endl;
|
||||
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==0);
|
||||
assert(test.isContinue(sol));
|
||||
test.updateParam(sol);
|
||||
|
||||
test(sol);
|
||||
assert(!test.accept(sol));
|
||||
assert(sol.fitness()==0);
|
||||
assert(!test.isContinue(sol));
|
||||
test.updateParam(sol);
|
||||
|
||||
|
||||
std::cout << "[t-moRandomBestHCexplorer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
63
mo/test/t-moRandomNeutralWalk.cpp
Normal file
63
mo/test/t-moRandomNeutralWalk.cpp
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
<t-moRandomNeutralWalk.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 <algo/moRandomNeutralWalk.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moRandomNeutralWalk] => START" << std::endl;
|
||||
|
||||
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 2eme constructeur
|
||||
moRandomNeutralWalk<bitNeighbor> test2(nh, fullEval, eval, 3, cont);
|
||||
|
||||
//test du 3eme constructeur
|
||||
moRandomNeutralWalk<bitNeighbor> test3(nh, fullEval, eval, 3, cont, sncomp);
|
||||
|
||||
std::cout << "[t-moRandomNeutralWalk] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
88
mo/test/t-moRandomNeutralWalkExplorer.cpp
Normal file
88
mo/test/t-moRandomNeutralWalkExplorer.cpp
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
<t-moRandomNeutralWalkExplorer.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 <explorer/moRandomNeutralWalkExplorer.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moRandomNeutralWalkExplorer] => START" << std::endl;
|
||||
|
||||
eoBit<eoMinimizingFitness> sol(4, true);
|
||||
sol.fitness(4);
|
||||
bitNeighborhood nh(4);
|
||||
evalOneMax eval(4);
|
||||
dummyEvalOneMax eval2(4);
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
|
||||
//test avec la fonction d'eval classique
|
||||
//on verifie qu'on ne trouve pas de voisin de mm fitness
|
||||
moRandomNeutralWalkExplorer<bitNeighbor> test(nh, eval, sncomp, 3);
|
||||
|
||||
test.initParam(sol);
|
||||
test(sol);
|
||||
assert(!test.accept(sol));
|
||||
assert(!test.isContinue(sol));
|
||||
|
||||
//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<bitNeighbor> test2(nh, eval2, sncomp, 3);
|
||||
|
||||
sol.fitness(2);
|
||||
test2.initParam(sol);
|
||||
test2(sol);
|
||||
assert(test2.accept(sol));
|
||||
test2.move(sol);
|
||||
assert(sol.fitness()==2);
|
||||
test2.updateParam(sol);
|
||||
assert(test2.isContinue(sol));
|
||||
|
||||
test2(sol);
|
||||
assert(test2.accept(sol));
|
||||
test2.move(sol);
|
||||
assert(sol.fitness()==2);
|
||||
test2.updateParam(sol);
|
||||
assert(test2.isContinue(sol));
|
||||
|
||||
test2(sol);
|
||||
assert(test2.accept(sol));
|
||||
test2.move(sol);
|
||||
assert(sol.fitness()==2);
|
||||
test2.updateParam(sol);
|
||||
assert(!test2.isContinue(sol));
|
||||
|
||||
std::cout << "[t-moRandomNeutralWalkExplorer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
57
mo/test/t-moRandomSearch.cpp
Normal file
57
mo/test/t-moRandomSearch.cpp
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
<t-moRandomSearch.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 <algo/moRandomSearch.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
|
||||
int main() {
|
||||
|
||||
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);
|
||||
|
||||
assert(test1.className()=="moRandomSearch");
|
||||
|
||||
std::cout << "[t-moRandomSearch] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
65
mo/test/t-moRandomSearchExplorer.cpp
Normal file
65
mo/test/t-moRandomSearchExplorer.cpp
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
<t-moRandomSearchExplorer.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 <explorer/moRandomSearchExplorer.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moRandomSearchExplorer] => START" << std::endl;
|
||||
|
||||
dummyInit init;
|
||||
oneMaxEval<bitVector> eval;
|
||||
bitVector sol(4, true);
|
||||
|
||||
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);
|
||||
|
||||
std::cout << "[t-moRandomSearchExplorer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
63
mo/test/t-moRandomWalk.cpp
Normal file
63
mo/test/t-moRandomWalk.cpp
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
<t-moRandomWalk.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 <algo/moRandomWalk.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
|
||||
int main() {
|
||||
|
||||
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;
|
||||
|
||||
//test du 1er constructeur
|
||||
moRandomWalk<bitNeighbor> test1(nh, fullEval, eval, 3);
|
||||
|
||||
//test du 2eme constructeur
|
||||
moRandomWalk<bitNeighbor> test2(nh, fullEval, eval, cont);
|
||||
|
||||
|
||||
std::cout << "[t-moRandomWalk] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
79
mo/test/t-moRandomWalkExplorer.cpp
Normal file
79
mo/test/t-moRandomWalkExplorer.cpp
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
<t-moRandomWalkExplorer.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 <explorer/moRandomWalkExplorer.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moRandomWalkExplorer] => START" << std::endl;
|
||||
|
||||
eoBit<eoMinimizingFitness> sol(4, true);
|
||||
sol.fitness(4);
|
||||
bitNeighborhood nh(4);
|
||||
evalOneMax eval(4);
|
||||
|
||||
//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<bitNeighbor> test(nh, eval);
|
||||
|
||||
test.initParam(sol);
|
||||
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==3);
|
||||
test.updateParam(sol);
|
||||
assert(test.isContinue(sol));
|
||||
|
||||
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==4);
|
||||
test.updateParam(sol);
|
||||
assert(test.isContinue(sol));
|
||||
|
||||
test(sol);
|
||||
assert(test.accept(sol));
|
||||
test.move(sol);
|
||||
assert(sol.fitness()==3);
|
||||
assert(!sol[0]);
|
||||
test.updateParam(sol);
|
||||
assert(test.isContinue(sol));
|
||||
|
||||
std::cout << "[t-moRandomWalkExplorer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
117
mo/test/t-moRestartPerturb.cpp
Normal file
117
mo/test/t-moRestartPerturb.cpp
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
<t-moRestartPerturb.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 <perturb/moRestartPerturb.h>
|
||||
#include <problems/permutation/moShiftNeighbor.h>
|
||||
#include <eval/queenEval.h>
|
||||
|
||||
#include <eoInt.h>
|
||||
#include <eoInit.h>
|
||||
|
||||
typedef eoInt<unsigned int> QUEEN;
|
||||
|
||||
class dummyInit : public eoInit<QUEEN>
|
||||
{
|
||||
public:
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
unsigned int size;
|
||||
|
||||
};
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moRestartPerturb] => START" << std::endl;
|
||||
|
||||
QUEEN queen;
|
||||
moShiftNeighbor<QUEEN> n;
|
||||
|
||||
dummyInit initializer(4);
|
||||
|
||||
queenEval<QUEEN> eval;
|
||||
|
||||
moRestartPerturb<moShiftNeighbor<QUEEN> > test(initializer, eval, 3);
|
||||
|
||||
queen.resize(4);
|
||||
queen[0]=1;
|
||||
queen[1]=2;
|
||||
queen[2]=0;
|
||||
queen[3]=3;
|
||||
|
||||
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);
|
||||
|
||||
queen[0]=1;
|
||||
queen[1]=2;
|
||||
queen[2]=0;
|
||||
queen[3]=3;
|
||||
|
||||
//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);
|
||||
|
||||
std::cout << "[t-moRestartPerturb] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
77
mo/test/t-moRndIndexedVectorTabuList.cpp
Executable file
77
mo/test/t-moRndIndexedVectorTabuList.cpp
Executable file
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
<t-moIndexedVectorTabuList.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 <memory/moRndIndexedVectorTabuList.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moRndIndexedVectorTabuList] => START" << std::endl;
|
||||
moRndIndexedVectorTabuList<bitNeighbor> test(4, 0,5);
|
||||
bitNeighbor n1;
|
||||
bitNeighbor n2;
|
||||
bitNeighbor n3;
|
||||
bitNeighbor n4;
|
||||
n1.index(0);
|
||||
n2.index(1);
|
||||
n3.index(2);
|
||||
n4.index(3);
|
||||
|
||||
eoBit<eoMinimizingFitness> sol1(4, true);
|
||||
eoBit<eoMinimizingFitness> sol2(4, true);
|
||||
sol2[0] = false;
|
||||
|
||||
//init
|
||||
test.init(sol1);
|
||||
|
||||
//ajout d'un voisin tabu
|
||||
test.add(sol1, n1);
|
||||
|
||||
//verification des voisins
|
||||
assert(test.check(sol1, n1));
|
||||
assert(!test.check(sol1, n2));
|
||||
assert(!test.check(sol1, n3));
|
||||
assert(!test.check(sol1, n4));
|
||||
|
||||
assert(test.check(sol2, n1));
|
||||
assert(!test.check(sol2, n2));
|
||||
assert(!test.check(sol2, n3));
|
||||
assert(!test.check(sol2, n4));
|
||||
|
||||
test.update(sol1, n1);
|
||||
|
||||
std::cout << "[t-moRndIndexedVectorTabuList] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
74
mo/test/t-moRndWithReplNeighborhood.cpp
Normal file
74
mo/test/t-moRndWithReplNeighborhood.cpp
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
<t-moRndWithReplNeighborhood.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 <neighborhood/moRndWithReplNeighborhood.h>
|
||||
|
||||
#include "moTestClass.h"
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moRndWithReplNeighborhood] => START" << std::endl;
|
||||
|
||||
unsigned int a, b;
|
||||
eoBit<int> sol;
|
||||
moBitNeighbor<int> n;
|
||||
|
||||
moRndWithReplNeighborhood< moBitNeighbor<int> > test(3);
|
||||
moRndWithReplNeighborhood< moBitNeighbor<int> > test2(0);
|
||||
|
||||
assert(test.hasNeighbor(sol));
|
||||
assert(!test2.hasNeighbor(sol));
|
||||
|
||||
test.init(sol,n);
|
||||
|
||||
//on s'assure qu'on a bien toujours bien l'index 0, 1 ou 2 qui est renvoyé
|
||||
for (unsigned int i=0; i<100; i++) {
|
||||
|
||||
a=n.index();
|
||||
test.next(sol,n);
|
||||
b=n.index();
|
||||
|
||||
assert(a==0 || a==1 || a==2);
|
||||
assert(b==0 || b==1 || b==2);
|
||||
assert(test.cont(sol));
|
||||
assert(!test2.cont(sol));
|
||||
assert(test.cont(sol));
|
||||
|
||||
}
|
||||
|
||||
assert(test.className()=="moRndWithReplNeighborhood");
|
||||
|
||||
std::cout << "[t-moRndWithReplNeighborhood] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
75
mo/test/t-moRndWithoutReplNeighborhood.cpp
Normal file
75
mo/test/t-moRndWithoutReplNeighborhood.cpp
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
<t-moRndWithoutReplNeighborhood.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 <neighborhood/moRndWithoutReplNeighborhood.h>
|
||||
|
||||
#include "moTestClass.h"
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moRndWithoutReplNeighborhood] => START" << std::endl;
|
||||
|
||||
unsigned int a, b, c;
|
||||
eoBit<int> sol;
|
||||
moBitNeighbor<int> n;
|
||||
|
||||
//instanciation
|
||||
moRndWithoutReplNeighborhood< moBitNeighbor<int> > test(3);
|
||||
moRndWithoutReplNeighborhood< moBitNeighbor<int> > test2(0);
|
||||
|
||||
//on verifie que test a bien des voisins et que test2 n'en a pas
|
||||
assert(test.hasNeighbor(sol));
|
||||
assert(!test2.hasNeighbor(sol));
|
||||
|
||||
//on recupere successivement les index
|
||||
test.init(sol, n);
|
||||
assert(test.cont(sol));
|
||||
a=test.position();
|
||||
test.next(sol, n);
|
||||
assert(test.cont(sol));
|
||||
b=test.position();
|
||||
test.next(sol,n);
|
||||
assert(!test.cont(sol));
|
||||
c=test.position();
|
||||
|
||||
//on s'assure qu'on a bien 0, 1 et 2 (dans un ordre aléatoire)
|
||||
assert(a==0 || b==0 || c==0);
|
||||
assert(a==1 || b==1 || c==1);
|
||||
assert(a==2 || b==2 || c==2);
|
||||
|
||||
assert(test.className()=="moRndWithoutReplNeighborhood");
|
||||
|
||||
std::cout << "[t-moRndWithoutReplNeighborhood] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
65
mo/test/t-moSA.cpp
Normal file
65
mo/test/t-moSA.cpp
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
<t-moSA.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 <algo/moSA.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include <coolingSchedule/moSimpleCoolingSchedule.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moSA] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
|
||||
//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 third constructor
|
||||
moTrueContinuator<bitNeighbor> cont;
|
||||
moSolNeighborComparator<bitNeighbor> comp;
|
||||
moSA<bitNeighbor> test3(nh, fullEval, eval, cool, comp, cont);
|
||||
|
||||
std::cout << "[t-moSA] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
87
mo/test/t-moSAexplorer.cpp
Normal file
87
mo/test/t-moSAexplorer.cpp
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
<t-moSAexplorer.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 "moTestClass.h"
|
||||
#include <explorer/moSAexplorer.h>
|
||||
#include <coolingSchedule/moSimpleCoolingSchedule.h>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moSAexplorer] => START" << std::endl;
|
||||
|
||||
eoBit<eoMinimizingFitness> sol(4, true);
|
||||
sol.fitness(4);
|
||||
bitNeighborhood nh(4);
|
||||
bitNeighborhood emptyNH(0);
|
||||
evalOneMax eval(4);
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moSimpleCoolingSchedule<bitVector> cool(10,0.1,2,0.1);
|
||||
|
||||
moSAexplorer<bitNeighbor> test1(emptyNH, eval, sncomp, cool);
|
||||
moSAexplorer<bitNeighbor> test2(nh, eval, sncomp, cool);
|
||||
|
||||
//test d'un voisinage vide
|
||||
test1.initParam(sol);
|
||||
test1(sol);
|
||||
assert(!test1.accept(sol));
|
||||
assert(test1.getTemperature()==10.0);
|
||||
|
||||
//test d'un voisinage "normal"
|
||||
test2.initParam(sol);
|
||||
test2(sol);
|
||||
assert(test2.accept(sol));
|
||||
test2.updateParam(sol);
|
||||
assert(test2.isContinue(sol));
|
||||
test2.move(sol);
|
||||
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++;
|
||||
test2.move(sol);
|
||||
}
|
||||
assert((ok>0) && (ko>0));
|
||||
|
||||
|
||||
|
||||
std::cout << "[t-moSAexplorer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
81
mo/test/t-moSampling.cpp
Normal file
81
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;
|
||||
}
|
||||
|
||||
91
mo/test/t-moSimpleCoolingSchedule.cpp
Normal file
91
mo/test/t-moSimpleCoolingSchedule.cpp
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
<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,0);
|
||||
assert(temperature==100);
|
||||
assert(test(temperature));
|
||||
test.update(temperature,0);
|
||||
assert(temperature==100);
|
||||
assert(test(temperature));
|
||||
|
||||
//then temperature must be /10
|
||||
test.update(temperature,0);
|
||||
assert(temperature==10);
|
||||
assert(test(temperature));
|
||||
test.update(temperature,0);
|
||||
assert(temperature==10);
|
||||
assert(test(temperature));
|
||||
test.update(temperature,0);
|
||||
assert(temperature==10);
|
||||
assert(test(temperature));
|
||||
|
||||
test.update(temperature,0);
|
||||
assert(temperature == 1);
|
||||
std::cout<< "\n";
|
||||
assert(test(temperature));
|
||||
test.update(temperature,0);
|
||||
std::cout<< "\n";
|
||||
assert(temperature==1);
|
||||
assert(test(temperature));
|
||||
test.update(temperature,0);
|
||||
std::cout<< "\n";
|
||||
assert(temperature==1);
|
||||
assert(test(temperature));
|
||||
|
||||
test.update(temperature,0);
|
||||
assert(temperature==0.1);
|
||||
assert(!test(temperature));
|
||||
|
||||
|
||||
std::cout << "[t-moSimpleCoolingSchedule] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
65
mo/test/t-moSimpleHC.cpp
Normal file
65
mo/test/t-moSimpleHC.cpp
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
<t-moSimpleHC.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 <algo/moSimpleHC.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moSimpleHC] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
|
||||
//test first constructor
|
||||
moSimpleHC<bitNeighbor> test1(nh, fullEval, eval);
|
||||
|
||||
//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);
|
||||
|
||||
std::cout << "[t-moSimpleHC] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
93
mo/test/t-moSimpleHCexplorer.cpp
Normal file
93
mo/test/t-moSimpleHCexplorer.cpp
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
<t-moSimpleHCexplorer.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 use,
|
||||
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".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
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 "moTestClass.h"
|
||||
#include <eval/moFullEvalByCopy.h>
|
||||
#include <explorer/moSimpleHCexplorer.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
//Pas grand chose à faire: le gros du travail est fait par le voisin et l'eval
|
||||
|
||||
std::cout << "[t-moSimpleHCexplorer] => START" << std::endl;
|
||||
|
||||
Solution sol;
|
||||
moDummyNeighborTest neighbor;
|
||||
moDummyEvalTest eval;
|
||||
moDummyNeighborhoodTest nh;
|
||||
moFullEvalByCopy<moDummyNeighborTest> fulleval(eval);
|
||||
moNeighborComparator<moDummyNeighborTest> comp;
|
||||
moSolNeighborComparator<moDummyNeighborTest> solNeighborComp;
|
||||
|
||||
|
||||
//verif constructor
|
||||
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
|
||||
sol.fitness(3);
|
||||
test(sol);
|
||||
test.accept(sol);
|
||||
assert(!test.isContinue(sol));
|
||||
|
||||
//hasNeighbor() retourne faux a l'entrée de accept() donc on doit pas continuer
|
||||
test(sol);
|
||||
test.accept(sol);
|
||||
assert(!test.isContinue(sol));
|
||||
|
||||
//hasNeighbor() retourne vrai et on ameliore la fitness donc on doit continuer
|
||||
test(sol);
|
||||
test.accept(sol);
|
||||
assert(test.isContinue(sol));
|
||||
|
||||
//verif de move -> on affecte la fitness du best d'avant
|
||||
test.move(sol);
|
||||
|
||||
//hasNeighbor() retourne vrai et on ameliore pas la fitness donc on doit pas continuer
|
||||
test(sol);
|
||||
test(sol);
|
||||
test.accept(sol);
|
||||
assert(!test.isContinue(sol));
|
||||
|
||||
assert(test.className()=="moSimpleHCexplorer");
|
||||
|
||||
std::cout << "[t-moSimpleHCexplorer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
61
mo/test/t-moSolComparator.cpp
Normal file
61
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;
|
||||
}
|
||||
|
||||
56
mo/test/t-moSolInit.cpp
Normal file
56
mo/test/t-moSolInit.cpp
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
<t-moSolInit.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 <perturb/moSolInit.h>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moSolInit] => START" << std::endl;
|
||||
|
||||
int a=3;
|
||||
|
||||
int b=5;
|
||||
|
||||
moSolInit<int> test(a);
|
||||
|
||||
test(b);
|
||||
assert(b==3);
|
||||
a=4;
|
||||
test(b);
|
||||
assert(b==4);
|
||||
|
||||
std::cout << "[t-moSolInit] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
72
mo/test/t-moSolNeighborComparator.cpp
Normal file
72
mo/test/t-moSolNeighborComparator.cpp
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
<t-moSolNeighborComparator.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 use,
|
||||
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".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
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 <problems/bitString/moBitNeighbor.h>
|
||||
#include <eoScalarFitness.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <ga/eoBit.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moSolNeighborComparator] => START" << std::endl;
|
||||
|
||||
moBitNeighbor<eoMinimizingFitness> neighbor;
|
||||
eoBit<eoMinimizingFitness> sol;
|
||||
|
||||
moSolNeighborComparator< moBitNeighbor<eoMinimizingFitness> > test;
|
||||
|
||||
neighbor.fitness(3);
|
||||
sol.fitness(2);
|
||||
//test with a minimizing fitness, neighbor must not be better than sol
|
||||
assert(!test(sol, neighbor));
|
||||
|
||||
//reversly
|
||||
neighbor.fitness(2);
|
||||
sol.fitness(3);
|
||||
assert(test(sol, neighbor));
|
||||
|
||||
//test equals
|
||||
assert(!test.equals(sol, neighbor));
|
||||
|
||||
neighbor.fitness(3);
|
||||
assert(test.equals(sol, neighbor));
|
||||
|
||||
assert(test.className()=="moSolNeighborComparator");
|
||||
|
||||
std::cout << "[t-moSolNeighborComparator] => OK" << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
154
mo/test/t-moSolVectorTabuList.cpp
Normal file
154
mo/test/t-moSolVectorTabuList.cpp
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
<t-moSolVectorTabuList.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 <memory/moSolVectorTabuList.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moSolVectorTabuList] => START" << std::endl;
|
||||
|
||||
//test without countdown
|
||||
moSolVectorTabuList<bitNeighbor> test(2,0);
|
||||
bitNeighbor n1;
|
||||
bitNeighbor n2;
|
||||
bitNeighbor n3;
|
||||
bitNeighbor n4;
|
||||
n1.index(0);
|
||||
n2.index(1);
|
||||
n3.index(2);
|
||||
n4.index(3);
|
||||
|
||||
eoBit<eoMinimizingFitness> sol1(4, true);
|
||||
eoBit<eoMinimizingFitness> sol2(4, true);
|
||||
eoBit<eoMinimizingFitness> sol3(4, true);
|
||||
eoBit<eoMinimizingFitness> sol4(4, true);
|
||||
|
||||
sol2[0]=false;
|
||||
sol3[1]=false;
|
||||
sol4[0]=false;
|
||||
sol4[1]=false;
|
||||
|
||||
//init
|
||||
test.init(sol1);
|
||||
|
||||
//ajout d'une sol tabu
|
||||
test.add(sol1,n1);
|
||||
|
||||
//verification des voisins de chaques sol
|
||||
assert(test.check(sol2,n1));
|
||||
assert(!test.check(sol2,n2));
|
||||
assert(!test.check(sol2,n3));
|
||||
assert(!test.check(sol2,n4));
|
||||
|
||||
assert(!test.check(sol3,n1));
|
||||
assert(test.check(sol3,n2));
|
||||
assert(!test.check(sol3,n3));
|
||||
assert(!test.check(sol3,n4));
|
||||
|
||||
assert(!test.check(sol4,n1));
|
||||
assert(!test.check(sol4,n2));
|
||||
assert(!test.check(sol4,n3));
|
||||
assert(!test.check(sol4,n4));
|
||||
|
||||
test.init(sol1);
|
||||
assert(!test.check(sol2,n1));
|
||||
assert(!test.check(sol3,n2));
|
||||
|
||||
test.update(sol1,n1);
|
||||
|
||||
test.add(sol1,n1);
|
||||
test.add(sol2,n1);
|
||||
assert(test.check(sol2,n1));
|
||||
test.add(sol4,n1);
|
||||
assert(!test.check(sol2,n1));
|
||||
assert(test.check(sol2,n2));
|
||||
|
||||
//test with a countdown at 3
|
||||
moSolVectorTabuList<bitNeighbor> test2(2,2);
|
||||
test2.init(sol1);
|
||||
test2.add(sol1,n1);
|
||||
assert(test2.check(sol2,n1));
|
||||
assert(!test2.check(sol2,n2));
|
||||
assert(!test2.check(sol2,n3));
|
||||
assert(!test2.check(sol2,n4));
|
||||
|
||||
assert(!test2.check(sol3,n1));
|
||||
assert(test2.check(sol3,n2));
|
||||
assert(!test2.check(sol3,n3));
|
||||
assert(!test2.check(sol3,n4));
|
||||
|
||||
assert(!test2.check(sol4,n1));
|
||||
assert(!test2.check(sol4,n2));
|
||||
assert(!test2.check(sol4,n3));
|
||||
assert(!test2.check(sol4,n4));
|
||||
|
||||
//coutdown sol1 -> 1
|
||||
test2.update(sol1,n1);
|
||||
assert(test2.check(sol2,n1));
|
||||
assert(!test2.check(sol2,n2));
|
||||
assert(!test2.check(sol2,n3));
|
||||
assert(!test2.check(sol2,n4));
|
||||
|
||||
assert(!test2.check(sol3,n1));
|
||||
assert(test2.check(sol3,n2));
|
||||
assert(!test2.check(sol3,n3));
|
||||
assert(!test2.check(sol3,n4));
|
||||
|
||||
assert(!test2.check(sol4,n1));
|
||||
assert(!test2.check(sol4,n2));
|
||||
assert(!test2.check(sol4,n3));
|
||||
assert(!test2.check(sol4,n4));
|
||||
|
||||
//coutdown sol1 -> 0 : sol1 is no longer tabu
|
||||
test2.update(sol1,n1);
|
||||
assert(!test2.check(sol2,n1));
|
||||
assert(!test2.check(sol2,n2));
|
||||
assert(!test2.check(sol2,n3));
|
||||
assert(!test2.check(sol2,n4));
|
||||
|
||||
assert(!test2.check(sol3,n1));
|
||||
assert(!test2.check(sol3,n2));
|
||||
assert(!test2.check(sol3,n3));
|
||||
assert(!test2.check(sol3,n4));
|
||||
|
||||
assert(!test2.check(sol4,n1));
|
||||
assert(!test2.check(sol4,n2));
|
||||
assert(!test2.check(sol4,n3));
|
||||
assert(!test2.check(sol4,n4));
|
||||
|
||||
std::cout << "[t-moSolVectorTabuList] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
64
mo/test/t-moSolutionStat.cpp
Normal file
64
mo/test/t-moSolutionStat.cpp
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
<t-moSolutionStat.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 <continuator/moSolutionStat.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moSolutionStat] => START" << std::endl;
|
||||
|
||||
eoBit<unsigned int> s(3);
|
||||
s[0]=true;
|
||||
s[1]=true;
|
||||
s[2]=false;
|
||||
|
||||
s.fitness(17);
|
||||
|
||||
moSolutionStat< eoBit<unsigned int > > test;
|
||||
|
||||
test(s);
|
||||
//on verifie que la solution est bien enregistré
|
||||
|
||||
assert(test.value()[0]);
|
||||
assert(test.value()[1]);
|
||||
assert(!test.value()[2]);
|
||||
assert(test.value().fitness()==17);
|
||||
|
||||
assert(test.className()=="moSolutionStat");
|
||||
|
||||
std::cout << "[t-moSolutionStat] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
112
mo/test/t-moStatistics.cpp
Normal file
112
mo/test/t-moStatistics.cpp
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
<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*std==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;
|
||||
}
|
||||
|
||||
72
mo/test/t-moTS.cpp
Normal file
72
mo/test/t-moTS.cpp
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
<t-moTS.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 <algo/moTS.h>
|
||||
#include "moTestClass.h"
|
||||
#include <eval/oneMaxEval.h>
|
||||
#include <continuator/moTrueContinuator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
#include <memory/moSolVectorTabuList.h>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moTS] => START" << std::endl;
|
||||
|
||||
bitNeighborhood nh(4);
|
||||
oneMaxEval<bitVector> fullEval;
|
||||
evalOneMax eval(4);
|
||||
|
||||
//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 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);
|
||||
|
||||
|
||||
std::cout << "[t-moTS] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
165
mo/test/t-moTSexplorer.cpp
Normal file
165
mo/test/t-moTSexplorer.cpp
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
<t-moTSexplorer.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 <memory/moSolVectorTabuList.h>
|
||||
#include <memory/moDummyIntensification.h>
|
||||
#include <memory/moDummyDiversification.h>
|
||||
#include <memory/moBestImprAspiration.h>
|
||||
#include <explorer/moTSexplorer.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moTSexplorer] => START" << std::endl;
|
||||
|
||||
//instansiation
|
||||
eoBit<eoMinimizingFitness> sol(4, true);
|
||||
sol.fitness(4);
|
||||
bitNeighborhood nh(4);
|
||||
bitNeighborhood emptyNH(0);
|
||||
evalOneMax eval(4);
|
||||
moNeighborComparator<bitNeighbor> ncomp;
|
||||
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||
moDummyIntensification<bitNeighbor> intens;
|
||||
moDummyDiversification<bitNeighbor> diver;
|
||||
moSolVectorTabuList<bitNeighbor> tabuList(4,0);
|
||||
moBestImprAspiration<bitNeighbor> 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);
|
||||
test2(sol);
|
||||
assert(!test2.accept(sol));
|
||||
|
||||
//test le comportement classique de la taboo
|
||||
test.initParam(sol);
|
||||
assert(aspir.getBest()==sol);
|
||||
|
||||
test(sol);
|
||||
test.updateParam(sol);
|
||||
assert(aspir.getBest()==sol);
|
||||
|
||||
//on ameliore et on stock une sol tabou 0111
|
||||
test(sol);
|
||||
test.move(sol);
|
||||
test.moveApplied(true);
|
||||
test.updateParam(sol);
|
||||
assert(aspir.getBest()==sol);
|
||||
|
||||
//on ameliore et on stock une autre sol tabou 0011
|
||||
test(sol);
|
||||
test.move(sol);
|
||||
test.moveApplied(true);
|
||||
test.updateParam(sol);
|
||||
assert(aspir.getBest()==sol);
|
||||
|
||||
//pareil on stock 0001 met pdt la recherche on se rend compte que 0111 est tabou
|
||||
test(sol);
|
||||
test.move(sol);
|
||||
test.moveApplied(true);
|
||||
test.updateParam(sol);
|
||||
assert(aspir.getBest()==sol);
|
||||
|
||||
//on modifie la sol en 1001(fitness 2) pour que la 1er sol exploré(0001) soit tabou
|
||||
//De plus on change la solution mais elle est pas meilleure que la best so Far
|
||||
sol[0]=true;
|
||||
std::cout << sol << std::endl;
|
||||
sol.fitness(2);
|
||||
test(sol);
|
||||
test.move(sol);
|
||||
test.moveApplied(true);
|
||||
test.updateParam(sol);
|
||||
assert( sol[0] && !sol[1] && !sol[2] && !sol[3]);
|
||||
sol[0]=false;
|
||||
sol[3]=true;
|
||||
assert(aspir.getBest()==sol);
|
||||
|
||||
//test du isContinue
|
||||
assert(test.isContinue(sol));
|
||||
|
||||
//test du terminate
|
||||
test.initParam(sol);
|
||||
sol[0]=true;
|
||||
sol[1]=true;
|
||||
sol[2]=true;
|
||||
sol[3]=true;
|
||||
sol.fitness(4);
|
||||
test(sol);
|
||||
test.move(sol);
|
||||
test.moveApplied(true);
|
||||
test.updateParam(sol);
|
||||
assert( !sol[0] && sol[1] && sol[2] && sol[3]);
|
||||
test.terminate(sol);
|
||||
assert( !sol[0] && !sol[1] && !sol[2] && sol[3]);
|
||||
|
||||
//test pour avoir que des mouvement taboo
|
||||
eoBit<eoMinimizingFitness> sol2(2, true);
|
||||
sol2.fitness(2);
|
||||
bitNeighborhood nh2(2);
|
||||
evalOneMax eval2(2);
|
||||
|
||||
moTSexplorer<bitNeighbor> test3(nh2, eval2, ncomp, sncomp, tabuList, intens, diver, aspir);
|
||||
|
||||
test3.initParam(sol2);
|
||||
test3(sol2);
|
||||
test3.move(sol2);
|
||||
test3.moveApplied(true);
|
||||
test3.updateParam(sol2);
|
||||
|
||||
test3(sol2);
|
||||
test3.move(sol2);
|
||||
test3.moveApplied(true);
|
||||
test3.updateParam(sol2);
|
||||
|
||||
test3(sol2);
|
||||
test3.move(sol2);
|
||||
test3.moveApplied(true);
|
||||
test3.updateParam(sol2);
|
||||
|
||||
test3(sol2);
|
||||
test3.move(sol2);
|
||||
test3.moveApplied(true);
|
||||
test3.updateParam(sol2);
|
||||
|
||||
//on a rempli la liste tabu pour que tout les voisins soit tabu
|
||||
test3(sol2);
|
||||
assert(!test3.accept(sol2));
|
||||
|
||||
|
||||
std::cout << "[t-moTSexplorer] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
71
mo/test/t-moTimeContinuator.cpp
Normal file
71
mo/test/t-moTimeContinuator.cpp
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
<t-moTimeContinuator.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 <continuator/moTimeContinuator.h>
|
||||
#include "moTestClass.h"
|
||||
#include <time.h>
|
||||
|
||||
void wait ( int seconds )
|
||||
{
|
||||
clock_t endwait;
|
||||
endwait = clock () + seconds * CLOCKS_PER_SEC ;
|
||||
while (clock() < endwait) {}
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moTimeContinuator] => START" << std::endl;
|
||||
|
||||
moTimeContinuator<moDummyNeighborTest> test(2, false);
|
||||
moTimeContinuator<moDummyNeighborTest> test2(3);
|
||||
Solution s;
|
||||
|
||||
test.init(s);
|
||||
assert(test(s));
|
||||
wait(1);
|
||||
assert(test(s));
|
||||
wait(1);
|
||||
assert(!test(s));
|
||||
test.init(s);
|
||||
assert(test(s));
|
||||
wait(2);
|
||||
assert(!test(s));
|
||||
|
||||
assert(test.className()=="moTimeContinuator");
|
||||
|
||||
std::cout << "[t-moTimeContinuator] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
53
mo/test/t-moTrueContinuator.cpp
Normal file
53
mo/test/t-moTrueContinuator.cpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
<t-moTrueContinuator.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 use,
|
||||
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".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
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 <continuator/moTrueContinuator.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
std::cout << "[t-moTrueContinuator] => START" << std::endl;
|
||||
|
||||
moTrueContinuator<moDummyNeighborTest> test;
|
||||
Solution s;
|
||||
|
||||
assert(test(s));
|
||||
|
||||
std::cout << "[t-moTrueContinuator] => OK" << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
112
mo/test/t-moVectorMonitor.cpp
Normal file
112
mo/test/t-moVectorMonitor.cpp
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
<t-moVectorMonitor.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 <continuator/moVectorMonitor.h>
|
||||
#include "moTestClass.h"
|
||||
|
||||
int main() {
|
||||
|
||||
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;
|
||||
|
||||
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());
|
||||
|
||||
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);
|
||||
|
||||
test1.fileExport("outputTestVectorMonitor.txt");
|
||||
|
||||
test1.clear();
|
||||
test2.clear();
|
||||
test3.clear();
|
||||
assert(test1.size()==0);
|
||||
assert(test2.size()==0);
|
||||
assert(test3.size()==0);
|
||||
|
||||
|
||||
|
||||
assert(test1.className()=="moVectorMonitor");
|
||||
|
||||
|
||||
|
||||
std::cout << "[t-moVectorMonitor] => OK" << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue