test added
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1809 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
a2cf7f781d
commit
c60f80b480
28 changed files with 701 additions and 53 deletions
|
|
@ -60,13 +60,6 @@ class moComparator : public eoBF<const T1 & , const T2 & , bool>
|
||||||
public:
|
public:
|
||||||
virtual bool equals(const T1&, const T2&) = 0;
|
virtual bool equals(const T1&, const T2&) = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the class id.
|
|
||||||
* @return the class name as a std::string
|
|
||||||
*/
|
|
||||||
virtual std::string className() const {
|
|
||||||
return "moComparator";
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ public :
|
||||||
* @param _eval an evaluation function
|
* @param _eval an evaluation function
|
||||||
* @param _neighborComparator a neighbor Comparator
|
* @param _neighborComparator a neighbor Comparator
|
||||||
* @param _solNeighborComparator a comparator between a solution and a neighbor
|
* @param _solNeighborComparator a comparator between a solution and a neighbor
|
||||||
|
* @param _k number of neighbors visited
|
||||||
*/
|
*/
|
||||||
moNeighborBestStat(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator, unsigned int _k = 0):
|
moNeighborBestStat(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator, unsigned int _k = 0):
|
||||||
moStat<EOT, Fitness>(true, "neighborhood"),
|
moStat<EOT, Fitness>(true, "neighborhood"),
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,12 @@ public:
|
||||||
moStat(T _value, std::string _description):
|
moStat(T _value, std::string _description):
|
||||||
eoValueParam<T>(_value, _description) {}
|
eoValueParam<T>(_value, _description) {}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* @return name of the class
|
// * @return name of the class
|
||||||
*/
|
// */
|
||||||
virtual std::string className(void) const {
|
// virtual std::string className(void) const {
|
||||||
return "moStat";
|
// return "moStat";
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,12 +56,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void init(EOT &){}
|
virtual void init(EOT &){}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return name of the class
|
|
||||||
*/
|
|
||||||
virtual std::string className(void) const {
|
|
||||||
return "moStatBase";
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#ifndef moVectorMonitor_h
|
#ifndef moVectorMonitor_h
|
||||||
#define moVectorMonitor_h
|
#define moVectorMonitor_h
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
#include <utils/eoMonitor.h>
|
#include <utils/eoMonitor.h>
|
||||||
#include <utils/eoParam.h>
|
#include <utils/eoParam.h>
|
||||||
|
|
||||||
|
|
@ -69,6 +70,14 @@ public:
|
||||||
moVectorMonitor(eoValueParam<EOT> & _param) : doubleParam(NULL), intParam(NULL), eotParam(&_param)
|
moVectorMonitor(eoValueParam<EOT> & _param) : doubleParam(NULL), intParam(NULL), eotParam(&_param)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
* @param _param the parameter of type EOT to save in the vector
|
||||||
|
*/
|
||||||
|
template <class ScalarType, class Compare>
|
||||||
|
moVectorMonitor(eoValueParam<eoScalarFitness<ScalarType, Compare> > & _param) : doubleParam( & (eoValueParam<double>&)_param), intParam(NULL), eotParam(NULL)
|
||||||
|
{ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
* @param _param the parameter of type EOT to save in the vector
|
* @param _param the parameter of type EOT to save in the vector
|
||||||
|
|
@ -163,11 +172,11 @@ public:
|
||||||
*/
|
*/
|
||||||
void fileExport(std::string _filename) {
|
void fileExport(std::string _filename) {
|
||||||
// create file
|
// create file
|
||||||
ofstream os(_filename.c_str());
|
std::ofstream os(_filename.c_str());
|
||||||
|
|
||||||
if (!os) {
|
if (!os) {
|
||||||
string str = "moVectorMonitor: Could not open " + _filename;
|
std::string str = "moVectorMonitor: Could not open " + _filename;
|
||||||
throw runtime_error(str);
|
throw std::runtime_error(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(unsigned int i = 0; i < size(); i++) {
|
for(unsigned int i = 0; i < size(); i++) {
|
||||||
|
|
|
||||||
|
|
@ -123,9 +123,9 @@ public:
|
||||||
* Return the class id.
|
* Return the class id.
|
||||||
* @return the class name as a std::string
|
* @return the class name as a std::string
|
||||||
*/
|
*/
|
||||||
virtual std::string className() const {
|
// virtual std::string className() const {
|
||||||
return "moNeighborhoodExplorer";
|
// return "moNeighborhoodExplorer";
|
||||||
}
|
// }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
moDummyNeighborhood<Neighbor> dummyNeighborhood;
|
moDummyNeighborhood<Neighbor> dummyNeighborhood;
|
||||||
|
|
|
||||||
|
|
@ -59,9 +59,9 @@ public:
|
||||||
* Return the class id.
|
* Return the class id.
|
||||||
* @return the class name as a std::string
|
* @return the class name as a std::string
|
||||||
*/
|
*/
|
||||||
virtual std::string className() const {
|
// virtual std::string className() const {
|
||||||
return "moIndexNeighborhood";
|
// return "moIndexNeighborhood";
|
||||||
}
|
// }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
unsigned int neighborhoodSize;
|
unsigned int neighborhoodSize;
|
||||||
|
|
|
||||||
|
|
@ -67,11 +67,10 @@ public:
|
||||||
*/
|
*/
|
||||||
moAutocorrelationSampling(eoInit<EOT> & _init,
|
moAutocorrelationSampling(eoInit<EOT> & _init,
|
||||||
moNeighborhood<Neighbor> & _neighborhood,
|
moNeighborhood<Neighbor> & _neighborhood,
|
||||||
eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval,
|
eoEvalFunc<EOT>& _fullEval,
|
||||||
|
moEval<Neighbor>& _eval,
|
||||||
unsigned int _nbStep) :
|
unsigned int _nbStep) :
|
||||||
moSampling<Neighbor>(_init, * new moRandomWalk<Neighbor>(_neighborhood, _fullEval, _eval, _nbStep), fitnessStat)
|
moSampling<Neighbor>(_init, * new moRandomWalk<Neighbor>(_neighborhood, _fullEval, _eval, _nbStep), fitnessStat){}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* default destructor
|
* default destructor
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,7 @@ public:
|
||||||
moDensityOfStatesSampling(eoInit<EOT> & _init,
|
moDensityOfStatesSampling(eoInit<EOT> & _init,
|
||||||
eoEvalFunc<EOT>& _fullEval,
|
eoEvalFunc<EOT>& _fullEval,
|
||||||
unsigned int _nbSol) :
|
unsigned int _nbSol) :
|
||||||
moSampling<Neighbor>(_init, * new moRandomSearch<Neighbor>(_init, _fullEval, _nbSol), fitnessStat)
|
moSampling<Neighbor>(_init, * new moRandomSearch<Neighbor>(_init, _fullEval, _nbSol), fitnessStat){}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* default destructor
|
* default destructor
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ public:
|
||||||
*/
|
*/
|
||||||
~moFDCsampling() {
|
~moFDCsampling() {
|
||||||
// delete the pointer on the local search which has been constructed in the constructor
|
// delete the pointer on the local search which has been constructed in the constructor
|
||||||
delete &localSearch;
|
delete localSearch;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -77,9 +77,7 @@ public:
|
||||||
fullEval(_fullEval),
|
fullEval(_fullEval),
|
||||||
eval(_eval),
|
eval(_eval),
|
||||||
nbSol(_nbSol)
|
nbSol(_nbSol)
|
||||||
{
|
{}
|
||||||
// std::cout << "moFitnessCloudSampling: Warming to nothing will be sample." << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* default destructor
|
* default destructor
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,8 @@ public:
|
||||||
*/
|
*/
|
||||||
moHillClimberSampling(eoInit<EOT> & _init,
|
moHillClimberSampling(eoInit<EOT> & _init,
|
||||||
moNeighborhood<Neighbor> & _neighborhood,
|
moNeighborhood<Neighbor> & _neighborhood,
|
||||||
eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval,
|
eoEvalFunc<EOT>& _fullEval,
|
||||||
|
moEval<Neighbor>& _eval,
|
||||||
unsigned int _nbAdaptWalk) :
|
unsigned int _nbAdaptWalk) :
|
||||||
moSampling<Neighbor>(initHC, * new moRandomSearch<Neighbor>(initHC, _fullEval, _nbAdaptWalk), copyStat),
|
moSampling<Neighbor>(initHC, * new moRandomSearch<Neighbor>(initHC, _fullEval, _nbAdaptWalk), copyStat),
|
||||||
copyStat(lengthStat),
|
copyStat(lengthStat),
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@
|
||||||
#define moSampling_h
|
#define moSampling_h
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
#include <eoFunctor.h>
|
#include <eoFunctor.h>
|
||||||
#include <utils/eoMonitor.h>
|
#include <utils/eoMonitor.h>
|
||||||
#include <continuator/moStat.h>
|
#include <continuator/moStat.h>
|
||||||
|
|
@ -44,6 +46,7 @@
|
||||||
#include <algo/moLocalSearch.h>
|
#include <algo/moLocalSearch.h>
|
||||||
#include <eoInit.h>
|
#include <eoInit.h>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To sample the search space:
|
* To sample the search space:
|
||||||
* A local search is used to sample the search space
|
* A local search is used to sample the search space
|
||||||
|
|
@ -97,7 +100,7 @@ public:
|
||||||
monitorVec.push_back(monitor);
|
monitorVec.push_back(monitor);
|
||||||
checkpoint->add(*monitor);
|
checkpoint->add(*monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To sample the search and get the statistics
|
* To sample the search and get the statistics
|
||||||
|
|
@ -131,11 +134,11 @@ public:
|
||||||
*/
|
*/
|
||||||
void fileExport(std::string _filename, std::string _delim = " ") {
|
void fileExport(std::string _filename, std::string _delim = " ") {
|
||||||
// create file
|
// create file
|
||||||
ofstream os(_filename.c_str());
|
std::ofstream os(_filename.c_str());
|
||||||
|
|
||||||
if (!os) {
|
if (!os) {
|
||||||
string str = "moSampling: Could not open " + _filename;
|
std::string str = "moSampling: Could not open " + _filename;
|
||||||
throw runtime_error(str);
|
throw std::runtime_error(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
// all vector have the same size
|
// all vector have the same size
|
||||||
|
|
@ -160,8 +163,8 @@ public:
|
||||||
*/
|
*/
|
||||||
void fileExport(unsigned int _col, std::string _filename) {
|
void fileExport(unsigned int _col, std::string _filename) {
|
||||||
if (_col >= monitorVec.size()) {
|
if (_col >= monitorVec.size()) {
|
||||||
string str = "moSampling: Could not export into file the vector. The index does not exists (too large)";
|
std::string str = "moSampling: Could not export into file the vector. The index does not exists (too large)";
|
||||||
throw runtime_error(str);
|
throw std::runtime_error(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
monitorVec[_col]->fileExport(_filename);
|
monitorVec[_col]->fileExport(_filename);
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
#define moStatistics_h
|
#define moStatistics_h
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <cmath>
|
||||||
#include <utils/eoDistance.h>
|
#include <utils/eoDistance.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -61,7 +62,7 @@ public:
|
||||||
* @param avg average to compute
|
* @param avg average to compute
|
||||||
* @param std standard deviation to compute
|
* @param std standard deviation to compute
|
||||||
*/
|
*/
|
||||||
void basic(const vector<double> & data,
|
void basic(const std::vector<double> & data,
|
||||||
double & min, double & max, double & avg, double & std) {
|
double & min, double & max, double & avg, double & std) {
|
||||||
|
|
||||||
if (data.size() == 0) {
|
if (data.size() == 0) {
|
||||||
|
|
@ -104,8 +105,8 @@ public:
|
||||||
* @param matrix matrix of distances between solutions
|
* @param matrix matrix of distances between solutions
|
||||||
*/
|
*/
|
||||||
template <class EOT>
|
template <class EOT>
|
||||||
void distances(const vector<EOT> & data, eoDistance<EOT> & distance,
|
void distances(const std::vector<EOT> & data, eoDistance<EOT> & distance,
|
||||||
vector< vector<double> > & matrix) {
|
std::vector< std::vector<double> > & matrix) {
|
||||||
if (data.size() == 0) {
|
if (data.size() == 0) {
|
||||||
matrix.resize(0);
|
matrix.resize(0);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -134,8 +135,8 @@ public:
|
||||||
* @param rho autocorrelation coefficients
|
* @param rho autocorrelation coefficients
|
||||||
* @param phi partial autocorrelation coefficients
|
* @param phi partial autocorrelation coefficients
|
||||||
*/
|
*/
|
||||||
void autocorrelation(const vector<double> & data, unsigned int nbS,
|
void autocorrelation(const std::vector<double> & data, unsigned int nbS,
|
||||||
vector<double> & rho, vector<double> & phi) {
|
std::vector<double> & rho, std::vector<double> & phi) {
|
||||||
if (data.size() == 0) {
|
if (data.size() == 0) {
|
||||||
rho.resize(0);
|
rho.resize(0);
|
||||||
phi.resize(0);
|
phi.resize(0);
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,15 @@ SET (TEST_LIST
|
||||||
t-moMinusOneCounterStat
|
t-moMinusOneCounterStat
|
||||||
t-moVectorMonitor
|
t-moVectorMonitor
|
||||||
t-moRandomSearchExplorer
|
t-moRandomSearchExplorer
|
||||||
|
t-moSampling
|
||||||
|
t-moDensityOfStatesSampling
|
||||||
|
t-moAutocorrelationSampling
|
||||||
|
t-moHillClimberSampling
|
||||||
|
t-moFDCsampling
|
||||||
|
t-moNeutralDegreeSampling
|
||||||
|
t-moFitnessCloudSampling
|
||||||
|
t-moNeutralWalkSampling
|
||||||
|
t-moStatistics
|
||||||
)
|
)
|
||||||
|
|
||||||
FOREACH (test ${TEST_LIST})
|
FOREACH (test ${TEST_LIST})
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
typedef eoBit<eoMinimizingFitness> bitVector;
|
typedef eoBit<eoMinimizingFitness> bitVector;
|
||||||
typedef moBitNeighbor<eoMinimizingFitness> bitNeighbor;
|
typedef moBitNeighbor<eoMinimizingFitness> bitNeighbor;
|
||||||
|
|
||||||
class moDummyRndNeighborhood: public moOrderNeighborhood<bitNeighbor>/*, public moRndNeighborhood<bitNeighbor>*/ {
|
class moDummyRndNeighborhood: public moOrderNeighborhood<bitNeighbor>, public moRndNeighborhood<bitNeighbor> {
|
||||||
public:
|
public:
|
||||||
moDummyRndNeighborhood(unsigned int a): moOrderNeighborhood<bitNeighbor>(a) {}
|
moDummyRndNeighborhood(unsigned int a): moOrderNeighborhood<bitNeighbor>(a) {}
|
||||||
};
|
};
|
||||||
|
|
@ -205,8 +205,24 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
class dummyInit: public eoInit<bitVector>{
|
class dummyInit: public eoInit<bitVector>{
|
||||||
|
public:
|
||||||
void operator()(bitVector& sol){
|
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
|
#endif
|
||||||
|
|
|
||||||
58
trunk/paradiseo-mo/test/t-moAutocorrelationSampling.cpp
Normal file
58
trunk/paradiseo-mo/test/t-moAutocorrelationSampling.cpp
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
<t-moAutocorrelationSampling.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include <sampling/moAutocorrelationSampling.h>
|
||||||
|
#include "moTestClass.h"
|
||||||
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moAutocorrelationSampling] => START" << std::endl;
|
||||||
|
|
||||||
|
bitNeighborhood nh(4);
|
||||||
|
oneMaxEval<bitVector> fullEval;
|
||||||
|
evalOneMax eval(4);
|
||||||
|
dummyInit2 init(4);
|
||||||
|
|
||||||
|
moAutocorrelationSampling<bitNeighbor> test(init, nh, fullEval, eval, 3);
|
||||||
|
|
||||||
|
test();
|
||||||
|
|
||||||
|
test.fileExport("outputTestAutocorrelationSampling");
|
||||||
|
|
||||||
|
|
||||||
|
std::cout << "[t-moAutocorrelationSampling] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
54
trunk/paradiseo-mo/test/t-moDensityOfStatesSampling.cpp
Normal file
54
trunk/paradiseo-mo/test/t-moDensityOfStatesSampling.cpp
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
<t-moDensityOfStatesSampling.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include <sampling/moDensityOfStatesSampling.h>
|
||||||
|
#include "moTestClass.h"
|
||||||
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moDensityOfStatesSampling] => START" << std::endl;
|
||||||
|
|
||||||
|
oneMaxEval<bitVector> fullEval;
|
||||||
|
dummyInit2 init(4);
|
||||||
|
|
||||||
|
moDensityOfStatesSampling<bitNeighbor> test(init, fullEval, 3);
|
||||||
|
test();
|
||||||
|
|
||||||
|
test.fileExport("outputTestDensityOfState");
|
||||||
|
|
||||||
|
std::cout << "[t-moDensityOfStatesSampling] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
61
trunk/paradiseo-mo/test/t-moFDCsampling.cpp
Normal file
61
trunk/paradiseo-mo/test/t-moFDCsampling.cpp
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
<t-moFDCsampling.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
|
||||||
|
#include <sampling/moFDCsampling.h>
|
||||||
|
#include "moTestClass.h"
|
||||||
|
#include <utils/eoDistance.h>
|
||||||
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moFDCsampling] => START" << std::endl;
|
||||||
|
|
||||||
|
oneMaxEval<bitVector> fullEval;
|
||||||
|
dummyInit2 init(4);
|
||||||
|
eoHammingDistance<bitVector> dist;
|
||||||
|
bitVector sol(4, false);
|
||||||
|
sol.fitness(0);
|
||||||
|
|
||||||
|
|
||||||
|
moFDCsampling<bitNeighbor> test(init, fullEval, dist, sol, 3);
|
||||||
|
|
||||||
|
test();
|
||||||
|
|
||||||
|
test.fileExport("outputTestFDCsampling");
|
||||||
|
|
||||||
|
std::cout << "[t-moFDCsampling] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
75
trunk/paradiseo-mo/test/t-moFitnessCloudSampling.cpp
Normal file
75
trunk/paradiseo-mo/test/t-moFitnessCloudSampling.cpp
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
<t-moFitnessCloudSampling.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include <sampling/moFitnessCloudSampling.h>
|
||||||
|
#include <sampling/moRndRndFitnessCloudSampling.h>
|
||||||
|
#include <sampling/moRndBestFitnessCloudSampling.h>
|
||||||
|
#include <sampling/moMHRndFitnessCloudSampling.h>
|
||||||
|
#include <sampling/moMHBestFitnessCloudSampling.h>
|
||||||
|
#include "moTestClass.h"
|
||||||
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moFitnessCloudSampling] => START" << std::endl;
|
||||||
|
|
||||||
|
bitNeighborhood nh(4);
|
||||||
|
oneMaxEval<bitVector> fullEval;
|
||||||
|
evalOneMax eval(4);
|
||||||
|
dummyInit2 init(4);
|
||||||
|
|
||||||
|
moFitnessCloudSampling<bitNeighbor> test1(init, nh, fullEval, eval, 3);
|
||||||
|
|
||||||
|
moRndRndFitnessCloudSampling<bitNeighbor> test2(init, nh, fullEval, eval, 3);
|
||||||
|
|
||||||
|
moRndBestFitnessCloudSampling<bitNeighbor> test3(init, nh, fullEval, eval, 3);
|
||||||
|
|
||||||
|
moMHRndFitnessCloudSampling<bitNeighbor> test4(init, nh, fullEval, eval, 3);
|
||||||
|
|
||||||
|
moMHBestFitnessCloudSampling<bitNeighbor> test5(init, nh, fullEval, eval, 3);
|
||||||
|
|
||||||
|
test1();
|
||||||
|
test2();
|
||||||
|
test3();
|
||||||
|
test4();
|
||||||
|
test5();
|
||||||
|
|
||||||
|
test1.fileExport("outputTestFitnessCloudSampling");
|
||||||
|
|
||||||
|
|
||||||
|
std::cout << "[t-moFitnessCloudSampling] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
57
trunk/paradiseo-mo/test/t-moHillClimberSampling.cpp
Normal file
57
trunk/paradiseo-mo/test/t-moHillClimberSampling.cpp
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
<t-moHillClimberSampling.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include <sampling/moHillClimberSampling.h>
|
||||||
|
#include "moTestClass.h"
|
||||||
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moHillClimberSampling] => START" << std::endl;
|
||||||
|
|
||||||
|
bitNeighborhood nh(4);
|
||||||
|
oneMaxEval<bitVector> fullEval;
|
||||||
|
evalOneMax eval(4);
|
||||||
|
dummyInit2 init(4);
|
||||||
|
|
||||||
|
moHillClimberSampling<bitNeighbor> test(init, nh, fullEval, eval, 3);
|
||||||
|
|
||||||
|
test();
|
||||||
|
|
||||||
|
test.fileExport("outputTestHillClimberSampling");
|
||||||
|
|
||||||
|
std::cout << "[t-moHillClimberSampling] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -42,7 +42,8 @@ int main(){
|
||||||
moNeighborVectorTabuList<bitNeighbor> test(2,0);
|
moNeighborVectorTabuList<bitNeighbor> test(2,0);
|
||||||
|
|
||||||
|
|
||||||
bitVector sol;
|
bitVector sol(4,true);
|
||||||
|
sol.fitness(0);
|
||||||
bitNeighbor n1;
|
bitNeighbor n1;
|
||||||
bitNeighbor n2;
|
bitNeighbor n2;
|
||||||
bitNeighbor n3;
|
bitNeighbor n3;
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,7 @@ int main() {
|
||||||
//test of moSecondMomentNeighborStat.h
|
//test of moSecondMomentNeighborStat.h
|
||||||
std::cout << "[t-moSecondMomentNeighborStat] => START" << std::endl;
|
std::cout << "[t-moSecondMomentNeighborStat] => START" << std::endl;
|
||||||
moSecondMomentNeighborStat<bitNeighbor> test7(test);
|
moSecondMomentNeighborStat<bitNeighbor> test7(test);
|
||||||
|
test7.init(sol);
|
||||||
test7(sol);
|
test7(sol);
|
||||||
assert(test7.value().first==6.6);
|
assert(test7.value().first==6.6);
|
||||||
assert(test7.value().second > 0.966 && test7.value().second < 0.967);
|
assert(test7.value().second > 0.966 && test7.value().second < 0.967);
|
||||||
|
|
|
||||||
64
trunk/paradiseo-mo/test/t-moNeutralDegreeSampling.cpp
Normal file
64
trunk/paradiseo-mo/test/t-moNeutralDegreeSampling.cpp
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
<t-moNeutralDegreeSampling.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include <sampling/moNeutralDegreeSampling.h>
|
||||||
|
#include "moTestClass.h"
|
||||||
|
#include <eval/oneMaxEval.h>
|
||||||
|
#include <comparator/moSolNeighborComparator.h>
|
||||||
|
#include <comparator/moNeighborComparator.h>
|
||||||
|
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moNeutralDegreeSampling] => START" << std::endl;
|
||||||
|
|
||||||
|
bitNeighborhood nh(4);
|
||||||
|
oneMaxEval<bitVector> fullEval;
|
||||||
|
evalOneMax eval(4);
|
||||||
|
dummyInit2 init(4);
|
||||||
|
|
||||||
|
moSolNeighborComparator<bitNeighbor> sncomp;
|
||||||
|
moNeighborComparator<bitNeighbor> ncomp;
|
||||||
|
|
||||||
|
moNeutralDegreeSampling<bitNeighbor> test1(init, nh, fullEval, eval, 3);
|
||||||
|
moNeutralDegreeSampling<bitNeighbor> test2(init, nh, fullEval, eval, ncomp, sncomp, 3);
|
||||||
|
|
||||||
|
test1();
|
||||||
|
|
||||||
|
test1.fileExport("outputNeutralDegreeSampling");
|
||||||
|
|
||||||
|
std::cout << "[t-moNeutralDegreeSampling] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
62
trunk/paradiseo-mo/test/t-moNeutralWalkSampling.cpp
Normal file
62
trunk/paradiseo-mo/test/t-moNeutralWalkSampling.cpp
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
<t-moNeutralWalkSampling.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
|
||||||
|
#include <sampling/moNeutralWalkSampling.h>
|
||||||
|
#include "moTestClass.h"
|
||||||
|
#include <utils/eoDistance.h>
|
||||||
|
#include <eval/oneMaxEval.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moNeutralWalkSampling] => START" << std::endl;
|
||||||
|
|
||||||
|
bitNeighborhood nh(4);
|
||||||
|
oneMaxEval<bitVector> fullEval;
|
||||||
|
evalOneMax eval(4);
|
||||||
|
dummyInit2 init(4);
|
||||||
|
bitVector sol(4, true);
|
||||||
|
sol.fitness(4);
|
||||||
|
eoHammingDistance<bitVector> dist;
|
||||||
|
|
||||||
|
moNeutralWalkSampling<bitNeighbor> test(sol, nh, fullEval, eval, dist, 3);
|
||||||
|
|
||||||
|
test();
|
||||||
|
|
||||||
|
test.fileExport("outputTestNeutralWalkSampling");
|
||||||
|
|
||||||
|
std::cout << "[t-moNeutralWalkSampling] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
81
trunk/paradiseo-mo/test/t-moSampling.cpp
Normal file
81
trunk/paradiseo-mo/test/t-moSampling.cpp
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
/*
|
||||||
|
<t-moSampling.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include <sampling/moSampling.h>
|
||||||
|
#include "moTestClass.h"
|
||||||
|
#include <algo/moFirstImprHC.h>
|
||||||
|
#include <eval/oneMaxEval.h>
|
||||||
|
#include <continuator/moSolutionStat.h>
|
||||||
|
#include <continuator/moCounterStat.h>
|
||||||
|
#include <continuator/moIterContinuator.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moSampling] => START" << std::endl;
|
||||||
|
|
||||||
|
bitNeighborhood nh(4);
|
||||||
|
oneMaxEval<bitVector> fullEval;
|
||||||
|
evalOneMax eval(4);
|
||||||
|
dummyInit2 init(4);
|
||||||
|
moIterContinuator<bitNeighbor> cont(3);
|
||||||
|
|
||||||
|
moFirstImprHC<bitNeighbor> hc(nh, fullEval, eval, cont);
|
||||||
|
moSolutionStat<bitVector> stat1;
|
||||||
|
moCounterStat<bitVector> stat2;
|
||||||
|
moSampling<bitNeighbor> test(init, hc, stat1);
|
||||||
|
|
||||||
|
test.add(stat2);
|
||||||
|
|
||||||
|
test();
|
||||||
|
|
||||||
|
std::vector<double> res;
|
||||||
|
std::vector<bitVector> res2;
|
||||||
|
res = test.getValues(1);
|
||||||
|
res2= test.getSolutions(0);
|
||||||
|
|
||||||
|
for(unsigned int i=0; i<res2.size(); i++)
|
||||||
|
assert(res2[i].fitness()==4-i);
|
||||||
|
|
||||||
|
for(unsigned int i=0; i<res.size(); i++)
|
||||||
|
assert(res[i]==i);
|
||||||
|
|
||||||
|
test.fileExport("outputTestSampling1");
|
||||||
|
test.fileExport(1, "outputTestSampling2");
|
||||||
|
|
||||||
|
assert(test.className()=="moSampling");
|
||||||
|
|
||||||
|
std::cout << "[t-moSampling] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -55,6 +55,7 @@ int main() {
|
||||||
moNeighborComparator<moDummyNeighborTest> comp;
|
moNeighborComparator<moDummyNeighborTest> comp;
|
||||||
moSolNeighborComparator<moDummyNeighborTest> solNeighborComp;
|
moSolNeighborComparator<moDummyNeighborTest> solNeighborComp;
|
||||||
|
|
||||||
|
|
||||||
//verif constructor
|
//verif constructor
|
||||||
moSimpleHCexplorer<moDummyNeighborTest> test(nh, fulleval, comp, solNeighborComp);
|
moSimpleHCexplorer<moDummyNeighborTest> test(nh, fulleval, comp, solNeighborComp);
|
||||||
|
|
||||||
|
|
|
||||||
111
trunk/paradiseo-mo/test/t-moStatistics.cpp
Normal file
111
trunk/paradiseo-mo/test/t-moStatistics.cpp
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
<t-moStatistics.cpp>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
modify and/ or redistribute the software under the terms of the CeCILL
|
||||||
|
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||||
|
"http://www.cecill.info".
|
||||||
|
|
||||||
|
In this respect, the user's attention is drawn to the risks associated
|
||||||
|
with loading, using, modifying and/or developing or reproducing the
|
||||||
|
software by the user in light of its specific status of free software,
|
||||||
|
that may mean that it is complicated to manipulate, and that also
|
||||||
|
therefore means that it is reserved for developers and experienced
|
||||||
|
professionals having in-depth computer knowledge. Users are therefore
|
||||||
|
encouraged to load and test the software's suitability as regards their
|
||||||
|
requirements in conditions enabling the security of their systems and/or
|
||||||
|
data to be ensured and, more generally, to use and operate it in the
|
||||||
|
same conditions as regards security.
|
||||||
|
The fact that you are presently reading this means that you have had
|
||||||
|
knowledge of the CeCILL license and that you accept its terms.
|
||||||
|
|
||||||
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include <sampling/moStatistics.h>
|
||||||
|
#include "moTestClass.h"
|
||||||
|
#include <utils/eoDistance.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
std::cout << "[t-moStatistics] => START" << std::endl;
|
||||||
|
|
||||||
|
moStatistics test;
|
||||||
|
|
||||||
|
double min;
|
||||||
|
double max;
|
||||||
|
double avg;
|
||||||
|
double std;
|
||||||
|
|
||||||
|
//test des stats basic
|
||||||
|
std::vector<double> sampling;
|
||||||
|
sampling.push_back(3);
|
||||||
|
sampling.push_back(5);
|
||||||
|
sampling.push_back(2);
|
||||||
|
sampling.push_back(4);
|
||||||
|
|
||||||
|
|
||||||
|
test.basic(sampling, min, max, avg, std);
|
||||||
|
assert(min==2);
|
||||||
|
assert(max==5);
|
||||||
|
assert(avg==3.5);
|
||||||
|
assert(std==sqrt(1.25));
|
||||||
|
|
||||||
|
sampling.resize(0);
|
||||||
|
test.basic(sampling, min, max, avg, std);
|
||||||
|
assert(min==0);
|
||||||
|
assert(max==0);
|
||||||
|
assert(avg==0);
|
||||||
|
assert(std==0);
|
||||||
|
|
||||||
|
//test de la distance
|
||||||
|
std::vector<bitVector> data;
|
||||||
|
eoHammingDistance<bitVector> dist;
|
||||||
|
bitVector tmp(4,true);
|
||||||
|
data.push_back(tmp);
|
||||||
|
tmp[0]=false;
|
||||||
|
data.push_back(tmp);
|
||||||
|
tmp[2]=false;
|
||||||
|
data.push_back(tmp);
|
||||||
|
|
||||||
|
std::vector< std::vector<double> > matrix;
|
||||||
|
|
||||||
|
test.distances(data, dist, matrix);
|
||||||
|
|
||||||
|
assert(matrix[0][0]==0.0);
|
||||||
|
assert(matrix[0][1]==1.0);
|
||||||
|
assert(matrix[0][2]==2.0);
|
||||||
|
|
||||||
|
assert(matrix[1][0]==1.0);
|
||||||
|
assert(matrix[1][1]==0.0);
|
||||||
|
assert(matrix[1][2]==1.0);
|
||||||
|
|
||||||
|
assert(matrix[2][0]==2.0);
|
||||||
|
assert(matrix[2][1]==1.0);
|
||||||
|
assert(matrix[2][2]==0.0);
|
||||||
|
|
||||||
|
//test de l'autocorrelation
|
||||||
|
std::vector<double> rho, phi;
|
||||||
|
test.autocorrelation(sampling, 2, rho, phi);
|
||||||
|
|
||||||
|
sampling.push_back(3);
|
||||||
|
sampling.push_back(5);
|
||||||
|
sampling.push_back(2);
|
||||||
|
sampling.push_back(4);
|
||||||
|
|
||||||
|
test.autocorrelation(sampling, 2, rho, phi);
|
||||||
|
|
||||||
|
std::cout << "[t-moStatistics] => OK" << std::endl;
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue