test added

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1809 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jhumeau 2010-05-12 15:10:32 +00:00
commit c60f80b480
28 changed files with 701 additions and 53 deletions

View file

@ -67,11 +67,10 @@ public:
*/
moAutocorrelationSampling(eoInit<EOT> & _init,
moNeighborhood<Neighbor> & _neighborhood,
eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval,
eoEvalFunc<EOT>& _fullEval,
moEval<Neighbor>& _eval,
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

View file

@ -64,9 +64,7 @@ public:
moDensityOfStatesSampling(eoInit<EOT> & _init,
eoEvalFunc<EOT>& _fullEval,
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

View file

@ -83,7 +83,7 @@ public:
*/
~moFDCsampling() {
// delete the pointer on the local search which has been constructed in the constructor
delete &localSearch;
delete localSearch;
}
protected:

View file

@ -77,9 +77,7 @@ public:
fullEval(_fullEval),
eval(_eval),
nbSol(_nbSol)
{
// std::cout << "moFitnessCloudSampling: Warming to nothing will be sample." << std::endl;
}
{}
/**
* default destructor

View file

@ -70,7 +70,8 @@ public:
*/
moHillClimberSampling(eoInit<EOT> & _init,
moNeighborhood<Neighbor> & _neighborhood,
eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval,
eoEvalFunc<EOT>& _fullEval,
moEval<Neighbor>& _eval,
unsigned int _nbAdaptWalk) :
moSampling<Neighbor>(initHC, * new moRandomSearch<Neighbor>(initHC, _fullEval, _nbAdaptWalk), copyStat),
copyStat(lengthStat),

View file

@ -36,6 +36,8 @@
#define moSampling_h
#include <vector>
#include <fstream>
#include <iostream>
#include <eoFunctor.h>
#include <utils/eoMonitor.h>
#include <continuator/moStat.h>
@ -44,6 +46,7 @@
#include <algo/moLocalSearch.h>
#include <eoInit.h>
/**
* To sample the search space:
* A local search is used to sample the search space
@ -97,7 +100,7 @@ public:
monitorVec.push_back(monitor);
checkpoint->add(*monitor);
}
}
}
/**
* To sample the search and get the statistics
@ -131,11 +134,11 @@ public:
*/
void fileExport(std::string _filename, std::string _delim = " ") {
// create file
ofstream os(_filename.c_str());
std::ofstream os(_filename.c_str());
if (!os) {
string str = "moSampling: Could not open " + _filename;
throw runtime_error(str);
std::string str = "moSampling: Could not open " + _filename;
throw std::runtime_error(str);
}
// all vector have the same size
@ -160,8 +163,8 @@ public:
*/
void fileExport(unsigned int _col, std::string _filename) {
if (_col >= monitorVec.size()) {
string str = "moSampling: Could not export into file the vector. The index does not exists (too large)";
throw runtime_error(str);
std::string str = "moSampling: Could not export into file the vector. The index does not exists (too large)";
throw std::runtime_error(str);
}
monitorVec[_col]->fileExport(_filename);

View file

@ -36,6 +36,7 @@
#define moStatistics_h
#include <vector>
#include <cmath>
#include <utils/eoDistance.h>
/**
@ -61,7 +62,7 @@ public:
* @param avg average 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) {
if (data.size() == 0) {
@ -104,8 +105,8 @@ public:
* @param matrix matrix of distances between solutions
*/
template <class EOT>
void distances(const vector<EOT> & data, eoDistance<EOT> & distance,
vector< vector<double> > & matrix) {
void distances(const std::vector<EOT> & data, eoDistance<EOT> & distance,
std::vector< std::vector<double> > & matrix) {
if (data.size() == 0) {
matrix.resize(0);
} else {
@ -134,8 +135,8 @@ public:
* @param rho autocorrelation coefficients
* @param phi partial autocorrelation coefficients
*/
void autocorrelation(const vector<double> & data, unsigned int nbS,
vector<double> & rho, vector<double> & phi) {
void autocorrelation(const std::vector<double> & data, unsigned int nbS,
std::vector<double> & rho, std::vector<double> & phi) {
if (data.size() == 0) {
rho.resize(0);
phi.resize(0);