+ some useful files added
This commit is contained in:
parent
84b1515a56
commit
8d18acb81d
18 changed files with 2149 additions and 133 deletions
115
src/doCMASA.h
115
src/doCMASA.h
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue