+ some useful files added

This commit is contained in:
Caner Candan 2010-08-03 10:26:15 +02:00
commit 8d18acb81d
18 changed files with 2149 additions and 133 deletions

1
src/do
View file

@ -22,7 +22,6 @@
#include "doSamplerUniform.h"
#include "doSamplerNormal.h"
#include "doDistribParams.h"
#include "doVectorBounds.h"
#include "doNormalParams.h"

View file

@ -86,8 +86,48 @@ public:
_continuator(continuator),
_cooling_schedule(cooling_schedule),
_initial_temperature(initial_temperature),
_replacor(replacor)
{}
_replacor(replacor),
_pop_results_destination("ResPop"),
// directory where populations state are going to be stored.
_ofs_params("ResParams.txt"),
_ofs_params_var("ResVars.txt"),
_bounds_results_destination("ResBounds")
{
//-------------------------------------------------------------
// Temporary solution to store populations state at each
// iteration for plotting.
//-------------------------------------------------------------
{
std::stringstream ss;
ss << "rm -rf " << _pop_results_destination;
::system(ss.str().c_str());
}
::mkdir(_pop_results_destination.c_str(), 0755); // create a first time the
//-------------------------------------------------------------
//-------------------------------------------------------------
// Temporary solution to store bounds values for each distribution.
//-------------------------------------------------------------
{
std::stringstream ss;
ss << "rm -rf " << _bounds_results_destination;
::system(ss.str().c_str());
}
::mkdir(_bounds_results_destination.c_str(), 0755); // create once directory
//-------------------------------------------------------------
}
//! function that launches the CMASA algorithm.
/*!
@ -118,44 +158,6 @@ public:
//-------------------------------------------------------------
//-------------------------------------------------------------
// Temporary solution to store populations state at each
// iteration for plotting.
//-------------------------------------------------------------
std::string pop_results_destination("ResPop");
{
std::stringstream ss;
ss << "rm -rf " << pop_results_destination;
::system(ss.str().c_str());
}
::mkdir(pop_results_destination.c_str(), 0755); // create a first time the
// directory where populations state are going to be stored.
std::ofstream ofs_params("ResParams.txt");
std::ofstream ofs_params_var("ResVars.txt");
//-------------------------------------------------------------
//-------------------------------------------------------------
// Temporary solution to store bounds valeur for each distribution.
//-------------------------------------------------------------
std::string bounds_results_destination("ResBounds");
{
std::stringstream ss;
ss << "rm -rf " << bounds_results_destination;
::system(ss.str().c_str());
}
::mkdir(bounds_results_destination.c_str(), 0755); // create a first time the
//-------------------------------------------------------------
{
D distrib = _estimator(pop);
@ -169,7 +171,7 @@ public:
hv.update( distrib.variance()[i] );
}
ofs_params_var << hv << std::endl;
_ofs_params_var << hv << std::endl;
}
do
@ -260,7 +262,7 @@ public:
{
std::stringstream ss;
ss << pop_results_destination << "/" << number_of_iterations;
ss << _pop_results_destination << "/" << number_of_iterations;
std::ofstream ofs(ss.str().c_str());
ofs << current_pop;
}
@ -279,12 +281,12 @@ public:
assert(size > 0);
std::stringstream ss;
ss << bounds_results_destination << "/" << number_of_iterations;
ss << _bounds_results_destination << "/" << number_of_iterations;
std::ofstream ofs(ss.str().c_str());
ofs << size << " ";
std::copy(distrib.param(0).begin(), distrib.param(0).end(), std::ostream_iterator< double >(ofs, " "));
std::copy(distrib.param(1).begin(), distrib.param(1).end(), std::ostream_iterator< double >(ofs, " "));
std::copy(distrib.mean().begin(), distrib.mean().end(), std::ostream_iterator< double >(ofs, " "));
std::copy(distrib.variance().begin(), distrib.variance().end(), std::ostream_iterator< double >(ofs, " "));
ofs << std::endl;
}
@ -337,7 +339,7 @@ public:
hv.update( distrib.variance()[i] );
}
ofs_params_var << hv << std::endl;
_ofs_params_var << hv << std::endl;
}
//-------------------------------------------------------------
@ -383,6 +385,27 @@ private:
//! A EOT replacor
eoReplacement < EOT > & _replacor;
//-------------------------------------------------------------
// Temporary solution to store populations state at each
// iteration for plotting.
//-------------------------------------------------------------
std::string _pop_results_destination;
std::ofstream _ofs_params;
std::ofstream _ofs_params_var;
//-------------------------------------------------------------
//-------------------------------------------------------------
// Temporary solution to store bounds values for each distribution.
//-------------------------------------------------------------
std::string _bounds_results_destination;
//-------------------------------------------------------------
};
#endif // !_doCMASA_h

View file

@ -1,28 +1,29 @@
#ifndef _doNormalParams_h
#define _doNormalParams_h
#include "doDistribParams.h"
template < typename EOT >
class doNormalParams : public doDistribParams< EOT >
class doNormalParams
{
public:
doNormalParams(EOT _mean, EOT _variance)
: doDistribParams< EOT >(2)
doNormalParams(EOT mean, EOT variance)
: _mean(mean), _variance(variance)
{
assert(_mean.size() > 0);
assert(_mean.size() == _variance.size());
mean() = _mean;
variance() = _variance;
}
doNormalParams(const doNormalParams& p)
: doDistribParams< EOT >( p )
{}
EOT& mean(){return _mean;}
EOT& variance(){return _variance;}
EOT& mean(){return this->param(0);}
EOT& variance(){return this->param(1);}
unsigned int size()
{
assert(_mean.size() == _variance.size());
return _mean.size();
}
private:
EOT _mean;
EOT _variance;
};
#endif // !_doNormalParams_h

View file

@ -110,4 +110,9 @@ protected:
double _hv;
};
class doCholesky : public doStats
{
};
#endif // !_doStats_h

View file

@ -1,28 +1,30 @@
#ifndef _doVectorBounds_h
#define _doVectorBounds_h
#include "doDistribParams.h"
template < typename EOT >
class doVectorBounds : public doDistribParams< EOT >
class doVectorBounds
{
public:
doVectorBounds(EOT _min, EOT _max)
: doDistribParams< EOT >(2)
doVectorBounds(EOT min, EOT max)
: _min(min), _max(max)
{
assert(_min.size() > 0);
assert(_min.size() == _max.size());
min() = _min;
max() = _max;
}
doVectorBounds(const doVectorBounds& v)
: doDistribParams< EOT >( v )
{}
EOT& min(){return _min;}
EOT& max(){return _max;}
EOT& min(){return this->param(0);}
EOT& max(){return this->param(1);}
unsigned int size()
{
assert(_min.size() == _max.size());
return _min.size();
}
private:
EOT _min;
EOT _max;
};
#endif // !_doVectorBounds_h

2
src/todo Normal file
View file

@ -0,0 +1,2 @@
* deplacer les ecritures pour gnuplot dans des classes type eoContinue (eoMonitor)
* integrer ACP