diff --git a/application/cma_sa/CMakeLists.txt b/application/cma_sa/CMakeLists.txt index 586ba66cd..d68a49c07 100644 --- a/application/cma_sa/CMakeLists.txt +++ b/application/cma_sa/CMakeLists.txt @@ -11,11 +11,13 @@ FOREACH(file ${RESOURCES}) EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${file} - ${CMAKE_CURRENT_BINARY_DIR}/${file} + ${DO_BINARY_DIR}/${file} ) ENDFOREACH(file) FILE(GLOB SOURCES *.cpp) +SET(EXECUTABLE_OUTPUT_PATH ${DO_BINARY_DIR}) + ADD_EXECUTABLE(${PROJECT_NAME} ${SOURCES}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} do ${EO_LIBRARIES} ${MO_LIBRARIES}) diff --git a/application/cma_sa/main.cpp b/application/cma_sa/main.cpp index e15d37f39..f0864a682 100644 --- a/application/cma_sa/main.cpp +++ b/application/cma_sa/main.cpp @@ -48,9 +48,6 @@ int main(int ac, char** av) doModifierMass< doNormal< EOT > >* modifier = new doNormalCenter< EOT >(); state.storeFunctor(modifier); - // EOT min(2, 42); - // EOT max(2, 32); - //eoEvalFunc< EOT >* plainEval = new BopoRosenbrock< EOT, double, const EOT& >(); eoEvalFunc< EOT >* plainEval = new Sphere< EOT >(); state.storeFunctor(plainEval); @@ -119,11 +116,11 @@ int main(int ac, char** av) // stopping criteria // ... and creates the parameter letters: C E g G s T - eoContinue< EOT >& monitoringContinue = do_make_continue(parser, state, eval); + eoContinue< EOT >& monitoring_continue = do_make_continue(parser, state, eval); // output - eoCheckPoint< EOT >& checkpoint = do_make_checkpoint(parser, state, eval, monitoringContinue); + eoCheckPoint< EOT >& checkpoint = do_make_checkpoint(parser, state, eval, monitoring_continue); // appends some missing code to checkpoint @@ -146,10 +143,10 @@ int main(int ac, char** av) // -------------------------- - // eoPopStat< EOT >* popStat = new eoPopStat; - // state.storeFunctor(popStat); + eoPopStat< EOT >* popStat = new eoPopStat; + state.storeFunctor(popStat); - // checkpoint.add(*popStat); + checkpoint.add(*popStat); // eoMonitor* fileSnapshot = new doFileSnapshot< std::vector< std::string > >("ResPop"); // state.storeFunctor(fileSnapshot); diff --git a/src/doDistribParams.h b/src/doDistribParams.h index b895eec98..ef07c1513 100644 --- a/src/doDistribParams.h +++ b/src/doDistribParams.h @@ -11,6 +11,18 @@ public: : _params(n) {} + doDistribParams(const doDistribParams& p) { *this = p; } + + doDistribParams& operator=(const doDistribParams& p) + { + if (this != &p) + { + this->_params = p._params; + } + + return *this; + } + EOT& param(unsigned int i = 0){return _params[i];} unsigned int param_size(){return _params.size();} diff --git a/src/doEstimatorNormal.h b/src/doEstimatorNormal.h index 84430f350..3bd2058fc 100644 --- a/src/doEstimatorNormal.h +++ b/src/doEstimatorNormal.h @@ -5,8 +5,6 @@ #include "doUniform.h" #include "doStats.h" -// TODO: calcule de la moyenne + covariance dans une classe derivee - template < typename EOT > class doEstimatorNormal : public doEstimator< doNormal< EOT > > { @@ -19,32 +17,23 @@ public: unsigned int dimsize = pop[0].size(); assert(dimsize > 0); - //std::vector< doVar > var(dimsize); doCovMatrix cov(dimsize); for (unsigned int i = 0; i < popsize; ++i) { cov.update(pop[i]); - // for (unsigned int d = 0; d < dimsize; ++d) - // { - // var[d].update(pop[i][d]); - // } } EOT mean(dimsize); - EOT variance(dimsize); + EOT covariance(dimsize); for (unsigned int d = 0; d < dimsize; ++d) { - // mean[d] = var[d].get_mean(); - // variance[d] = var[d].get_var(); - //variance[d] = var[d].get_std(); // perhaps I should use this !?! - mean[d] = cov.get_mean(d); - variance[d] = cov.get_var(d); + covariance[d] = cov.get_var(d); } - return doNormal< EOT >(mean, variance); + return doNormal< EOT >(mean, covariance); } }; diff --git a/src/doFileSnapshot.h b/src/doFileSnapshot.h index 39a5bb169..def9efc27 100644 --- a/src/doFileSnapshot.h +++ b/src/doFileSnapshot.h @@ -83,20 +83,13 @@ public : // now make sure there is a dir without any genXXX file in it if (res) // no dir present { - //s = std::string("mkdir ")+dirname; ::mkdir(dirname.c_str(), 0755); } else if (!res && _rmFiles) { - //s = std::string("/bin/rm ")+dirname+ "/" + filename + "*"; std::string s = dirname+ "/" + filename + "*"; ::unlink(s.c_str()); } - // else - // s = " "; - - //int nothing = system(s.c_str()); - // all done } /** accessor: has something changed (for gnuplot subclass) @@ -148,43 +141,23 @@ public : */ eoMonitor& operator()(std::ostream& _os) { - //eo::log << eo::debug << "TOTO" << std::endl; - - //_os << "TOTO" << "\n"; - - //_os << v[0] << "\n"; - - // const eoValueParam > * ptParam = - // static_cast >* >(vec[0]); - - // what's the size of vec ?!? - - eo::log << eo::debug; - - eo::log << "vec size: " << vec.size() << std::endl; - const eoValueParam< EOTParam > * ptParam = static_cast< const eoValueParam< EOTParam >* >(vec[0]); - //const std::vector v = ptParam->value(); EOTParam v(ptParam->value()); if (vec.size() == 1) // only one std::vector: -> add number in front { eo::log << "I am here..." << std::endl; - //eo::log << *vec[0] << std::endl; - for (unsigned k=0; k > vv(vec.size()); std::vector< EOTParam > vv(vec.size()); vv[0]=v; for (unsigned i=1; i >* >(vec[1]); ptParam = static_cast< const eoValueParam< EOTParam >* >(vec[1]); vv[i] = ptParam->value(); if (vv[i].size() != v.size()) diff --git a/src/doNormalParams.h b/src/doNormalParams.h index fbfc88edf..18d88fb45 100644 --- a/src/doNormalParams.h +++ b/src/doNormalParams.h @@ -17,6 +17,10 @@ public: variance() = _variance; } + doNormalParams(const doNormalParams& p) + : doDistribParams< EOT >( p ) + {} + EOT& mean(){return this->param(0);} EOT& variance(){return this->param(1);} }; diff --git a/src/doVectorBounds.h b/src/doVectorBounds.h index 65655c3c1..8a0530dba 100644 --- a/src/doVectorBounds.h +++ b/src/doVectorBounds.h @@ -17,6 +17,10 @@ public: max() = _max; } + doVectorBounds(const doVectorBounds& v) + : doDistribParams< EOT >( v ) + {} + EOT& min(){return this->param(0);} EOT& max(){return this->param(1);} };