From 81491c6fdb3d9b08a98805d8c53723c5299ecd59 Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Tue, 15 Mar 2011 16:39:46 +0100 Subject: [PATCH 1/6] * eoLogger: forgot to close opened file --- eo/src/utils/eoLogger.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eo/src/utils/eoLogger.cpp b/eo/src/utils/eoLogger.cpp index a729d0cf..ff6f8407 100644 --- a/eo/src/utils/eoLogger.cpp +++ b/eo/src/utils/eoLogger.cpp @@ -67,7 +67,9 @@ eoLogger::eoLogger() } eoLogger::~eoLogger() -{} +{ + if (_fd > 2) { ::close(_fd); } +} std::string eoLogger::className() const { From 131b09ca183cba254e07e5e6dc4e16742c612dc8 Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Tue, 15 Mar 2011 18:05:45 +0100 Subject: [PATCH 2/6] * edoSampler: sampler method protected --- edo/src/edoSampler.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/edo/src/edoSampler.h b/edo/src/edoSampler.h index efd77649..4a0d9244 100644 --- a/edo/src/edoSampler.h +++ b/edo/src/edoSampler.h @@ -51,8 +51,6 @@ public: // virtual EOType operator()( D& ) = 0 (provided by eoUF< A1, R >) - virtual EOType sample( D& ) = 0; - EOType operator()( D& distrib ) { unsigned int size = distrib.size(); @@ -84,6 +82,10 @@ public: return solution; } +protected: + + virtual EOType sample( D& ) = 0; + private: //edoBounderNo _dummy_bounder; From 6e87948a01258b210ca2fede9aa96f2cada6b01b Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Sun, 4 Sep 2011 17:19:03 +0200 Subject: [PATCH 3/6] * edoEDASA: indentation --- edo/src/edoEDASA.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/edo/src/edoEDASA.h b/edo/src/edoEDASA.h index 1d47c57d..b2f0fe70 100644 --- a/edo/src/edoEDASA.h +++ b/edo/src/edoEDASA.h @@ -74,18 +74,18 @@ public: \param replacor Population replacor */ edoEDASA (eoSelect< EOT > & selector, - edoEstimator< D > & estimator, - eoSelectOne< EOT > & selectone, - edoModifierMass< D > & modifier, - edoSampler< D > & sampler, - eoContinue< EOT > & pop_continue, - edoContinue< D > & distribution_continue, - eoEvalFunc < EOT > & evaluation, - moContinuator< moDummyNeighbor > & sa_continue, - moCoolingSchedule & cooling_schedule, - double initial_temperature, - eoReplacement< EOT > & replacor - ) + edoEstimator< D > & estimator, + eoSelectOne< EOT > & selectone, + edoModifierMass< D > & modifier, + edoSampler< D > & sampler, + eoContinue< EOT > & pop_continue, + edoContinue< D > & distribution_continue, + eoEvalFunc < EOT > & evaluation, + moContinuator< moDummyNeighbor > & sa_continue, + moCoolingSchedule & cooling_schedule, + double initial_temperature, + eoReplacement< EOT > & replacor + ) : _selector(selector), _estimator(estimator), _selectone(selectone), From e2c680e847e1ca84bc92f72988c21a9c23c1edf6 Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Tue, 25 Oct 2011 20:33:20 +0200 Subject: [PATCH 4/6] + FindEO.cmake --- eo/cmake/modules/FindEO.cmake | 100 ++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 eo/cmake/modules/FindEO.cmake diff --git a/eo/cmake/modules/FindEO.cmake b/eo/cmake/modules/FindEO.cmake new file mode 100644 index 00000000..0ca6a017 --- /dev/null +++ b/eo/cmake/modules/FindEO.cmake @@ -0,0 +1,100 @@ +# File: FindEO.cmake +# CMAKE commands to actually use the EO library +# Version: 0.0.1 +# +# The following variables are filled out: +# - EO_INCLUDE_DIR +# - EO_LIBRARY_DIR +# - EO_LIBRARIES +# - EO_FOUND +# +# Here are the components: +# - PyEO +# - es +# - ga +# - cma +# +# You can use FIND_PACKAGE( EO COMPONENTS ... ) to enable one or several components. +# + +# Default enabled components +SET(EO_LIBRARIES_TO_FIND eo eoutils) + +# Use FIND_PACKAGE( EO COMPONENTS ... ) to enable modules +IF(EO_FIND_COMPONENTS) + FOREACH(component ${EO_FIND_COMPONENTS}) + STRING(TOUPPER ${component} _COMPONENT) + SET(EO_USE_${_COMPONENT} 1) + ENDFOREACH(component) + + # To make sure we don't use PyEO, ES, GA, CMA when not in COMPONENTS + IF(NOT EO_USE_PYEO) + SET(EO_DONT_USE_PYEO 1) + ELSE(NOT EO_USE_PYEO) + SET(EO_LIBRARIES_TO_FIND ${EO_LIBRARIES_TO_FIND} PyEO) + ENDIF(NOT EO_USE_PYEO) + + IF(NOT EO_USE_ES) + SET(EO_DONT_USE_ES 1) + ELSE(NOT EO_USE_ES) + SET(EO_LIBRARIES_TO_FIND ${EO_LIBRARIES_TO_FIND} es) + ENDIF(NOT EO_USE_ES) + + IF(NOT EO_USE_GA) + SET(EO_DONT_USE_GA 1) + ELSE(NOT EO_USE_GA) + SET(EO_LIBRARIES_TO_FIND ${EO_LIBRARIES_TO_FIND} ga) + ENDIF(NOT EO_USE_GA) + + IF(NOT EO_USE_CMA) + SET(EO_DONT_USE_CMA 1) + ELSE(NOT EO_USE_CMA) + SET(EO_LIBRARIES_TO_FIND ${EO_LIBRARIES_TO_FIND} cma) + ENDIF(NOT EO_USE_CMA) +ENDIF(EO_FIND_COMPONENTS) + +IF(NOT EO_INCLUDE_DIR) + FIND_PATH( + EO_INCLUDE_DIR + EO.h + PATHS + /usr/include/eo + /usr/local/include/eo + ) +ENDIF(NOT EO_INCLUDE_DIR) + +IF(NOT EO_LIBRARY_DIR) + FIND_PATH( + EO_LIBRARY_DIR + libeo.a + PATHS + /usr/lib + /usr/local/lib + ) +ENDIF(NOT EO_LIBRARY_DIR) + +IF(NOT EO_LIBRARIES) + SET(EO_LIBRARIES) + FOREACH(component ${EO_LIBRARIES_TO_FIND}) + FIND_LIBRARY( + EO_${component}_LIBRARY + NAMES ${component} + PATHS + /usr/lib + /usr/local/lib + ) + IF(EO_${component}_LIBRARY) + SET(EO_LIBRARIES ${EO_LIBRARIES} ${EO_${component}_LIBRARY}) + ELSE(EO_${component}_LIBRARY) + MESSAGE(FATAL_ERROR "${component} component not found.") + ENDIF(EO_${component}_LIBRARY) + ENDFOREACH(component) +ENDIF(NOT EO_LIBRARIES) + +IF(EO_INCLUDE_DIR AND EO_LIBRARY_DIR AND EO_LIBRARIES) + SET(EO_FOUND 1) + MARK_AS_ADVANCED(EO_FOUND) + MARK_AS_ADVANCED(EO_INCLUDE_DIR) + MARK_AS_ADVANCED(EO_LIBRARY_DIR) + MARK_AS_ADVANCED(EO_LIBRARIES) +ENDIF(EO_INCLUDE_DIR AND EO_LIBRARY_DIR AND EO_LIBRARIES) From e6b1c63fde7e22c3eb7a8e9f4b9d3fc7a02d8b0e Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 28 Oct 2011 16:50:15 +0200 Subject: [PATCH 5/6] assert there is less indexes than items in the whole solution given to the repairer dispatcher ; comment useless debug code --- edo/src/edoRepairerDispatcher.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/edo/src/edoRepairerDispatcher.h b/edo/src/edoRepairerDispatcher.h index 5c4aa7d8..5dffb3f9 100644 --- a/edo/src/edoRepairerDispatcher.h +++ b/edo/src/edoRepairerDispatcher.h @@ -83,15 +83,27 @@ public: //! Repair a solution by calling several repair operator on subset of indexes virtual void operator()( EOT& sol ) { - // ipair is an iterator that points on a pair +// std::cout << "in dispatcher, sol = " << sol << std::endl; + + // ipair is an iterator that points on a pair of for( typename edoRepairerDispatcher::iterator ipair = this->begin(); ipair != this->end(); ++ipair ) { + + assert( ipair->first.size() <= sol.size() ); // assert there is less indexes than items in the whole solution + // a partial copy of the sol EOT partsol; +// std::cout << "\tusing indexes = "; // j is an iterator that points on an uint for( std::vector< unsigned int >::iterator j = ipair->first.begin(); j != ipair->first.end(); ++j ) { + +// std::cout << *j << " "; +// std::cout.flush(); + partsol.push_back( sol.at(*j) ); } // for j +// std::cout << std::endl; +// std::cout << "\tpartial sol = " << partsol << std::endl; assert( partsol.size() > 0 ); From d002dccadf1a2d97ca93702fbae7d3828506479d Mon Sep 17 00:00:00 2001 From: nojhan Date: Thu, 3 Nov 2011 10:54:07 +0100 Subject: [PATCH 6/6] cleaner debug code for uniform bounder --- edo/src/edoBounderUniform.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/edo/src/edoBounderUniform.h b/edo/src/edoBounderUniform.h index c90317c7..f5ea97c7 100644 --- a/edo/src/edoBounderUniform.h +++ b/edo/src/edoBounderUniform.h @@ -49,6 +49,10 @@ public: assert( this->max().size() > 0 ); assert( sol.size() > 0); + assert( sol.size() == this->min().size() ); + + eo::log << eo::debug << "BounderUniform: from sol = " << sol; + eo::log.flush(); unsigned int size = sol.size(); for (unsigned int d = 0; d < size; ++d) { @@ -58,6 +62,8 @@ public: sol[d] = rng.uniform( this->min()[d], this->max()[d] ); } } // for d in size + + eo::log << eo::debug << "\tto sol = " << sol << std::endl; } };