+ 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

View file

@ -52,7 +52,8 @@ int main(int ac, char** av)
eoEvalFunc< EOT >* plainEval = new Sphere< EOT >();
state.storeFunctor(plainEval);
eoEvalFuncCounter< EOT > eval(*plainEval);
unsigned long max_eval = parser.getORcreateParam((unsigned long)0, "maxEval", "Maximum number of evaluations (0 = none)", 'E', "Stopping criterion").value(); // E
eoEvalFuncCounter< EOT > eval(*plainEval, max_eval);
eoRndGenerator< double >* gen = new eoUniformGenerator< double >(-5, 5);
//eoRndGenerator< double >* gen = new eoNormalGenerator< double >(0, 1);
@ -122,31 +123,20 @@ int main(int ac, char** av)
eoCheckPoint< EOT >& checkpoint = do_make_checkpoint(parser, state, eval, monitoring_continue);
// appends some missing code to checkpoint
// eoPopStat< EOT >* popStat = new eoPopStat<EOT>;
// state.storeFunctor(popStat);
// eoValueParam<bool>& plotPopParam = parser.createParam(false, "plotPop", "Plot sorted pop. every gen.", 0, "Graphical Output");
// checkpoint.add(*popStat);
// if (plotPopParam.value()) // we do want plot dump
// {
// eoScalarFitnessStat<EOT>* fitStat = new eoScalarFitnessStat<EOT>;
// state.storeFunctor(fitStat);
// eoGnuplot1DMonitor* gnuplot = new eoGnuplot1DMonitor("gnuplot.txt");
// state.storeFunctor(gnuplot);
// checkpoint.add(*fitStat);
// gnuplot->add(eval);
// gnuplot->add(*popStat);
// eoFileSnapshot* snapshot = new eoFileSnapshot("ResPop");
// state.storeFunctor(snapshot);
//gnuplot->gnuplotCommand("set yrange [0:500]");
// snapshot->add(*fitStat);
// checkpoint.add(*snapshot);
// }
// --------------------------
eoPopStat< EOT >* popStat = new eoPopStat<EOT>;
state.storeFunctor(popStat);
checkpoint.add(*popStat);
// checkpoint.add(*gnuplot);
// eoMonitor* fileSnapshot = new doFileSnapshot< std::vector< std::string > >("ResPop");
// state.storeFunctor(fileSnapshot);
@ -206,6 +196,10 @@ int main(int ac, char** av)
{
do_run(*algo, pop);
}
catch (eoReachedThresholdException& e)
{
eo::log << eo::warnings << e.what() << std::endl;
}
catch (std::exception& e)
{
eo::log << eo::errors << "exception: " << e.what() << std::endl;

0
application/cma_sa/plot.py Executable file → Normal file
View file

7
build_gcc_linux_debug Normal file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env sh
mkdir debug
cd debug
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
cd ..

7
build_gcc_linux_release Normal file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env sh
mkdir release
cd release
cmake ..
make
cd ..

1
copying Normal file
View file

@ -0,0 +1 @@
Private license

4
distclean Normal file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env sh
rm -rf debug
rm -rf release

View file

@ -19,6 +19,15 @@ IF (DOXYGEN_FOUND)
"${CMAKE_CURRENT_SOURCE_DIR}/${DOC_CONFIG_FILE}.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${DOC_CONFIG_FILE}"
)
INSTALL(
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DESTINATION share/do COMPONENT libraries
PATTERN "CMakeFiles" EXCLUDE
PATTERN "cmake_install.cmake" EXCLUDE
PATTERN "Makefile" EXCLUDE
PATTERN "doxyfile" EXCLUDE
)
ELSE (DOXYGEN_FOUND)
MESSAGE(STATUS "Unable to generate the documentation, Doxygen package not found")
ENDIF (DOXYGEN_FOUND)

File diff suppressed because it is too large Load diff

560
matrix.hpp Normal file
View file

@ -0,0 +1,560 @@
/***************************************************************************
* $Id: matrix.hpp,v 1.11 2006/05/13 10:05:53 nojhan Exp $
* Copyright : Free Software Foundation
* Author : Johann Dréo <nojhan@gmail.com>
****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef MATRIX
#define MATRIX
#include <vector>
#include <sstream>
#include "Exception_oMetah.hpp"
using namespace std;
namespace ometah {
//! Test if a vector is comprised in bounds
template<class T>
bool isInBounds( T aVector, T mins, T maxs)
{
unsigned int i;
for(i=0; i<aVector.size(); i++ ){
// too low
if( aVector[i] < mins[i] ){
return false;
// too high
}else if( aVector[i] > maxs[i] ){
return false;
}
}
return true;
}
//! Force a vector to be in bounds
template<class T>
T forceBounds( T aVector, T mins, T maxs)
{
T CastedVector=aVector;
unsigned int i;
for(i=0; i<aVector.size(); i++ ){
if( aVector[i] < mins[i] ){
CastedVector[i]=mins[i];
}else if( aVector[i] > maxs[i] ){
CastedVector[i]=maxs[i];
}
}
return CastedVector;
}
//! Create a 2D matrix filled with values
/*
if we want a vector<vector<double> > :
T stand for double
V stand for vector<vector<double> >
*/
template <class T, class U>
U matrixFilled( unsigned int dimL, unsigned int dimC, T fillValue )
{
unsigned int i;
// make the vector<double> possible at this step
typename U::value_type vec(dimC, fillValue);
U mat;
for(i=0; i<dimL; i++){
mat.push_back(vec);
}
return mat;
}
template <class T>
vector<vector< T > > matrixFilled( unsigned int dimL, unsigned int dimC, T fillValue )
{
unsigned int i;
// make the vector<double> possible at this step
vector< T > vec(dimC, fillValue);
vector<vector< T > > mat;
for(i=0; i<dimL; i++){
mat.push_back(vec);
}
return mat;
}
//! Multipliate two 2D matrix
template<class T>
T multiply( T matA, T matB)
{
T newMat;
unsigned int Al=matA.size();
unsigned int Ac=matA[0].size();
unsigned int Bl=matB.size();
unsigned int Bc=matB[0].size();
newMat=matrixFilled( Al,Bc,0.0);
if(Ac!=Bl) {
throw Exception_Size_Match("Cannot multiply matrices, sizes does not match", EXCEPTION_INFOS );
}
for( unsigned int i=0; i<Al; i++ ) {
for( unsigned int j=0; j<Bc; j++ ) {
for( unsigned int k=0; k<Ac ;k++ ) {
newMat[i][j] += matA[i][k]*matB[k][j];
}
}
}
return newMat;
}
//! Multiply each term of a vector by a scalar
template<class T, class U>
U multiply(U aVector, T aNb)
{
U res;
res.reserve( aVector.size() );
unsigned int i;
for(i=0; i<aVector.size(); i++){
double x=aVector[i]*aNb;
res.push_back(x);
}
return res;
}
//! Cholesky factorization
template<class T>
T cholesky( T A)
{
// FIXME : vérifier que A est symétrique définie positive
T B;
unsigned int Al=A.size();
unsigned int Ac=A[0].size();
B = matrixFilled(Al, Ac, 0.0);
unsigned int i,j,k;
// first column
i=0;
// diagonal
j=0;
B[0][0]=sqrt(A[0][0]);
// end of the column
for(j=1;j<Ac;j++) {
B[j][0] = A[0][j] / B[0][0];
}
// end of the matrix
for(i=1;i<Al;i++){ // each column
// diagonal
double sum=0.0;
for(k=0; k<i; k++) {
sum += B[i][k]*B[i][k];
}
// Check for math error
if( (A[i][i]-sum) <= 0 ) {
ostringstream msg;
msg << "Error: Cannot compute the Cholesky decomposition, matrix may not be positive definite (A[";
msg << i << "][" << i << "]-sum(B[i][k]^2) = " << A[i][i]-sum << ").";
throw Exception_Math(msg.str(), EXCEPTION_INFOS );
}
B[i][i] = sqrt( A[i][i] - sum );
for(j=i+1;j<Al;j++){ // rows
// one element
sum = 0.0;
for(k=0; k<i; k++) {
sum += B[j][k]*B[i][k];
}
B[j][i] = (A[j][i] - sum) / B[i][i];
}
}
return B;
}
//! Transposition of a matrix
template<class T>
T transpose( T &mat)
{
unsigned int iSize=mat.size();
unsigned int jSize=mat[0].size();
if ( iSize == 0 || jSize == 0 ) {
ostringstream msg;
msg << "ErrorSize: matrix not defined "
<< "(iSize:" << iSize << ", jSize:" << jSize << ")";
throw Exception_Size( msg.str(), EXCEPTION_INFOS );
}
typename T::value_type aVector;
T newMat;
unsigned int i, j;
for (j=0; j<jSize; j++) {
for(i=0; i<iSize; i++) {
if ( mat[i].size() != jSize ) {
ostringstream msg;
msg << "ErrorSize: matrix not defined "
<< "(iSize:" << iSize << ", jSize:" << jSize << ", matrix[" << i << "].size:" << mat[i].size() << ")";
throw Exception_Size(msg.str(), EXCEPTION_INFOS );
}
aVector.push_back(mat[i][j]);
}//j
newMat.push_back(aVector);
aVector.clear();
}//i
return newMat;
}
//! Calculate the mean vector of a matrix
template<class T>
vector<T> mean( vector<vector<T> > mat)
{
vector<T> moyDim;
moyDim.reserve(mat.size());
unsigned int i,a;
a=mat.size();
for(i=0;i<a;i++) {
moyDim.push_back( mean(mat[i]) );
}
return moyDim;
}
//! Calculate the mean of a vector
template<class T>
T mean( vector<T> aVector, unsigned int begin=0, unsigned int during=0)
{
if (during==0) {
during = aVector.size() - begin; // if no end : take all
}
T aSum, aMean;
aSum = sum(aVector, begin, during); // Sum
aMean = aSum / (during - begin); // Mean
return aMean;
}
//! Calculate a variance-covariance matrix from a list of vector
/*!
For a population of p points on n dimensions :
if onRow==true, the matrix should have p rows and n columns.
if onRow==false, the matrix should have n rows and p columns.
*/
template<class U>
U varianceCovariance( U pop, bool onRow = true)
{
/*
// vector of means
typename U::value_type vecMeanCentered;
if(onRow) {
vecMeanCentered = mean( transpose(pop) ); // p rows and n columns => means of p
} else {
vecMeanCentered = mean( pop ); // n rows and p columns => means of n
}
// centered population
// same size as the initial matrix
U popMeanCentered = matrixFilled(pop.size(),pop[0].size(), 0.0);
// centering
// rows
for(unsigned int i=0;i<pop.size();i++) {
// columns
for(unsigned int j=0;j<pop[i].size();j++) {
popMeanCentered[i][j] = (pop[i][j] - vecMeanCentered[j]);
}
}
*/
// no centering
U popMeanCentered = pop;
// transposition of the centered matrix
U popMeanCenteredT;
popMeanCenteredT = transpose(popMeanCentered);
// final variance/covariance matrix
U popVar;
if(onRow) {
popVar = multiply( popMeanCenteredT, popMeanCentered ); // if p rows and n columns => covariance of p
} else {
popVar = multiply( popMeanCentered, popMeanCenteredT ); // if n rows and p columns => covariance of n
}
// multiplication by 1/n :
for(unsigned int i=0;i<popVar.size();i++) {
for(unsigned int j=0;j<popVar[i].size();j++) {
popVar[i][j]=popVar[i][j]/(pop.size());
}
}
return popVar;
}
//! Calculate the sum of a vector
template<class T>
T sum(vector<T> aVector, unsigned int begin=0, unsigned int during=0)
{
if ( begin > aVector.size() || during > aVector.size() ) {
ostringstream msg;
msg << "ErrorSize: parameters are out of vector bounds "
<< "(begin:" << begin << ", during:" << during
<< ", size:" << aVector.size() << ")";
throw Exception_Size_Index( msg.str(), EXCEPTION_INFOS );
}
if (during==0) {
during = aVector.size() - begin;
}
T aSum=0;
for (unsigned int j=begin; j<during; j++) {
aSum = aSum + aVector[j]; // sum
}//for (j)
return aSum;
}
//! Calculate the standard deviation of a vector
template<class T>
T stdev(vector<T> aVector, unsigned int begin=0, unsigned int during=0)
{
if ( begin > aVector.size() || during > aVector.size() ) {
ostringstream msg;
msg << "ErrorSize: parameters are out of vector bounds "
<< "(begin:" << begin << ", during:" << during
<< ", size:" << aVector.size() << ")";
throw Exception_Size_Index( msg.str(), EXCEPTION_INFOS );
}
if (during==0) {
during = aVector.size() - begin;
}
vector<T> deviation;
T aMean, aDev, aStd;
aMean = mean(aVector, begin, during); // mean
for (unsigned int j=begin; j<during; j++) {
aDev = aMean - aVector[j];
deviation.push_back(aDev*aDev);
}//for (j)
aStd = sqrt( mean(deviation, begin, during) );
return aStd;
}
//! Find the minimum value of a vector
template<class T>
typename T::value_type min(T aVector, unsigned int begin=0, unsigned int during=0)
{
if ( begin > aVector.size() || during > aVector.size() ) {
ostringstream msg;
msg << "ErrorSize: parameters are out of vector bounds "
<< "(begin:" << begin << ", during:" << during
<< ", size:" << aVector.size() << ")";
throw Exception_Size_Index( msg.str(), EXCEPTION_INFOS );
}
if (during==0) {
during = aVector.size() - begin;
}
typename T::value_type aMin = aVector[begin];
for (unsigned int i=begin+1; i<during; i++) {
if ( aVector[i] < aMin ) {
aMin = aVector[i];
}
}
return aMin;
}
//! Find the minimums values of a matrix, for each row
template<class T>
vector<T> mins(vector<vector< T > > aMatrix)
{
vector<T> mins;
for( unsigned int i=0; i < aMatrix.size(); i++ ) {
mins.push_back( min(aMatrix[i]) );
}
return mins;
}
//! Find the maximums values of a matrix, for each row
template<class T>
vector<T> maxs(vector<vector< T > > aMatrix)
{
vector<T> maxs;
for( unsigned int i=0; i < aMatrix.size(); i++ ) {
maxs.push_back( max(aMatrix[i]) );
}
return maxs;
}
//! Find the maximum value of a vector
template<class T>
typename T::value_type max(T aVector, unsigned int begin=0, unsigned int during=0)
{
if ( begin > aVector.size() || during > aVector.size() ) {
ostringstream msg;
msg << "ErrorSize: parameters are out of vector bounds "
<< "(begin:" << begin << ", during:" << during
<< ", size:" << aVector.size() << ")";
throw Exception_Size_Index( msg.str(), EXCEPTION_INFOS );
}
if (during==0) {
during = aVector.size() - begin;
}
typename T::value_type aMax = aVector[begin];
for (unsigned int i=begin+1; i<during; i++) {
if ( aVector[i] > aMax ) {
aMax = aVector[i];
}
}
return aMax;
}
//! Substraction of two vectors, terms by terms
template<class T>
T substraction(T from, T that)
{
T res;
res.reserve(from.size());
for(unsigned int i=0; i<from.size(); i++){
res.push_back( from[i]-that[i] );
}
return res;
}
//! Addition of two vectors, terms by terms
template<class T>
T addition(T from, T that)
{
T res;
res.reserve( from.size() );
for(unsigned int i=0; i<from.size(); i++){
res.push_back( from[i]+that[i] );
}
return res;
}
//! Calculate the absolute values of a vector
template<class T>
T absolute(T aVector)
{
for(unsigned int i=0; i<aVector.size(); i++){
aVector[i] = abs(aVector[i]);
}
return aVector;
}
template<class T>
vector<T> gravityCenter( vector<vector<T> > points, vector<T> weights )
{
// if we have only one weight, we use it for all items
if ( weights.size() == 1 ) {
for ( unsigned int i=1; i < points.size(); i++ ) {
weights.push_back( weights[0] );
}
}
// if sizes does not match : error
if ( points.size() != weights.size() ) {
ostringstream msg;
msg << "ErrorSize: "
<< "points size (" << points.size() << ")"
<< " does not match weights size (" << weights.size() << ")";
throw Exception_Size_Match( msg.str(), EXCEPTION_INFOS );
}
T weightsSum = sum(weights);
vector<vector< T > > pointsT = transpose( points );
vector<T> gravity;
for ( unsigned int i=0; i < pointsT.size(); i++ ) { // dimensions
T g = 0;
for ( unsigned int j=0; j < pointsT[i].size(); j++ ) { // points
g += ( pointsT[i][j] * weights[j] ) / weightsSum;
}
gravity.push_back( g );
}
return gravity;
}
} // ometah
#endif // MATRIX

5
package_deb Normal file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env sh
cd release
cpack -G DEB
cd ..

5
package_rpm Normal file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env sh
cd release
cpack -G RPM
cd ..

57
readme Normal file
View file

@ -0,0 +1,57 @@
This package contains the source code for BOPO problems.
# Step 1 - Configuration
------------------------
Rename the "install.cmake-dist" file as "install.cmake" and edit it, inserting the FULL PATH
to your ParadisEO distribution.
On Windows write your path with double antislash (ex: C:\\Users\\...)
# Step 2 - Build process
------------------------
ParadisEO is assumed to be compiled. To download ParadisEO, please visit http://paradiseo.gforge.inria.fr/.
Go to the BOPO/build/ directory and lunch cmake:
(Unix) > cmake ..
(Windows) > cmake .. -G"Visual Studio 9 2008"
Note for windows users: if you don't use VisualStudio 9, enter the name of your generator instead of "VisualStudio 9 2008".
# Step 3 - Compilation
----------------------
In the bopo/build/ directory:
(Unix) > make
(Windows) Open the VisualStudio solution and compile it, compile also the target install.
You can refer to this tutorial if you don't know how to compile a solution: http://paradiseo.gforge.inria.fr/index.php?n=Paradiseo.VisualCTutorial
# Step 4 - Execution
---------------------
A toy example is given to test the components. You can run these tests as following.
To define problem-related components for your own problem, please refer to the tutorials available on the website : http://paradiseo.gforge.inria.fr/.
In the bopo/build/ directory:
(Unix) > ctest
Windows users, please refer to this tutorial: http://paradiseo.gforge.inria.fr/index.php?n=Paradiseo.VisualCTutorial
In the directory "application", there are several directory such as p_eoco which instantiate NSGAII on BOPO problems.
(Unix) After compilation you can run the script "bopo/run.sh" and see results in "NSGAII.out". Parameters can be modified in the script.
(Windows) Add argument "NSGAII.param" and execute the corresponding algorithms.
Windows users, please refer to this tutorial: http://paradiseo.gforge.inria.fr/index.php?n=Paradiseo.VisualCTutorial
# Documentation
---------------
The API-documentation is available in doc/html/index.html
# Things to keep in mind when using BOPO
----------------------------------------
* By default, the EO random generator's seed is initialized by the number of seconds since the epoch (with time(0)). It is available in the status file dumped at each execution. Please, keep in mind that if you start two run at the same second without modifying the seed, you will get exactly the same results.
* Execution times are measured with the boost:timer, that measure wallclock time. Additionaly, it could not measure times larger than approximatively 596.5 hours (or even less). See http://www.boost.org/doc/libs/1_33_1/libs/timer/timer.htm
* The q-quantile computation use averaging at discontinuities (in R, it correspond to the R-2 method, in SAS, SAS-5). For more explanations, see http://en.wikipedia.org/wiki/Quantile#Estimating_the_quantiles_of_a_population and http://stat.ethz.ch/R-manual/R-devel/library/stats/html/quantile.html
* You can send a SIGUSR1 to a process to get some information (written down in the log file) on the current state of the search.

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