From 70e60a50d2c1adcf0140d97ac9def6fe4307b59e Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Thu, 5 May 2011 17:15:10 +0200 Subject: [PATCH] * whitespace cleanup --- edo/AUTHORS | 5 +- edo/COPYING | 14 +- edo/application/eda/main.cpp | 4 +- edo/src/edo | 4 +- edo/src/edo.cpp | 5 +- edo/src/edoAlgo.h | 4 +- edo/src/edoBounder.h | 4 +- edo/src/edoBounderBound.h | 4 +- edo/src/edoBounderNo.h | 4 +- edo/src/edoBounderRng.h | 5 +- edo/src/edoBounderUniform.h | 20 +- edo/src/edoContinue.h | 4 +- edo/src/edoDistrib.h | 4 +- edo/src/edoEDA.h | 6 +- edo/src/edoEDASA.h | 6 +- edo/src/edoEstimator.h | 4 +- edo/src/edoEstimatorNormalMono.h | 4 +- edo/src/edoEstimatorNormalMulti.h | 4 +- edo/src/edoEstimatorUniform.h | 4 +- edo/src/edoModifier.h | 5 +- edo/src/edoModifierDispersion.h | 4 +- edo/src/edoModifierMass.h | 5 +- edo/src/edoNormalMono.h | 4 +- edo/src/edoNormalMonoCenter.h | 5 +- edo/src/edoNormalMulti.h | 4 +- edo/src/edoNormalMultiCenter.h | 4 +- edo/src/edoSampler.h | 4 +- edo/src/edoSamplerNormalMono.h | 6 +- edo/src/edoSamplerNormalMulti.h | 4 +- edo/src/edoSamplerUniform.h | 4 +- edo/src/edoUniform.h | 4 +- edo/src/edoUniformCenter.h | 4 +- edo/src/edoVectorBounds.h | 4 +- edo/src/utils/edoCheckPoint.h | 4 +- edo/src/utils/edoFileSnapshot.cpp | 4 +- edo/src/utils/edoFileSnapshot.h | 4 +- edo/src/utils/edoHyperVolume.h | 4 +- edo/src/utils/edoPopStat.h | 4 +- edo/src/utils/edoStat.h | 4 +- edo/src/utils/edoStatNormalMono.h | 4 +- edo/src/utils/edoStatNormalMulti.h | 4 +- edo/src/utils/edoStatUniform.h | 4 +- edo/test/t-bounderno.cpp | 4 +- edo/test/t-continue.cpp | 4 +- edo/test/t-edoEstimatorNormalMulti.cpp | 4 +- edo/test/t-mean-distance.cpp | 4 +- edo/test/t-uniform.cpp | 4 +- edo/test/test_cov_parameters.py | 12 +- eo/CHANGELOG | 226 +++---- eo/COPYING | 4 +- eo/ConfigureChecks.cmake | 26 +- eo/INSTALL | 1 - eo/LICENSE | 6 +- eo/NEWS | 13 +- eo/README | 23 +- eo/app/gprop/CMakeLists.txt | 11 +- eo/app/gprop/gprop.h | 8 +- eo/app/gprop/l2.h | 42 +- eo/app/gprop/mlp.h | 68 +- eo/app/gprop/mse.h | 36 +- eo/app/gprop/qp.h | 88 +-- eo/app/gprop/vecop.h | 11 +- eo/app/gpsymreg/CMakeLists.txt | 5 +- eo/app/gpsymreg/fitness.h | 3 +- eo/app/gpsymreg/main.cpp | 17 +- eo/app/gpsymreg/node.h | 100 +-- eo/app/gpsymreg/parameters.h | 42 +- eo/app/mastermind/CMakeLists.txt | 5 +- eo/app/mastermind/mastermind.cpp | 4 +- eo/config.guess | 170 ++--- eo/config.h.cmake | 2 - eo/contrib/MGE/eoInitVirus.h | 12 +- eo/contrib/boost/config.hpp | 17 +- eo/contrib/boost/config/abi_prefix.hpp | 2 +- eo/contrib/boost/config/abi_suffix.hpp | 4 +- eo/contrib/boost/config/auto_link.hpp | 28 +- eo/contrib/boost/limits.hpp | 13 +- eo/contrib/eoAged.h | 13 +- eo/contrib/eoDrawable.h | 56 +- eo/install_symlink.py.cmake | 16 +- eo/test/ChangeLog | 10 +- eo/test/RoyalRoad.h | 4 +- eo/test/binary_value.h | 2 +- eo/test/boxplot.py | 6 +- eo/test/fitness_traits.cpp | 6 +- eo/test/real_value.h | 7 +- eo/test/run_tests | 2 +- eo/test/t-eo.cpp | 5 +- eo/test/t-eo2dVector.cc | 8 +- eo/test/t-eoCMAES.cpp | 4 - eo/test/t-eoCheckpointing.cpp | 37 +- eo/test/t-eoDualFitness.cpp | 24 +- eo/test/t-eoESAll.cpp | 32 +- eo/test/t-eoESFull.cpp | 24 +- eo/test/t-eoEasyEA.cpp | 17 +- eo/test/t-eoEasyPSO.cpp | 33 +- eo/test/t-eoExtendedVelocity.cpp | 4 +- eo/test/t-eoExternalEO.cpp | 22 +- eo/test/t-eoFitnessAssembled.cpp | 27 +- eo/test/t-eoFitnessAssembledEA.cpp | 38 +- eo/test/t-eoFunctor.cpp | 3 +- eo/test/t-eoGA.cpp | 2 +- eo/test/t-eoGenOp.cpp | 26 +- eo/test/t-eoIQRStat.cpp | 8 +- eo/test/t-eoInitPermutation.cpp | 14 +- eo/test/t-eoOrderXover.cpp | 16 +- eo/test/t-eoPBIL.cpp | 8 +- eo/test/t-eoRNG.cpp | 16 +- eo/test/t-eoReal.cpp | 6 +- eo/test/t-eoReplacement.cpp | 16 +- eo/test/t-eoRingTopology.cpp | 12 +- eo/test/t-eoRoulette.cpp | 16 +- eo/test/t-eoSecondsElapsedContinue.cpp | 3 - eo/test/t-eoSelect.cpp | 12 +- eo/test/t-eoSharing.cpp | 6 +- eo/test/t-eoShiftMutation.cpp | 14 +- eo/test/t-eoStateAndParser.cpp | 24 +- eo/test/t-eoSwapMutation.cpp | 16 +- eo/test/t-eoSymreg.cpp | 100 +-- eo/test/t-eoSyncEasyPSO.cpp | 32 +- eo/test/t-eoTwoOptMutation.cpp | 14 +- eo/test/t-eoUniform.cpp | 2 +- eo/test/t-eoVirus.cpp | 3 +- eo/test/t-eobin.cpp | 4 +- eo/test/t-eofitness.cpp | 19 +- eo/test/t-openmp.py | 84 +-- eo/test/t-selectOne.cpp | 10 +- eo/tutorial/Lesson1/CMakeLists.txt | 12 +- eo/tutorial/Lesson1/FirstBitGA.cpp | 14 +- eo/tutorial/Lesson1/FirstRealGA.cpp | 14 +- eo/tutorial/Lesson1/Makefile.simple | 6 +- eo/tutorial/Lesson1/exercise1.3.cpp | 6 +- eo/tutorial/Lesson2/CMakeLists.txt | 12 +- eo/tutorial/Lesson2/FirstBitEA.cpp | 4 +- eo/tutorial/Lesson2/FirstRealEA.cpp | 6 +- eo/tutorial/Lesson2/Makefile.simple | 8 +- eo/tutorial/Lesson2/binary_value.h | 3 +- eo/tutorial/Lesson2/exercise2.3.cpp | 6 +- eo/tutorial/Lesson2/real_value.h | 7 +- eo/tutorial/Lesson3/CMakeLists.txt | 13 +- eo/tutorial/Lesson3/Makefile.simple | 8 +- eo/tutorial/Lesson3/SecondBitEA.cpp | 8 +- eo/tutorial/Lesson3/SecondRealEA.cpp | 8 +- eo/tutorial/Lesson3/binary_value.h | 3 +- eo/tutorial/Lesson3/exercise3.1.cpp | 10 +- eo/tutorial/Lesson3/real_value.h | 7 +- eo/tutorial/Lesson4/BitEA.cpp | 10 +- eo/tutorial/Lesson4/CMakeLists.txt | 17 +- eo/tutorial/Lesson4/ESEA.cpp | 28 +- eo/tutorial/Lesson4/ESEA.param | 3 +- eo/tutorial/Lesson4/Makefile.simple | 12 +- eo/tutorial/Lesson4/RealEA.cpp | 6 +- eo/tutorial/Lesson4/RealEA.param | 3 +- eo/tutorial/Lesson4/binary_value.h | 2 +- eo/tutorial/Lesson4/real_value.h | 7 +- eo/tutorial/Lesson5/CMakeLists.txt | 10 +- eo/tutorial/Lesson5/Makefile.simple | 10 +- eo/tutorial/Lesson5/OneMaxEA.cpp | 22 +- eo/tutorial/Lesson5/OneMaxLibEA.cpp | 22 +- eo/tutorial/Lesson5/eoOneMax.h | 17 +- eo/tutorial/Lesson5/eoOneMaxEvalFunc.h | 12 +- eo/tutorial/Lesson5/eoOneMaxInit.h | 7 +- eo/tutorial/Lesson5/eoOneMaxMutation.h | 32 +- eo/tutorial/Lesson5/eoOneMaxQuadCrossover.h | 32 +- eo/tutorial/Lesson5/make_OneMax.cpp | 17 +- eo/tutorial/Lesson5/make_genotype_OneMax.h | 20 +- eo/tutorial/Lesson5/make_op_OneMax.h | 44 +- eo/tutorial/Lesson6/BinaryPSO.cpp | 38 +- eo/tutorial/Lesson6/CMakeLists.txt | 11 +- eo/tutorial/Lesson6/Makefile.simple | 10 +- eo/tutorial/Lesson6/RealPSO.cpp | 42 +- eo/tutorial/Makefile.simple | 12 +- eo/tutorial/README | 9 +- eo/tutorial/Templates/CMakeLists.txt.src-tmpl | 13 +- eo/tutorial/Templates/CMakeLists.txt.top-tmpl | 18 +- eo/tutorial/Templates/ChangeLog | 4 +- eo/tutorial/Templates/EO.tpl | 4 +- eo/tutorial/Templates/MyStructLibEA.cpp | 22 +- eo/tutorial/Templates/README | 6 +- eo/tutorial/Templates/README.manual | 36 +- eo/tutorial/Templates/binCrossover.tmpl | 14 +- eo/tutorial/Templates/configure.ac.tmpl | 6 +- eo/tutorial/Templates/continue.tmpl | 9 +- eo/tutorial/Templates/createEOproject.sh | 4 +- eo/tutorial/Templates/eoMyStruct.tmpl | 25 +- eo/tutorial/Templates/evalFunc.tmpl | 12 +- eo/tutorial/Templates/init.tmpl | 7 +- .../lessOffspringExternalSelectorGenOp.tmpl | 18 +- .../lessOffspringSameSelectorGenOp.tmpl | 10 +- eo/tutorial/Templates/make_MyStruct.cpp | 1 - .../Templates/make_genotype_MyStruct.h | 20 +- eo/tutorial/Templates/make_op_MyStruct.h | 44 +- eo/tutorial/Templates/moreOffspringGenOp.tmpl | 18 +- eo/tutorial/Templates/stat.tmpl | 3 +- website/index.html | 602 +++++++++--------- 195 files changed, 1752 insertions(+), 1862 deletions(-) diff --git a/edo/AUTHORS b/edo/AUTHORS index 550b46c0..d66d82bf 100644 --- a/edo/AUTHORS +++ b/edo/AUTHORS @@ -1,6 +1,5 @@ - -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/COPYING b/edo/COPYING index 4362b491..d4537832 100644 --- a/edo/COPYING +++ b/edo/COPYING @@ -1,5 +1,5 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA @@ -10,7 +10,7 @@ as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -112,7 +112,7 @@ modification follow. Pay close attention to the difference between a former contains code derived from the library, whereas the latter must be combined with the library in order to run. - GNU LESSER GENERAL PUBLIC LICENSE + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other @@ -432,7 +432,7 @@ decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. @@ -455,9 +455,9 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Libraries + How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that diff --git a/edo/application/eda/main.cpp b/edo/application/eda/main.cpp index 8fc663fd..ceb64fb3 100644 --- a/edo/application/eda/main.cpp +++ b/edo/application/eda/main.cpp @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edo b/edo/src/edo index 54f20284..1a6a2c68 100644 --- a/edo/src/edo +++ b/edo/src/edo @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edo.cpp b/edo/src/edo.cpp index ff2bd2f9..aab9c37b 100644 --- a/edo/src/edo.cpp +++ b/edo/src/edo.cpp @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or @@ -25,4 +25,3 @@ Authors: */ #include "edo" - diff --git a/edo/src/edoAlgo.h b/edo/src/edoAlgo.h index 249e42dd..464cb55e 100644 --- a/edo/src/edoAlgo.h +++ b/edo/src/edoAlgo.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoBounder.h b/edo/src/edoBounder.h index 98bfc1a8..3341db5c 100644 --- a/edo/src/edoBounder.h +++ b/edo/src/edoBounder.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoBounderBound.h b/edo/src/edoBounderBound.h index 8d5e52be..106748a3 100644 --- a/edo/src/edoBounderBound.h +++ b/edo/src/edoBounderBound.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoBounderNo.h b/edo/src/edoBounderNo.h index 27d65e6c..c1a98e71 100644 --- a/edo/src/edoBounderNo.h +++ b/edo/src/edoBounderNo.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoBounderRng.h b/edo/src/edoBounderRng.h index e1e3617f..8c7bb3ef 100644 --- a/edo/src/edoBounderRng.h +++ b/edo/src/edoBounderRng.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or @@ -60,4 +60,3 @@ private: }; #endif // !_edoBounderRng_h - diff --git a/edo/src/edoBounderUniform.h b/edo/src/edoBounderUniform.h index fef1674d..3af5579f 100644 --- a/edo/src/edoBounderUniform.h +++ b/edo/src/edoBounderUniform.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or @@ -39,16 +39,16 @@ public: void operator()( EOT& sol ) { - unsigned int size = sol.size(); - assert(size > 0); + unsigned int size = sol.size(); + assert(size > 0); - for (unsigned int d = 0; d < size; ++d) { + for (unsigned int d = 0; d < size; ++d) { - if ( sol[d] < this->min()[d] || sol[d] > this->max()[d]) { - // use EO's global "rng" - sol[d] = rng.uniform( this->min()[d], this->max()[d] ); - } - } // for d in size + if ( sol[d] < this->min()[d] || sol[d] > this->max()[d]) { + // use EO's global "rng" + sol[d] = rng.uniform( this->min()[d], this->max()[d] ); + } + } // for d in size } }; diff --git a/edo/src/edoContinue.h b/edo/src/edoContinue.h index 2f7dff5a..14b89e61 100644 --- a/edo/src/edoContinue.h +++ b/edo/src/edoContinue.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoDistrib.h b/edo/src/edoDistrib.h index 29ff500d..5ce9ce06 100644 --- a/edo/src/edoDistrib.h +++ b/edo/src/edoDistrib.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoEDA.h b/edo/src/edoEDA.h index dde0bb3a..21f95f52 100644 --- a/edo/src/edoEDA.h +++ b/edo/src/edoEDA.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or @@ -108,7 +108,7 @@ public: */ void operator ()(eoPop< EOT > & pop) { - assert(pop.size() > 0); + assert(pop.size() > 0); //double temperature = _initial_temperature; diff --git a/edo/src/edoEDASA.h b/edo/src/edoEDASA.h index b77daa07..99da07cd 100644 --- a/edo/src/edoEDASA.h +++ b/edo/src/edoEDASA.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or @@ -108,7 +108,7 @@ public: */ void operator ()(eoPop< EOT > & pop) { - assert(pop.size() > 0); + assert(pop.size() > 0); double temperature = _initial_temperature; diff --git a/edo/src/edoEstimator.h b/edo/src/edoEstimator.h index 6a2be7a3..c68069ee 100644 --- a/edo/src/edoEstimator.h +++ b/edo/src/edoEstimator.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoEstimatorNormalMono.h b/edo/src/edoEstimatorNormalMono.h index 1ef61ab7..97036855 100644 --- a/edo/src/edoEstimatorNormalMono.h +++ b/edo/src/edoEstimatorNormalMono.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoEstimatorNormalMulti.h b/edo/src/edoEstimatorNormalMulti.h index 8b4b7abb..6d5eb0ba 100644 --- a/edo/src/edoEstimatorNormalMulti.h +++ b/edo/src/edoEstimatorNormalMulti.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoEstimatorUniform.h b/edo/src/edoEstimatorUniform.h index 7c5779ff..8b61c7bd 100644 --- a/edo/src/edoEstimatorUniform.h +++ b/edo/src/edoEstimatorUniform.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoModifier.h b/edo/src/edoModifier.h index 5aac0bb5..91f7fbe2 100644 --- a/edo/src/edoModifier.h +++ b/edo/src/edoModifier.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or @@ -38,4 +38,3 @@ public: }; #endif // !_edoModifier_h - diff --git a/edo/src/edoModifierDispersion.h b/edo/src/edoModifierDispersion.h index 81a6b541..0d890cbe 100644 --- a/edo/src/edoModifierDispersion.h +++ b/edo/src/edoModifierDispersion.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoModifierMass.h b/edo/src/edoModifierMass.h index fee69d2d..414918c7 100644 --- a/edo/src/edoModifierMass.h +++ b/edo/src/edoModifierMass.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or @@ -42,4 +42,3 @@ public: }; #endif // !_edoModifierMass_h - diff --git a/edo/src/edoNormalMono.h b/edo/src/edoNormalMono.h index 0850386c..34c71450 100644 --- a/edo/src/edoNormalMono.h +++ b/edo/src/edoNormalMono.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoNormalMonoCenter.h b/edo/src/edoNormalMonoCenter.h index 8bd990a7..ac6e75f3 100644 --- a/edo/src/edoNormalMonoCenter.h +++ b/edo/src/edoNormalMonoCenter.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or @@ -44,4 +44,3 @@ public: }; #endif // !_edoNormalMonoCenter_h - diff --git a/edo/src/edoNormalMulti.h b/edo/src/edoNormalMulti.h index 54f695b1..9a602e73 100644 --- a/edo/src/edoNormalMulti.h +++ b/edo/src/edoNormalMulti.h @@ -1,8 +1,8 @@ // (c) Thales group, 2010 /* Authors: - Johann Dreo - Caner Candan + Johann Dreo + Caner Candan */ #ifndef _edoNormalMulti_h diff --git a/edo/src/edoNormalMultiCenter.h b/edo/src/edoNormalMultiCenter.h index e59c5634..c929ac56 100644 --- a/edo/src/edoNormalMultiCenter.h +++ b/edo/src/edoNormalMultiCenter.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoSampler.h b/edo/src/edoSampler.h index 4a0d9244..212e861c 100644 --- a/edo/src/edoSampler.h +++ b/edo/src/edoSampler.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoSamplerNormalMono.h b/edo/src/edoSamplerNormalMono.h index d628ba2f..b52ad283 100644 --- a/edo/src/edoSamplerNormalMono.h +++ b/edo/src/edoSamplerNormalMono.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or @@ -74,7 +74,7 @@ public: { AtomType mean = distrib.mean()[i]; AtomType variance = distrib.variance()[i]; - AtomType random = rng.normal(mean, variance); + AtomType random = rng.normal(mean, variance); assert(variance >= 0); diff --git a/edo/src/edoSamplerNormalMulti.h b/edo/src/edoSamplerNormalMulti.h index 889c2e54..2aa59950 100644 --- a/edo/src/edoSamplerNormalMulti.h +++ b/edo/src/edoSamplerNormalMulti.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoSamplerUniform.h b/edo/src/edoSamplerUniform.h index a7b4c316..dbb8f412 100644 --- a/edo/src/edoSamplerUniform.h +++ b/edo/src/edoSamplerUniform.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoUniform.h b/edo/src/edoUniform.h index 93d3b537..01cf3cb3 100644 --- a/edo/src/edoUniform.h +++ b/edo/src/edoUniform.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoUniformCenter.h b/edo/src/edoUniformCenter.h index 8284439b..22ce9516 100644 --- a/edo/src/edoUniformCenter.h +++ b/edo/src/edoUniformCenter.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/edoVectorBounds.h b/edo/src/edoVectorBounds.h index 3c00995f..c72a10c2 100644 --- a/edo/src/edoVectorBounds.h +++ b/edo/src/edoVectorBounds.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/utils/edoCheckPoint.h b/edo/src/utils/edoCheckPoint.h index 90ba72e6..5ba25ac1 100644 --- a/edo/src/utils/edoCheckPoint.h +++ b/edo/src/utils/edoCheckPoint.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/utils/edoFileSnapshot.cpp b/edo/src/utils/edoFileSnapshot.cpp index 40f1db68..1860ac0f 100644 --- a/edo/src/utils/edoFileSnapshot.cpp +++ b/edo/src/utils/edoFileSnapshot.cpp @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/utils/edoFileSnapshot.h b/edo/src/utils/edoFileSnapshot.h index 43e6f088..17d04263 100644 --- a/edo/src/utils/edoFileSnapshot.h +++ b/edo/src/utils/edoFileSnapshot.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/utils/edoHyperVolume.h b/edo/src/utils/edoHyperVolume.h index a1bf4e59..85bcf033 100644 --- a/edo/src/utils/edoHyperVolume.h +++ b/edo/src/utils/edoHyperVolume.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/utils/edoPopStat.h b/edo/src/utils/edoPopStat.h index c8df5f96..4d5c9f10 100644 --- a/edo/src/utils/edoPopStat.h +++ b/edo/src/utils/edoPopStat.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/utils/edoStat.h b/edo/src/utils/edoStat.h index 24dce9c4..de5b4d2d 100644 --- a/edo/src/utils/edoStat.h +++ b/edo/src/utils/edoStat.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/utils/edoStatNormalMono.h b/edo/src/utils/edoStatNormalMono.h index 8cb28553..b16b3ae5 100644 --- a/edo/src/utils/edoStatNormalMono.h +++ b/edo/src/utils/edoStatNormalMono.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/utils/edoStatNormalMulti.h b/edo/src/utils/edoStatNormalMulti.h index 74adb0ba..68af0735 100644 --- a/edo/src/utils/edoStatNormalMulti.h +++ b/edo/src/utils/edoStatNormalMulti.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/src/utils/edoStatUniform.h b/edo/src/utils/edoStatUniform.h index ab75e66b..8ccb93be 100644 --- a/edo/src/utils/edoStatUniform.h +++ b/edo/src/utils/edoStatUniform.h @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/test/t-bounderno.cpp b/edo/test/t-bounderno.cpp index 3f7a189b..ac294ce7 100644 --- a/edo/test/t-bounderno.cpp +++ b/edo/test/t-bounderno.cpp @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/test/t-continue.cpp b/edo/test/t-continue.cpp index 7206a0c3..2f2bd324 100644 --- a/edo/test/t-continue.cpp +++ b/edo/test/t-continue.cpp @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/test/t-edoEstimatorNormalMulti.cpp b/edo/test/t-edoEstimatorNormalMulti.cpp index 23324eef..431f6f98 100644 --- a/edo/test/t-edoEstimatorNormalMulti.cpp +++ b/edo/test/t-edoEstimatorNormalMulti.cpp @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/test/t-mean-distance.cpp b/edo/test/t-mean-distance.cpp index 6f3b84f6..a69bc8f1 100644 --- a/edo/test/t-mean-distance.cpp +++ b/edo/test/t-mean-distance.cpp @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/test/t-uniform.cpp b/edo/test/t-uniform.cpp index ec01ec7a..228ce5e2 100644 --- a/edo/test/t-uniform.cpp +++ b/edo/test/t-uniform.cpp @@ -1,6 +1,6 @@ /* -The Evolving Distribution Objects framework (EDO) is a template-based, -ANSI-C++ evolutionary computation library which helps you to write your +The Evolving Distribution Objects framework (EDO) is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your own estimation of distribution algorithms. This library is free software; you can redistribute it and/or diff --git a/edo/test/test_cov_parameters.py b/edo/test/test_cov_parameters.py index 7a90f167..30688ca4 100755 --- a/edo/test/test_cov_parameters.py +++ b/edo/test/test_cov_parameters.py @@ -10,9 +10,9 @@ from numpy import arange if __name__ == '__main__': for p1 in list(arange(0.1, 1.1, 0.1)): - for p2 in list(arange(-1., 0., 0.1)) + list(arange(0., 1.1, 0.1)): - for p3 in list(arange(0.1, 1.1, 0.1)): - gen = '%d_%.1f_%.1f_%.1f_%.1f' % (PSIZE, MEAN, p1, p2, p3) - cmd = CMD % ( PSIZE, MEAN, p1, p2, p3, gen, gen ) - print cmd - system( cmd ) + for p2 in list(arange(-1., 0., 0.1)) + list(arange(0., 1.1, 0.1)): + for p3 in list(arange(0.1, 1.1, 0.1)): + gen = '%d_%.1f_%.1f_%.1f_%.1f' % (PSIZE, MEAN, p1, p2, p3) + cmd = CMD % ( PSIZE, MEAN, p1, p2, p3, gen, gen ) + print cmd + system( cmd ) diff --git a/eo/CHANGELOG b/eo/CHANGELOG index 09c7a2e6..56e4df4b 100644 --- a/eo/CHANGELOG +++ b/eo/CHANGELOG @@ -1274,11 +1274,11 @@ Date: Thu Feb 22 08:27:32 2007 +0000 * mutation.tmpl, quadCrossover.tmpl, stat.tmpl: Initialize formerly uninitialized variables. - + * README.tmpl: Hint to regular Templates/README for details. - + * README: Add documentation for adding new source-files. - + * Makefile.am.src-tmpl (noinst_HEADERS): Add (MyStruct_SOURCES): Move header files from here to the new noinst_HEADERS variable. @@ -1315,7 +1315,7 @@ Date: Sun Jan 14 18:56:31 2007 +0000 for automake finding the scripts of eo itself if we run it in a embedded subdirectory. (COPYING, INSTALL): create. - + * README: State more explicitly what a "complete installation" means. Give build-instructions for moved directories. @@ -1359,9 +1359,9 @@ Author: kuepper Date: Mon Dec 18 11:17:55 2006 +0000 * TODO.html, README.html: Remove these old files. - + * AUTHORS, COPYING, ForRelease, NEWS, ToDo: Update for release. - + * eo.cfg (PROJECT_NUMBER): Bump version to 1.0 Author: kuepper @@ -1373,7 +1373,7 @@ Author: kuepper Date: Sun Dec 17 22:59:53 2006 +0000 * README: Better links to Templates/ - + * configure.in: Bump version to 1.0-beta2. Author: kuepper @@ -1402,11 +1402,11 @@ Date: Sat Dec 16 21:55:03 2006 +0000 * EO.tpl, MyStructEA.cpp, MyStructSEA.cpp, make_MyStruct.cpp: Use correct names for includes. - + * README.manual: This is a copy of the old README. - + * README: Describe the new way and setup of creating a new EO project. - + * createEOproject.sh, Makefile.am.src-tmpl, Makefile.am.top-tmpl: * configure.ac.tmpl: New files to create a standalone EO project from templates. @@ -1435,7 +1435,7 @@ Author: kuepper Date: Mon Dec 4 22:27:41 2006 +0000 * Makefile.am: Add t-eoRNG - + * t-eoRNG.cpp: Start test for random number generator. Author: kuepper @@ -1472,11 +1472,11 @@ Author: kuepper Date: Sun Dec 3 10:41:54 2006 +0000 * mainpage.html: update, add link to Niko Hansen's comparison - + * README: Add more specific note about tutorial. - + * configure.in: Bump version to 1.0-beta1 - + * tutorial/Makefile.am: Add all necessary files, including html and Templates to distribution. @@ -1517,13 +1517,13 @@ Author: kuepper Date: Sat Dec 2 10:18:57 2006 +0000 * eoTimedMonitor.h (eoTimedMonitor::seconds): Make unsigned. - + * eoRNG.cpp, eoRNG.h (K, M, N): Declare static and initialize in cpp. - + * t-eoGenOp.cpp (init): Do not add std::ends to end of string, as this results in escape-codes (^@) to be printed at runtime and is not necessary anyway. - + * test/t-eoSymreg.cpp (SymregNode::operator()): Initialize r1 and r2 to avoid compiler warnings. @@ -1531,7 +1531,7 @@ Author: kuepper Date: Sat Dec 2 09:39:13 2006 +0000 * eoRNG.h: Cleanup docs and document /all/ members. - + * eoRNG.cpp, eoRNG.h (K, M, N): Declare static and initialize in cpp. Author: kuepper @@ -1548,9 +1548,9 @@ Author: kuepper Date: Fri Dec 1 20:08:51 2006 +0000 * Makefile.am: Update for release-distribution. - + * Makefile.am: Add missing CMA header for distribution. - + * Makefile.am: Add missing header for distribution. Author: kuepper @@ -1603,7 +1603,7 @@ Author: kuepper Date: Thu Nov 16 12:52:46 2006 +0000 * configure.in (AC_DEBUG): add test - + * acinclude.m4 (AC_DEBUG): Define debug-feature and set DEBUG, NODEBUG, or NDEBUG according to its value. @@ -1613,10 +1613,10 @@ Date: Thu Nov 16 12:35:46 2006 +0000 * make_genotype_real.h (eoEsChromInit): Rewrite vecSigmaInit-handling: If sigmaInit is relative (%), do not read vecSigmaInit. Otherwise always use vecSigmaInit with default all values of sigmaInit. - + * eoParser.h (eoParser::getORcreateParam): Make this a real if-then-else clause around ptParam (found or not). - + * eoParam.h (eoValueParam::setValue): Document. (eoValueParam >::setValue): Allow delimiters ',' and ';'. A plain ' ' does not work, as it is not correctly read by @@ -1973,9 +1973,9 @@ Date: Sun Oct 2 21:42:08 2005 +0000 - add a user-option for gnuplot-support - separate gnuplot-code into declaration and implementation, so we can define at EO-build-time whether to use it or not. - + Adopt code and Makefiles to above changes. - + Some minor fixes. Author: kuepper @@ -2311,7 +2311,7 @@ Date: Thu Dec 23 15:29:07 2004 +0000 Adjust code to perform to C++ standard according to gcc-3.4 interpretation... (Have not compiled/checked/changed paradisEO.) - + That is, the current code compiles with gcc-3.4 and the checks (besides t-MGE1bit) all pass. @@ -2362,7 +2362,7 @@ Date: Fri Nov 5 08:57:34 2004 +0000 easily read as a parameter) - eoIntBound and all other integer-equivalent of the classes in eoRealBound.h Note that there is no equivalent to eoRealVectorBounds for vector of integers - + In file eo, I have added the 2 includes of eoRealBounds.h and eoIntBounds.h The first one was already there by chance, through eoUniformInit.h @@ -2569,13 +2569,13 @@ Author: kuepper Date: Fri Sep 17 16:53:31 2004 +0000 Updated build-prcess to be completely under automake control. - + For the tutorial the old Makefiles are saved as Makefile.simple in all the respective directories. - + Use generated config.h instead of command-line passing of preprocessor flags. - + Updated support files from current automake. Author: kuepper @@ -3300,7 +3300,7 @@ Date: Sun Jan 5 16:31:50 2003 +0000 Added pyeo. Some changes needed to be made for include files and the like in some files (and some bugs were fixed as well [Marc: eoOneToOneBreeder was a mess]) - + eoFunctor.h now contains static functor_category members, this shouldn't hurt anyone. Author: maartenkeijzer @@ -3398,7 +3398,7 @@ Date: Wed Sep 18 12:40:46 2002 +0000 A new readFrom & printOn function for EO.h Now it CAN handle VALID/INVALID fitnesses. - + The problems are over at last Author: cahon @@ -3592,7 +3592,7 @@ Date: Mon Jun 17 04:13:45 2002 +0000 Adding the truncation selectors. 2 versions: eoTruncatedSelectOne is an eoSelectOne, and - eoTruncatedSelectMany works like an eoSelectMany (but is NOT) + eoTruncatedSelectMany works like an eoSelectMany (but is NOT) Author: jeggermo Date: Mon Jun 10 14:10:35 2002 +0000 @@ -3609,7 +3609,7 @@ Date: Mon May 13 11:31:32 2002 +0000 EO::printOn has been changed so that the printOn function will always print a valid fitness value even if the fitness is invalid - + Jeroen Author: jeggermo @@ -3827,7 +3827,7 @@ Date: Mon Apr 15 12:56:35 2002 +0000 eoParseTree printOn and readFrom functions changed for compatibility with paradisEO - + The fitness is now printed in the same way as in eoBit Author: evomarc @@ -4138,9 +4138,9 @@ Date: Mon Feb 4 14:28:00 2002 +0000 the gpsymreg code has been slightly altered to allow compilation using the Intel C++ Compiler for Linux. - + Other compilers should not be affected. - + A slightly different makefile is needed Author: jeggermo @@ -4317,7 +4317,7 @@ Date: Tue Dec 4 21:15:16 2001 +0000 some template classes and functions which did not need to be templates have been changed to normal classes and functions with hard coded typed - + This might help with M$VC++ 6.0 compatibility Author: jeggermo @@ -4537,8 +4537,8 @@ Date: Sat Nov 10 09:02:17 2001 +0000 Small modifications here and there to be MSVC++ compatible Mainly, time.h -> ctime - definition of loop index out of loops when multiply used - no typename in declaration using template typename + definition of loop index out of loops when multiply used + no typename in declaration using template typename Author: evomarc Date: Sat Nov 10 06:59:02 2001 +0000 @@ -4628,15 +4628,15 @@ Date: Sat Nov 3 22:10:11 2001 +0000 the name of the eoGpDepthInitializer class (initializer for parse_tree's has been changed to - + eoParseTreeDepthInit but backward compatibility is maintained by using a #define statement: - + #define eoGpDepthInitializer eoParseTreeDepthInit - + The initializer for strongly typed GP has been changed to eoStParseTreeDepthInit - + the gpsymreg application has been changed to use the new name Author: jeggermo @@ -4839,7 +4839,7 @@ Author: jeggermo Date: Tue Jul 17 08:58:52 2001 +0000 small documentation change for eoParseTree.h. - + added a depth initializer for strongly typed genetic programming added subtree xover for strongly typed genetic programming added branch mutation for strongly typed genetic programming @@ -4862,7 +4862,7 @@ Date: Wed Jul 4 04:44:30 2001 +0000 Adding eoPopEvalFunc, that handles evaluation globally: it receives two populations, parents and offspring, and does whatever necessary. The subclass eoPopLoopEval does the simple loop on the offspring. - + eoEasyEA was subsequently modified to handle an eoPopEval passed in Ctor, but also to encapsulate an eoEvalFunc into an eoPopLoopEval tranparently. @@ -4874,7 +4874,7 @@ Date: Tue Jul 3 12:56:44 2001 +0000 Modified eoEaseyEA accordingly - you can either pass an eoEvalFunc, as before (it is then encapsulated into an eoPopLoopEval that does the good old loop on the offspring - or directly pass a full eoPopEvalFunc - + Small modification also in make_op_es -> keyword "none" is now recognized for one of the crossover of either object variables or stdev's @@ -4883,9 +4883,9 @@ Date: Mon Jul 2 13:31:04 2001 +0000 Changed the directory structure for gp now: eoParseTree <-- the eoParseTree class - eoParseTreeDepthInit <-- the eoParseTree depth initializer (eoGpDepthInitializer) - eoParseTreeOp <-- the operators (xover and mutation) - + eoParseTreeDepthInit <-- the eoParseTree depth initializer (eoGpDepthInitializer) + eoParseTreeOp <-- the operators (xover and mutation) + base documentation written for: * eoParseTree * eoGpDepthInitializer @@ -4895,9 +4895,9 @@ Date: Mon Jul 2 13:31:04 2001 +0000 * eoExpansionMutation * eoCollapseSubtreeMutation * eoHoistMutation - + I also created a group ParseTree which contains all classes related to eoParseTree - + eoGpMutate.h has been removed (merged with eoParseTree operators into eoParseTreeOp Author: jeggermo @@ -4978,16 +4978,16 @@ Author: jeggermo Date: Thu Jun 28 14:03:59 2001 +0000 new Mutation operators for eoParseTree in src/gp/eoGpMutate.h - + a symbolic regression example program added to the app-dir - + configure.in and Makefile(s).am changed Author: jeggermo Date: Thu Jun 28 13:55:14 2001 +0000 Additional mutation operators for eoParseTree - + * Point Mutation * Expansion Mutation * Collapse Subtree Mutation @@ -5195,7 +5195,7 @@ Date: Wed May 2 10:42:32 2001 +0000 src/es/eoEsGlobalXover.h and src/es/eoEsLocalXover.h for crossover src/es/make_XXX_es.h for user-input test/t-eoEsAll.cpp to test - + However, an old bug appeared: className was not const in eoGenOp (and derived classes) so I had to change that throughtout the hierarchy @@ -5212,7 +5212,7 @@ Date: Mon Apr 30 13:24:42 2001 +0000 Changed the interface of make_genotype - now templatized by the EOT and not the fitness - this is mandatory for ES genoptypes as it allows to choose the type of gentype at run-time (from existing types, of course!) - + Also moved make_help.cpp into utils dir (otherwise you'd had to maintain a copy into each representation dir!). @@ -5224,7 +5224,7 @@ Date: Mon Apr 30 13:01:07 2001 +0000 Changed the interface of make_genotype - now templatized by the EOT and not the fitness - this is mandatory for ES genoptypes as it allows to choose the type of gentype at run-time (from existing types, of course!) - + Also moved make_help.cpp into utils dir (otherwise you'd had to maintain a copy into each representation dir!). @@ -5427,7 +5427,7 @@ Date: Wed Apr 4 03:47:33 2001 +0000 Added the signal handling - see eoCtrlCContinue.h I've disabled it in case of MSC as I don't know if this works there ... - + Also added a couple of "virtual" in the ga dir Author: evomarc @@ -5455,7 +5455,7 @@ Date: Wed Mar 28 09:00:54 2001 +0000 FDCStat and FileSnapshot: better error messageing Scalar fitness: is now a vector of doubles exercise3.1 added gnuplot again - + Don't know about eoCombinedContinue Author: evomarc @@ -5646,7 +5646,7 @@ Author: maartenkeijzer Date: Mon Mar 12 16:00:58 2001 +0000 EO: added overloaded printing of fitness (for vectors and pairs) - + Various bugs and ommissions in eoPerf2Worth and eoSelectFromWorth Author: maartenkeijzer @@ -5658,12 +5658,12 @@ Author: maartenkeijzer Date: Sat Mar 10 14:02:23 2001 +0000 Changed the populator to be a) more efficient and b) more useable - + It is no longer derived from eoPop, it now gets a destination population. This saves a lot of copying. The semantics has changed a little as well. It is now an _infinite_ iterator. operator++ will *not* dispense new individuals, but will merely stay at the end. To get a new indy, use operator*() as before. - + eoEasyEA now checks the checkpoint *after* making a generation and clears the offspring eoGeneralBreeder is changed to reflect the changes in eoPopulator eoSequentialSelect now uses setup() rather than init() @@ -5717,7 +5717,7 @@ Date: Mon Feb 19 12:23:13 2001 +0000 To be able to use the primitive std::generate function, added a set of wrappers in eoSTLFunctor.h that have the copy semantics most STL functions expect (namely pass-by-value rather then pass-by-reference). - + Updated test/Makefile.am to also test t-eoRandom Author: evomarc @@ -5736,14 +5736,14 @@ Author: maartenkeijzer Date: Sat Feb 17 10:51:31 2001 +0000 eoVector is back (eoFixedLength and eoVariableLength are gone) - + Also: introducing eoRndGenerators.h for eoRndGenerator derived classes: - + eoNormalGenerator eoUniformGenerator eoBooleanGenerator eoNegExpGenerator - + Note the suffix that are added to aid in determining what these classes do Author: evomarc @@ -5829,13 +5829,13 @@ Date: Wed Feb 14 14:09:16 2001 +0000 Author: maartenkeijzer Date: Wed Feb 14 10:35:26 2001 +0000 - + Changed the signature of eoMon, eoBin and eoQuadOp to return a bool, without invalidating fitness. Added a set of invalidators to take over that job (see for instance eoSGA and eoSGATransform how this can transparantly used) - + Derived eoState from eoFunctorStore (for convenience, from a design perspective this may sound wrong) - + Added a wrap_op function that does the wrapping for you (see eoOpContainer how this made this functor exceedingly less hairy). Checked all the tests removed the eoGeneric*Op family (not needed anymore) and of course changed all the operators to reflect the change (and found a few that didn't @@ -5865,24 +5865,24 @@ Author: maartenkeijzer Date: Tue Feb 13 12:38:19 2001 +0000 fixed a bug: the parser now correctly parses parameters of the form - + -Pvalue - + This will now produce 'value'. The buggy parser would parse 'alue' here. I am truly and deeply ashamed to have created such an off-by-one error. - + Marc assumed this was wanted behaviour (so that it should read: -P=value) I must admit that this is a logical conclusion, though it was merely a side-effect of the error. To not force Marc to rewrite the tutorial and his way of working with EO, I decided to make a feature out of the bug, so that now the parser will parse: - + -Pvalue -P=value - + and of course the true and blue: - + -Parameter=value - + I will now go and check if I sent out some crappy papers caused by this bug (as I've been using eo!) Author: maartenkeijzer @@ -5894,14 +5894,14 @@ Author: maartenkeijzer Date: Mon Feb 12 13:58:51 2001 +0000 Ok, updated the Makefile.am again to use the - + make check - + Command I picked up in the automake documentation (RTFM, you know) - + Tagged a lot of header functions in the GnuPlot files with 'inline', so they can be used from more than one sourcefile. - + Ok, now the interesting news. Started a new library libga (not to be confused with Matthew's GaLib). Here I suggest we put a fairly complete and configurable genetic algorithm. Just to see how far we can stretch ourselves and also to have @@ -5920,7 +5920,7 @@ Author: maartenkeijzer Date: Sun Feb 11 16:25:03 2001 +0000 Removed small bug in reading outside a buffer in eoParser::readFrom - + This caused the parser to crash when a simple flag of the form program -f was given. @@ -6014,8 +6014,8 @@ Date: Fri Feb 9 05:09:26 2001 +0000 I also changed - the eoQuadratic into eoQuad (as dicussed with Maarten) - the eoBin into eoBit, with more appropriate names for the "binary" - operators (that can be unary!) as no one protested when I posted on - eodev list + operators (that can be unary!) as no one protested when I posted on + eodev list Author: evomarc Date: Wed Feb 7 05:15:18 2001 +0000 @@ -6039,7 +6039,7 @@ Date: Wed Feb 7 05:04:24 2001 +0000 Added selection methods eoBestSelect always return the best individual eoSequentialSelect a selectOne version of eoDetSelect (uses an index to - return next offspring from sorted pop) + return next offspring from sorted pop) Author: evomarc Date: Thu Feb 1 05:27:36 2001 +0000 @@ -6061,7 +6061,7 @@ Date: Wed Jan 31 18:38:39 2001 +0000 every generation) which is different from the continuous monitoring (same file/plot is angemented every generation). This lead to a number of modifications in many files in utils dir - + But now we can watch on-line - fitness spreadout - FDC plots @@ -6078,7 +6078,7 @@ Date: Mon Jan 29 10:25:44 2001 +0000 Added the truncate and the hasNoBoundAtAll methods in eoRealBounds. The former simply set values to the boundary values in case they are out The latter allows to short-cut all bound-checks when no need - + SOme day I will put this in utils, and have a eoRealBounds.cpp in the pre-compiled library @@ -6129,12 +6129,12 @@ Date: Sat Jan 27 07:43:58 2001 +0000 eo everything that is general to any representation es.h everything about real representation (in es dir) ga.h everything related to bitstring representation (in ga dir) - + To be continued by gp.h, and ... - + This has lead to some slight modifications in test file eobin and all tutorial examples files... - + I've also added in utils eoDistance, generic functor to compute distances, including also the generic Euclidian distance @@ -6145,9 +6145,9 @@ Date: Sat Jan 27 07:41:46 2001 +0000 eo everything that is general to any representation es.h everything about real representation (in es dir) ga.h everything related to bitstring representation (in ga dir) - + To be continued by gp.h, and ... - + This has lead to some slight modifications in test file eobin and all tutorial examples files... @@ -6405,7 +6405,7 @@ Date: Tue Jan 2 07:03:57 2001 +0000 permanent parameters (eoParser only holds references), and egcs did not allow to create them by reference, i.e. in the line eoValueParam & blablaParam(...); - + So now everything is done in the main_function, and 3 lines are needed to create and read every paramter (sigh ...) @@ -6483,16 +6483,16 @@ Date: Tue Dec 19 18:41:19 2000 +0000 THe big eoReplacement update: The interface for eoReplacement is now eoPop&, eoPop& (i.e. no const) and the result must be in the first argument in the end. - + Hence it is possible to do SSGA and all intermediate replacmeent procedures - + The classes derived from eoMergeReduce.h are now in a separate file The SSGA-like replcaement procedures are in eoReduceMerge.h A more general replacement can be found in eoSurviveAndDie.h (it could be made a littel more general - still open for upgrades). - + Also some accessors have been added to the eoPop (best and worse individuals) - + And include file eo has been updated Author: evomarc @@ -6630,16 +6630,16 @@ Author: evomarc Date: Mon Dec 4 06:58:43 2000 +0000 Added the lastCall construct: if the stopping condition becomes true in eoCheckPoint, - a method called lastCall is called for everything contained in that checkpoint - (stats, updaters and monitors). This can be extremely useful - - for stateSavers (see below) - - for monitoring things like rates of success of operators, where what you - are interested in is the final result only. + a method called lastCall is called for everything contained in that checkpoint + (stats, updaters and monitors). This can be extremely useful + - for stateSavers (see below) + - for monitoring things like rates of success of operators, where what you + are interested in is the final result only. Added of course a virtual method lastCall that does nothing by default in classes - eoBaseStat, eoBaseSortedStat, eoUpdater and eoMonitor + eoBaseStat, eoBaseSortedStat, eoUpdater and eoMonitor Added a boolean to control the save of the state in method eoCountedStateSaver::lastCall - so you can ask that the state is saved at final population, whatever happens. - I also added the corresponding constructor to take this into account. + so you can ask that the state is saved at final population, whatever happens. + I also added the corresponding constructor to take this into account. Author: evomarc Date: Mon Dec 4 05:55:59 2000 +0000 @@ -6822,8 +6822,8 @@ Author: evomarc Date: Tue Nov 28 06:46:37 2000 +0000 Modified the contructor: the default value for the delimiter is now " " - and I added a boolean argument to indicate whether or not we want to - overwrite an existing file with same name (default is overwrite). + and I added a boolean argument to indicate whether or not we want to + overwrite an existing file with same name (default is overwrite). Added the getFileName accessor. Author: evomarc @@ -7085,7 +7085,7 @@ Author: maartenkeijzer Date: Fri Oct 6 10:41:38 2000 +0000 Added an eoSortedStatBase for more efficient statistic calculations - + updated a few makefiles to include the html and latex docs with the distribution. @@ -7844,12 +7844,12 @@ Author: mac Date: Mon Mar 6 16:05:47 2000 +0000 Fixed bug in eoGOpSelector (missing break!) - + eoOp.h: binOp's second arg is const once more - + all dsp and dsw files were touched by msvc, but did add some stuff (which will be added to eo later) - + Hope this all works Author: mac @@ -7879,7 +7879,7 @@ Author: marc Date: Tue Feb 29 05:14:40 2000 +0000 wherease the command "cvs ci" is OK. - + Here we go: - added the virtual destructors of all classes, to suppress g++ annoying warnings when using -Wall option @@ -7930,7 +7930,7 @@ Date: Sat Feb 19 16:30:42 2000 +0000 Moved the static eoRNG rng to an extern eoRNG This external object is now defined in eoPersistent.cpp - + This should change... Author: mac diff --git a/eo/COPYING b/eo/COPYING index 2bb5b6e5..b8df7fd4 100644 --- a/eo/COPYING +++ b/eo/COPYING @@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. - + 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an @@ -457,7 +457,7 @@ DAMAGES. END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Libraries + How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that diff --git a/eo/ConfigureChecks.cmake b/eo/ConfigureChecks.cmake index a8ef34aa..ee687fdf 100644 --- a/eo/ConfigureChecks.cmake +++ b/eo/ConfigureChecks.cmake @@ -1,4 +1,3 @@ - # NOTE: only add something here if it is really needed by EO include(CheckIncludeFile) @@ -7,17 +6,17 @@ include(CheckSymbolExists) include(CheckFunctionExists) include(CheckLibraryExists) -check_library_exists(m cos "cos in libm" HAVE_LIBM) +check_library_exists(m cos "cos in libm" HAVE_LIBM) -check_include_files(cmath.h "cmath.h" HAVE_CMATH_H) -check_include_files(stdio.h "stdio.h" HAVE_STDIO_H) -check_include_files(stdlib.h "stdlib.h" HAVE_STDLIB_H) -check_include_files(string.h "string.h" HAVE_STRING_H) -check_include_files(strings.h "strings.h" HAVE_STRINGS_H) -check_include_files(malloc.h "malloc.h" HAVE_MALLOC_H) -check_include_files(limits.h "limits.h" HAVE_LIMITS_H) -check_include_files(unistd.h "unistd.h" HAVE_UNISTD_H) -check_include_files(stdint.h "stdint.h" HAVE_STDINT_H) +check_include_files(cmath.h "cmath.h" HAVE_CMATH_H) +check_include_files(stdio.h "stdio.h" HAVE_STDIO_H) +check_include_files(stdlib.h "stdlib.h" HAVE_STDLIB_H) +check_include_files(string.h "string.h" HAVE_STRING_H) +check_include_files(strings.h "strings.h" HAVE_STRINGS_H) +check_include_files(malloc.h "malloc.h" HAVE_MALLOC_H) +check_include_files(limits.h "limits.h" HAVE_LIMITS_H) +check_include_files(unistd.h "unistd.h" HAVE_UNISTD_H) +check_include_files(stdint.h "stdint.h" HAVE_STDINT_H) # Use check_symbol_exists to check for symbols in a reliable @@ -27,7 +26,4 @@ check_include_files(stdint.h "stdint.h" HAVE_STDINT_H) # specific order. Refer to the man page for each symbol for which a # check is to be added to get the proper set of headers. Example : -#check_symbol_exists(asymbol "symbole.h" HAVE_SYMBOLE) - - - +#check_symbol_exists(asymbol "symbole.h" HAVE_SYMBOLE) diff --git a/eo/INSTALL b/eo/INSTALL index 6336b026..89a45625 100644 --- a/eo/INSTALL +++ b/eo/INSTALL @@ -233,4 +233,3 @@ operates. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. - diff --git a/eo/LICENSE b/eo/LICENSE index 223ede7d..b8df7fd4 100644 --- a/eo/LICENSE +++ b/eo/LICENSE @@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. - + 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an @@ -457,7 +457,7 @@ DAMAGES. END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Libraries + How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that @@ -500,5 +500,3 @@ necessary. Here is a sample; alter the names: Ty Coon, President of Vice That's all there is to it! - - diff --git a/eo/NEWS b/eo/NEWS index 0f067e00..92beb69a 100644 --- a/eo/NEWS +++ b/eo/NEWS @@ -7,11 +7,11 @@ - GCC 4.3 compatibility - new versatile log system with several nested verbose levels - classes using intern verbose parameters marked as deprecated, please update your code accordingly if you use one of the following files: - eo/src/eoCombinedInit.h - eo/src/eoGenContinue.h - eo/src/eoProportionalCombinedOp.h - eo/src/utils/eoData.h - eo/src/utils/eoStdoutMonitor.h + eo/src/eoCombinedInit.h + eo/src/eoGenContinue.h + eo/src/eoProportionalCombinedOp.h + eo/src/utils/eoData.h + eo/src/utils/eoStdoutMonitor.h - an evaluator that throw an exception if a maximum eval numbers has been reached, independently of the number of generations - new monitor that can write on any ostream - new continuator that can catch POSIX system user signals @@ -33,10 +33,9 @@ - Add Microsoft Visual C++ project support files (for Visual Studio 2003 and 2005) - Upgrade Teamplates/ script to create a complete standalone EO project (using autotools) - Remove support for pre-standard C++ compiler (i.e. gcc-2.x), which allows to - clean up the code considerably. + clean up the code considerably. Assume availability of sstream and limits. * release 0.9.3z.1 (1. Oct. 2005) - Support gcc-3.4 and gcc.4.x. - Provide full automake/autoconf/configure support. - diff --git a/eo/README b/eo/README index 0ce22936..98cf75e1 100644 --- a/eo/README +++ b/eo/README @@ -1,8 +1,7 @@ - - EO README FILE + EO README FILE ======================================================================= - check latest news at http://eodev.sourceforge.net/ + check latest news at http://eodev.sourceforge.net/ ======================================================================= Welcome to EO, the Evolving Objects library. @@ -14,7 +13,7 @@ In case of any problem, please e-mail us at eodev-help@lists.sourceforge.net, eodev@egroups.com To get started, take a look at the tutorial, starting with - ./tutorial/html/eoTutorial.html + ./tutorial/html/eoTutorial.html The easiest way to start programming a new genome with all EO evolution engines handy is to create a new standalone EO project from @@ -23,11 +22,11 @@ an introduction;) ================================================================== - BUILDING EO + BUILDING EO ================================================================== The basic installation procedure goes the following: -Go to your build-directory and run +Go to your build-directory and run $(SRCDIR)/configure make make check @@ -50,7 +49,7 @@ specific about EO. =================================================================== - DIRECTORY STRUCTURE + DIRECTORY STRUCTURE =================================================================== After unpacking the archive file, you should end up with the following structure: @@ -63,7 +62,7 @@ structure: | | | +- ga bistring-genotypes source files | | - | +- es real-valued-genotypes source files + | +- es real-valued-genotypes source files | | | +- gp Genetic Programming source files | | @@ -74,9 +73,9 @@ structure: +-- tutorial TUTORIAL dir (indeed :-) | | | +- html all html files - start by browsing index.html - | | + | | | +- LessonX for X=1, 2, 3, ... : example of increasing complexity - | + | | | +-- doc DOCUMENTATION dir (generated by Doxygen) @@ -93,7 +92,7 @@ structure: | +-- app APPLICATIONS - one dir per separate application | | - | +- gprop GA/backpropagation for neural nets + | +- gprop GA/backpropagation for neural nets | | | +- mastermind the wellknown MasterMind game | @@ -103,7 +102,7 @@ structure: =================================================================== - NOTES + NOTES =================================================================== If you extracted a fresh snapshot from the cvs-repository, remember to run diff --git a/eo/app/gprop/CMakeLists.txt b/eo/app/gprop/CMakeLists.txt index e19df9bd..e37af2e5 100644 --- a/eo/app/gprop/CMakeLists.txt +++ b/eo/app/gprop/CMakeLists.txt @@ -18,15 +18,14 @@ LINK_DIRECTORIES(${EO_BINARY_DIR}/lib) SET (GPROP_SOURCES gprop.cpp) # especially for Visual Studio -IF(NOT WIN32 OR CYGWIN) - ADD_EXECUTABLE(gprop ${GPROP_SOURCES}) +IF(NOT WIN32 OR CYGWIN) + ADD_EXECUTABLE(gprop ${GPROP_SOURCES}) ADD_DEPENDENCIES(gprop eo eoutils) - - TARGET_LINK_LIBRARIES(gprop eo eoutils) - + + TARGET_LINK_LIBRARIES(gprop eo eoutils) + SET(GPROP_VERSION ${GLOBAL_VERSION}) SET_TARGET_PROPERTIES(gprop PROPERTIES VERSION "${GPROP_VERSION}") ENDIF(NOT WIN32 OR CYGWIN) ###################################################################################### - diff --git a/eo/app/gprop/gprop.h b/eo/app/gprop/gprop.h index 98904186..db67c188 100644 --- a/eo/app/gprop/gprop.h +++ b/eo/app/gprop/gprop.h @@ -207,12 +207,12 @@ int correct(const mlp::net& net, const mlp::set& set) unsigned partial = 0; for (unsigned i = 0; i < s->output.size(); ++i) - if ((s->output[i] < 0.5 && net(s->input)[i] < 0.5) || - (s->output[i] > 0.5 && net(s->input)[i] > 0.5)) - ++partial; + if ((s->output[i] < 0.5 && net(s->input)[i] < 0.5) || + (s->output[i] > 0.5 && net(s->input)[i] > 0.5)) + ++partial; if (partial == s->output.size()) - ++sum; + ++sum; } return sum; diff --git a/eo/app/gprop/l2.h b/eo/app/gprop/l2.h index 011c6610..cff4a67c 100644 --- a/eo/app/gprop/l2.h +++ b/eo/app/gprop/l2.h @@ -29,7 +29,7 @@ namespace l2 //--------------------------------------------------------------------------- // error //--------------------------------------------------------------------------- - + real error(const mlp::net& net, const set& ts) { real error_ = 0.0; @@ -37,12 +37,12 @@ namespace l2 for (set::const_iterator s = ts.begin(); s != ts.end(); ++s) { vector out = net(s->input); - + for (unsigned i = 0; i < out.size(); ++i) { real target = s->output[i]; real value = out[i]; - error_ -= target * log(value + min_real) + + error_ -= target * log(value + min_real) + (1.0 - target) * log(1.0 - value + min_real); } } @@ -53,25 +53,25 @@ namespace l2 //------------------------------------------------------------------------- // l2 //------------------------------------------------------------------------- - + class net: public qp::net { public: net(mlp::net& n): qp::net(n) {} - + real error(const set& ts) { real error_ = 0; - + for (set::const_iterator s = ts.begin(); s != ts.end(); ++s) { forward(s->input); error_ -= backward(s->input, s->output); } - + return error_; } - + private: real backward(const vector& input, const vector& output) { @@ -84,7 +84,7 @@ namespace l2 { neuron& n = (*current_layer)[j]; real out = output[j]; - n.ndelta += n.delta = (out - n.out) / + n.ndelta += n.delta = (out - n.out) / (n.out * (1.0 - n.out) + min_real) * n.out * (1.0 - n.out); if (size() == 1) // monolayer @@ -92,21 +92,21 @@ namespace l2 else // multilayer for (unsigned k = 0; k < n.dxo.size(); ++k) n.dxo[k] += n.delta * (*backward_layer)[k].out; - - error_ += out * log(n.out + min_real) + + + error_ += out * log(n.out + min_real) + (1.0 - out) * log(1.0 - n.out + min_real); } - + // hidden layers while (++current_layer != rend()) { reverse_iterator forward_layer = current_layer - 1; - reverse_iterator backward_layer = current_layer + 1; - + reverse_iterator backward_layer = current_layer + 1; + for (unsigned j = 0; j < current_layer->size(); ++j) { neuron& n = (*current_layer)[j]; - real sum = 0; + real sum = 0; for (unsigned k = 0; k < forward_layer->size(); ++k) { neuron& nf = (*forward_layer)[k]; @@ -114,7 +114,7 @@ namespace l2 } n.delta = n.out * (1.0 - n.out) * sum; n.ndelta += n.delta; - + if (backward_layer == rend()) // first hidden layer n.dxo += n.delta * input; else // rest of hidden layers @@ -122,19 +122,19 @@ namespace l2 n.dxo[k] += n.delta * (*backward_layer)[k].out; } } - + return error_; } }; - + //--------------------------------------------------------------------------- - + } // namespace l2 //----------------------------------------------------------------------------- #endif // l2_h -// Local Variables: -// mode:C++ +// Local Variables: +// mode:C++ // End: diff --git a/eo/app/gprop/mlp.h b/eo/app/gprop/mlp.h index dbd12bda..c7c61282 100644 --- a/eo/app/gprop/mlp.h +++ b/eo/app/gprop/mlp.h @@ -45,7 +45,7 @@ namespace std { istream& operator>>(istream& is, mlp::vector& v) { for (mlp::vector::iterator vi = v.begin() ; vi != v.end() ; vi++) { - is >> *vi; + is >> *vi; } return is; } @@ -133,15 +133,15 @@ namespace mlp #ifdef HAVE_LIBYAML_CPP YAML_SERIALIZABLE_AUTO(neuron) void emit_yaml(YAML::Emitter&out) const { - out << YAML::BeginMap; - out << YAML::Key << "Class" << YAML::Value << "mlp::neuron"; - YAML_EMIT_MEMBER(out,bias); - YAML_EMIT_MEMBER(out,weight); - out << YAML::EndMap; + out << YAML::BeginMap; + out << YAML::Key << "Class" << YAML::Value << "mlp::neuron"; + YAML_EMIT_MEMBER(out,bias); + YAML_EMIT_MEMBER(out,weight); + out << YAML::EndMap; } void load_yaml(const YAML::Node& node) { - YAML_LOAD_MEMBER(node, bias); - YAML_LOAD_MEMBER(node, weight); + YAML_LOAD_MEMBER(node, bias); + YAML_LOAD_MEMBER(node, weight); } #endif }; @@ -213,17 +213,17 @@ namespace mlp { } #ifdef HAVE_LIBYAML_CPP friend ostream& operator<<(YAML::Emitter& e, const layer &l) { - e << ((std::vector)l); + e << ((std::vector)l); } friend void operator>>(const YAML::Node& n, layer &l) { - // These temporary variable shenanegins are necessary because - // the compiler gets very confused about which template operator>> - // function to use. - // The following does not work: n >> l; - // So we use a temporary variable thusly: - std::vector *obviously_a_vector = &l; - n >> *obviously_a_vector; + // These temporary variable shenanegins are necessary because + // the compiler gets very confused about which template operator>> + // function to use. + // The following does not work: n >> l; + // So we use a temporary variable thusly: + std::vector *obviously_a_vector = &l; + n >> *obviously_a_vector; } #endif @@ -243,7 +243,7 @@ namespace std { istream& operator>>(istream& is, mlp::layer& l) { for (mlp::layer::iterator li = l.begin() ; li != l.end() ; li++) { - is >> *li; + is >> *li; } return is; } @@ -277,15 +277,15 @@ namespace mlp { #ifdef HAVE_LIBYAML_CPP YAML_SERIALIZABLE_AUTO(net) void emit_members(YAML::Emitter&out) const { - const std::vector* me_as_layer_vector = this; - out << YAML::Key << "layers" << YAML::Value << *me_as_layer_vector; + const std::vector* me_as_layer_vector = this; + out << YAML::Key << "layers" << YAML::Value << *me_as_layer_vector; } void load_members(const YAML::Node& node) { - std::vector* me_as_layer_vector = this; - node["layers"] >> *me_as_layer_vector; + std::vector* me_as_layer_vector = this; + node["layers"] >> *me_as_layer_vector; } - #endif // HAVE_LIBYAML_CPP + #endif // HAVE_LIBYAML_CPP /** Virtual destructor */ virtual ~net() {}; @@ -303,14 +303,14 @@ namespace mlp { is >> layer_size; layer_sizes.push_back(layer_size); } - unsigned check_outputs; + unsigned check_outputs; is >> check_outputs; assert (check_outputs == num_outputs); init (num_inputs,num_outputs,layer_sizes); - // skip forward to pass up opening '<' char - char c=' '; - while (c!='<' && !is.eof()) { is >> c;} - for (iterator l =begin() ; l != end(); l++) { + // skip forward to pass up opening '<' char + char c=' '; + while (c!='<' && !is.eof()) { is >> c;} + for (iterator l =begin() ; l != end(); l++) { is >> *l; } do { is >> c; } while (c == ' ' && !is.eof()); @@ -351,15 +351,15 @@ namespace mlp { } void save(ostream &os) const { - // Save the number of inputs, number of outputs, and number of hidden layers + // Save the number of inputs, number of outputs, and number of hidden layers os << num_inputs() << "\n" << num_outputs() << "\n" << num_hidden_layers() << "\n"; - for(const_iterator l = begin(); l != end(); ++l) + for(const_iterator l = begin(); l != end(); ++l) os << l->size() << " "; - os << "\n"; - os << "< "; - for(const_iterator l = begin(); l != end(); ++l) + os << "\n"; + os << "< "; + for(const_iterator l = begin(); l != end(); ++l) os << *l << " "; - os << ">\n"; + os << ">\n"; } @@ -454,7 +454,7 @@ namespace mlp { void load(istream &is) { unsigned input_size, output_size; - is >> input_size >> output_size; + is >> input_size >> output_size; sample samp(input_size, output_size);; while (is >> samp) { push_back(samp); } } diff --git a/eo/app/gprop/mse.h b/eo/app/gprop/mse.h index 841a88e3..3fb62fa0 100644 --- a/eo/app/gprop/mse.h +++ b/eo/app/gprop/mse.h @@ -28,7 +28,7 @@ namespace mse //--------------------------------------------------------------------------- // error //--------------------------------------------------------------------------- - + real error(const mlp::net& net, const set& ts) { real error_ = 0.0; @@ -36,7 +36,7 @@ namespace mse for (set::const_iterator s = ts.begin(); s != ts.end(); ++s) { vector out = net(s->input); - + for (unsigned i = 0; i < out.size(); ++i) { real diff = s->output[i] - out[i]; @@ -49,26 +49,26 @@ namespace mse //------------------------------------------------------------------------- // mse //------------------------------------------------------------------------- - + class net: public qp::net { public: net(mlp::net& n): qp::net(n) {} - + real error(const set& ts) { real error_ = 0; - + for (set::const_iterator s = ts.begin(); s != ts.end(); ++s) { forward(s->input); error_ += backward(s->input, s->output); } error_ /= ts.size(); - + return error_; } - + private: real backward(const vector& input, const vector& output) { @@ -89,22 +89,22 @@ namespace mse else // multilayer for (unsigned k = 0; k < n.dxo.size(); ++k) n.dxo[k] += n.delta * (*backward_layer)[k].out; - + error_ += diff * diff; } - + // hidden layers while (++current_layer != rend()) { reverse_iterator forward_layer = current_layer - 1; reverse_iterator backward_layer = current_layer + 1; - + for (unsigned j = 0; j < current_layer->size(); ++j) { - + neuron& n = (*current_layer)[j]; real sum = 0; - + for (unsigned k = 0; k < forward_layer->size(); ++k) { neuron& nf = (*forward_layer)[k]; @@ -113,8 +113,8 @@ namespace mse n.delta = n.out * (1.0 - n.out) * sum; n.ndelta += n.delta; - - + + if (backward_layer == rend()) // first hidden layer n.dxo += n.delta * input; else // rest of hidden layers @@ -122,19 +122,19 @@ namespace mse n.dxo[k] += n.delta * (*backward_layer)[k].out; } } - + return error_; } }; //--------------------------------------------------------------------------- - + } // namespace mse //----------------------------------------------------------------------------- #endif // mse_h -// Local Variables: -// mode:C++ +// Local Variables: +// mode:C++ // End: diff --git a/eo/app/gprop/qp.h b/eo/app/gprop/qp.h index 068d1382..fb983675 100644 --- a/eo/app/gprop/qp.h +++ b/eo/app/gprop/qp.h @@ -41,55 +41,55 @@ namespace qp const real backtrack_step = 0.5; const real me_floor = 0.0001; const real mw_floor = 0.0001; - + //--------------------------------------------------------------------------- // neuron //--------------------------------------------------------------------------- - + struct neuron { mlp::neuron* n; real out, delta, ndelta, dbias1, dbias2; vector dweight1, dweight2, dxo; - - neuron(mlp::neuron& _n): - n(&_n), out(0), delta(0), ndelta(0), dbias1(0), dbias2(0), - dweight1(n->weight.size(), 0), - dweight2(n->weight.size(), 0), + + neuron(mlp::neuron& _n): + n(&_n), out(0), delta(0), ndelta(0), dbias1(0), dbias2(0), + dweight1(n->weight.size(), 0), + dweight2(n->weight.size(), 0), dxo(n->weight.size(), 0) {} - + void reset() { // underlaying neuron n->reset(); - + // addons out = delta = ndelta = dbias1 = dbias2 = 0; fill(dweight1.begin(), dweight1.end(), 0); fill(dweight2.begin(), dweight2.end(), 0); fill(dxo.begin(), dxo.end(), 0); } - + real operator()(const vector& input) { - return out = mlp::sigmoid(n->bias + dbias1 + + return out = mlp::sigmoid(n->bias + dbias1 + (n->weight + dweight1) * input); } }; - + std::ostream& operator<<(std::ostream& os, const neuron& n) { - return os << *n.n << " " << n.out << " " << n.delta << " " - << n.ndelta << " " << n.dbias1 << " " << n.dbias2 << " " + return os << *n.n << " " << n.out << " " << n.delta << " " + << n.ndelta << " " << n.dbias1 << " " << n.dbias2 << " " << n.dweight1 << " " << n.dweight2 << " " << n.dxo; } - - + + //--------------------------------------------------------------------------- // layer //--------------------------------------------------------------------------- - + class layer: public std::vector { public: @@ -102,16 +102,16 @@ namespace qp void reset() { for(iterator n = begin(); n != end(); ++n) - n->reset(); + n->reset(); } vector operator()(const vector& input) { vector output(size()); - + for(unsigned i = 0; i < output.size(); ++i) - output[i] = (*this)[i](input); - + output[i] = (*this)[i](input); + return output; } }; @@ -120,10 +120,10 @@ namespace qp //--------------------------------------------------------------------------- // net //--------------------------------------------------------------------------- - + class net: public std::vector { - public: + public: net(mlp::net& n) //: std::vector(n.begin(), n.end()) { reset(); } { for (mlp::net::iterator l = n.begin(); l != n.end(); ++l) @@ -135,27 +135,27 @@ namespace qp void reset() { for(iterator l = begin(); l != end(); ++l) - l->reset(); + l->reset(); } - - real train(const set& ts, - unsigned epochs, - real target_error, + + real train(const set& ts, + unsigned epochs, + real target_error, real tolerance, - real eta = eta_default, - real momentum = alpha_default, + real eta = eta_default, + real momentum = alpha_default, real lambda = lambda_default) { real error_ = max_real; - + while (epochs-- && error_ > target_error) { real last_error = error_; - + init_delta(); error_ = error(ts); - + if (error_ < last_error + tolerance) { coeff_adapt(eta, momentum, lambda); @@ -170,10 +170,10 @@ namespace qp error_ = last_error; } } - + return error_; } - + virtual real error(const set& ts) = 0; // protected: @@ -185,7 +185,7 @@ namespace qp input.swap(tmp); } } - + // private: void init_delta() { @@ -193,11 +193,11 @@ namespace qp for (layer::iterator n = l->begin(); n != l->end(); ++n) fill(n->dxo.begin(), n->dxo.end(), n->ndelta = 0.0); } - + void coeff_adapt(real& eta, real& momentum, real& lambda) { real me = 0, mw = 0, ew = 0; - + for (iterator l = begin(); l != end(); ++l) for (layer::iterator n = l->begin(); n != l->end(); ++n) { @@ -205,7 +205,7 @@ namespace qp mw += n->dweight1 * n->dweight1; ew += n->dxo * n->dweight1; } - + me = std::max(static_cast(sqrt(me)), me_floor); mw = std::max(static_cast(sqrt(mw)), mw_floor); eta *= (1.0 + 0.5 * ew / ( me * mw)); @@ -213,11 +213,11 @@ namespace qp lambda = lambda0 * me / mw; momentum = eta * lambda; #ifdef DEBUG - std::cout << me << " \t" << mw << " \t" << ew << " \t" + std::cout << me << " \t" << mw << " \t" << ew << " \t" << eta << " \t" << momentum << " \t" << lambda << std::endl; #endif // DEBUG } - + void weight_update(unsigned size, bool fire, real eta, real momentum) { for (iterator l = begin(); l != end(); ++l) @@ -239,13 +239,13 @@ namespace qp }; //--------------------------------------------------------------------------- - + } // namespace qp //----------------------------------------------------------------------------- #endif // qp_h -// Local Variables: -// mode:C++ +// Local Variables: +// mode:C++ // End: diff --git a/eo/app/gprop/vecop.h b/eo/app/gprop/vecop.h index 2654f2b1..dd4a23a8 100644 --- a/eo/app/gprop/vecop.h +++ b/eo/app/gprop/vecop.h @@ -160,14 +160,14 @@ template std::ostream& operator<<(std::ostream& os, const std::vector(os, " ")); os << v.back(); - } + } return os << '>'; } template std::istream& operator>>(std::istream& is, std::vector& v) { v.clear(); - + char c; is >> c; if (!is || c != '<') @@ -186,7 +186,7 @@ template std::istream& operator>>(std::istream& is, std::vector& v) } } while (is && c != '>'); } - + return is; } @@ -194,11 +194,11 @@ template std::istream& operator>>(std::istream& is, std::vector& v) // euclidean_distance //----------------------------------------------------------------------------- -template T euclidean_distance(const std::vector& v1, +template T euclidean_distance(const std::vector& v1, const std::vector& v2) { T sum = 0, tmp; - + for (unsigned i = 0; i < v1.size(); ++i) { tmp = v1[i] - v2[i]; @@ -211,4 +211,3 @@ template T euclidean_distance(const std::vector& v1, //----------------------------------------------------------------------------- #endif - diff --git a/eo/app/gpsymreg/CMakeLists.txt b/eo/app/gpsymreg/CMakeLists.txt index 45b561e1..1bb25867 100644 --- a/eo/app/gpsymreg/CMakeLists.txt +++ b/eo/app/gpsymreg/CMakeLists.txt @@ -18,8 +18,8 @@ LINK_DIRECTORIES(${EO_BINARY_DIR}/lib) SET (GPSYMREG_SOURCES main.cpp) # no matter what is the OS, hopefully -ADD_EXECUTABLE(gpsymreg ${GPSYMREG_SOURCES}) - +ADD_EXECUTABLE(gpsymreg ${GPSYMREG_SOURCES}) + ADD_DEPENDENCIES(gpsymreg eo eoutils) ###################################################################################### @@ -36,4 +36,3 @@ SET_TARGET_PROPERTIES(gpsymreg PROPERTIES VERSION "${GPSYMREG_VERSION}") TARGET_LINK_LIBRARIES(gpsymreg eo eoutils) ###################################################################################### - diff --git a/eo/app/gpsymreg/fitness.h b/eo/app/gpsymreg/fitness.h index 90047cc7..d4fdb505 100644 --- a/eo/app/gpsymreg/fitness.h +++ b/eo/app/gpsymreg/fitness.h @@ -14,7 +14,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact: todos@geneura.ugr.es, http://geneura.ugr.es - jeggermo@liacs.nl + jeggermo@liacs.nl */ #ifndef _FITNESS_FUNCTION_H @@ -225,4 +225,3 @@ class RegFitness: public eoEvalFunc< eoParseTree > }; #endif - diff --git a/eo/app/gpsymreg/main.cpp b/eo/app/gpsymreg/main.cpp index 98823e34..6d3318ff 100644 --- a/eo/app/gpsymreg/main.cpp +++ b/eo/app/gpsymreg/main.cpp @@ -30,7 +30,7 @@ Contact: todos@geneura.ugr.es, http://geneura.ugr.es - jeggermo@liacs.nl + jeggermo@liacs.nl */ @@ -146,25 +146,25 @@ int main(int argc, char *argv[]) // the parameters are passed on as well - RegFitness eval(generationCounter, initSequence, parameter); + RegFitness eval(generationCounter, initSequence, parameter); // Depth Initializor, set for Ramped Half and Half Initialization - eoParseTreeDepthInit initializer(parameter.InitMaxDepth, initSequence, true, true); + eoParseTreeDepthInit initializer(parameter.InitMaxDepth, initSequence, true, true); // create the initial population - Pop pop(parameter.population_size, initializer); + Pop pop(parameter.population_size, initializer); // and evaluate the individuals - apply(eval, pop); + apply(eval, pop); @@ -335,10 +335,3 @@ int main(int argc, char *argv[]) } - - - - - - - diff --git a/eo/app/gpsymreg/node.h b/eo/app/gpsymreg/node.h index 85aa4479..02b0279b 100644 --- a/eo/app/gpsymreg/node.h +++ b/eo/app/gpsymreg/node.h @@ -3,18 +3,18 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This library 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 General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - + Contact: todos@geneura.ugr.es, http://geneura.ugr.es - jeggermo@liacs.nl + jeggermo@liacs.nl */ #ifndef _NODE_H @@ -33,13 +33,13 @@ using namespace std; /* A new Operation and Node class for even more flexibility. Improvements over the t-eoSymreg code are: - + * No hardcoded functions or operators. The Operation and Node class below allow you to specify your own unary and binary functions as well as binary operators (like +,-,*,/). Moreover you can detemine if you want to allow primitve subroutines with either one or two arguments. - - If a Node has a subroutine Operation it will take evaluate the first + + If a Node has a subroutine Operation it will take evaluate the first (and possible second) child branch and use them as input variables for the remaining second (or third) child branch. */ @@ -47,20 +47,20 @@ using namespace std; typedef enum {Variable, UFunction, BFunction, BOperator, Const} Type; -typedef double (*BinaryFunction)(const double,const double); +typedef double (*BinaryFunction)(const double,const double); typedef double (*UnaryFunction)(const double); struct Operation { public: - + typedef unsigned int VariableID; typedef string Label; - + // if your compiler allows you to have nameless unions you can make this a // union by removing the //'s below - + //union //{ UnaryFunction uFunction; @@ -68,34 +68,34 @@ struct Operation VariableID id; double constant; //}; - - - + + + Label label; Type type; - + // the default constructor results in a constant with value 0 Operation() : constant(0), label("0"), type(Const){}; // two possible constructors for Unary Functions Operation(UnaryFunction _uf, Label _label): uFunction(_uf), label(_label), type(UFunction) {}; Operation(Label _label, UnaryFunction _uf): uFunction(_uf), label(_label), type(UFunction) {}; - + // Watch out there are two constructors using pointers two binary functions: // Binary Function (printed as label(subtree0,subtree1) (e.g. pow(x,y)) // Binary Operator (printed as (subtree0 label subtree1) (e.g. x^y) // The difference is purely cosmetic. - + // If you specify the label before the function pointer -> Binary Function Operation(Label _label, BinaryFunction _bf): bFunction(_bf), label(_label), type(BFunction) {}; // If you specify the function pointer before the label -> Binary Operator Operation(BinaryFunction _bf, Label _label): bFunction(_bf), label(_label), type(BOperator) {}; - + // A constructor for variables Operation(VariableID _id, Label _label): id(_id), label(_label), type(Variable) {}; // A constructor for constants Operation(double _constant, Label _label): constant(_constant), label(_label), type(Const) {}; - - + + Operation(const Operation &_op) { switch(_op.type) @@ -110,7 +110,7 @@ struct Operation label = _op.label; }; virtual ~Operation(){}; - + }; @@ -118,14 +118,14 @@ class Node { private: Operation op; - + public: - + Node(void): op(Operation()){}; Node(Operation &_op) : op(_op){}; virtual ~Node(void) {} - - int arity(void) const + + int arity(void) const { switch(op.type) { @@ -134,53 +134,53 @@ class Node case BFunction: return 2; case BOperator: return 2; case Const: return 0; - } - return 0; + } + return 0; } - + void randomize(void) {} - + template void operator()(double& result, Children args, vector &var) const { double result0; double result1; - - + + switch(op.type) { case Variable: result = var[op.id%var.size()]; //%var.size() used in the case of Subroutines and as a security measure break; case UFunction: args[0].apply(result0, var); - result = op.uFunction(result0); + result = op.uFunction(result0); break; - case BFunction: + case BFunction: case BOperator: args[0].apply(result0, var); - args[1].apply(result1, var); + args[1].apply(result1, var); result = op.bFunction(result0,result1); break; case Const: result = op.constant; - break; - + break; + } - + } - + template void operator()(string& result, Children args) const { - + string subtree0; string subtree1; string subtree2; - + switch(op.type) { - - case Variable: + + case Variable: case Const: result += op.label; break; - + case UFunction: result += op.label; result += "("; args[0].apply(subtree0); @@ -195,7 +195,7 @@ class Node args[1].apply(subtree1); result += subtree1; result += ")"; - break; + break; case BOperator: result += "("; args[0].apply(subtree0); result += subtree0; @@ -204,16 +204,16 @@ class Node result += subtree1; result += ")"; break; - default: result += "ERROR in Node::operator(string,...) \n"; break; + default: result += "ERROR in Node::operator(string,...) \n"; break; } } - + Operation getOp(void) const {return op;} - + }; - - + + @@ -230,7 +230,7 @@ class Node std::ostream& operator<<(std::ostream& os, const Node& eot) { Operation op(eot.getOp()); - + os << (eot.getOp()).label; return os; } diff --git a/eo/app/gpsymreg/parameters.h b/eo/app/gpsymreg/parameters.h index 4cd23ec0..ed9a0257 100644 --- a/eo/app/gpsymreg/parameters.h +++ b/eo/app/gpsymreg/parameters.h @@ -3,18 +3,18 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This library 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 General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - + Contact: todos@geneura.ugr.es, http://geneura.ugr.es - jeggermo@liacs.nl + jeggermo@liacs.nl */ #ifndef _PARAMETERS_FUNCTION_H @@ -28,7 +28,7 @@ using namespace std; struct Parameters{ unsigned int nGenerations; // -G - unsigned population_size; // -P + unsigned population_size; // -P unsigned offspring_size; // -O unsigned int MaxSize; // -S unsigned int InitMaxDepth; // -D @@ -41,72 +41,72 @@ struct Parameters{ Parameters(int argc, char **argv) { eoParser parser(argc,argv); - + // generations eoValueParam paramGenerations(1, "generations", "Generations", 'G', false); parser.processParam( paramGenerations ); nGenerations = paramGenerations.value(); cerr << "nGenerations= " << nGenerations << endl; - + // populationsize eoValueParam paramPopulationSize(10, "populationsize", "PopulationSize", 'P', false); parser.processParam( paramPopulationSize ); population_size = paramPopulationSize.value(); cerr << "population_size= " << population_size << endl; - + // offspringsize eoValueParam paramOffspringSize(population_size, "offspringsize", "OffspringSize", 'O', false); parser.processParam( paramOffspringSize ); offspring_size = paramOffspringSize.value(); cerr << "offspring_size= " << offspring_size << endl; - + // maxsize eoValueParam paramMaxSize(15, "maxsize", "MaxSize", 'S', false); parser.processParam( paramMaxSize ); MaxSize = paramMaxSize.value(); cerr << "MaxSize= " << MaxSize << endl; - + // initialmaxdepth eoValueParam paramInitialMaxDepth(4, "initialmaxdepth", "InitialMaxDepth", 'D', false); parser.processParam( paramInitialMaxDepth ); InitMaxDepth = paramInitialMaxDepth.value(); cerr << "InitMaxDepth= " << InitMaxDepth << endl; - + // randomseed eoValueParam paramRandomSeed(1, "randomseed", "Random Seed", 'R', false); parser.processParam( paramRandomSeed ); randomseed = paramRandomSeed.value(); cerr << "randomseed= " << randomseed << endl; - - + + // crossover-rate eoValueParam paramXover(0.75, "crossoverrate", "crossover rate", 'x', false); parser.processParam(paramXover ); xover_rate = paramXover.value(); cerr << "xover_rate= " << xover_rate << endl; - + //mutation-rate eoValueParam paramMutation(0.25, "mutationrate", "mutation rate", 'm', false); parser.processParam(paramMutation ); mutation_rate = paramMutation.value(); cerr << "mutation_rate= " << mutation_rate << endl; - + //tournament size eoValueParam paramTournamentSize(5, "tournamentsize", "tournament size", 't', false); parser.processParam(paramTournamentSize ); tournamentsize = paramTournamentSize.value(); cerr << "Tournament Size= " << tournamentsize << endl; - - + + if (parser.userNeedsHelp()) { - parser.printHelp(cout); - exit(1); + parser.printHelp(cout); + exit(1); } }; - + ~Parameters(){}; -}; +}; #endif diff --git a/eo/app/mastermind/CMakeLists.txt b/eo/app/mastermind/CMakeLists.txt index d07e9741..6fde0887 100644 --- a/eo/app/mastermind/CMakeLists.txt +++ b/eo/app/mastermind/CMakeLists.txt @@ -18,8 +18,8 @@ LINK_DIRECTORIES(${EO_BINARY_DIR}/lib) SET (MASTERMIND_SOURCES mastermind.cpp) # no matter what is the OS, hopefully -ADD_EXECUTABLE(mastermind ${MASTERMIND_SOURCES}) - +ADD_EXECUTABLE(mastermind ${MASTERMIND_SOURCES}) + ADD_DEPENDENCIES(mastermind eo eoutils) ###################################################################################### @@ -36,4 +36,3 @@ SET_TARGET_PROPERTIES(mastermind PROPERTIES VERSION "${MASTERMIND_VERSION}") TARGET_LINK_LIBRARIES(mastermind eo eoutils) ###################################################################################### - diff --git a/eo/app/mastermind/mastermind.cpp b/eo/app/mastermind/mastermind.cpp index 9a2ed163..c1788991 100644 --- a/eo/app/mastermind/mastermind.cpp +++ b/eo/app/mastermind/mastermind.cpp @@ -51,8 +51,8 @@ int main(int argc, char** argv) } catch (exception& e) { - cerr << argv[0] << ": " << e.what() << endl; - exit(EXIT_FAILURE); + cerr << argv[0] << ": " << e.what() << endl; + exit(EXIT_FAILURE); } return 0; diff --git a/eo/config.guess b/eo/config.guess index 9b9789b1..2784e1b2 100755 --- a/eo/config.guess +++ b/eo/config.guess @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2004-03-03' +timestamp='2011-05-05' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -186,7 +186,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in fi ;; *) - os=netbsd + os=netbsd ;; esac # The OS release @@ -270,7 +270,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on @@ -342,7 +342,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo i370-ibm-openedition exit 0 ;; *:OS400:*:*) - echo powerpc-ibm-os400 + echo powerpc-ibm-os400 exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} @@ -419,23 +419,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit 0 ;; @@ -504,8 +504,8 @@ EOF echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ @@ -614,52 +614,52 @@ EOF 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac + esac ;; + esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c - #define _HPUX_SOURCE - #include - #include + #define _HPUX_SOURCE + #include + #include - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa @@ -739,22 +739,22 @@ EOF exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit 0 ;; + exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit 0 ;; + exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit 0 ;; + exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit 0 ;; + exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; @@ -778,14 +778,14 @@ EOF exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} @@ -919,7 +919,7 @@ EOF EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; - esac + esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} @@ -961,7 +961,7 @@ EOF s/.*supported targets: *// s/ .*// p'` - case "$ld_supported_targets" in + case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" ;; @@ -1013,11 +1013,11 @@ EOF echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. + # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:OS/2:*:*) @@ -1076,10 +1076,10 @@ EOF exit 0 ;; pc:*:*:*) # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp - exit 0 ;; + exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; @@ -1114,8 +1114,8 @@ EOF /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; @@ -1149,9 +1149,9 @@ EOF fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; + # says + echo i586-unisys-sysv4 + exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm @@ -1173,11 +1173,11 @@ EOF exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-unknown-sysv${UNAME_RELEASE} fi - exit 0 ;; + exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; @@ -1262,7 +1262,7 @@ EOF echo pdp10-unknown-its exit 0 ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} + echo mips-sei-seiux${UNAME_RELEASE} exit 0 ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` @@ -1289,11 +1289,11 @@ main () #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 - "4" + "4" #else "" #endif - ); exit (0); + ); exit (0); #endif #endif diff --git a/eo/config.h.cmake b/eo/config.h.cmake index 81699c23..24568be1 100644 --- a/eo/config.h.cmake +++ b/eo/config.h.cmake @@ -71,5 +71,3 @@ /* Define to `unsigned int' if does not define. */ #cmakedefine size_t - - diff --git a/eo/contrib/MGE/eoInitVirus.h b/eo/contrib/MGE/eoInitVirus.h index 082339c8..f4cb5307 100644 --- a/eo/contrib/MGE/eoInitVirus.h +++ b/eo/contrib/MGE/eoInitVirus.h @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact: todos@geneura.ugr.es, http://geneura.ugr.es - Marc.Schoenauer@polytechnique.fr - mak@dhi.dk + Marc.Schoenauer@polytechnique.fr + mak@dhi.dk */ //----------------------------------------------------------------------------- @@ -43,7 +43,7 @@ public: eoInitVirus(unsigned _combien, eoRndGenerator& _generator ) : combien(_combien), generator(_generator) {} - + virtual void operator()( eoVirus& chrom) { chrom.resize(combien); @@ -54,7 +54,7 @@ public: } chrom.invalidate(); } - + private : unsigned combien; /// generic wrapper for eoFunctor (s), to make them have the function-pointer style copy semantics @@ -68,7 +68,7 @@ public: eoInitVirus1bit(unsigned _combien, eoRndGenerator& _generator ) : combien(_combien), generator(_generator) {} - + virtual void operator()( eoVirus& chrom) { chrom.resize(combien); @@ -77,7 +77,7 @@ public: chrom.virusBitSet(0, true ); chrom.invalidate(); } - + private : unsigned combien; /// generic wrapper for eoFunctor (s), to make them have the function-pointer style copy semantics diff --git a/eo/contrib/boost/config.hpp b/eo/contrib/boost/config.hpp index 055a2785..176b4391 100644 --- a/eo/contrib/boost/config.hpp +++ b/eo/contrib/boost/config.hpp @@ -1,8 +1,8 @@ // Boost config.hpp configuration header file ------------------------------// -// (C) Copyright John Maddock 2002. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright John Maddock 2002. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/config for most recent version. @@ -57,14 +57,3 @@ #include #endif // BOOST_CONFIG_HPP - - - - - - - - - - - diff --git a/eo/contrib/boost/config/abi_prefix.hpp b/eo/contrib/boost/config/abi_prefix.hpp index 1733dc03..a1d93a2a 100644 --- a/eo/contrib/boost/config/abi_prefix.hpp +++ b/eo/contrib/boost/config/abi_prefix.hpp @@ -1,7 +1,7 @@ // abi_prefix header -------------------------------------------------------// // © Copyright John Maddock 2003 - + // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt). diff --git a/eo/contrib/boost/config/abi_suffix.hpp b/eo/contrib/boost/config/abi_suffix.hpp index 6339da63..f9eb493d 100644 --- a/eo/contrib/boost/config/abi_suffix.hpp +++ b/eo/contrib/boost/config/abi_suffix.hpp @@ -1,7 +1,7 @@ // abi_sufffix header -------------------------------------------------------// // © Copyright John Maddock 2003 - + // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt). @@ -19,5 +19,3 @@ #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif - - diff --git a/eo/contrib/boost/config/auto_link.hpp b/eo/contrib/boost/config/auto_link.hpp index 0c36f7b0..8a3c2e19 100644 --- a/eo/contrib/boost/config/auto_link.hpp +++ b/eo/contrib/boost/config/auto_link.hpp @@ -18,13 +18,13 @@ USAGE: Before including this header you must define one or more of define the following macros: BOOST_LIB_NAME: Required: A string containing the basename of the library, - for example boost_regex. + for example boost_regex. BOOST_LIB_TOOLSET: Optional: the base name of the toolset. BOOST_DYN_LINK: Optional: when set link to dll rather than static library. BOOST_LIB_DIAGNOSTIC: Optional: when set the header will print out the name - of the library selected (useful for debugging). + of the library selected (useful for debugging). BOOST_AUTO_LINK_NOMANGLE: Specifies that we should link to BOOST_LIB_NAME.lib, - rather than a mangled-name version. + rather than a mangled-name version. These macros will be undef'ed at the end of the header, further this header has no include guards - so be sure to include it only once from your library! @@ -56,13 +56,13 @@ BOOST_LIB_TOOLSET: The compiler toolset name (vc6, vc7, bcb5 etc). BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing. BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used, - contains one or more of the following letters after - a hiphen: + contains one or more of the following letters after + a hiphen: - s static runtime (dynamic if not present). - d debug build (release if not present). - g debug/diagnostic runtime (release if not present). - p STLPort Build. + s static runtime (dynamic if not present). + d debug build (release if not present). + g debug/diagnostic runtime (release if not present). + p STLPort Build. BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. @@ -342,13 +342,3 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. #if defined(BOOST_AUTO_LINK_NOMANGLE) # undef BOOST_AUTO_LINK_NOMANGLE #endif - - - - - - - - - - diff --git a/eo/contrib/boost/limits.hpp b/eo/contrib/boost/limits.hpp index f468dbce..85607208 100644 --- a/eo/contrib/boost/limits.hpp +++ b/eo/contrib/boost/limits.hpp @@ -1,5 +1,4 @@ - -// (C) Copyright John maddock 1999. +// (C) Copyright John maddock 1999. // (C) David Abrahams 2002. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -33,7 +32,7 @@ namespace std { template<> - class numeric_limits + class numeric_limits { public: @@ -82,11 +81,11 @@ namespace std BOOST_STATIC_CONSTANT(bool, traps = false); BOOST_STATIC_CONSTANT(bool, tinyness_before = false); BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero); - + }; template<> - class numeric_limits + class numeric_limits { public: @@ -135,9 +134,9 @@ namespace std BOOST_STATIC_CONSTANT(bool, traps = false); BOOST_STATIC_CONSTANT(bool, tinyness_before = false); BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero); - + }; } -#endif +#endif #endif diff --git a/eo/contrib/eoAged.h b/eo/contrib/eoAged.h index c4c02fc3..0fa525ae 100644 --- a/eo/contrib/eoAged.h +++ b/eo/contrib/eoAged.h @@ -4,7 +4,7 @@ //----------------------------------------------------------------------------- // eoAge.h // (c) GeNeura Team, 1998 -/* +/* This library 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 @@ -38,7 +38,7 @@ using namespace std; //----------------------------------------------------------------------------- /** eoAge is a template class that adds an age to an object.\\ -Requisites for template instantiation are that the object must admit a default ctor +Requisites for template instantiation are that the object must admit a default ctor and a copy ctor. The Object must be an eoObject, thus, it must have its methods: className, printOn, readFrom. @see eoObject @@ -55,7 +55,7 @@ class eoAged: public Object /// Virtual dtor. They are needed in virtual class hierarchies virtual ~eoAged() {}; - + ///returns the age of the object unsigned long Age() const {return age;} @@ -67,7 +67,7 @@ class eoAged: public Object readFrom and printOn are directly inherited from eo1d */ //@{ - /** Return the class id. This should be redefined in each class; but + /** Return the class id. This should be redefined in each class; but it's got code as an example of implementation. Only "leaf" classes can be non-virtual. */ @@ -83,7 +83,7 @@ class eoAged: public Object _is >> age; } - + /** * Write object. It's called printOn since it prints the object _on_ a stream. * @param _os A ostream. @@ -93,7 +93,7 @@ class eoAged: public Object _os << age; } //@} - + private: /** Default Constructor. \\ @@ -106,4 +106,3 @@ class eoAged: public Object }; #endif EOAGE_H - diff --git a/eo/contrib/eoDrawable.h b/eo/contrib/eoDrawable.h index 221bf2c1..a614042f 100644 --- a/eo/contrib/eoDrawable.h +++ b/eo/contrib/eoDrawable.h @@ -1,9 +1,9 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - +// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- + //----------------------------------------------------------------------------- -// eoDrawable.h +// eoDrawable.h // (c) GeNeura Team, 1999 -/* +/* This library 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 @@ -27,38 +27,38 @@ //----------------------------------------------------------------------------- -using namespace std; +using namespace std; //----------------------------------------------------------------------------- // eoDrawable //----------------------------------------------------------------------------- - -/** eoDrawable is a template class that adds a drawing interface to an object.\\ -Requisites for template instantiation are that the object must admit a default ctor -and a copy ctor. The Object must be an eoObject, thus, it must have its methods: className, -eoDrawables can be drawn on any two-dimensional surface; it can be added to any -object with above characteristics. -@see eoObject -*/ + +/** eoDrawable is a template class that adds a drawing interface to an object. +Requisites for template instantiation are that the object must admit a default ctor +and a copy ctor. The Object must be an eoObject, thus, it must have its methods: className, +eoDrawables can be drawn on any two-dimensional surface; it can be added to any +object with above characteristics. +@see eoObject +*/ template class eoDrawable { public: - /// Main ctor from an already built Object. - eoDrawable( const Object& _o): Object( _o ){}; + /// Main ctor from an already built Object. + eoDrawable( const Object& _o): Object( _o ){}; /// Copy constructor. - eoDrawable( const eoDrawable& _d): Object( _d ){}; - - /// Virtual dtor. They are needed in virtual class hierarchies - virtual ~eoDrawable() {}; - - - /**Draws the object. It must be redefined in any subclass, it´s impossible - to have a general drawing method - @param _x, _y coorinates */ - virtual void draw( unsigned _x, unsigned _y) = 0; - -}; + eoDrawable( const eoDrawable& _d): Object( _d ){}; -#endif EODRAWABLE_H + /// Virtual dtor. They are needed in virtual class hierarchies + virtual ~eoDrawable() {}; + + + /**Draws the object. It must be redefined in any subclass, it´s impossible + to have a general drawing method + @param _x, _y coorinates */ + virtual void draw( unsigned _x, unsigned _y) = 0; + +}; + +#endif //! EODRAWABLE_H diff --git a/eo/install_symlink.py.cmake b/eo/install_symlink.py.cmake index 0a867f4b..145d67a1 100755 --- a/eo/install_symlink.py.cmake +++ b/eo/install_symlink.py.cmake @@ -9,9 +9,9 @@ PREFIX = "/usr" DATA = { 'dirs': [ "%s/share/%s" % (PREFIX, NAME) ], 'links': [ ("%s/src" % SOURCE, "%s/include/%s" % (PREFIX, NAME)), - ("%s/doc" % BINARY, "%s/share/%s/doc" % (PREFIX, NAME)), - ("%s/%s.pc" % (BINARY, NAME), "%s/lib/pkgconfig/%s.pc" % (PREFIX, NAME)), - ] + ("%s/doc" % BINARY, "%s/share/%s/doc" % (PREFIX, NAME)), + ("%s/%s.pc" % (BINARY, NAME), "%s/lib/pkgconfig/%s.pc" % (PREFIX, NAME)), + ] } LIBRARIES = ["libcma.a", "libeo.a", "libeoutils.a", "libes.a", "libga.a"] @@ -21,8 +21,8 @@ import os, sys def isroot(): if os.getuid() != 0: - print '[WARNING] you have to be root' - return False + print '[WARNING] you have to be root' + return False return True def uninstall(): @@ -41,11 +41,11 @@ def data(): if __name__ == '__main__': if not isroot(): - sys.exit() + sys.exit() if len(sys.argv) < 2: - print 'Usage: %s [install|uninstall|data]' % sys.argv[0] - sys.exit() + print 'Usage: %s [install|uninstall|data]' % sys.argv[0] + sys.exit() if sys.argv[1] == 'install': install() elif sys.argv[1] == 'uninstall': uninstall() diff --git a/eo/test/ChangeLog b/eo/test/ChangeLog index 0167b10a..74702538 100644 --- a/eo/test/ChangeLog +++ b/eo/test/ChangeLog @@ -14,12 +14,12 @@ * test/t-eoSymreg.cpp (SymregNode::operator()): Initialize r1 and r2 to avoid compiler warnings. - - + + 2006-07-02 Thomas Legrand * test/t-eoEasyPSO.cpp: added PSO test - + * test/Makefile.am: added PSO test @@ -28,9 +28,9 @@ * test/t-eoSyncEasyPSO.cpp: added synchronous PSO test * test/t-eoEasyPSO.cpp: customized PSO test (initialization) * test/Makefile.am: added synchronous PSO test - + * Local Variables: * coding: iso-8859-1 * mode: flyspell * fill-column: 80 - * End: \ No newline at end of file + * End: diff --git a/eo/test/RoyalRoad.h b/eo/test/RoyalRoad.h index b49e4741..5592f3cd 100644 --- a/eo/test/RoyalRoad.h +++ b/eo/test/RoyalRoad.h @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact: todos@geneura.ugr.es, http://geneura.ugr.es - Marc.Schoenauer@polytechnique.fr + Marc.Schoenauer@polytechnique.fr CVS Info: $Date: 2001-06-21 12:03:17 $ $Header: /home/nojhan/dev/eodev/eodev_cvs/eo/test/RoyalRoad.h,v 1.3 2001-06-21 12:03:17 jmerelo Exp $ $Author: jmerelo $ */ @@ -51,7 +51,7 @@ class RoyalRoad: public eoEvalFunc { _eo.fitness( fitness ); } }; - + private: unsigned div; diff --git a/eo/test/binary_value.h b/eo/test/binary_value.h index 793e9de6..59dc4cc3 100644 --- a/eo/test/binary_value.h +++ b/eo/test/binary_value.h @@ -4,7 +4,7 @@ /** Just the simple function that takes binary value of a chromosome and sets the fitnes. - @param _chrom A binary chromosome + @param _chrom A binary chromosome */ template double binary_value(const Chrom& _chrom) diff --git a/eo/test/boxplot.py b/eo/test/boxplot.py index bf6e84b5..20273c18 100755 --- a/eo/test/boxplot.py +++ b/eo/test/boxplot.py @@ -5,11 +5,11 @@ import sys if __name__ == '__main__': if len(sys.argv) < 2: - print 'Usage: boxplot.py [Results files, ...]' - sys.exit() + print 'Usage: boxplot.py [Results files, ...]' + sys.exit() for i in range(1, len(sys.argv)): - pylab.boxplot( [ [ float(value) for value in line.split() ] for line in open( sys.argv[i] ).readlines() ] ) + pylab.boxplot( [ [ float(value) for value in line.split() ] for line in open( sys.argv[i] ).readlines() ] ) pylab.xlabel('iterations') pylab.show() diff --git a/eo/test/fitness_traits.cpp b/eo/test/fitness_traits.cpp index 19edb27a..4af0e34b 100644 --- a/eo/test/fitness_traits.cpp +++ b/eo/test/fitness_traits.cpp @@ -101,7 +101,7 @@ struct fitness_traits< pair > /* end fitness_traits.h */ -/* EO.h +/* EO.h The Fitness template argument is there for backward compatibility reasons @@ -236,7 +236,7 @@ public : { if (!fitness_traits::needs_mapping) { - throw runtime_error("eoPop: no scaling needed, yet a scaling function is defined"); + throw runtime_error("eoPop: no scaling needed, yet a scaling function is defined"); } (*p2w)(*this); @@ -429,5 +429,3 @@ int main() std::cout << e.what() << std::endl; } } - - diff --git a/eo/test/real_value.h b/eo/test/real_value.h index 8bedd6b9..8b58d317 100644 --- a/eo/test/real_value.h +++ b/eo/test/real_value.h @@ -2,8 +2,8 @@ //----------------------------------------------------------------------------- -/** Just a simple function that takes an eoEsBase and sets the fitnes - to sphere +/** Just a simple function that takes an eoEsBase and sets the fitnes + to sphere @param _ind vector */ @@ -14,6 +14,3 @@ double real_value(const std::vector& _ind) sum += _ind[i] * _ind[i]; return sum/_ind.size(); } - - - diff --git a/eo/test/run_tests b/eo/test/run_tests index ebaec0af..22b9644a 100755 --- a/eo/test/run_tests +++ b/eo/test/run_tests @@ -1,7 +1,7 @@ #!/bin/sh echo "Testing -h" -./t-eoCheckpointing -h +./t-eoCheckpointing -h echo "Finished" diff --git a/eo/test/t-eo.cpp b/eo/test/t-eo.cpp index 22fcb5be..f2c0e177 100644 --- a/eo/test/t-eo.cpp +++ b/eo/test/t-eo.cpp @@ -8,8 +8,7 @@ int main() // EO objects can be printed with stream operators std::cout << "chrom1 = " << chrom1 << std::endl - << "chrom2 = " << chrom2 << std::endl; - + << "chrom2 = " << chrom2 << std::endl; + return 0; } - diff --git a/eo/test/t-eo2dVector.cc b/eo/test/t-eo2dVector.cc index bce0e82b..0288fdc5 100644 --- a/eo/test/t-eo2dVector.cc +++ b/eo/test/t-eo2dVector.cc @@ -37,14 +37,14 @@ main() C c1( 5,6,1 ); cout << "Default constructor with values: " << endl << c1 << endl; - + } { eoUniform aleat( 1,10 ); C c1( 5,6, aleat ); cout << "Random constructor: " << endl << c1 << endl; - + } { C c1( 3,4,1 ), c2( c1 ); @@ -111,12 +111,12 @@ main() cout << "Number of Columns: " << endl << c1.numOfCols() << endl; } - + { cout << "Class Name: " << endl << c1.className() << endl; } - + cout << "-----------------------------------------------------" << endl << "Catching exceptions: " << endl diff --git a/eo/test/t-eoCMAES.cpp b/eo/test/t-eoCMAES.cpp index 912d5128..07b59509 100644 --- a/eo/test/t-eoCMAES.cpp +++ b/eo/test/t-eoCMAES.cpp @@ -1,4 +1,3 @@ - #include #include @@ -123,6 +122,3 @@ int main(int argc, char* argv[]) { cout << "Fitness achieved = " << pop[0].fitness() << endl; cout << "Function evaluations = " << evals.value() << endl; } - - - diff --git a/eo/test/t-eoCheckpointing.cpp b/eo/test/t-eoCheckpointing.cpp index 5562ccb0..134b05cc 100644 --- a/eo/test/t-eoCheckpointing.cpp +++ b/eo/test/t-eoCheckpointing.cpp @@ -1,4 +1,3 @@ - // to avoid long name warnings #ifdef _MSC_VER #pragma warning(disable:4786) @@ -113,38 +112,38 @@ int the_main(int argc, char **argv) if (parser.userNeedsHelp()) { - parser.printHelp(std::cout); - return 0; + parser.printHelp(std::cout); + return 0; } // Either load or initialize if (load_name.value() != "") { - state.load(load_name.value()); // load the rest + state.load(load_name.value()); // load the rest } else { - // else + // else - // initialize rng and population + // initialize rng and population - rng.reseed(seed.value()); + rng.reseed(seed.value()); - pop.resize(2); + pop.resize(2); - pop[0].fitness(1); - pop[1].fitness(2); + pop[0].fitness(1); + pop[1].fitness(2); } while(checkpoint(pop)) { - pop[0].fitness(pop[0].fitness() + 1); + pop[0].fitness(pop[0].fitness() + 1); - time_t now = time(0); + time_t now = time(0); - while (time(0) == now) {} // wait a second to test timed saver + while (time(0) == now) {} // wait a second to test timed saver - std::cout << "gen " << generationCounter.value() << std::endl; + std::cout << "gen " << generationCounter.value() << std::endl; } // run the algorithm @@ -152,9 +151,9 @@ int the_main(int argc, char **argv) // Save when needed if (save_name.value() != "") { - std::string file_name = save_name.value(); - save_name.value() = ""; // so that it does not appear in the parser section of the state file - state.save(file_name); + std::string file_name = save_name.value(); + save_name.value() = ""; // so that it does not appear in the parser section of the state file + state.save(file_name); } return 1; @@ -164,11 +163,11 @@ int main(int argc, char **argv) { try { - the_main(argc, argv); + the_main(argc, argv); } catch(std::exception& e) { - std::cout << "Exception: " << e.what() << std::endl; + std::cout << "Exception: " << e.what() << std::endl; } } diff --git a/eo/test/t-eoDualFitness.cpp b/eo/test/t-eoDualFitness.cpp index 90b35ed7..6b8fd6e1 100644 --- a/eo/test/t-eoDualFitness.cpp +++ b/eo/test/t-eoDualFitness.cpp @@ -1,4 +1,3 @@ - #include #include @@ -13,16 +12,16 @@ class DualSphere : public eoEvalFunc public: virtual void operator()( EOT & x ) { - if( x.invalid() ) { return; } + if( x.invalid() ) { return; } - double sum = 0; - int sign = 1; - for( unsigned int i=0, s=x.size(); i0 ? true : false ) ); + x.fitness( std::make_pair( sum, sign>0 ? true : false ) ); } }; @@ -60,7 +59,7 @@ int main() pop.push_back( sol4 ); // on the sphere function everyone has the same fitness of 1 if( test(pop, 0) != 0 ) { - exit(1); + exit(1); } pop.erase(pop.begin(),pop.end()); @@ -75,7 +74,7 @@ int main() pop.push_back( sol3 ); pop.push_back( sol4 ); if( test(pop, 1) != 1 ) { - exit(1); + exit(1); } // test on a random normal distribution @@ -84,7 +83,6 @@ int main() pop = eoPop( 1000000, init_N ); double iqr = test(pop, 1.09); if( iqr < 1.08 || iqr > 1.11 ) { - exit(1); + exit(1); } } - diff --git a/eo/test/t-eoESAll.cpp b/eo/test/t-eoESAll.cpp index 07949404..3a77b629 100644 --- a/eo/test/t-eoESAll.cpp +++ b/eo/test/t-eoESAll.cpp @@ -37,34 +37,34 @@ int main_function(int argc, char *argv[]) eoParser parser(argc, argv); // for user-parameter reading eoState state; // keeps all things allocated eoValueParam& simpleParam = parser.getORcreateParam(true, "Isotropic", - "Isotropic self-adaptive mutation", - 'i', "ES mutation"); + "Isotropic self-adaptive mutation", + 'i', "ES mutation"); eoValueParam& stdevsParam = parser.getORcreateParam(false, "Stdev", - "One self-adaptive stDev per variable", - 's', "ES mutation"); + "One self-adaptive stDev per variable", + 's', "ES mutation"); eoValueParam& corrParam = parser.getORcreateParam(false, "Correl", - "Use correlated mutations", - 'c', "ES mutation"); + "Use correlated mutations", + 'c', "ES mutation"); // Run the appropriate algorithm if (simpleParam.value() == false) { - std::cout << "Using eoReal" << std::endl; - runAlgorithm(eoReal(), parser, state); + std::cout << "Using eoReal" << std::endl; + runAlgorithm(eoReal(), parser, state); } else if (stdevsParam.value() == false) { - std::cout << "Using eoEsSimple" << std::endl; - runAlgorithm(eoEsSimple(), parser, state); + std::cout << "Using eoEsSimple" << std::endl; + runAlgorithm(eoEsSimple(), parser, state); } else if (corrParam.value() == false) { - std::cout << "Using eoEsStdev" << std::endl; - runAlgorithm(eoEsStdev(), parser, state); + std::cout << "Using eoEsStdev" << std::endl; + runAlgorithm(eoEsStdev(), parser, state); } else { - std::cout << "Using eoEsFull" << std::endl; - runAlgorithm(eoEsFull(), parser, state); + std::cout << "Using eoEsFull" << std::endl; + runAlgorithm(eoEsFull(), parser, state); } return 0; } @@ -83,11 +83,11 @@ int main(int argc, char **argv) #endif try { - main_function(argc, argv); + main_function(argc, argv); } catch(std::exception& e) { - std::cout << "Exception: " << e.what() << '\n'; + std::cout << "Exception: " << e.what() << '\n'; } } diff --git a/eo/test/t-eoESFull.cpp b/eo/test/t-eoESFull.cpp index 7a217b58..7c5e84d9 100644 --- a/eo/test/t-eoESFull.cpp +++ b/eo/test/t-eoESFull.cpp @@ -34,7 +34,7 @@ int main_function(int argc, char *argv[]) // Define Parameters and load them eoValueParam& seed = parser.createParam(static_cast(time(0)), - "seed", "Random number seed"); + "seed", "Random number seed"); eoValueParam& load_name = parser.createParam(string(), "Load","Load a state file",'L'); eoValueParam& save_name = parser.createParam(string(), "Save","Saves a state file",'S'); eoValueParam& stdevs = parser.createParam(false, "Stdev", "Use adaptive mutation rates", 's'); @@ -62,23 +62,23 @@ int main_function(int argc, char *argv[]) // Run the appropriate algorithm if (stdevs.value() == false && corr.value() == false) { - runAlgorithm(eoEsSimple() ,parser, state, bounds, load_name); + runAlgorithm(eoEsSimple() ,parser, state, bounds, load_name); } else if (corr.value() == true) { - runAlgorithm(eoEsFull(),parser, state, bounds, load_name); + runAlgorithm(eoEsFull(),parser, state, bounds, load_name); } else { - runAlgorithm(eoEsStdev(), parser, state, bounds, load_name); + runAlgorithm(eoEsStdev(), parser, state, bounds, load_name); } // and save if (!save_name.value().empty()) { - string file_name = save_name.value(); - save_name.value() = ""; // so that it does not appear in the parser section of the state file - state.save(file_name); + string file_name = save_name.value(); + save_name.value() = ""; // so that it does not appear in the parser section of the state file + state.save(file_name); } return 0; @@ -98,11 +98,11 @@ int main(int argc, char **argv) try { - main_function(argc, argv); + main_function(argc, argv); } catch(std::exception& e) { - std::cout << "Exception: " << e.what() << '\n'; + std::cout << "Exception: " << e.what() << '\n'; } return 1; @@ -120,7 +120,7 @@ void runAlgorithm(EOT, eoParser& _parser, eoState& _state, eoRealVectorBounds& _ if (lambda_rate.value() < 1.0f) { - throw logic_error("lambda_rate must be larger than 1 in a comma strategy"); + throw logic_error("lambda_rate must be larger than 1 in a comma strategy"); } // Initialization @@ -137,8 +137,8 @@ void runAlgorithm(EOT, eoParser& _parser, eoState& _state, eoRealVectorBounds& _ } else { - // evaluate initial population - apply(eval, pop); + // evaluate initial population + apply(eval, pop); } // Ok, time to set up the algorithm diff --git a/eo/test/t-eoEasyEA.cpp b/eo/test/t-eoEasyEA.cpp index afda2362..ba3035d2 100644 --- a/eo/test/t-eoEasyEA.cpp +++ b/eo/test/t-eoEasyEA.cpp @@ -16,12 +16,12 @@ main() // a chromosome randomizer eoBinRandom random; -// the populations: - eoPop pop; +// the populations: + eoPop pop; // Evaluation eoEvalFuncPtr eval( binary_value ); - + for (i = 0; i < POP_SIZE; ++i) { Chrom chrom(CHROM_SIZE); @@ -29,12 +29,12 @@ main() eval(chrom); pop.push_back(chrom); } - + std::cout << "population:" << std::endl; for (i = 0; i < pop.size(); ++i) std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl; - + // selection eoLottery lottery; @@ -45,7 +45,7 @@ main() eoBreeder breeder( propSel ); propSel.addOp(bitflip, 0.25); propSel.addOp(xover, 0.75); - + // replacement eoInclusion inclusion; @@ -65,11 +65,10 @@ main() std::cout << "exception: " << e.what() << std::endl;; exit(EXIT_FAILURE); } - + std::cout << "pop" << std::endl; for (i = 0; i < pop.size(); ++i) std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl; - + return 0; } - diff --git a/eo/test/t-eoEasyPSO.cpp b/eo/test/t-eoEasyPSO.cpp index 96e5b004..af290e13 100644 --- a/eo/test/t-eoEasyPSO.cpp +++ b/eo/test/t-eoEasyPSO.cpp @@ -19,7 +19,7 @@ double real_value (const Particle & _particle) { double sum = 0; for (unsigned i = 0; i < _particle.size ()-1; i++) - sum += pow(_particle[i],2); + sum += pow(_particle[i],2); return (sum); } @@ -50,15 +50,15 @@ int main() // perform position initialization pop.append (POP_SIZE, random); - + // topology eoLinearTopology topology(NEIGHBORHOOD_SIZE); // the full initializer eoInitializer init(eval,veloRandom,localInit,topology,pop); init(); - - + + // bounds eoRealVectorBounds bnds(VEC_SIZE,-1.5,1.5); @@ -71,33 +71,32 @@ int main() // Terminators eoGenContinue genCont1 (50); eoGenContinue genCont2 (50); - + // PS flight eoEasyPSO pso1(genCont1, eval, velocity, flight); eoEasyPSO pso2(init,genCont2, eval, velocity, flight); - + // flight try { - pso1(pop); - std::cout << "FINAL POPULATION AFTER PSO n°1:" << std::endl; + pso1(pop); + std::cout << "FINAL POPULATION AFTER PSO n°1:" << std::endl; for (i = 0; i < pop.size(); ++i) - std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl; - - pso2(pop); - std::cout << "FINAL POPULATION AFTER PSO n°2:" << std::endl; + std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl; + + pso2(pop); + std::cout << "FINAL POPULATION AFTER PSO n°2:" << std::endl; for (i = 0; i < pop.size(); ++i) - std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl; + std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl; } catch (std::exception& e) { - std::cout << "exception: " << e.what() << std::endl;; - exit(EXIT_FAILURE); + std::cout << "exception: " << e.what() << std::endl;; + exit(EXIT_FAILURE); } - + return 0; } - diff --git a/eo/test/t-eoExtendedVelocity.cpp b/eo/test/t-eoExtendedVelocity.cpp index c42fb4c6..3fca3f30 100644 --- a/eo/test/t-eoExtendedVelocity.cpp +++ b/eo/test/t-eoExtendedVelocity.cpp @@ -66,11 +66,11 @@ int main(int argc, char **argv) { try { - main_function(argc, argv); + main_function(argc, argv); } catch(std::exception& e) { - std::cout << "Exception: " << e.what() << " in t-eoExtendedVelocity" << std::endl; + std::cout << "Exception: " << e.what() << " in t-eoExtendedVelocity" << std::endl; } return EXIT_SUCCESS; } diff --git a/eo/test/t-eoExternalEO.cpp b/eo/test/t-eoExternalEO.cpp index aae16985..8246863f 100644 --- a/eo/test/t-eoExternalEO.cpp +++ b/eo/test/t-eoExternalEO.cpp @@ -4,7 +4,7 @@ #endif #include -#include // runtime_error +#include // runtime_error #include #include @@ -61,9 +61,9 @@ bool UserDefMutate(UserDefStruct& a) a = RandomStruct(); // just for testing if (rng.flip(0.1f)) - a.d = UserDefStruct::test; + a.d = UserDefStruct::test; else - a.d = UserDefStruct::another; + a.d = UserDefStruct::another; return true; } @@ -72,13 +72,13 @@ bool UserDefBinCrossover(UserDefStruct& a, const UserDefStruct& b) std::cout << "UserDefBinCrossover\n"; if (rng.flip(0.5)) - a.a = b.a; + a.a = b.a; if (rng.flip(0.5)) - a.b = b.b; + a.b = b.b; if (rng.flip(0.5)) - a.c = b.c; + a.c = b.c; if (rng.flip(0.5)) - a.d = b.d; + a.d = b.d; return true; } @@ -86,13 +86,13 @@ bool UserDefQuadCrossover(UserDefStruct& a, UserDefStruct& b) { std::cout << "UserDefQuadCrossover\n"; if (rng.flip(0.5)) - swap(a.a, b.a); + swap(a.a, b.a); if (rng.flip(0.5)) - swap(a.b, b.b); + swap(a.b, b.b); if (rng.flip(0.5)) - swap(a.c, b.c); + swap(a.c, b.c); if (rng.flip(0.5)) - swap(a.d, b.d); + swap(a.d, b.d); return true; } diff --git a/eo/test/t-eoFitnessAssembled.cpp b/eo/test/t-eoFitnessAssembled.cpp index 5a492aed..018d739a 100644 --- a/eo/test/t-eoFitnessAssembled.cpp +++ b/eo/test/t-eoFitnessAssembled.cpp @@ -1,5 +1,5 @@ // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - + //----------------------------------------------------------------------------- // t-eoFitnessAssembled.cpp // Marc Wintermantel & Oliver Koenig @@ -11,19 +11,19 @@ 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 library 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 library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - + Contact: todos@geneura.ugr.es, http://geneura.ugr.es - Marc.Schoenauer@inria.fr - mak@dhi.dk + Marc.Schoenauer@inria.fr + mak@dhi.dk */ //----------------------------------------------------------------------------- #include @@ -32,7 +32,7 @@ #include "eoScalarFitnessAssembled.h" void test_eoScalarFitnessAssembledClass(){ - + // Create instances eoAssembledMinimizingFitness A,B,C(5, 1.3, "C value"); @@ -53,9 +53,9 @@ void test_eoScalarFitnessAssembledClass(){ std::cout << "C= " << C << std::endl; std::cout << "Printing values and descriptions: " << std::endl; std::cout << "A: "; A.printAll( std::cout ); std::cout << std::endl; - std::cout << "B: "; B.printAll( std::cout ); std::cout << std::endl; + std::cout << "B: "; B.printAll( std::cout ); std::cout << std::endl; std::cout << "C: "; C.printAll( std::cout ); std::cout << std::endl; - + A.resize(8, 100.3, "A resized"); std::cout << "Resized A: "; A.printAll( std::cout ); std::cout << std::endl; @@ -68,7 +68,7 @@ void test_eoScalarFitnessAssembledClass(){ F=A; G= 7.5; std::cout << "F = A : " << F << "\t G = 7.5 : " << G << std::endl; - + // Comparing... std::cout << "AB: " << (A>B) << std::endl; @@ -80,15 +80,15 @@ void test_eoScalarFitnessAssembledClass(){ int main(){ - + std::cout << "-----------------------------------" << std::endl; std::cout << "START t-eoFitnessAssembled" << std::endl; try{ // Test the fitness class itself test_eoScalarFitnessAssembledClass(); - - + + } catch(std::exception& e){ @@ -102,4 +102,3 @@ int main(){ return 0; } - diff --git a/eo/test/t-eoFitnessAssembledEA.cpp b/eo/test/t-eoFitnessAssembledEA.cpp index 6369ac57..e0453567 100644 --- a/eo/test/t-eoFitnessAssembledEA.cpp +++ b/eo/test/t-eoFitnessAssembledEA.cpp @@ -1,5 +1,5 @@ // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - + //----------------------------------------------------------------------------- // t-eoFitnessAssembledEA.cpp // Marc Wintermantel & Oliver Koenig @@ -11,19 +11,19 @@ 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 library 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 library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - + Contact: todos@geneura.ugr.es, http://geneura.ugr.es - Marc.Schoenauer@inria.fr - mak@dhi.dk + Marc.Schoenauer@inria.fr + mak@dhi.dk */ //----------------------------------------------------------------------------- #ifdef HAVE_CONFIG_H @@ -41,7 +41,7 @@ #include // Definition of representation #include // Uniformly initializes real vector in bounds #include // Initialization of a genotype -#include // Base class for fitness evaluation +#include // Base class for fitness evaluation #include // Variation operators using standard Real operators #include // The fitness class typedef eoReal Indi; @@ -51,7 +51,7 @@ typedef eoReal Indi; #include // The stopping criterion #include // Outputs (stats, population dumps, ...) #include // Evolution engine (selection and replacement) -#include // simple call to the algo.stays there for consistency reasons +#include // simple call to the algo.stays there for consistency reasons // Define a fitness class template @@ -59,9 +59,9 @@ class eoAssembledEvalFunc : public eoEvalFunc{ public: // Constructor defining number and descriptions of fitness terms eoAssembledEvalFunc() { - + // Define a temporary fitness object to have access to its static traits - typename EOT::Fitness tmpfit(3, 0.0); + typename EOT::Fitness tmpfit(3, 0.0); tmpfit.setDescription(0,"Fitness"); tmpfit.setDescription(1,"Some Value"); tmpfit.setDescription(2,"Other Value"); @@ -70,27 +70,27 @@ public: void operator()(EOT& _eo){ - // Define temporary fitness object + // Define temporary fitness object // (automatically gets initialized with size given in constructor) typename EOT::Fitness tmpfit; - + // Eval some dummy fitness double sum1=0.0, sum2=0.0; for (unsigned i=0; i < _eo.size(); ++i){ sum1 += _eo[i]*_eo[i]; sum2 += fabs(_eo[i]) + fabs(_eo[i]); } - + // Store some fitness terms tmpfit[1]= sum1; tmpfit[2]= sum2; - + // Store the fitness tmpfit = (sum1 + sum2)/_eo.size(); // Pass it _eo.fitness( tmpfit ); - + } }; @@ -99,14 +99,14 @@ void make_help(eoParser & _parser); // now use all of the above, + representation dependent things int main(int argc, char* argv[]){ - + std::cout << "-----------------------------------" << std::endl; std::cout << "START t-eoFitnessAssembledEA" << std::endl; try{ // Parser & State - eoParser parser(argc, argv); // for user-parameter reading + eoParser parser(argc, argv); // for user-parameter reading eoState state; // keeps all things allocated //// @@ -120,7 +120,7 @@ int main(int argc, char* argv[]){ // The genotype eoRealInitBounded& init = do_make_genotype(parser, state, Indi() ); - + // The variation operators eoGenOp& op = do_make_op(parser, state, init); @@ -158,7 +158,7 @@ int main(int argc, char* argv[]){ std::cout << "Final Population\n"; pop.sortedPrintOn(std::cout); std::cout << std::endl; - + } catch(std::exception& e) { diff --git a/eo/test/t-eoFunctor.cpp b/eo/test/t-eoFunctor.cpp index b0bf5249..f309eebc 100644 --- a/eo/test/t-eoFunctor.cpp +++ b/eo/test/t-eoFunctor.cpp @@ -1,4 +1,3 @@ - #include #include @@ -13,7 +12,7 @@ class Tester : public eoInit public : void operator()(int& i) { - i=1; + i=1; } }; diff --git a/eo/test/t-eoGA.cpp b/eo/test/t-eoGA.cpp index effac3b0..fafed297 100644 --- a/eo/test/t-eoGA.cpp +++ b/eo/test/t-eoGA.cpp @@ -21,7 +21,7 @@ int main(int argc, char* argv[]) ///// FIRST, problem or representation dependent stuff ////////////////////////////////////////////////////// - // The evaluation fn - encapsulated into an eval counter for output + // The evaluation fn - encapsulated into an eval counter for output eoEvalFuncPtr mainEval( binary_value ); eoEvalFuncCounter eval(mainEval); diff --git a/eo/test/t-eoGenOp.cpp b/eo/test/t-eoGenOp.cpp index 910474f9..c959a3bb 100644 --- a/eo/test/t-eoGenOp.cpp +++ b/eo/test/t-eoGenOp.cpp @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact: mkeijzer@dhi.dk - Marc.Schoenauer@polytechnique.fr + Marc.Schoenauer@polytechnique.fr */ //----------------------------------------------------------------------------- @@ -38,10 +38,10 @@ struct Dummy : public EO Dummy(std::string _s="") : s(_s) {} void printOn(std::ostream & _os) const - { - EO::printOn(_os); - _os << " - " << s ; - } + { + EO::printOn(_os); + _os << " - " << s ; + } std::string s; }; @@ -179,9 +179,9 @@ void init(eoPop & _pop, unsigned _pSize) for (unsigned i=0; i<_pSize; i++) { std::ostringstream os; - os << i; - _pop[i] = Dummy(os.str()); - _pop[i].fitness(i); + os << i; + _pop[i] = Dummy(os.str()); + _pop[i].fitness(i); } } @@ -190,7 +190,7 @@ int the_main(int argc, char **argv) { eoParser parser(argc, argv); eoValueParam parentSizeParam( - parser.createParam(unsigned(10), "parentSize", "Parent size",'P')); + parser.createParam(unsigned(10), "parentSize", "Parent size",'P')); pSize = parentSizeParam.value(); // global variable eoValueParam seedParam(time(0), "seed", "Random number seed", 'S'); @@ -201,8 +201,8 @@ int the_main(int argc, char **argv) // i.e. in case you need parameters somewhere else, postpone these if (parser.userNeedsHelp()) { - parser.printHelp(std::cout); - exit(1); + parser.printHelp(std::cout); + exit(1); } ////////////////////////////////// define operators @@ -379,11 +379,11 @@ int main(int argc, char **argv) { try { - the_main(argc, argv); + the_main(argc, argv); } catch(std::exception& e) { - std::cout << "Exception: " << e.what() << std::endl; + std::cout << "Exception: " << e.what() << std::endl; } } diff --git a/eo/test/t-eoIQRStat.cpp b/eo/test/t-eoIQRStat.cpp index 60bcff8f..e49dc38d 100644 --- a/eo/test/t-eoIQRStat.cpp +++ b/eo/test/t-eoIQRStat.cpp @@ -1,4 +1,3 @@ - #include #include #include @@ -39,7 +38,7 @@ int main() pop.push_back( sol4 ); // on the sphere function everyone has the same fitness of 1 if( test(pop, 0) != 0 ) { - exit(1); + exit(1); } pop.erase(pop.begin(),pop.end()); @@ -54,7 +53,7 @@ int main() pop.push_back( sol3 ); pop.push_back( sol4 ); if( test(pop, 1) != 1 ) { - exit(1); + exit(1); } // test on a random normal distribution @@ -63,7 +62,6 @@ int main() pop = eoPop( 1000000, init_N ); double iqr = test(pop, 1.09); if( iqr < 1.08 || iqr > 1.11 ) { - exit(1); + exit(1); } } - diff --git a/eo/test/t-eoInitPermutation.cpp b/eo/test/t-eoInitPermutation.cpp index 4090128b..e4a683b1 100644 --- a/eo/test/t-eoInitPermutation.cpp +++ b/eo/test/t-eoInitPermutation.cpp @@ -32,9 +32,9 @@ bool check_permutation(const Chrom & _chrom) std::cout << " Error: Wrong permutation !" << std::endl; std::string s; s.append( " Wrong permutation in t-eoInitPermutation"); - throw std::runtime_error( s ); + throw std::runtime_error( s ); } - return true; + return true; } int main() @@ -44,13 +44,13 @@ int main() // a chromosome randomizer eoInitPermutation random(CHROM_SIZE); - - // the population: + + // the population: eoPop pop; - + // Evaluation eoEvalFuncPtr eval( real_value ); - + for (i = 0; i < POP_SIZE; ++i) { Chrom chrom(CHROM_SIZE); @@ -61,7 +61,7 @@ int main() check_permutation(chrom); pop.push_back(chrom); } - + return 0; } diff --git a/eo/test/t-eoOrderXover.cpp b/eo/test/t-eoOrderXover.cpp index f44b8c69..32e44dad 100644 --- a/eo/test/t-eoOrderXover.cpp +++ b/eo/test/t-eoOrderXover.cpp @@ -38,13 +38,13 @@ int main() // a chromosome randomizer eoInitPermutation random(CHROM_SIZE); - - // the population: + + // the population: eoPop pop; - + // Evaluation //eoEvalFuncPtr eval( real_value ); - + for (i = 0; i < POP_SIZE; ++i) { Chrom chrom(CHROM_SIZE); @@ -52,18 +52,18 @@ int main() //eval(chrom); pop.push_back(chrom); } - + // a shift mutation eoOrderXover cross; - + for (i = 0; i < POP_SIZE; ++i) std::cout << " Initial chromosome n�" << i << " : " << pop[i] << "..." << std::endl; cross(pop[0],pop[1]); cross(pop[1],pop[2]); - + for (i = 0; i < POP_SIZE; ++i) { - std::cout << " Initial chromosome n�" << i << " becomes : " << pop[i] << " after orderXover" << std::endl; + std::cout << " Initial chromosome n�" << i << " becomes : " << pop[i] << " after orderXover" << std::endl; check_permutation(pop[i]); } return 0; diff --git a/eo/test/t-eoPBIL.cpp b/eo/test/t-eoPBIL.cpp index adba787f..1d2654b8 100644 --- a/eo/test/t-eoPBIL.cpp +++ b/eo/test/t-eoPBIL.cpp @@ -98,14 +98,14 @@ int main(int argc, char* argv[]) // now create the snapshot monitor eoValueParam& plotDistribParam = parser.getORcreateParam(false, "plotDistrib", - "Plot Distribution", '\0', - "Output - Graphical"); + "Plot Distribution", '\0', + "Output - Graphical"); if (plotDistribParam.value()) { #ifdef HAVE_GNUPLOT unsigned frequency=1; // frequency of plots updates eoGnuplot1DSnapshot *distribSnapshot = new eoGnuplot1DSnapshot(ptDirNameParam->value(), - frequency, "distrib"); + frequency, "distrib"); state.storeFunctor(distribSnapshot); // add the distribution (it is an eoValueParam >) distribSnapshot->add(distrib); @@ -117,7 +117,7 @@ int main(int argc, char* argv[]) // the algorithm: EDA // don't know where else to put the population size! unsigned popSize = parser.getORcreateParam(unsigned(100), "popSize", - "Population Size", 'P', "Algorithm").value(); + "Population Size", 'P', "Algorithm").value(); eoSimpleEDA eda(update, eval, popSize, checkpoint); ///// End of construction of the algorith diff --git a/eo/test/t-eoRNG.cpp b/eo/test/t-eoRNG.cpp index 4ff94170..1ece31a0 100644 --- a/eo/test/t-eoRNG.cpp +++ b/eo/test/t-eoRNG.cpp @@ -24,21 +24,21 @@ int main() double sigma(5.); double sum(0.); for(size_t i=0; i sigma / 0.68) { - cerr << "Normal distribution seems out of bounds; " - << "rerun to make sure it wasn't a statistical outlier" << endl; - return -1; + cerr << "Normal distribution seems out of bounds; " + << "rerun to make sure it wasn't a statistical outlier" << endl; + return -1; } sum = 0.; for(size_t i=0; i sigma / 0.68) { - cerr << "Normal distribution seems out of bounds; " - << "rerun to make sure it wasn't a statistical outlier" << endl; - return -1; + cerr << "Normal distribution seems out of bounds; " + << "rerun to make sure it wasn't a statistical outlier" << endl; + return -1; } return 0; } diff --git a/eo/test/t-eoReal.cpp b/eo/test/t-eoReal.cpp index 851e1982..163b0ea8 100644 --- a/eo/test/t-eoReal.cpp +++ b/eo/test/t-eoReal.cpp @@ -20,9 +20,9 @@ int main(int argc, char* argv[]) ///// FIRST, problem or representation dependent stuff ////////////////////////////////////////////////////// - // The evaluation fn - encapsulated into an eval counter for output - eoEvalFuncPtr&> - mainEval( real_value ); + // The evaluation fn - encapsulated into an eval counter for output + eoEvalFuncPtr&> + mainEval( real_value ); eoEvalFuncCounter eval(mainEval); // the genotype - through a genotype initializer diff --git a/eo/test/t-eoReplacement.cpp b/eo/test/t-eoReplacement.cpp index a0f02406..fc44543d 100644 --- a/eo/test/t-eoReplacement.cpp +++ b/eo/test/t-eoReplacement.cpp @@ -5,10 +5,10 @@ #pragma warning(disable:4786) #endif -#include // runtime_error +#include // runtime_error //----------------------------------------------------------------------------- -// tt.cpp: +// tt.cpp: // //----------------------------------------------------------------------------- @@ -37,7 +37,7 @@ public : //----------------------------------------------------------------------------- int the_main(int argc, char **argv) -{ +{ eoParser parser(argc, argv); eoValueParam parentSizeParam(10, "parentSize", "Parent size",'P'); parser.processParam( parentSizeParam ); @@ -73,13 +73,13 @@ int the_main(int argc, char **argv) if (parser.userNeedsHelp()) { - parser.printHelp(std::cout); - exit(1); + parser.printHelp(std::cout); + exit(1); } unsigned i; - std::cout << "Testing the replacements\nParents SIze = " << pSize + std::cout << "Testing the replacements\nParents SIze = " << pSize << " and offspring size = " << oSize << std::endl; rng.reseed(42); @@ -213,11 +213,11 @@ int main(int argc, char **argv) { try { - the_main(argc, argv); + the_main(argc, argv); } catch(std::exception& e) { - std::cout << "Exception: " << e.what() << std::endl; + std::cout << "Exception: " << e.what() << std::endl; } } diff --git a/eo/test/t-eoRingTopology.cpp b/eo/test/t-eoRingTopology.cpp index e7d7488d..de2824c2 100644 --- a/eo/test/t-eoRingTopology.cpp +++ b/eo/test/t-eoRingTopology.cpp @@ -19,15 +19,15 @@ double f (const Indi & _indi) int main_function(int argc, char **argv) { //Parameters - const unsigned int VEC_SIZE = 2; - const unsigned int POP_SIZE = 10; - const unsigned int NEIGHBORHOOD_SIZE= 3; + const unsigned int VEC_SIZE = 2; + const unsigned int POP_SIZE = 10; + const unsigned int NEIGHBORHOOD_SIZE= 3; rng.reseed (33); eoEvalFuncPtr plainEval(f); eoEvalFuncCounter < Indi > eval (plainEval); eoUniformGenerator < double >uGen (0., 5.); - eoInitFixedLength < Indi > random (VEC_SIZE, uGen); + eoInitFixedLength < Indi > random (VEC_SIZE, uGen); eoUniformGenerator < double >sGen (-1., 1.); eoVelocityInitFixedLength < Indi > veloRandom (VEC_SIZE, sGen); eoFirstIsBestInit < Indi > localInit; @@ -57,11 +57,11 @@ int main(int argc, char **argv) { try { - main_function(argc, argv); + main_function(argc, argv); } catch(std::exception& e) { - std::cout << "Exception: " << e.what() << " in t-eoRingTopology" << std::endl; + std::cout << "Exception: " << e.what() << " in t-eoRingTopology" << std::endl; } } diff --git a/eo/test/t-eoRoulette.cpp b/eo/test/t-eoRoulette.cpp index 5c350122..d6f63b8a 100644 --- a/eo/test/t-eoRoulette.cpp +++ b/eo/test/t-eoRoulette.cpp @@ -1,4 +1,3 @@ - #include #include #include @@ -29,22 +28,22 @@ int test_select() } Select select; - + unsigned ndraws = 10000; - + for (unsigned i = 0; i < ndraws; ++i) { const TestEO& eo = select(pop); - + counts[eo.index]++; } cout << "Threshold = " << 1./sqrt(double(ndraws)) << endl; - + for (unsigned i = 0; i < 4; ++i) { cout << counts[i]/ndraws << ' '; - + double c = counts[i]/ndraws; if (fabs(c - probs[i]) > 1./sqrt((double)ndraws)) { @@ -52,7 +51,7 @@ int test_select() return 1; } } - + cout << endl; return 0; } @@ -62,7 +61,6 @@ int main() rng.reseed(44); if (test_select >()) return 1; - + return test_select >(); } - diff --git a/eo/test/t-eoSecondsElapsedContinue.cpp b/eo/test/t-eoSecondsElapsedContinue.cpp index e6e59a61..d6124c22 100644 --- a/eo/test/t-eoSecondsElapsedContinue.cpp +++ b/eo/test/t-eoSecondsElapsedContinue.cpp @@ -1,4 +1,3 @@ - #ifdef HAVE_CONFIG_H #include #endif @@ -29,5 +28,3 @@ int main() { return 0; } - - diff --git a/eo/test/t-eoSelect.cpp b/eo/test/t-eoSelect.cpp index d62e5ade..23d76c48 100644 --- a/eo/test/t-eoSelect.cpp +++ b/eo/test/t-eoSelect.cpp @@ -121,8 +121,8 @@ eoValueParam tournamentSizeParam = parser.createParam(unsigned(2), "to if (parser.userNeedsHelp()) { - parser.printHelp(std::cout); - exit(0); + parser.printHelp(std::cout); + exit(0); } // hard-coded directory name ... @@ -155,7 +155,7 @@ eoValueParam tournamentSizeParam = parser.createParam(unsigned(2), "to // random seed eoValueParam& seedParam = parser.createParam(uint32_t(0), "seed", - "Random number seed", 'S'); + "Random number seed", 'S'); if (seedParam.value() == 0) seedParam.value() = time(0); rng.reseed(seedParam.value()); @@ -212,11 +212,11 @@ int main(int argc, char **argv) { try { - the_main(argc, argv); + the_main(argc, argv); } catch(std::exception& e) { - std::cout << "Exception: " << e.what() << std::endl; - return 1; + std::cout << "Exception: " << e.what() << std::endl; + return 1; } } diff --git a/eo/test/t-eoSharing.cpp b/eo/test/t-eoSharing.cpp index a68820be..86721b09 100644 --- a/eo/test/t-eoSharing.cpp +++ b/eo/test/t-eoSharing.cpp @@ -230,11 +230,11 @@ int main(int argc, char **argv) { try { - the_main(argc, argv); + the_main(argc, argv); } catch(std::exception& e) { - std::cout << "Exception: " << e.what() << std::endl; - return 1; + std::cout << "Exception: " << e.what() << std::endl; + return 1; } } diff --git a/eo/test/t-eoShiftMutation.cpp b/eo/test/t-eoShiftMutation.cpp index afc27749..15c4e6b9 100644 --- a/eo/test/t-eoShiftMutation.cpp +++ b/eo/test/t-eoShiftMutation.cpp @@ -47,13 +47,13 @@ int main() // a chromosome randomizer eoInitPermutation random(CHROM_SIZE); - - // the population: + + // the population: eoPop pop; - + // Evaluation eoEvalFuncPtr eval( real_value ); - + for (i = 0; i < POP_SIZE; ++i) { Chrom chrom(CHROM_SIZE); @@ -61,10 +61,10 @@ int main() eval(chrom); pop.push_back(chrom); } - + // a shift mutation eoShiftMutation shift; - + for (i = 0; i < POP_SIZE; ++i) { std::cout << " Initial chromosome n°" << i << " : " << pop[i] << "..." << std::endl; @@ -72,7 +72,7 @@ int main() std::cout << " ... becomes : " << pop[i] << " after shift mutation" << std::endl; check_permutation(pop[i]); } - + return 0; } diff --git a/eo/test/t-eoStateAndParser.cpp b/eo/test/t-eoStateAndParser.cpp index 80551279..a851cb59 100644 --- a/eo/test/t-eoStateAndParser.cpp +++ b/eo/test/t-eoStateAndParser.cpp @@ -89,22 +89,22 @@ int the_main(int argc, char **argv) if (parser.userNeedsHelp()) { - parser.printHelp(std::cout); - return 0; + parser.printHelp(std::cout); + return 0; } // Either load or initialize if (load_name.value() != "") { - state.load(load_name.value()); // load the rest + state.load(load_name.value()); // load the rest } else { - // else + // else - // initialize rng and population + // initialize rng and population - rng.reseed(seed.value()); + rng.reseed(seed.value()); } // run the algorithm @@ -112,13 +112,13 @@ int the_main(int argc, char **argv) // Save when needed if (save_name.value() != "") { - std::string file_name = save_name.value(); - save_name.value() = ""; // so that it does not appear in the parser section of the state file - state.save(file_name); + std::string file_name = save_name.value(); + save_name.value() = ""; // so that it does not appear in the parser section of the state file + state.save(file_name); } for (int i = 0; i < 100; ++i) - rng.rand(); + rng.rand(); std::cout << "a random number is " << rng.random(1024) << std::endl;; @@ -129,11 +129,11 @@ int main(int argc, char **argv) { try { - the_main(argc, argv); + the_main(argc, argv); } catch(std::exception& e) { - std::cout << "Exception: " << e.what() << std::endl; + std::cout << "Exception: " << e.what() << std::endl; } } diff --git a/eo/test/t-eoSwapMutation.cpp b/eo/test/t-eoSwapMutation.cpp index f2c33789..3099d707 100644 --- a/eo/test/t-eoSwapMutation.cpp +++ b/eo/test/t-eoSwapMutation.cpp @@ -48,13 +48,13 @@ int main() // a chromosome randomizer eoInitPermutation random(CHROM_SIZE); - - // the population: + + // the population: eoPop pop; - + // Evaluation eoEvalFuncPtr eval( real_value ); - + for (i = 0; i < POP_SIZE; ++i) { Chrom chrom(CHROM_SIZE); @@ -62,11 +62,11 @@ int main() eval(chrom); pop.push_back(chrom); } - - + + // a swap mutation eoSwapMutation swap; - + for (i = 0; i < POP_SIZE; ++i) { std::cout << " Initial chromosome n°" << i << " : " << pop[i] << "..." << std::endl; @@ -74,7 +74,7 @@ int main() std::cout << " ... becomes : " << pop[i] << " after swap mutation" << std::endl; check_permutation(pop[i]); } - + return 0; } diff --git a/eo/test/t-eoSymreg.cpp b/eo/test/t-eoSymreg.cpp index f9aebd06..d332789b 100644 --- a/eo/test/t-eoSymreg.cpp +++ b/eo/test/t-eoSymreg.cpp @@ -23,57 +23,57 @@ public : // arity function, need this function! int arity() const { return op == X? 0 : 2; } - void randomize() {} + void randomize() {} // evaluation function, single case, using first argument to give value of variable template void operator()(double& result, Children args, double var) const { - double r1(0.), r2(0.); - if (arity() == 2) - { - args[0].apply(r1, var); - args[1].apply(r2, var); - } - switch (op) - { - case Plus : result = r1 + r2; break; - case Min : result = r1 - r2; break; - case Mult : result = r1 * r2; break; - case PDiv : { - if (r2 == 0.0) - // protection a la Koza, realistic implementations - // should maybe throw an exception - result = 1.0; - else - result = r1 / r2; - break; - } - case X : result = var; break; - } + double r1(0.), r2(0.); + if (arity() == 2) + { + args[0].apply(r1, var); + args[1].apply(r2, var); + } + switch (op) + { + case Plus : result = r1 + r2; break; + case Min : result = r1 - r2; break; + case Mult : result = r1 * r2; break; + case PDiv : { + if (r2 == 0.0) + // protection a la Koza, realistic implementations + // should maybe throw an exception + result = 1.0; + else + result = r1 / r2; + break; + } + case X : result = var; break; + } } /// 'Pretty' print to ostream function template - void operator()(string& result, Children args) const + void operator()(string& result, Children args) const { - static const string lb = "("; - static const string rb = ")"; - char opStr[4] = " "; - opStr[1] = op; + static const string lb = "("; + static const string rb = ")"; + char opStr[4] = " "; + opStr[1] = op; if (arity() == 0) { - result = "x"; - return; - } - // else - string r1; - args[0].apply(r1); - result = lb + r1; - result += opStr; - args[1].apply(r1); - result += r1 + rb; + result = "x"; + return; + } + // else + string r1; + args[0].apply(r1); + result = lb + r1; + result += opStr; + args[1].apply(r1); + result += r1 + rb; } Operator getOp() const { return op; } @@ -99,7 +99,7 @@ static SymregNode init_sequence[5] = {SymregNode::X, SymregNode::Plus, SymregNod // template <> // bool lt_arity(const SymregNode &node1, const SymregNode &node2) // { -// return (node1.arity() < node2.arity()); +// return (node1.arity() < node2.arity()); // } // #endif @@ -166,16 +166,16 @@ public : vector outputs; outputs.resize(inputs.size()); - double fitness = 0.0; + double fitness = 0.0; for (unsigned i = 0; i < inputs.size(); ++i) - { + { _eo.apply(outputs[i], inputs[i]); - fitness += (outputs[i] - target[i]) * (outputs[i] - target[i]); - } + fitness += (outputs[i] - target[i]) * (outputs[i] - target[i]); + } - fitness /= (double) target.size(); - fitness = sqrt(fitness); + fitness /= (double) target.size(); + fitness = sqrt(fitness); if (fitness > 1e+20) fitness = 1e+20; @@ -197,11 +197,11 @@ void print_best(eoPop& pop) for (unsigned i = 1; i < pop.size(); ++i) { - if (best < pop[i].fitness()) - { - best = pop[i].fitness(); - index = i; - } + if (best < pop[i].fitness()) + { + best = pop[i].fitness(); + index = i; + } } std::cout << "\t"; diff --git a/eo/test/t-eoSyncEasyPSO.cpp b/eo/test/t-eoSyncEasyPSO.cpp index f9acba24..68d9838b 100644 --- a/eo/test/t-eoSyncEasyPSO.cpp +++ b/eo/test/t-eoSyncEasyPSO.cpp @@ -19,7 +19,7 @@ double real_value (const Particle & _particle) { double sum = 0; for (unsigned i = 0; i < _particle.size ()-1; i++) - sum += pow(_particle[i],2); + sum += pow(_particle[i],2); return (sum); } @@ -50,15 +50,15 @@ int main() // perform position initialization pop.append (POP_SIZE, random); - + // topology eoLinearTopology topology(NEIGHBORHOOD_SIZE); // the full initializer eoInitializer init(eval,veloRandom,localInit,topology,pop); init(); - - + + // bounds eoRealVectorBounds bnds(VEC_SIZE,-1.5,1.5); @@ -71,32 +71,32 @@ int main() // Terminators eoGenContinue genCont1 (50); eoGenContinue genCont2 (50); - + // PS flight eoSyncEasyPSO pso1(genCont1, eval, velocity, flight); eoSyncEasyPSO pso2(init,genCont2, eval, velocity, flight); - + // flight try { - pso1(pop); - std::cout << "FINAL POPULATION AFTER SYNC PSO n°1:" << std::endl; + pso1(pop); + std::cout << "FINAL POPULATION AFTER SYNC PSO n°1:" << std::endl; for (i = 0; i < pop.size(); ++i) - std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl; - - pso2(pop); - std::cout << "FINAL POPULATION AFTER SYNC PSO n°2:" << std::endl; + std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl; + + pso2(pop); + std::cout << "FINAL POPULATION AFTER SYNC PSO n°2:" << std::endl; for (i = 0; i < pop.size(); ++i) - std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl; + std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl; } catch (std::exception& e) { - std::cout << "exception: " << e.what() << std::endl;; - exit(EXIT_FAILURE); + std::cout << "exception: " << e.what() << std::endl;; + exit(EXIT_FAILURE); } - + return 0; } diff --git a/eo/test/t-eoTwoOptMutation.cpp b/eo/test/t-eoTwoOptMutation.cpp index 95e713a6..60ef89a1 100644 --- a/eo/test/t-eoTwoOptMutation.cpp +++ b/eo/test/t-eoTwoOptMutation.cpp @@ -48,13 +48,13 @@ int main() // a chromosome randomizer eoInitPermutation random(CHROM_SIZE); - - // the population: + + // the population: eoPop pop; - + // Evaluation eoEvalFuncPtr eval( real_value ); - + for (i = 0; i < POP_SIZE; ++i) { Chrom chrom(CHROM_SIZE); @@ -62,10 +62,10 @@ int main() eval(chrom); pop.push_back(chrom); } - + // a twoOpt mutation eoTwoOptMutation twoOpt; - + for (i = 0; i < POP_SIZE; ++i) { std::cout << " Initial chromosome n°" << i << " : " << pop[i] << "..." << std::endl; @@ -73,7 +73,7 @@ int main() std::cout << " ... becomes : " << pop[i] << " after twoOpt mutation" << std::endl; check_permutation(pop[i]); } - + return 0; } diff --git a/eo/test/t-eoUniform.cpp b/eo/test/t-eoUniform.cpp index 04c23e5c..c4f188d4 100644 --- a/eo/test/t-eoUniform.cpp +++ b/eo/test/t-eoUniform.cpp @@ -16,7 +16,7 @@ main() { for ( unsigned i = 0; i < 100; i ++) { std::cout << u1() << "\t" << u2() << "\t" << u3() << std::endl; } - + } //----------------------------------------------------------------------------- diff --git a/eo/test/t-eoVirus.cpp b/eo/test/t-eoVirus.cpp index 347a7896..8ecdf207 100644 --- a/eo/test/t-eoVirus.cpp +++ b/eo/test/t-eoVirus.cpp @@ -67,11 +67,10 @@ int main() // Chrom Transmision std::cout << "Chrom transmission--------" << std::endl; - VirusTransmission vt; + VirusTransmission vt; vt( chrom2, chrom ); std::cout << chrom2 << std::endl; return 0; } - diff --git a/eo/test/t-eobin.cpp b/eo/test/t-eobin.cpp index 7c27e001..d857dd82 100644 --- a/eo/test/t-eobin.cpp +++ b/eo/test/t-eobin.cpp @@ -208,11 +208,11 @@ int main() try { - main_function(); + main_function(); } catch(std::exception& e) { - std::cout << "Exception: " << e.what() << '\n'; + std::cout << "Exception: " << e.what() << '\n'; } } diff --git a/eo/test/t-eofitness.cpp b/eo/test/t-eofitness.cpp index 1999e9fd..1cc55e65 100644 --- a/eo/test/t-eofitness.cpp +++ b/eo/test/t-eofitness.cpp @@ -18,11 +18,11 @@ int test_fitness(Fitness a, Fitness b) { // srand(time(0)); -// Fitness a = aval; //static_cast(rand()) / RAND_MAX; +// Fitness a = aval; //static_cast(rand()) / RAND_MAX; // Fitness b = bval; //static_cast(rand()) / RAND_MAX; std::cout.precision(2); - + unsigned repeat = 2; while (repeat--) { @@ -32,25 +32,25 @@ int test_fitness(Fitness a, Fitness b) std::cout << a << " < " << b << " is true" << std::endl; else std::cout << a << " < " << b << " is false" < "; if (a > b) std::cout << a << " > " << b << " is true" << std::endl; else std::cout << a << " > " << b << " is false" < 0 else 1 - iters = ( nonzero( P - p ) / ps ) * ( nonzero( D - d ) / ds ) - pylab.xlabel('%d iterations from %d,%d to %d,%d' % ( iters, p, d, P, D) ) - pylab.ylabel('%s - %s' % (cur, name)) - pylab.savefig( filename + '.pdf', format='pdf' ) - pylab.savefig( filename + '.png', format='png' ) - pylab.cla() - pylab.clf() + def generate( filenames ): + for cur in filenames: + filename = RESULT_FILE_FORMAT % (pwd, cur, p, ps, P, d, ds, D, r, s) + pylab.boxplot( get_boxplot_data( filename ) ) + nonzero = lambda x: x if x > 0 else 1 + iters = ( nonzero( P - p ) / ps ) * ( nonzero( D - d ) / ds ) + pylab.xlabel('%d iterations from %d,%d to %d,%d' % ( iters, p, d, P, D) ) + pylab.ylabel('%s - %s' % (cur, name)) + pylab.savefig( filename + '.pdf', format='pdf' ) + pylab.savefig( filename + '.png', format='png' ) + pylab.cla() + pylab.clf() - if not options.onlyVarTime: - generate( ['speedup', 'efficiency', 'dynamicity'] ) - if not options.onlyConstTime: - generate( ['variable_speedup', 'variable_efficiency', 'variable_dynamicity'] ) + if not options.onlyVarTime: + generate( ['speedup', 'efficiency', 'dynamicity'] ) + if not options.onlyConstTime: + generate( ['variable_speedup', 'variable_efficiency', 'variable_dynamicity'] ) def main(): if not options.onlyprint: - logging.info('creates first the new topic repository %s', options.topic) - os.mkdir( options.topic ) + logging.info('creates first the new topic repository %s', options.topic) + os.mkdir( options.topic ) logging.info('do all tests with r = %d and a common seed value = %d' % (options.nRun, options.seed)) @@ -133,24 +133,24 @@ def main(): F = options.fixedBound if options.measure is None or 1 in options.measure: - logging.info('(1) measure for all combinaisons of P n D') - do_measure( '1', 1*n, 10*n, 101*n, 1*n, 10*n, 101*n ) + logging.info('(1) measure for all combinaisons of P n D') + do_measure( '1', 1*n, 10*n, 101*n, 1*n, 10*n, 101*n ) if options.measure is None or 2 in options.measure: - logging.info('(2) measure for P \in [%d, %d[ with D fixed to %d' % (1*n, 101*n, F)) - do_measure( '2', 1*n, 1*n, 101*n, F, 1, F ) + logging.info('(2) measure for P \in [%d, %d[ with D fixed to %d' % (1*n, 101*n, F)) + do_measure( '2', 1*n, 1*n, 101*n, F, 1, F ) if options.measure is None or 3 in options.measure: - logging.info('(3) measure for P \in [%d, %d[ with ps = %d and D fixed to %d' % (1*n, 1001*n, 10*n, F)) - do_measure( '3', 1*n, 10*n, 1001*n, F, 1, F ) + logging.info('(3) measure for P \in [%d, %d[ with ps = %d and D fixed to %d' % (1*n, 1001*n, 10*n, F)) + do_measure( '3', 1*n, 10*n, 1001*n, F, 1, F ) if options.measure is None or 4 in options.measure: - logging.info('(4) measure for D \in [%d, %d[ with P fixed to %d' % (1*n, 101*n, F)) - do_measure( '4', F, 1, F, 1*n, 1*n, 101*n ) + logging.info('(4) measure for D \in [%d, %d[ with P fixed to %d' % (1*n, 101*n, F)) + do_measure( '4', F, 1, F, 1*n, 1*n, 101*n ) if options.measure is None or 5 in options.measure: - logging.info('(5) measure for D \in [%d, %d[ with ds = %d and P fixed to %d' % (1*n, 1001*n, 10*n, F)) - do_measure( '5', F, 1, F, 1*n, 10*n, 1001*n ) + logging.info('(5) measure for D \in [%d, %d[ with ds = %d and P fixed to %d' % (1*n, 1001*n, 10*n, F)) + do_measure( '5', F, 1, F, 1*n, 10*n, 1001*n ) # when executed, just run main(): if __name__ == '__main__': diff --git a/eo/test/t-selectOne.cpp b/eo/test/t-selectOne.cpp index e401188e..0647d5d2 100644 --- a/eo/test/t-selectOne.cpp +++ b/eo/test/t-selectOne.cpp @@ -3,8 +3,8 @@ //----------------------------------------------------------------------------- // t-selectOne.cpp // This program test the breeder object -// (c) GeNeura Team, 1998 -/* +// (c) GeNeura Team, 1998 +/* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact: todos@geneura.ugr.es, http://geneura.ugr.es - + */ //----------------------------------------------------------------------------- @@ -52,7 +52,7 @@ main() unsigned i; eoBinRandom random; - eoPop pop; + eoPop pop; // Create the population for (i = 0; i < POP_SIZE; ++i) { @@ -61,7 +61,7 @@ main() BinaryValue()(chrom); pop.push_back(chrom); } - + // print population std::cout << "population:" << std::endl; for (i = 0; i < pop.size(); ++i) diff --git a/eo/tutorial/Lesson1/CMakeLists.txt b/eo/tutorial/Lesson1/CMakeLists.txt index 614b8421..72862e03 100644 --- a/eo/tutorial/Lesson1/CMakeLists.txt +++ b/eo/tutorial/Lesson1/CMakeLists.txt @@ -10,23 +10,23 @@ INCLUDE_DIRECTORIES(${EO_SOURCE_DIR}/src/utils) ### 2) Specify where CMake can find the libraries ###################################################################################### -IF(NOT WIN32 OR CYGWIN) +IF(NOT WIN32 OR CYGWIN) LINK_DIRECTORIES(${EO_BINARY_DIR}/lib) ENDIF(NOT WIN32 OR CYGWIN) # especially for Visual Studio -IF(WIN32 AND NOT CYGWIN) +IF(WIN32 AND NOT CYGWIN) LINK_DIRECTORIES(${EO_BINARY_DIR}\\lib\\${CMAKE_BUILD_TYPE}) -ENDIF(WIN32 AND NOT CYGWIN) +ENDIF(WIN32 AND NOT CYGWIN) ###################################################################################### ### 3) Define your targets ###################################################################################### # no matter what is the OS, hopefully -ADD_EXECUTABLE(FirstBitGA FirstBitGA.cpp) -ADD_EXECUTABLE(FirstRealGA FirstRealGA.cpp) -ADD_EXECUTABLE(exercise1.3 exercise1.3.cpp) +ADD_EXECUTABLE(FirstBitGA FirstBitGA.cpp) +ADD_EXECUTABLE(FirstRealGA FirstRealGA.cpp) +ADD_EXECUTABLE(exercise1.3 exercise1.3.cpp) ADD_DEPENDENCIES(FirstBitGA ga eo eoutils) ADD_DEPENDENCIES(FirstRealGA ga eo eoutils) diff --git a/eo/tutorial/Lesson1/FirstBitGA.cpp b/eo/tutorial/Lesson1/FirstBitGA.cpp index ac53607a..cc187a81 100644 --- a/eo/tutorial/Lesson1/FirstBitGA.cpp +++ b/eo/tutorial/Lesson1/FirstBitGA.cpp @@ -78,10 +78,10 @@ void main_function(int argc, char **argv) { Indi v; // void individual, to be filled for (unsigned ivar=0; ivar gga(select, xover, CROSS_RATE, mutation, MUT_RATE, - eval, continuator); + eval, continuator); // Apply algo to pop - that's it! gga(pop); @@ -156,11 +156,11 @@ int main(int argc, char **argv) try { - main_function(argc, argv); + main_function(argc, argv); } catch(exception& e) { - cout << "Exception: " << e.what() << '\n'; + cout << "Exception: " << e.what() << '\n'; } return 1; diff --git a/eo/tutorial/Lesson1/FirstRealGA.cpp b/eo/tutorial/Lesson1/FirstRealGA.cpp index 09db59e6..074c5ae8 100644 --- a/eo/tutorial/Lesson1/FirstRealGA.cpp +++ b/eo/tutorial/Lesson1/FirstRealGA.cpp @@ -78,10 +78,10 @@ void main_function(int argc, char **argv) { Indi v; // void individual, to be filled for (unsigned ivar=0; ivar gga(select, xover, CROSS_RATE, mutation, MUT_RATE, - eval, continuator); + eval, continuator); // Apply algo to pop - that's it! gga(pop); @@ -151,11 +151,11 @@ int main(int argc, char **argv) { try { - main_function(argc, argv); + main_function(argc, argv); } catch(exception& e) { - cout << "Exception: " << e.what() << '\n'; + cout << "Exception: " << e.what() << '\n'; } return 1; diff --git a/eo/tutorial/Lesson1/Makefile.simple b/eo/tutorial/Lesson1/Makefile.simple index 093ca852..cca13043 100644 --- a/eo/tutorial/Lesson1/Makefile.simple +++ b/eo/tutorial/Lesson1/Makefile.simple @@ -5,11 +5,11 @@ DIR_EO = ../../src .SUFFIXES: .cpp # Warning: $(CXX) in Linux (RedHat and Mandrake at least) is g++ -# However, if you are using this Makefile within xemacs, +# However, if you are using this Makefile within xemacs, # and have problems with the interpretation of the output (and its colors) # then you should use c++ instead (make CXX=c++ will do) -.cpp: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -pg -o $@ $*.cpp $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a +.cpp: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -pg -o $@ $*.cpp $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a .cpp.o: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -c -pg $*.cpp @@ -21,5 +21,5 @@ lesson1 : $(firstGA) all : $(ALL) -clean : +clean : @/bin/rm $(ALL) *.o *~ diff --git a/eo/tutorial/Lesson1/exercise1.3.cpp b/eo/tutorial/Lesson1/exercise1.3.cpp index abd62a0b..89965d51 100644 --- a/eo/tutorial/Lesson1/exercise1.3.cpp +++ b/eo/tutorial/Lesson1/exercise1.3.cpp @@ -18,7 +18,7 @@ //----------------------------------------------------------------------------- // Include the corresponding file -#include // bitstring representation & operators +#include // bitstring representation & operators // define your individuals typedef eoBit Indi; // A bitstring with fitness double @@ -151,11 +151,11 @@ int main(int argc, char **argv) try { - main_function(argc, argv); + main_function(argc, argv); } catch(exception& e) { - cout << "Exception: " << e.what() << '\n'; + cout << "Exception: " << e.what() << '\n'; } return 1; diff --git a/eo/tutorial/Lesson2/CMakeLists.txt b/eo/tutorial/Lesson2/CMakeLists.txt index db3e0e98..23669155 100644 --- a/eo/tutorial/Lesson2/CMakeLists.txt +++ b/eo/tutorial/Lesson2/CMakeLists.txt @@ -10,23 +10,23 @@ INCLUDE_DIRECTORIES(${EO_SOURCE_DIR}/src/utils) ### 2) Specify where CMake can find the libraries ###################################################################################### -IF(NOT WIN32 OR CYGWIN) +IF(NOT WIN32 OR CYGWIN) LINK_DIRECTORIES(${EO_BINARY_DIR}/lib) ENDIF(NOT WIN32 OR CYGWIN) # especially for Visual Studio -IF(WIN32 AND NOT CYGWIN) +IF(WIN32 AND NOT CYGWIN) LINK_DIRECTORIES(${EO_BINARY_DIR}\\lib\\${CMAKE_BUILD_TYPE}) -ENDIF(WIN32 AND NOT CYGWIN) +ENDIF(WIN32 AND NOT CYGWIN) ###################################################################################### ### 3) Define your targets ###################################################################################### # no matter what is the OS, hopefully -ADD_EXECUTABLE(FirstBitEA FirstBitEA.cpp) -ADD_EXECUTABLE(FirstRealEA FirstRealEA.cpp) -ADD_EXECUTABLE(exercise2.3 exercise2.3.cpp) +ADD_EXECUTABLE(FirstBitEA FirstBitEA.cpp) +ADD_EXECUTABLE(FirstRealEA FirstRealEA.cpp) +ADD_EXECUTABLE(exercise2.3 exercise2.3.cpp) ###################################################################################### ### 4) Optionnal diff --git a/eo/tutorial/Lesson2/FirstBitEA.cpp b/eo/tutorial/Lesson2/FirstBitEA.cpp index 13da7895..fd508a55 100644 --- a/eo/tutorial/Lesson2/FirstBitEA.cpp +++ b/eo/tutorial/Lesson2/FirstBitEA.cpp @@ -182,11 +182,11 @@ int main(int argc, char **argv) try { - main_function(argc, argv); + main_function(argc, argv); } catch(exception& e) { - cout << "Exception: " << e.what() << '\n'; + cout << "Exception: " << e.what() << '\n'; } return 1; diff --git a/eo/tutorial/Lesson2/FirstRealEA.cpp b/eo/tutorial/Lesson2/FirstRealEA.cpp index 8901c381..6c259b3b 100644 --- a/eo/tutorial/Lesson2/FirstRealEA.cpp +++ b/eo/tutorial/Lesson2/FirstRealEA.cpp @@ -52,7 +52,7 @@ void main_function(int argc, char **argv) const float P_MUT = 0.5; // mutation probability const double EPSILON = 0.01; // range for real uniform mutation - double SIGMA = 0.3; // std dev. for normal mutation + double SIGMA = 0.3; // std dev. for normal mutation // some parameters for chosing among different operators const double hypercubeRate = 0.5; // relative weight for hypercube Xover const double segmentRate = 0.5; // relative weight for segment Xover @@ -181,11 +181,11 @@ int main(int argc, char **argv) { try { - main_function(argc, argv); + main_function(argc, argv); } catch(exception& e) { - cout << "Exception: " << e.what() << '\n'; + cout << "Exception: " << e.what() << '\n'; } return 1; diff --git a/eo/tutorial/Lesson2/Makefile.simple b/eo/tutorial/Lesson2/Makefile.simple index 1aec1710..d5cba225 100644 --- a/eo/tutorial/Lesson2/Makefile.simple +++ b/eo/tutorial/Lesson2/Makefile.simple @@ -1,5 +1,5 @@ ### This Makefile is part of the tutorial of the EO library -# Unlike other Makefiles in EO, it is not using the automake/autoconf +# Unlike other Makefiles in EO, it is not using the automake/autoconf # so that it stays easy to understant (you are in the tutorial, remember!) # MS, Oct. 2002 @@ -10,11 +10,11 @@ DIR_EO = ../../src .SUFFIXES: .cpp # Warning: $(CXX) in Linux (RedHat and Mandrake at least) is g++ -# However, if you are using this Makefile within xemacs, +# However, if you are using this Makefile within xemacs, # and have problems with the interpretation of the output (and its colors) # then you should use c++ instead (make CXX=c++ will do) -.cpp: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -pg -o $@ $*.cpp $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a +.cpp: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -pg -o $@ $*.cpp $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a .cpp.o: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -c -pg $*.cpp @@ -26,7 +26,7 @@ lesson2 : $(firstEA) all : $(ALL) -clean : +clean : @/bin/rm $(ALL) *.o *~ FirstRealEA : real_value.h diff --git a/eo/tutorial/Lesson2/binary_value.h b/eo/tutorial/Lesson2/binary_value.h index f2f5d6ca..66d2823e 100644 --- a/eo/tutorial/Lesson2/binary_value.h +++ b/eo/tutorial/Lesson2/binary_value.h @@ -4,7 +4,7 @@ /** Just a simple function that takes binary value of a chromosome and sets the fitnes. - @param _chrom A binary chromosome + @param _chrom A binary chromosome */ // INIT double binary_value(const std::vector& _chrom) @@ -14,4 +14,3 @@ double binary_value(const std::vector& _chrom) sum += _chrom[i]; return sum; } - diff --git a/eo/tutorial/Lesson2/exercise2.3.cpp b/eo/tutorial/Lesson2/exercise2.3.cpp index dc39e5d9..c1b51aa0 100644 --- a/eo/tutorial/Lesson2/exercise2.3.cpp +++ b/eo/tutorial/Lesson2/exercise2.3.cpp @@ -20,7 +20,7 @@ // REPRESENTATION //----------------------------------------------------------------------------- // Include the corresponding file -#include // bitstring representation & operators +#include // bitstring representation & operators // define your individuals typedef eoBit Indi; // A bitstring with fitness double @@ -186,11 +186,11 @@ int main(int argc, char **argv) { try { - main_function(argc, argv); + main_function(argc, argv); } catch(exception& e) { - cout << "Exception: " << e.what() << '\n'; + cout << "Exception: " << e.what() << '\n'; } return 1; diff --git a/eo/tutorial/Lesson2/real_value.h b/eo/tutorial/Lesson2/real_value.h index cc32e633..866e2941 100644 --- a/eo/tutorial/Lesson2/real_value.h +++ b/eo/tutorial/Lesson2/real_value.h @@ -1,8 +1,8 @@ #include //----------------------------------------------------------------------------- -/** Just a simple function that takes an vector and sets the fitnes +/** Just a simple function that takes an vector and sets the fitnes to the sphere function. Please use doubles not float!!! - @param _ind A floatingpoint vector + @param _ind A floatingpoint vector */ // INIT @@ -15,6 +15,3 @@ double real_value(const std::vector& _ind) } return -sum; } - - - diff --git a/eo/tutorial/Lesson3/CMakeLists.txt b/eo/tutorial/Lesson3/CMakeLists.txt index b3e7c0a7..a59f4a63 100644 --- a/eo/tutorial/Lesson3/CMakeLists.txt +++ b/eo/tutorial/Lesson3/CMakeLists.txt @@ -10,23 +10,23 @@ INCLUDE_DIRECTORIES(${EO_SOURCE_DIR}/src/utils) ### 2) Specify where CMake can find the libraries ###################################################################################### -IF(NOT WIN32 OR CYGWIN) +IF(NOT WIN32 OR CYGWIN) LINK_DIRECTORIES(${EO_BINARY_DIR}/lib) ENDIF(NOT WIN32 OR CYGWIN) # especially for Visual Studio -IF(WIN32 AND NOT CYGWIN) +IF(WIN32 AND NOT CYGWIN) LINK_DIRECTORIES(${EO_BINARY_DIR}\\lib\\${CMAKE_BUILD_TYPE}) -ENDIF(WIN32 AND NOT CYGWIN) +ENDIF(WIN32 AND NOT CYGWIN) ###################################################################################### ### 3) Define your targets ###################################################################################### # no matter what is the OS, hopefully -ADD_EXECUTABLE(SecondBitEA SecondBitEA.cpp) -ADD_EXECUTABLE(SecondRealEA SecondRealEA.cpp) -ADD_EXECUTABLE(exercise3.1 exercise3.1.cpp) +ADD_EXECUTABLE(SecondBitEA SecondBitEA.cpp) +ADD_EXECUTABLE(SecondRealEA SecondRealEA.cpp) +ADD_EXECUTABLE(exercise3.1 exercise3.1.cpp) ADD_DEPENDENCIES(SecondBitEA ga eoutils eo) ADD_DEPENDENCIES(SecondRealEA ga eoutils eo) @@ -62,4 +62,3 @@ INSTALL(TARGETS SecondRealEA RUNTIME DESTINATION share/eo/examples/Lesson3 COMPO INSTALL(TARGETS exercise3.1 RUNTIME DESTINATION share/eo/examples/Lesson3 COMPONENT examples) ###################################################################################### - diff --git a/eo/tutorial/Lesson3/Makefile.simple b/eo/tutorial/Lesson3/Makefile.simple index 186791f2..3e63424d 100644 --- a/eo/tutorial/Lesson3/Makefile.simple +++ b/eo/tutorial/Lesson3/Makefile.simple @@ -1,5 +1,5 @@ ### This Makefile is part of the tutorial of the EO library -# Unlike other Makefiles in EO, it is not using the automake/autoconf +# Unlike other Makefiles in EO, it is not using the automake/autoconf # so that it stays easy to understant (you are in the tutorial, remember!) # MS, Oct. 2002 @@ -10,11 +10,11 @@ DIR_EO = ../../src .SUFFIXES: .cpp # Warning: $(CXX) in Linux (RedHat and Mandrake at least) is g++ -# However, if you are using this Makefile within xemacs, +# However, if you are using this Makefile within xemacs, # and have problems with the interpretation of the output (and its colors) # then you should use c++ instead (make CXX=c++ will do) -.cpp: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -pg -o $@ $*.cpp $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a +.cpp: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -pg -o $@ $*.cpp $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a .cpp.o: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -c -pg $*.cpp @@ -29,5 +29,5 @@ all : $(ALL) SecondBitEA : binary_value.h SecondRealEA : real_value.h -clean : +clean : @/bin/rm $(ALL) *.o *.sav *.xg *.status *~ diff --git a/eo/tutorial/Lesson3/SecondBitEA.cpp b/eo/tutorial/Lesson3/SecondBitEA.cpp index 0507bc5c..92e18128 100644 --- a/eo/tutorial/Lesson3/SecondBitEA.cpp +++ b/eo/tutorial/Lesson3/SecondBitEA.cpp @@ -126,8 +126,8 @@ void main_function(int argc, char **argv) // i.e. in case you need parameters somewhere else, postpone these if (parser.userNeedsHelp()) { - parser.printHelp(cout); - exit(1); + parser.printHelp(cout); + exit(1); } if (statusParam.value() != "") { @@ -337,11 +337,11 @@ int main(int argc, char **argv) { try { - main_function(argc, argv); + main_function(argc, argv); } catch(exception& e) { - cout << "Exception: " << e.what() << '\n'; + cout << "Exception: " << e.what() << '\n'; } return 1; diff --git a/eo/tutorial/Lesson3/SecondRealEA.cpp b/eo/tutorial/Lesson3/SecondRealEA.cpp index 2ae69fd8..b5ca0c80 100644 --- a/eo/tutorial/Lesson3/SecondRealEA.cpp +++ b/eo/tutorial/Lesson3/SecondRealEA.cpp @@ -104,8 +104,8 @@ void main_function(int argc, char **argv) // i.e. in case you need parameters somewhere else, postpone these if (parser.userNeedsHelp()) { - parser.printHelp(cout); - exit(1); + parser.printHelp(cout); + exit(1); } if (statusName != "") { @@ -318,11 +318,11 @@ int main(int argc, char **argv) { try { - main_function(argc, argv); + main_function(argc, argv); } catch(exception& e) { - cout << "Exception: " << e.what() << '\n'; + cout << "Exception: " << e.what() << '\n'; } return 1; diff --git a/eo/tutorial/Lesson3/binary_value.h b/eo/tutorial/Lesson3/binary_value.h index f2f5d6ca..66d2823e 100644 --- a/eo/tutorial/Lesson3/binary_value.h +++ b/eo/tutorial/Lesson3/binary_value.h @@ -4,7 +4,7 @@ /** Just a simple function that takes binary value of a chromosome and sets the fitnes. - @param _chrom A binary chromosome + @param _chrom A binary chromosome */ // INIT double binary_value(const std::vector& _chrom) @@ -14,4 +14,3 @@ double binary_value(const std::vector& _chrom) sum += _chrom[i]; return sum; } - diff --git a/eo/tutorial/Lesson3/exercise3.1.cpp b/eo/tutorial/Lesson3/exercise3.1.cpp index 50531e09..f21e5930 100644 --- a/eo/tutorial/Lesson3/exercise3.1.cpp +++ b/eo/tutorial/Lesson3/exercise3.1.cpp @@ -24,7 +24,7 @@ // REPRESENTATION //----------------------------------------------------------------------------- // Include the corresponding file -#include // bitstring representation & operators +#include // bitstring representation & operators // define your genotype and fitness types typedef eoBit Indi; @@ -126,8 +126,8 @@ void main_function(int argc, char **argv) // i.e. in case you need parameters somewhere else, postpone these if (parser.userNeedsHelp()) { - parser.printHelp(cout); - exit(1); + parser.printHelp(cout); + exit(1); } if (statusParam.value() != "") { @@ -393,11 +393,11 @@ int main(int argc, char **argv) { try { - main_function(argc, argv); + main_function(argc, argv); } catch(exception& e) { - cout << "Exception: " << e.what() << '\n'; + cout << "Exception: " << e.what() << '\n'; } return 1; diff --git a/eo/tutorial/Lesson3/real_value.h b/eo/tutorial/Lesson3/real_value.h index 7fe002b6..525bf393 100644 --- a/eo/tutorial/Lesson3/real_value.h +++ b/eo/tutorial/Lesson3/real_value.h @@ -1,8 +1,8 @@ #include //----------------------------------------------------------------------------- -/** Just a simple function that takes an vector and sets the fitnes +/** Just a simple function that takes an vector and sets the fitnes to the sphere function. Please use doubles not float!!! - @param _ind A floatingpoint vector + @param _ind A floatingpoint vector */ // INIT @@ -15,6 +15,3 @@ double real_value(const std::vector& _ind) } return sum; } - - - diff --git a/eo/tutorial/Lesson4/BitEA.cpp b/eo/tutorial/Lesson4/BitEA.cpp index fd6f1fbd..97a6cc43 100644 --- a/eo/tutorial/Lesson4/BitEA.cpp +++ b/eo/tutorial/Lesson4/BitEA.cpp @@ -10,7 +10,7 @@ using namespace std; int main(int argc, char* argv[]) -{ +{ try { @@ -29,7 +29,7 @@ int main(int argc, char* argv[]) ////////////////////////////////////////////////////// // EVAL - // The evaluation fn - encapsulated into an eval counter for output + // The evaluation fn - encapsulated into an eval counter for output eoEvalFuncPtr mainEval( binary_value ); eoEvalFuncCounter eval(mainEval); @@ -38,7 +38,7 @@ int main(int argc, char* argv[]) eoInit& init = make_genotype(parser, state, EOT()); // if you want to do sharing, you'll need a distance. - // here Hamming distance + // here Hamming distance eoHammingDistance dist; // OPERATORS @@ -74,7 +74,7 @@ int main(int argc, char* argv[]) // evaluate intial population AFTER help and status in case it takes time apply(eval, pop); // STOP - // print it out (sort witout modifying) + // print it out (sort witout modifying) cout << "Initial Population\n"; pop.sortedPrintOn(cout); cout << endl; @@ -82,7 +82,7 @@ int main(int argc, char* argv[]) // GENERATION run_ea(ga, pop); // run the ga // STOP - // print it out (sort witout modifying) + // print it out (sort witout modifying) cout << "Final Population\n"; pop.sortedPrintOn(cout); cout << endl; diff --git a/eo/tutorial/Lesson4/CMakeLists.txt b/eo/tutorial/Lesson4/CMakeLists.txt index 20e0cde4..739fed1b 100644 --- a/eo/tutorial/Lesson4/CMakeLists.txt +++ b/eo/tutorial/Lesson4/CMakeLists.txt @@ -21,7 +21,7 @@ EXECUTE_PROCESS( # COMMAND ${CMAKE_COMMAND} # ARGS -E copy_if_different # ${EO_SOURCE_DIR}/tutorial/Lesson4/ESEA.param -# ${EO_BINARY_DIR}/tutorial/Lesson4) +# ${EO_BINARY_DIR}/tutorial/Lesson4) #ADD_CUSTOM_TARGET(param DEPENDS ${EO_SOURCE_DIR}/tutorial/Lesson4/RealEA.param) #ADD_CUSTOM_COMMAND( # TARGET param @@ -29,7 +29,7 @@ EXECUTE_PROCESS( # COMMAND ${CMAKE_COMMAND} # ARGS -E copy_if_different # ${EO_SOURCE_DIR}/tutorial/Lesson4/RealEA.param -# ${EO_BINARY_DIR}/tutorial/Lesson4) +# ${EO_BINARY_DIR}/tutorial/Lesson4) ###################################################################################### ### 1) Include the sources @@ -44,23 +44,23 @@ INCLUDE_DIRECTORIES(${EO_SOURCE_DIR}/src/ga) ### 2) Specify where CMake can find the libraries ###################################################################################### -IF(NOT WIN32 OR CYGWIN) +IF(NOT WIN32 OR CYGWIN) LINK_DIRECTORIES(${EO_BINARY_DIR}/lib) ENDIF(NOT WIN32 OR CYGWIN) # especially for Visual Studio -IF(WIN32 AND NOT CYGWIN) +IF(WIN32 AND NOT CYGWIN) LINK_DIRECTORIES(${EO_BINARY_DIR}\\lib\\${CMAKE_BUILD_TYPE}) -ENDIF(WIN32 AND NOT CYGWIN) +ENDIF(WIN32 AND NOT CYGWIN) ###################################################################################### ### 3) Define your targets ###################################################################################### # no matter what is the OS, hopefully -ADD_EXECUTABLE(BitEA BitEA.cpp) -ADD_EXECUTABLE(RealEA RealEA.cpp) -ADD_EXECUTABLE(ESEA ESEA.cpp) +ADD_EXECUTABLE(BitEA BitEA.cpp) +ADD_EXECUTABLE(RealEA RealEA.cpp) +ADD_EXECUTABLE(ESEA ESEA.cpp) #ADD_DEPENDENCIES(BitEA es ga eo eoutils) #ADD_DEPENDENCIES(RealEA es ga eo eoutils) @@ -96,4 +96,3 @@ INSTALL(TARGETS RealEA RUNTIME DESTINATION share/eo/examples/Lesson4 COMPONENT e INSTALL(TARGETS ESEA RUNTIME DESTINATION share/eo/examples/Lesson4 COMPONENT examples) ###################################################################################### - diff --git a/eo/tutorial/Lesson4/ESEA.cpp b/eo/tutorial/Lesson4/ESEA.cpp index 1c1bd30c..6a2b51a2 100644 --- a/eo/tutorial/Lesson4/ESEA.cpp +++ b/eo/tutorial/Lesson4/ESEA.cpp @@ -20,14 +20,14 @@ using namespace std; #include "real_value.h" // the sphere fitness -// Now the main -/////////////// +// Now the main +/////////////// typedef eoMinimizingFitness FitT; template void runAlgorithm(EOT, eoParser& _parser, eoState& _state); - -int main_function(int argc, char *argv[]) + +int main_function(int argc, char *argv[]) { // Create the command-line parser eoParser parser(argc, argv); // for user-parameter reading @@ -55,33 +55,33 @@ int main_function(int argc, char *argv[]) cout << "Using eoEsStdev" << endl; runAlgorithm(eoEsStdev(), parser, state); } - else + else { cout << "Using eoEsFull" << endl; runAlgorithm(eoEsFull(), parser, state); } - return 0; + return 0; } // A main that catches the exceptions - + int main(int argc, char **argv) { try { - main_function(argc, argv); + main_function(argc, argv); } catch(exception& e) { - cout << "Exception: " << e.what() << '\n'; + cout << "Exception: " << e.what() << '\n'; } - + return 1; } /** The templatized main (sort of) - * quite similar to the main of other genotypes + * quite similar to the main of other genotypes * (e.g. t-eoReal and t-eoGA in test dir) */ template @@ -92,9 +92,9 @@ void runAlgorithm(EOT, eoParser& _parser, eoState& _state) ///// FIRST, problem or representation dependent stuff ////////////////////////////////////////////////////// - // The evaluation fn - encapsulated into an eval counter for output - eoEvalFuncPtr&> - mainEval( real_value ); + // The evaluation fn - encapsulated into an eval counter for output + eoEvalFuncPtr&> + mainEval( real_value ); eoEvalFuncCounter eval(mainEval); // the genotype - through a genotype initializer diff --git a/eo/tutorial/Lesson4/ESEA.param b/eo/tutorial/Lesson4/ESEA.param index 06df5c73..b5dc6d01 100644 --- a/eo/tutorial/Lesson4/ESEA.param +++ b/eo/tutorial/Lesson4/ESEA.param @@ -1,4 +1,3 @@ - ###### General ###### # --help=0 # -h : Prints this message # --stopOnUnknownParam=1 # Stop if unkown param entered @@ -17,7 +16,7 @@ --weakElitism=0 # -w : Old best parent replaces new worst offspring *if necessary* ###### Genotype Initialization ###### -# --vecSize=10 # -n : The number of variables +# --vecSize=10 # -n : The number of variables # --initBounds=10[-1,1] # -B : Bounds for initialization (MUST be bounded) --sigmaInit=0.3% # -s : Initial value for Sigmas (with a '%' -> scaled by the range of each variable) diff --git a/eo/tutorial/Lesson4/Makefile.simple b/eo/tutorial/Lesson4/Makefile.simple index 75bd41dd..72c02565 100644 --- a/eo/tutorial/Lesson4/Makefile.simple +++ b/eo/tutorial/Lesson4/Makefile.simple @@ -1,5 +1,5 @@ ### This Makefile is part of the tutorial of the EO library -# Unlike other Makefiles in EO, it is not using the automake/autoconf +# Unlike other Makefiles in EO, it is not using the automake/autoconf # so that it stays easy to understant (you are in the tutorial, remember!) # MS, Oct. 2002 @@ -10,11 +10,11 @@ DIR_EO = ../../src .SUFFIXES: .cpp # Warning: $(CXX) in Linux (RedHat and Mandrake at least) is g++ -# However, if you are using this Makefile within xemacs, +# However, if you are using this Makefile within xemacs, # and have problems with the interpretation of the output (and its colors) # then you should use c++ instead (make CXX=c++ will do) -.cpp: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -o $@ $*.cpp $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a +.cpp: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -o $@ $*.cpp $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a .cpp.o: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -c $*.cpp @@ -22,12 +22,12 @@ ALL = BitEA RealEA ESEA all : $(ALL) -BitEA : BitEA.o ; - $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.2\" -Wall -g -o $@ $< $(DIR_EO)/ga/libga.a $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a +BitEA : BitEA.o ; + $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.2\" -Wall -g -o $@ $< $(DIR_EO)/ga/libga.a $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a RealEA : RealEA.o ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.2\" -Wall -g -o $@ $< $(DIR_EO)/es/libes.a $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a ESEA : ESEA.o ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.2\" -Wall -g -o $@ $< $(DIR_EO)/es/libes.a $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a -clean : +clean : @/bin/rm $(ALL) *.o *.sav *.xg *.status *~ diff --git a/eo/tutorial/Lesson4/RealEA.cpp b/eo/tutorial/Lesson4/RealEA.cpp index 8002136c..1775b12b 100644 --- a/eo/tutorial/Lesson4/RealEA.cpp +++ b/eo/tutorial/Lesson4/RealEA.cpp @@ -20,9 +20,9 @@ int main(int argc, char* argv[]) ///// FIRST, problem or representation dependent stuff ////////////////////////////////////////////////////// - // The evaluation fn - encapsulated into an eval counter for output - eoEvalFuncPtr&> - mainEval( real_value ); + // The evaluation fn - encapsulated into an eval counter for output + eoEvalFuncPtr&> + mainEval( real_value ); eoEvalFuncCounter eval(mainEval); // the genotype - through a genotype initializer diff --git a/eo/tutorial/Lesson4/RealEA.param b/eo/tutorial/Lesson4/RealEA.param index dba2db34..d1f8cfc4 100644 --- a/eo/tutorial/Lesson4/RealEA.param +++ b/eo/tutorial/Lesson4/RealEA.param @@ -1,4 +1,3 @@ - ###### General ###### # --help=0 # -h : Prints this message # --stopOnUnknownParam=1 # Stop if unkown param entered @@ -12,7 +11,7 @@ --weakElitism=0 # -w : Old best parent replaces new worst offspring *if necessary* ###### Genotype Initialization ###### -# --vecSize=10 # -n : The number of variables +# --vecSize=10 # -n : The number of variables # --initBounds=10[-1,1] # -B : Bounds for initialization (MUST be bounded) --sigmaInit=0.3% # -s : Initial value for Sigmas (with a '%' -> scaled by the range of each variable) diff --git a/eo/tutorial/Lesson4/binary_value.h b/eo/tutorial/Lesson4/binary_value.h index 188835fc..f8dd5891 100644 --- a/eo/tutorial/Lesson4/binary_value.h +++ b/eo/tutorial/Lesson4/binary_value.h @@ -4,7 +4,7 @@ /** Just a simple function that takes binary value of a chromosome and sets the fitnes. - @param _chrom A binary chromosome + @param _chrom A binary chromosome */ template double binary_value(const Chrom& _chrom) diff --git a/eo/tutorial/Lesson4/real_value.h b/eo/tutorial/Lesson4/real_value.h index 8f3a0df5..f8ef3e58 100644 --- a/eo/tutorial/Lesson4/real_value.h +++ b/eo/tutorial/Lesson4/real_value.h @@ -2,8 +2,8 @@ //----------------------------------------------------------------------------- -/** Just a simple function that takes an eoEsBase and sets the fitnes - to sphere +/** Just a simple function that takes an eoEsBase and sets the fitnes + to sphere @param _ind vector */ @@ -14,6 +14,3 @@ double real_value(const std::vector& _ind) sum += _ind[i] * _ind[i]; return sqrt(sum); } - - - diff --git a/eo/tutorial/Lesson5/CMakeLists.txt b/eo/tutorial/Lesson5/CMakeLists.txt index 224552e3..72852d04 100644 --- a/eo/tutorial/Lesson5/CMakeLists.txt +++ b/eo/tutorial/Lesson5/CMakeLists.txt @@ -9,22 +9,22 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) ### 2) Specify where CMake can find the libraries ###################################################################################### -IF(NOT WIN32 OR CYGWIN) +IF(NOT WIN32 OR CYGWIN) LINK_DIRECTORIES(${EO_BINARY_DIR}/lib) ENDIF(NOT WIN32 OR CYGWIN) # especially for Visual Studio -IF(WIN32 AND NOT CYGWIN) +IF(WIN32 AND NOT CYGWIN) LINK_DIRECTORIES(${EO_BINARY_DIR}\\lib\\${CMAKE_BUILD_TYPE}) -ENDIF(WIN32 AND NOT CYGWIN) +ENDIF(WIN32 AND NOT CYGWIN) ###################################################################################### ### 3) Define your targets ###################################################################################### # no matter what is the OS, hopefully -ADD_EXECUTABLE(OneMaxEA OneMaxEA.cpp) -ADD_EXECUTABLE(OneMaxLibEA OneMaxLibEA.cpp make_OneMax.cpp) +ADD_EXECUTABLE(OneMaxEA OneMaxEA.cpp) +ADD_EXECUTABLE(OneMaxLibEA OneMaxLibEA.cpp make_OneMax.cpp) ADD_DEPENDENCIES(OneMaxEA es ga eo eoutils) ADD_DEPENDENCIES(OneMaxLibEA es ga eo eoutils) diff --git a/eo/tutorial/Lesson5/Makefile.simple b/eo/tutorial/Lesson5/Makefile.simple index bb865c10..ace0df58 100644 --- a/eo/tutorial/Lesson5/Makefile.simple +++ b/eo/tutorial/Lesson5/Makefile.simple @@ -1,5 +1,5 @@ ### This Makefile is part of the tutorial of the EO library -# Unlike other Makefiles in EO, it is not using the automake/autoconf +# Unlike other Makefiles in EO, it is not using the automake/autoconf # so that it stays easy to understant (you are in the tutorial, remember!) # MS, Oct. 2002 @@ -10,11 +10,11 @@ DIR_EO = ../../src .SUFFIXES: .cpp # Warning: $(CXX) in Linux (RedHat and Mandrake at least) is g++ -# However, if you are using this Makefile within xemacs, +# However, if you are using this Makefile within xemacs, # and have problems with the interpretation of the output (and its colors) # then you should use c++ instead (make CXX=c++ will do) -.cpp: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -o $@ $*.cpp $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a +.cpp: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -o $@ $*.cpp $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a .cpp.o: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -c $*.cpp @@ -39,7 +39,7 @@ LIB_EO = $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a ALL = OneMaxEA OneMaxLibEA OneMaxEA : OneMaxEA.o - $(CXX) -g -o $@ OneMaxEA.o $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a -lm + $(CXX) -g -o $@ OneMaxEA.o $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a -lm OneMaxLibEA : OneMaxLibEA.o make_OneMax.o $(CXX) -g -o $@ OneMaxLibEA.o make_OneMax.o $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a -lm @@ -53,4 +53,4 @@ clean : ; /bin/rm *.o $(ALL) ########## local dependencies OneMaxEA.o : $(COMMON_SOURCES) OneMaxEA.cpp OneMaxLibEA.o : $(COMMON_SOURCES) OneMaxLibEA.cpp -make_OneMax.o : make_OneMax.cpp eoOneMax.h +make_OneMax.o : make_OneMax.cpp eoOneMax.h diff --git a/eo/tutorial/Lesson5/OneMaxEA.cpp b/eo/tutorial/Lesson5/OneMaxEA.cpp index 1f3470f3..14a0f4c5 100644 --- a/eo/tutorial/Lesson5/OneMaxEA.cpp +++ b/eo/tutorial/Lesson5/OneMaxEA.cpp @@ -17,7 +17,7 @@ main file BitEA in tutorial/Lesson4 dir. Or you can wait until we do it :-) */ -// Miscilaneous include and declaration +// Miscilaneous include and declaration #include using namespace std; @@ -29,17 +29,17 @@ using namespace std; // include here whatever specific files for your representation // Basically, this should include at least the following -/** definition of representation: +/** definition of representation: * class eoOneMax MUST derive from EO for some fitness */ #include "eoOneMax.h" -/** definition of initilizqtion: +/** definition of initilizqtion: * class eoOneMaxInit MUST derive from eoInit */ #include "eoOneMaxInit.h" -/** definition of evaluation: +/** definition of evaluation: * class eoOneMaxEvalFunc MUST derive from eoEvalFunc * and should test for validity before doing any computation * see tutorial/Templates/evalFunc.tmpl @@ -51,19 +51,19 @@ using namespace std; //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // START fitness type: double or eoMaximizingFitness if you are maximizing // eoMinimizingFitness if you are minimizing -typedef eoMaximizingFitness MyFitT ; // type of fitness +typedef eoMaximizingFitness MyFitT ; // type of fitness // END fitness type //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // Then define your EO objects using that fitness type -typedef eoOneMax Indi; // ***MUST*** derive from EO +typedef eoOneMax Indi; // ***MUST*** derive from EO // create an initializer #include "make_genotype_OneMax.h" eoInit & make_genotype(eoParser& _parser, eoState&_state, Indi _eo) { return do_make_genotype(_parser, _state, _eo); -} +} // and the variation operaotrs #include "make_op_OneMax.h" @@ -75,7 +75,7 @@ eoGenOp& make_op(eoParser& _parser, eoState& _state, eoInit& _init) // Use existing modules to define representation independent routines // These are parser-based definitions of objects -// how to initialize the population +// how to initialize the population // it IS representation independent if an eoInit is given #include eoPop& make_pop(eoParser& _parser, eoState& _state, eoInit & _init) @@ -92,7 +92,7 @@ eoContinue& make_continue(eoParser& _parser, eoState& _state, eoEvalFuncCo // outputs (stats, population dumps, ...) #include -eoCheckPoint& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter& _eval, eoContinue& _continue) +eoCheckPoint& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter& _eval, eoContinue& _continue) { return do_make_checkpoint(_parser, _state, _eval, _continue); } @@ -104,7 +104,7 @@ eoAlgo& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc // the instanciating fitnesses @@ -141,7 +141,7 @@ int main(int argc, char* argv[]) eoGenOp& op = make_op(parser, state, init); - //// Now the representation-independent things + //// Now the representation-independent things // // YOU SHOULD NOT NEED TO MODIFY ANYTHING BEYOND THIS POINT // unless you want to add specific statistics to the checkpoint diff --git a/eo/tutorial/Lesson5/OneMaxLibEA.cpp b/eo/tutorial/Lesson5/OneMaxLibEA.cpp index 42d25f92..febcca44 100644 --- a/eo/tutorial/Lesson5/OneMaxLibEA.cpp +++ b/eo/tutorial/Lesson5/OneMaxLibEA.cpp @@ -8,11 +8,11 @@ Template for creating a new representation in EO ================================================ This is the template main file for compiling after creating a -library. +library. See make_OneMax.cpp file. */ -// Miscilaneous include and declaration +// Miscilaneous include and declaration #include using namespace std; @@ -24,17 +24,17 @@ using namespace std; // include here whatever specific files for your representation // Basically, this should include at least the following -/** definition of representation: +/** definition of representation: * class eoOneMax MUST derive from EO for some fitness */ #include "eoOneMax.h" -/** definition of initilizqtion: +/** definition of initilizqtion: * class eoOneMaxInit MUST derive from eoInit */ #include "eoOneMaxInit.h" -/** definition of evaluation: +/** definition of evaluation: * class eoOneMaxEvalFunc MUST derive from eoEvalFunc * and should test for validity before doing any computation * see tutorial/Templates/evalFunc.tmpl @@ -46,12 +46,12 @@ using namespace std; // // START fitness type: double or eoMaximizingFitness if you are maximizing // eoMinimizingFitness if you are minimizing -typedef eoMinimizingFitness MyFitT ; // type of fitness +typedef eoMinimizingFitness MyFitT ; // type of fitness // END fitness type // // Then define your EO objects using that fitness type -typedef eoOneMax Indi; // ***MUST*** derive from EO +typedef eoOneMax Indi; // ***MUST*** derive from EO // create an initializer - done here and NOT in make_OneMax.cpp // because it is NOT representation independent @@ -59,7 +59,7 @@ typedef eoOneMax Indi; // ***MUST*** derive from EO eoInit & make_genotype(eoParser& _parser, eoState&_state, Indi _eo) { return do_make_genotype(_parser, _state, _eo); -} +} // same thing for the variation operaotrs #include "make_op_OneMax.h" @@ -70,7 +70,7 @@ eoGenOp& make_op(eoParser& _parser, eoState& _state, eoInit& _init) // The representation independent routines are simply declared here -// how to initialize the population +// how to initialize the population // it IS representation independent if an eoInit is given eoPop& make_pop(eoParser& _parser, eoState& _state, eoInit & _init); @@ -83,7 +83,7 @@ eoCheckPoint& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFu // evolution engine (selection and replacement) eoAlgo& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc& _eval, eoContinue& _continue, eoGenOp& _op); -// simple call to the algo. stays there for consistency reasons +// simple call to the algo. stays there for consistency reasons // no template for that one void run_ea(eoAlgo& _ga, eoPop& _pop); @@ -115,7 +115,7 @@ int main(int argc, char* argv[]) eoGenOp& op = make_op(parser, state, init); - //// Now the representation-independent things + //// Now the representation-independent things // // YOU SHOULD NOT NEED TO MODIFY ANYTHING BEYOND THIS POINT // unless you want to add specific statistics to the checkpoint diff --git a/eo/tutorial/Lesson5/eoOneMax.h b/eo/tutorial/Lesson5/eoOneMax.h index a85bb89f..e78b9050 100644 --- a/eo/tutorial/Lesson5/eoOneMax.h +++ b/eo/tutorial/Lesson5/eoOneMax.h @@ -11,7 +11,7 @@ Template for creating a new representation in EO #ifndef _eoOneMax_h #define _eoOneMax_h -/** +/** * Always write a comment in this format before class definition * if you want the class to be documented by Doxygen @@ -20,7 +20,7 @@ Template for creating a new representation in EO * like eoVector for instance, if you handle a vector of something.... * If you create a structure from scratch, - * the only thing you need to provide are + * the only thing you need to provide are * a default constructor * IO routines printOn and readFrom * @@ -31,11 +31,11 @@ template< class FitT> class eoOneMax: public EO { public: /** Ctor: you MUST provide a default ctor. - * though such individuals will generally be processed + * though such individuals will generally be processed * by some eoInit object */ - eoOneMax() - { + eoOneMax() + { // START Code of default Ctor of an eoOneMax object // END Code of default Ctor of an eoOneMax object } @@ -54,7 +54,7 @@ public: // First write the fitness EO::printOn(_os); _os << ' '; - // START Code of default output + // START Code of default output /** HINTS * in EO we systematically write the sizes of things before the things @@ -66,7 +66,7 @@ public: // END Code of default output } - /** reading... + /** reading... * of course, your readFrom must be able to read what printOn writes!!! */ void readFrom(istream& _is) @@ -87,7 +87,7 @@ public: bool bTmp; _is >> bTmp; b[i] = bTmp; - } + } // END Code of input } @@ -108,4 +108,3 @@ private: // put all data here }; #endif - diff --git a/eo/tutorial/Lesson5/eoOneMaxEvalFunc.h b/eo/tutorial/Lesson5/eoOneMaxEvalFunc.h index b7f18746..e9c31d79 100644 --- a/eo/tutorial/Lesson5/eoOneMaxEvalFunc.h +++ b/eo/tutorial/Lesson5/eoOneMaxEvalFunc.h @@ -1,13 +1,13 @@ /** -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - + The above line is usefulin Emacs-like editors */ - + /* Template for evaluator in EO, a functor that computes the fitness of an EO ========================================================================== */ - + #ifndef _eoOneMaxEvalFunc_h #define _eoOneMaxEvalFunc_h @@ -18,7 +18,7 @@ Template for evaluator in EO, a functor that computes the fitness of an EO // include the base definition of eoEvalFunc #include "eoEvalFunc.h" -/** +/** Always write a comment in this format before class definition if you want the class to be documented by Doxygen */ @@ -29,7 +29,7 @@ public: /// Ctor - no requirement // START eventually add or modify the anyVariable argument eoOneMaxEvalFunc() - // eoOneMaxEvalFunc( varType _anyVariable) : anyVariable(_anyVariable) + // eoOneMaxEvalFunc( varType _anyVariable) : anyVariable(_anyVariable) // END eventually add or modify the anyVariable argument { // START Code of Ctor of an eoOneMaxEvalFunc object @@ -39,7 +39,7 @@ public: /** Actually compute the fitness * * @param EOT & _eo the EO object to evaluate - * it should stay templatized to be usable + * it should stay templatized to be usable * with any fitness type */ void operator()(EOT & _eo) diff --git a/eo/tutorial/Lesson5/eoOneMaxInit.h b/eo/tutorial/Lesson5/eoOneMaxInit.h index 7d97ae7b..3622aa67 100644 --- a/eo/tutorial/Lesson5/eoOneMaxInit.h +++ b/eo/tutorial/Lesson5/eoOneMaxInit.h @@ -14,12 +14,12 @@ Template for EO objects initialization in EO // include the base definition of eoInit #include -/** +/** * Always write a comment in this format before class definition * if you want the class to be documented by Doxygen * * There is NO ASSUMPTION on the class GenoypeT. - * In particular, it does not need to derive from EO (e.g. to initialize + * In particular, it does not need to derive from EO (e.g. to initialize * atoms of an eoVector you will need an eoInit) */ template @@ -28,7 +28,7 @@ public: /// Ctor - no requirement // START eventually add or modify the anyVariable argument // eoOneMaxInit() - eoOneMaxInit( unsigned _vecSize) : vecSize(_vecSize) + eoOneMaxInit( unsigned _vecSize) : vecSize(_vecSize) // END eventually add or modify the anyVariable argument { // START Code of Ctor of an eoOneMaxInit object @@ -60,4 +60,3 @@ private: }; #endif - diff --git a/eo/tutorial/Lesson5/eoOneMaxMutation.h b/eo/tutorial/Lesson5/eoOneMaxMutation.h index 50e93109..42a840fe 100644 --- a/eo/tutorial/Lesson5/eoOneMaxMutation.h +++ b/eo/tutorial/Lesson5/eoOneMaxMutation.h @@ -32,10 +32,10 @@ public: eoOneMaxMutation() // eoOneMaxMutation( varType _anyVariable) : anyVariable(_anyVariable) // END eventually add or modify the anyVariable argument - { - // START Code of Ctor of an eoOneMaxEvalFunc object - // END Code of Ctor of an eoOneMaxEvalFunc object - } + { + // START Code of Ctor of an eoOneMaxEvalFunc object + // END Code of Ctor of an eoOneMaxEvalFunc object + } /// The class name. Used to display statistics string className() const { return "eoOneMaxMutation"; } @@ -45,19 +45,19 @@ public: * @param _genotype The parent genotype (will be modified) */ bool operator()(GenotypeT & _genotype) - { - bool isModified(true); - // START code for mutation of the _genotype object + { + bool isModified(true); + // START code for mutation of the _genotype object - /** Requirement - * if (_genotype has been modified) - * isModified = true; - * else - * isModified = false; - */ - return isModified; - // END code for mutation of the _genotype object - } + /** Requirement + * if (_genotype has been modified) + * isModified = true; + * else + * isModified = false; + */ + return isModified; + // END code for mutation of the _genotype object + } private: // START Private data of an eoOneMaxMutation object diff --git a/eo/tutorial/Lesson5/eoOneMaxQuadCrossover.h b/eo/tutorial/Lesson5/eoOneMaxQuadCrossover.h index 5a201bd0..b1094215 100644 --- a/eo/tutorial/Lesson5/eoOneMaxQuadCrossover.h +++ b/eo/tutorial/Lesson5/eoOneMaxQuadCrossover.h @@ -33,10 +33,10 @@ public: eoOneMaxQuadCrossover() // eoOneMaxQuadCrossover( varType _anyVariable) : anyVariable(_anyVariable) // END eventually add or modify the anyVariable argument - { - // START Code of Ctor of an eoOneMaxEvalFunc object - // END Code of Ctor of an eoOneMaxEvalFunc object - } + { + // START Code of Ctor of an eoOneMaxEvalFunc object + // END Code of Ctor of an eoOneMaxEvalFunc object + } /// The class name. Used to display statistics string className() const { return "eoOneMaxQuadCrossover"; } @@ -47,19 +47,19 @@ public: * @param _genotype2 The second parent */ bool operator()(GenotypeT& _genotype1, GenotypeT & _genotype2) - { - bool oneAtLeastIsModified(true); - // START code for crossover of _genotype1 and _genotype2 objects + { + bool oneAtLeastIsModified(true); + // START code for crossover of _genotype1 and _genotype2 objects - /** Requirement - * if (at least one genotype has been modified) // no way to distinguish - * oneAtLeastIsModified = true; - * else - * oneAtLeastIsModified = false; - */ - return oneAtLeastIsModified; - // END code for crossover of _genotype1 and _genotype2 objects - } + /** Requirement + * if (at least one genotype has been modified) // no way to distinguish + * oneAtLeastIsModified = true; + * else + * oneAtLeastIsModified = false; + */ + return oneAtLeastIsModified; + // END code for crossover of _genotype1 and _genotype2 objects + } private: // START Private data of an eoOneMaxQuadCrossover object diff --git a/eo/tutorial/Lesson5/make_OneMax.cpp b/eo/tutorial/Lesson5/make_OneMax.cpp index 29fa78e6..7c2c05ee 100644 --- a/eo/tutorial/Lesson5/make_OneMax.cpp +++ b/eo/tutorial/Lesson5/make_OneMax.cpp @@ -17,7 +17,7 @@ and src/es (for real vectors). */ -// Miscilaneous include and declaration +// Miscilaneous include and declaration #include using namespace std; @@ -29,7 +29,7 @@ using namespace std; // include here whatever specific files for your representation // Basically, this should include at least the following -/** definition of representation: +/** definition of representation: * class eoOneMax MUST derive from EO for some fitness */ #include "eoOneMax.h" @@ -43,12 +43,12 @@ using namespace std; // eoInit> & make_genotype(eoParser& _parser, eoState&_state, eoOneMax _eo) // { // return do_make_genotype(_parser, _state, _eo); -// } +// } // eoInit> & make_genotype(eoParser& _parser, eoState&_state, eoOneMax _eo) // { // return do_make_genotype(_parser, _state, _eo); -// } +// } // same thing for the variation operaotrs //--------------------------------------- @@ -65,7 +65,7 @@ using namespace std; // The following modules use ***representation independent*** routines -// how to initialize the population +// how to initialize the population // it IS representation independent if an eoInit is given #include eoPop >& make_pop(eoParser& _parser, eoState& _state, eoInit > & _init) @@ -92,12 +92,12 @@ eoContinue >& make_continue(eoParser& _parser, eoS // outputs (stats, population dumps, ...) #include -eoCheckPoint >& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter >& _eval, eoContinue >& _continue) +eoCheckPoint >& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter >& _eval, eoContinue >& _continue) { return do_make_checkpoint(_parser, _state, _eval, _continue); } -eoCheckPoint >& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter >& _eval, eoContinue >& _continue) +eoCheckPoint >& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter >& _eval, eoContinue >& _continue) { return do_make_checkpoint(_parser, _state, _eval, _continue); } @@ -114,7 +114,7 @@ eoAlgo >& make_algo_scalar(eoParser& _parser, eoS return do_make_algo_scalar(_parser, _state, _eval, _continue, _op); } -// simple call to the algo. stays there for consistency reasons +// simple call to the algo. stays there for consistency reasons // no template for that one #include void run_ea(eoAlgo >& _ga, eoPop >& _pop) @@ -126,4 +126,3 @@ void run_ea(eoAlgo >& _ga, eoPop * - * It could be here tempatized only on the fitness, as it can be used + * It could be here tempatized only on the fitness, as it can be used * to evolve structures with any fitness. - * However, for consistency reasons, it was finally chosen, as in - * the rest of EO, to templatize by the full EOT, as this eventually + * However, for consistency reasons, it was finally chosen, as in + * the rest of EO, to templatize by the full EOT, as this eventually * allows to choose the type of genotype at run time (see in es dir) * - * It returns an eoInit that can later be used to initialize + * It returns an eoInit that can later be used to initialize * the population (see make_pop.h). * * It uses a parser (to get user parameters) and a state (to store the memory) * the last argument is to disambiguate the call upon different instanciations. * - * WARNING: that last argument will generally be the result of calling - * the default ctor of EOT, resulting in most cases in an EOT + * WARNING: that last argument will generally be the result of calling + * the default ctor of EOT, resulting in most cases in an EOT * that is ***not properly initialized*** */ template eoInit & do_make_genotype(eoParameterLoader& _parser, eoState& _state, EOT) { - // read any useful parameter here from the parser + // read any useful parameter here from the parser // the param itself will belong to the parser (as far as memory is concerned) // paramType & param = _parser.createParam(deafultValue, "Keyword", "Comment to appear in help and status", 'c',"Section of status file").value(); diff --git a/eo/tutorial/Lesson5/make_op_OneMax.h b/eo/tutorial/Lesson5/make_op_OneMax.h index d19c8930..e157720f 100644 --- a/eo/tutorial/Lesson5/make_op_OneMax.h +++ b/eo/tutorial/Lesson5/make_op_OneMax.h @@ -3,7 +3,7 @@ //----------------------------------------------------------------------------- // make_op_OneMax.h // (c) Marc Schoenauer, Maarten Keijzer and GeNeura Team, 2001 -/* +/* This library 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 @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact: todos@geneura.ugr.es, http://geneura.ugr.es - Marc.Schoenauer@polytechnique.fr - mkeijzer@dhi.dk + Marc.Schoenauer@polytechnique.fr + mkeijzer@dhi.dk */ //----------------------------------------------------------------------------- @@ -35,14 +35,14 @@ // combinations of simple eoOps (eoMonOp and eoQuadOp) #include -/** definition of mutation: +/** definition of mutation: * class eoOneMaxMonop MUST derive from eoMonOp */ #include "eoOneMaxMutation.h" -/** definition of crossover (either as eoBinOp (2->1) or eoQuadOp (2->2): +/** definition of crossover (either as eoBinOp (2->1) or eoQuadOp (2->2): * class eoOneMaxBinCrossover MUST derive from eoBinOp - * OR + * OR * class eoOneMaxQuadCrossover MUST derive from eoQuadOp */ // #include "eoOneMaxBinOp.h" @@ -61,9 +61,9 @@ * This function builds the operators that will be applied to the eoOneMax * * It uses a parser (to get user parameters), a state (to store the memory) - * the last parameter is an eoInit: if some operator needs some info + * the last parameter is an eoInit: if some operator needs some info * about the genotypes, the init has it all (e.g. bounds, ...) - * Simply do + * Simply do * EOT myEO; * _init(myEO); * and myEO is then an ACTUAL object @@ -85,7 +85,7 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit2) only - no time for the eoBinOp case // you can have more than one - combined in a proportional way - + // first, define the crossover objects and read their rates from the parser - - // A first crossover + + // A first crossover eoQuadOp *cross = new eoOneMaxQuadCrossover /* (varType _anyVariable) */; // store in the state _state.storeFunctor(cross); @@ -106,21 +106,21 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit *propXover = + eoPropCombinedQuadOp *propXover = new eoPropCombinedQuadOp(*cross, cross1Rate); // and of course stor it in the state _state.storeFunctor(propXover); - // Optional: A second(and third, and ...) crossover + // Optional: A second(and third, and ...) crossover // of course you must create the corresponding classes // and all ***MUST*** derive from eoQuadOp /* Uncomment if necessary - and replicate as many time as you need - cross = new eoOneMaxSecondCrossover(varType _anyVariable); + cross = new eoOneMaxSecondCrossover(varType _anyVariable); _state.storeFunctor(cross); - double cross2Rate = _parser.createParam(1.0, "cross2Rate", "Relative rate for crossover 2", '2', "Variation Operators").value(); - propXover.add(*cross, cross2Rate); + double cross2Rate = _parser.createParam(1.0, "cross2Rate", "Relative rate for crossover 2", '2', "Variation Operators").value(); + propXover.add(*cross, cross2Rate); */ // if you want some gentle output, the last one shoudl be like // propXover.add(*cross, crossXXXRate, true); @@ -130,12 +130,12 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit *mut = new eoOneMaxMutation/* (varType _anyVariable) */; _state.storeFunctor(mut); // its relative rate in the combination @@ -151,8 +151,8 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit(varType _anyVariable); _state.storeFunctor(mut); - double mut2Rate = _parser.createParam(1.0, "mut2Rate", "Relative rate for mutation 2", '2', "Variation Operators").value(); - propMutation.add(*mut, mut2Rate); + double mut2Rate = _parser.createParam(1.0, "mut2Rate", "Relative rate for mutation 2", '2', "Variation Operators").value(); + propMutation.add(*mut, mut2Rate); */ // if you want some gentle output, the last one shoudl be like // propMutation.add(*mut, mutXXXRate, true); @@ -170,7 +170,7 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit swarm + // population <=> swarm eoPop pop; /// EVALUATION @@ -78,8 +78,8 @@ void main_function(int argc, char **argv) ////////////// // ring topology eoRingTopology topology(NEIGHBORHOOD_SIZE); - - + + ///////////////////// // INITIALIZATION //////////////////// @@ -87,7 +87,7 @@ void main_function(int argc, char **argv) eoUniformGenerator uGen; eoInitFixedLength < Particle > random (VEC_SIZE, uGen); pop.append (POP_SIZE, random); - + // velocities initialization component eoUniformGenerator < double >sGen (VELOCITY_INIT_MIN, VELOCITY_INIT_MAX); eoVelocityInitFixedLength < Particle > veloRandom (VEC_SIZE, sGen); @@ -101,23 +101,23 @@ void main_function(int argc, char **argv) // - the first best positions of each particle // - setups the topology eoInitializer fullInit(eval,veloRandom,localInit,topology,pop); - + // Full initialization here to be able to print the initial population // Else: give the "init" component in the eoEasyPSO constructor fullInit(); - + ///////////// // OUTPUT //////////// // sort pop before printing it! pop.sort(); - + // Print (sorted) the initial population (raw printout) cout << "INITIAL POPULATION:" << endl; for (unsigned i = 0; i < pop.size(); ++i) - cout << "\t best fit=" << pop[i] << endl; + cout << "\t best fit=" << pop[i] << endl; + - /////////////// /// VELOCITY ////////////// @@ -148,7 +148,7 @@ void main_function(int argc, char **argv) //////////////////////////////////////// // standard PSO requires // stopping criteria, evaluation,velocity, flight - + eoEasyPSO pso(genCont, eval, velocity, flight); // Apply the algo to the swarm - that's it! @@ -159,7 +159,7 @@ void main_function(int argc, char **argv) pop.sort(); cout << "FINAL POPULATION:" << endl; for (unsigned i = 0; i < pop.size(); ++i) - cout << "\t best fit=" << pop[i] << endl; + cout << "\t best fit=" << pop[i] << endl; } @@ -167,14 +167,14 @@ void main_function(int argc, char **argv) // A main that catches the exceptions int main(int argc, char **argv) -{ +{ try { - main_function(argc, argv); + main_function(argc, argv); } catch(exception& e) { - cout << "Exception: " << e.what() << '\n'; + cout << "Exception: " << e.what() << '\n'; } return 1; diff --git a/eo/tutorial/Lesson6/CMakeLists.txt b/eo/tutorial/Lesson6/CMakeLists.txt index b1e41453..8cc0b101 100644 --- a/eo/tutorial/Lesson6/CMakeLists.txt +++ b/eo/tutorial/Lesson6/CMakeLists.txt @@ -8,21 +8,21 @@ INCLUDE_DIRECTORIES(${EO_SOURCE_DIR}/src) ### 2) Specify where CMake can find the libraries ###################################################################################### -IF(NOT WIN32 OR CYGWIN) +IF(NOT WIN32 OR CYGWIN) LINK_DIRECTORIES(${EO_BINARY_DIR}/lib) ENDIF(NOT WIN32 OR CYGWIN) # especially for Visual Studio -IF(WIN32 AND NOT CYGWIN) +IF(WIN32 AND NOT CYGWIN) LINK_DIRECTORIES(${EO_BINARY_DIR}\\lib\\${CMAKE_BUILD_TYPE}) -ENDIF(WIN32 AND NOT CYGWIN) +ENDIF(WIN32 AND NOT CYGWIN) ###################################################################################### ### 3) Define your targets ###################################################################################### -ADD_EXECUTABLE(BinaryPSO BinaryPSO.cpp) -ADD_EXECUTABLE(RealPSO RealPSO.cpp) +ADD_EXECUTABLE(BinaryPSO BinaryPSO.cpp) +ADD_EXECUTABLE(RealPSO RealPSO.cpp) ###################################################################################### ### 4) Optionnal @@ -49,4 +49,3 @@ INSTALL(TARGETS BinaryPSO RUNTIME DESTINATION share/eo/examples/Lesson6 COMPONEN INSTALL(TARGETS RealPSO RUNTIME DESTINATION share/eo/examples/Lesson6 COMPONENT examples) ###################################################################################### - diff --git a/eo/tutorial/Lesson6/Makefile.simple b/eo/tutorial/Lesson6/Makefile.simple index d9b5b64f..5cdc5a46 100644 --- a/eo/tutorial/Lesson6/Makefile.simple +++ b/eo/tutorial/Lesson6/Makefile.simple @@ -1,5 +1,5 @@ ### This Makefile is part of the tutorial of the EO library -# Unlike other Makefiles in EO, it is not using the automake/autoconf +# Unlike other Makefiles in EO, it is not using the automake/autoconf # so that it stays easy to understant (you are in the tutorial, remember!) # MS, Oct. 2002 @@ -10,12 +10,12 @@ DIR_EO = ../../src .SUFFIXES: .cpp # Warning: $(CXX) in Linux (RedHat and Mandrake at least) is g++ -# However, if you are using this Makefile within xemacs, +# However, if you are using this Makefile within xemacs, # and have problems with the interpretation of the output (and its colors) # then you should use c++ instead (make CXX=c++ will do) -.cpp: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -pg -o $@ $*.cpp -#$(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a +.cpp: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -pg -o $@ $*.cpp +#$(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a .cpp.o: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -c -pg $*.cpp @@ -27,5 +27,5 @@ lesson6 : $(PSO) all : $(ALL) -clean : +clean : @/bin/rm $(ALL) *.o *.sav *.xg *.status *~ diff --git a/eo/tutorial/Lesson6/RealPSO.cpp b/eo/tutorial/Lesson6/RealPSO.cpp index 77d1167c..23f67100 100644 --- a/eo/tutorial/Lesson6/RealPSO.cpp +++ b/eo/tutorial/Lesson6/RealPSO.cpp @@ -27,7 +27,7 @@ FitT real_value (const Particle & _particle) { double sum = 0; for (unsigned i = 0; i < _particle.size(); i++) - sum += pow(_particle[i],2); + sum += pow(_particle[i],2); return (sqrt(sum)); } @@ -38,21 +38,21 @@ void main_function(int argc, char **argv) // PARAMETRES // all parameters are hard-coded! const unsigned int SEED = 42; // seed for random number generator - + const unsigned int MAX_GEN=100; const unsigned int VEC_SIZE = 2; const unsigned int POP_SIZE = 20; const unsigned int NEIGHBORHOOD_SIZE= 5; - + const double POS_INIT_MIN= -2; const double POS_INIT_MAX= 2; - + const double VELOCITY_INIT_MIN= -1; const double VELOCITY_INIT_MAX= 1; - + const double VELOCITY_MIN= -1.5; const double VELOCITY_MAX= 1.5; - + const double INERTIA= 1; const double LEARNING_FACTOR1= 1.7; const double LEARNING_FACTOR2= 2.3; @@ -64,9 +64,9 @@ void main_function(int argc, char **argv) // you'll aways get the same result, NOT a random run rng.reseed(SEED); - + /// SWARM - // population <=> swarm + // population <=> swarm eoPop pop; /// EVALUATION @@ -79,8 +79,8 @@ void main_function(int argc, char **argv) ////////////// // linear topology eoLinearTopology topology(NEIGHBORHOOD_SIZE); - - + + ///////////////////// // INITIALIZATION //////////////////// @@ -88,7 +88,7 @@ void main_function(int argc, char **argv) eoUniformGenerator < double >uGen (POS_INIT_MIN, POS_INIT_MAX); eoInitFixedLength < Particle > random (VEC_SIZE, uGen); pop.append (POP_SIZE, random); - + // velocities initialization component eoUniformGenerator < double >sGen (VELOCITY_INIT_MIN, VELOCITY_INIT_MAX); eoVelocityInitFixedLength < Particle > veloRandom (VEC_SIZE, sGen); @@ -102,23 +102,23 @@ void main_function(int argc, char **argv) // - the first best positions of each particle // - setups the topology eoInitializer fullInit(eval,veloRandom,localInit,topology,pop); - + // Full initialization here to be able to print the initial population // Else: give the "init" component in the eoEasyPSO constructor fullInit(); - + ///////////// // OUTPUT //////////// // sort pop before printing it! pop.sort(); - + // Print (sorted) the initial population (raw printout) cout << "INITIAL POPULATION:" << endl; for (unsigned i = 0; i < pop.size(); ++i) - cout << "\t best fit=" << pop[i] << endl; + cout << "\t best fit=" << pop[i] << endl; + - /////////////// /// VELOCITY ////////////// @@ -149,7 +149,7 @@ void main_function(int argc, char **argv) //////////////////////////////////////// // standard PSO requires // stopping criteria, evaluation,velocity, flight - + eoEasyPSO pso(genCont, eval, velocity, flight); // Apply the algo to the swarm - that's it! @@ -160,7 +160,7 @@ void main_function(int argc, char **argv) pop.sort(); cout << "FINAL POPULATION:" << endl; for (unsigned i = 0; i < pop.size(); ++i) - cout << "\t best fit=" << pop[i] << endl; + cout << "\t best fit=" << pop[i] << endl; } @@ -168,14 +168,14 @@ void main_function(int argc, char **argv) // A main that catches the exceptions int main(int argc, char **argv) -{ +{ try { - main_function(argc, argv); + main_function(argc, argv); } catch(exception& e) { - cout << "Exception: " << e.what() << '\n'; + cout << "Exception: " << e.what() << '\n'; } return 1; diff --git a/eo/tutorial/Makefile.simple b/eo/tutorial/Makefile.simple index 5b5d54b2..b82ca27f 100644 --- a/eo/tutorial/Makefile.simple +++ b/eo/tutorial/Makefile.simple @@ -3,22 +3,22 @@ SUBDIRS = Lesson1 Lesson2 Lesson3 Lesson4 Lesson5 Lesson6 all: for i in $(SUBDIRS); do cd $$i && $(MAKE) all; cd ..; done -lesson1 : +lesson1 : cd Lesson1; make -lesson2 : +lesson2 : cd Lesson2; make -lesson3 : +lesson3 : cd Lesson3; make -lesson4 : +lesson4 : cd Lesson4; make -lesson5 : +lesson5 : cd Lesson5; make -lesson6 : +lesson6 : cd Lesson6; make #empty dist and distdir to let top-level 'make' do its job diff --git a/eo/tutorial/README b/eo/tutorial/README index aecd143e..e9d99410 100644 --- a/eo/tutorial/README +++ b/eo/tutorial/README @@ -2,12 +2,11 @@ Eo Tutorial - corresponding to EO version 0.9.1+ To start the tutorial, read index.html in your favorite browser. -Many things are missing, including many solutions for the exercises, +Many things are missing, including many solutions for the exercises, the introduction to EC and most of the Component-based pages. -More important, all examples of this tutorial have only been tested -on a Linux computer, and the Makefile will not work with MS-Windows +More important, all examples of this tutorial have only been tested +on a Linux computer, and the Makefile will not work with MS-Windows systems. Any help is welcome! -Be patient ... +Be patient ... evoMarc - diff --git a/eo/tutorial/Templates/CMakeLists.txt.src-tmpl b/eo/tutorial/Templates/CMakeLists.txt.src-tmpl index 833fa2b4..ee23cd0d 100755 --- a/eo/tutorial/Templates/CMakeLists.txt.src-tmpl +++ b/eo/tutorial/Templates/CMakeLists.txt.src-tmpl @@ -1,5 +1,3 @@ - - ###################################################################################### ### 1) Include the sources ###################################################################################### @@ -16,14 +14,14 @@ INCLUDE_DIRECTORIES(${EO_SOURCE_DIR}/src/do) ### 2) Specify where CMake can find the libraries ###################################################################################### -IF(NOT WIN32 OR CYGWIN) +IF(NOT WIN32 OR CYGWIN) LINK_DIRECTORIES(${EO_BINARY_DIR}/lib) ENDIF(NOT WIN32 OR CYGWIN) # especially for Visual Studio -IF(WIN32 AND NOT CYGWIN) +IF(WIN32 AND NOT CYGWIN) LINK_DIRECTORIES(${EO_BINARY_DIR}\\lib\\${CMAKE_BUILD_TYPE}) -ENDIF(WIN32 AND NOT CYGWIN) +ENDIF(WIN32 AND NOT CYGWIN) ###################################################################################### @@ -33,7 +31,7 @@ ENDIF(WIN32 AND NOT CYGWIN) ### 3) Define your targets ###################################################################################### -ADD_EXECUTABLE(MyStructEA MyStructEA.cpp) +ADD_EXECUTABLE(MyStructEA MyStructEA.cpp) ###################################################################################### @@ -42,7 +40,6 @@ ADD_EXECUTABLE(MyStructEA MyStructEA.cpp) ### 4) Link the librairies for the targets ###################################################################################### -TARGET_LINK_LIBRARIES(MyStructEA eo eoutils ga es) +TARGET_LINK_LIBRARIES(MyStructEA eo eoutils ga es) ###################################################################################### - diff --git a/eo/tutorial/Templates/CMakeLists.txt.top-tmpl b/eo/tutorial/Templates/CMakeLists.txt.top-tmpl index e169d235..c653b681 100755 --- a/eo/tutorial/Templates/CMakeLists.txt.top-tmpl +++ b/eo/tutorial/Templates/CMakeLists.txt.top-tmpl @@ -1,7 +1,5 @@ - - ###################################################################################### -### 1) Main project config +### 1) Main project config ###################################################################################### # set the project name @@ -19,16 +17,16 @@ ENABLE_LANGUAGE(CXX) IF(NOT EO_SOURCE_DIR) SET( EO_SOURCE_DIR - EO_SRC_DIR CACHE STRING - "EO source directory" - FORCE) + EO_SRC_DIR CACHE STRING + "EO source directory" + FORCE) ENDIF(NOT EO_SOURCE_DIR) IF(NOT EO_BINARY_DIR) - SET( EO_BINARY_DIR - EO_BIN_DIR CACHE STRING - "EO binary directory" - FORCE) + SET( EO_BINARY_DIR + EO_BIN_DIR CACHE STRING + "EO binary directory" + FORCE) ENDIF(NOT EO_BINARY_DIR) ###################################################################################### diff --git a/eo/tutorial/Templates/ChangeLog b/eo/tutorial/Templates/ChangeLog index ffecdd09..2ede582e 100644 --- a/eo/tutorial/Templates/ChangeLog +++ b/eo/tutorial/Templates/ChangeLog @@ -35,12 +35,12 @@ * README.manual: This is a copy of the old README. * README: Describe the new way and setup of creating a new EO project. - + * createEOproject.sh, Makefile.am.src-tmpl, Makefile.am.top-tmpl: * configure.ac.tmpl: New files to create a standalone EO project from templates. - + * Local Variables: * coding: iso-8859-1 * mode: flyspell diff --git a/eo/tutorial/Templates/EO.tpl b/eo/tutorial/Templates/EO.tpl index 342681bc..959ad56a 100644 --- a/eo/tutorial/Templates/EO.tpl +++ b/eo/tutorial/Templates/EO.tpl @@ -370,8 +370,8 @@ public: void printOn(ostream& os) const { // First write the fitness - EO::printOn(os); - os << ' '; + EO::printOn(os); + os << ' '; // START Code of default output /** HINTS diff --git a/eo/tutorial/Templates/MyStructLibEA.cpp b/eo/tutorial/Templates/MyStructLibEA.cpp index 24fed341..54e9f2ff 100644 --- a/eo/tutorial/Templates/MyStructLibEA.cpp +++ b/eo/tutorial/Templates/MyStructLibEA.cpp @@ -8,11 +8,11 @@ Template for creating a new representation in EO ================================================ This is the template main file for compiling after creating a -"library", i.e. putting everything but the fitness in a separate file +"library", i.e. putting everything but the fitness in a separate file (make_MyStruct.cpp) and compiling it once and for all. */ -// Miscilaneous include and declaration +// Miscilaneous include and declaration #include using namespace std; @@ -24,17 +24,17 @@ using namespace std; // include here whatever specific files for your representation // Basically, this should include at least the following -/** definition of representation: +/** definition of representation: * class eoMyStruct MUST derive from EO for some fitness */ #include "eoMyStruct.h" -/** definition of initilizqtion: +/** definition of initilizqtion: * class eoMyStructInit MUST derive from eoInit */ #include "eoMyStructInit.h" -/** definition of evaluation: +/** definition of evaluation: * class eoMyStructEvalFunc MUST derive from eoEvalFunc * and should test for validity before doing any computation * see tutorial/Templates/evalFunc.tmpl @@ -46,12 +46,12 @@ using namespace std; // // START fitness type: double or eoMaximizingFitness if you are maximizing // eoMinimizingFitness if you are minimizing -typedef eoMinimizingFitness MyFitT ; // type of fitness +typedef eoMinimizingFitness MyFitT ; // type of fitness // END fitness type // // Then define your EO objects using that fitness type -typedef eoMyStruct Indi; // ***MUST*** derive from EO +typedef eoMyStruct Indi; // ***MUST*** derive from EO // create an initializer - done here and NOT in make_MyStruct.cpp // because it is NOT representation independent @@ -59,7 +59,7 @@ typedef eoMyStruct Indi; // ***MUST*** derive from EO eoInit & make_genotype(eoParser& _parser, eoState&_state, Indi _eo) { return do_make_genotype(_parser, _state, _eo); -} +} // same thing for the variation operaotrs #include "make_op_MyStruct.h" @@ -70,7 +70,7 @@ eoGenOp& make_op(eoParser& _parser, eoState& _state, eoInit& _init) // The representation independent routines are simply declared here -// how to initialize the population +// how to initialize the population // it IS representation independent if an eoInit is given eoPop& make_pop(eoParser& _parser, eoState& _state, eoInit & _init); @@ -83,7 +83,7 @@ eoCheckPoint& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFu // evolution engine (selection and replacement) eoAlgo& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc& _eval, eoContinue& _continue, eoGenOp& _op); -// simple call to the algo. stays there for consistency reasons +// simple call to the algo. stays there for consistency reasons // no template for that one void run_ea(eoAlgo& _ga, eoPop& _pop); @@ -115,7 +115,7 @@ int main(int argc, char* argv[]) eoGenOp& op = make_op(parser, state, init); - //// Now the representation-independent things + //// Now the representation-independent things // // YOU SHOULD NOT NEED TO MODIFY ANYTHING BEYOND THIS POINT // unless you want to add specific statistics to the checkpoint diff --git a/eo/tutorial/Templates/README b/eo/tutorial/Templates/README index 9ab2d6a7..33d9438e 100644 --- a/eo/tutorial/Templates/README +++ b/eo/tutorial/Templates/README @@ -19,10 +19,10 @@ When running bash, use this: You can freely move the created project around. However, whenever you change the location of the source- or build-directories, you need to -run +run touch configure.ac && autoreconf -in the source-directory and - make +in the source-directory and + make in the build-directory (which might or might not be the same for you). diff --git a/eo/tutorial/Templates/README.manual b/eo/tutorial/Templates/README.manual index 2683707c..38693d83 100644 --- a/eo/tutorial/Templates/README.manual +++ b/eo/tutorial/Templates/README.manual @@ -5,7 +5,7 @@ However, see there first for the creation of new projects. ======================================================================== This directory contains sample files that should make it easy to -create an EO algorithm to evolve any type of structure +create an EO algorithm to evolve any type of structure (EO comes with two examples, bitstrings and vector of real variables, so you'll need this as soon as you want to evolve something else). @@ -13,7 +13,7 @@ At the moment, only algorithms involving a scalar fitness (double) are implemented (see test dir for Pareto optimization of multiple- objective fitness - or be patient :-) -This file will help you to build the same algorithm than the ones +This file will help you to build the same algorithm than the ones in the Lesson4 of the tutorial, but with YOUR genotype instead of bitstrings or vector. More details in Lesson5 of the tutorial. @@ -30,7 +30,7 @@ mutation and the computation of its fitness. The helper script * create.sh * will create for you the files you need from the samples in tutorial/Templates dir, and all you'll have to do is to include the actual code where indicated in those files (between -keywords START and END). +keywords START and END). First, let's choose a name: let's call the new EO class eoAppli. All newly created classes will be named eoAppliXXX (in the file @@ -41,24 +41,24 @@ eoAppliXXX) 2- create the directory for your application (let's assume you call it APPLICATION): type in - mkdir APPLICATION + mkdir APPLICATION -3- go to the Templates dir +3- go to the Templates dir - cd Templates + cd Templates -and run the helper script create.sh with the following arguments +and run the helper script create.sh with the following arguments - ./create.sh Appli ../APPLICATION + ./create.sh Appli ../APPLICATION -4- cd to the APPLICATION dir (cd ../APPLICATION). +4- cd to the APPLICATION dir (cd ../APPLICATION). You should see there the following files: AppliEA.cpp the main file, includes all other, to be compiled Makefile with default target eoAppliEA eoAppli.h class eoAppli, FitT = template fitness eoAppliEvalFunc.h class for the computation of fotness eoAppliInit.h class for genotype initlialization - eoAppliMutation.h class for mutation + eoAppliMutation.h class for mutation eoAppliQuadCrossover.h class for (quadratic) crossover make_genotype_Appli.h helper function that create the initializer make_op_Appli.h helper function that creates the variatin operators @@ -78,11 +78,11 @@ HINT: look for keywords START and END and modify code in between. 6- Compile eoAppliEA.cpp. If your APPLICATION dir is in the tutorial dir, you don't need to modify Makefile. Just type in - % make + % make 7- Run the resulting program: - % eoAppliEA + % eoAppliEA The default output is one line per generation with the generation number, the number of evaluations performed, the best and average @@ -93,7 +93,7 @@ The algorithm stops by default after 100 generations. e.g. eoAppliEA.param, edit eoAppliEA.param (uncomment the lines you want to become active), and run - % eoAppliEA @eoAppliEA.param + % eoAppliEA @eoAppliEA.param (see the Lesson 5 of the tutorial for more details now). @@ -121,19 +121,19 @@ To add another operator, you have to create another class by mimicking what has been done for the first operator. For instance, let's suppose you want to create another mutation. -* duplicate the code for eoAppliMutation class +* duplicate the code for eoAppliMutation class * in the second version, change the class name (eoAppliMutation) into another name (let's say eoAppliBetterMutation) - you must change the name in the class declaration, in the constructor and in the className() method. * in the new eoAppliBetterMutation class, change the code for the operator() - and eventually the code for the constructor. -* in the make_op_Appli.h file, in the mutation section, uncomment the -lines +* in the make_op_Appli.h file, in the mutation section, uncomment the +lines mut = new eoAppliSecondMutation(varType _anyVariable); _state.storeFunctor(mut); - double mut2Rate = _parser.createParam(1.0, "mut2Rate", "Relative rate for mutation 2", '2', "Variation Operators").value(); - propMutation.add(*mut, mut2Rate); + double mut2Rate = _parser.createParam(1.0, "mut2Rate", "Relative rate for mutation 2", '2', "Variation Operators").value(); + propMutation.add(*mut, mut2Rate); and change the name of the class from eoAppliSecondMutation to your name eoAppliBetterMutation (you can also change the keyword from diff --git a/eo/tutorial/Templates/binCrossover.tmpl b/eo/tutorial/Templates/binCrossover.tmpl index 5adabe68..c3f44c5a 100644 --- a/eo/tutorial/Templates/binCrossover.tmpl +++ b/eo/tutorial/Templates/binCrossover.tmpl @@ -7,8 +7,8 @@ The above line is useful in Emacs-like editors Template for simple binary crossover operators ============================================== -Binary crossover operators modify the first genotype only, -based on the second +Binary crossover operators modify the first genotype only, +based on the second */ #ifndef eoMyStructBinCrossover_H @@ -16,14 +16,14 @@ based on the second #include -/** +/** * Always write a comment in this format before class definition * if you want the class to be documented by Doxygen * * THere is NO ASSUMPTION on the class GenoypeT. * In particular, it does not need to derive from EO */ -template +template class eoMyStructBinCrossover: public eoBinOp { public: @@ -31,8 +31,8 @@ public: * Ctor - no requirement */ // START eventually add or modify the anyVariable argument - eoMyStructBinCrossover() - // eoMyStructBinCrossover( varType _anyVariable) : anyVariable(_anyVariable) + eoMyStructBinCrossover() + // eoMyStructBinCrossover( varType _anyVariable) : anyVariable(_anyVariable) // END eventually add or modify the anyVariable argument { // START Code of Ctor of an eoMyStructEvalFunc object @@ -47,7 +47,7 @@ public: * @param _genotype1 The first genotype * @param _genotype2 The second genotype - const */ - bool operator()(GenotypeT & _genotype1, const GenotypeT & _genotype2) + bool operator()(GenotypeT & _genotype1, const GenotypeT & _genotype2) { // START code for crossover of _genotype1 and _genotype2 objects diff --git a/eo/tutorial/Templates/configure.ac.tmpl b/eo/tutorial/Templates/configure.ac.tmpl index cc52cebd..8c09bf41 100644 --- a/eo/tutorial/Templates/configure.ac.tmpl +++ b/eo/tutorial/Templates/configure.ac.tmpl @@ -21,11 +21,11 @@ AC_CHECK_HEADERS([eo], [], [AC_ERROR(Evolving Objects headers are required)]) dnl Checks for libraries. AC_LANG(C++) AC_CHECK_LIB([eoutils], [main], [], - AC_MSG_ERROR([Evolving Objects utility library is required.])) + AC_MSG_ERROR([Evolving Objects utility library is required.])) AC_CHECK_LIB([eo], [main], [], - AC_MSG_ERROR([Evolving Objects library is required.])) + AC_MSG_ERROR([Evolving Objects library is required.])) AC_CHECK_LIB([es], [main], [], - AC_MSG_ERROR([EO Evolutionary strategies library is required.])) + AC_MSG_ERROR([EO Evolutionary strategies library is required.])) dnl Checks for library functions. diff --git a/eo/tutorial/Templates/continue.tmpl b/eo/tutorial/Templates/continue.tmpl index 2ec5a7be..bfcee4d3 100644 --- a/eo/tutorial/Templates/continue.tmpl +++ b/eo/tutorial/Templates/continue.tmpl @@ -14,11 +14,11 @@ Template for continuator in EO, i.e. stopping conditions for EO algorithms // include the base definition of eoContinue #include -/** +/** * Always write a comment in this format before class definition * if you want the class to be documented by Doxygen * - * ATTENTION, class EOT *must* derive from EO, as operator() will + * ATTENTION, class EOT *must* derive from EO, as operator() will * be called with an eoPop */ template< class EOT> @@ -29,7 +29,7 @@ public: */ // START eventually add or modify the anyVariable argument eoMyStructContinue() - // eoMyStructBinCrossover( varType _anyVariable) : anyVariable(_anyVariable) + // eoMyStructBinCrossover( varType _anyVariable) : anyVariable(_anyVariable) // END eventually add or modify the anyVariable argument { // START Code of Ctor of an eoMyStructEvalFunc object @@ -41,7 +41,7 @@ public: * * @param _pop an eoPop */ - virtual bool operator() ( const eoPop& _pop ) + virtual bool operator() ( const eoPop& _pop ) { bool stopCondition ; // to store the stopping condition // START Code of computation of stopping condition @@ -62,4 +62,3 @@ private: }; #endif - diff --git a/eo/tutorial/Templates/createEOproject.sh b/eo/tutorial/Templates/createEOproject.sh index 57915340..9f932f90 100755 --- a/eo/tutorial/Templates/createEOproject.sh +++ b/eo/tutorial/Templates/createEOproject.sh @@ -12,7 +12,7 @@ endif if ($#argv < 1) then echo "Usage: $0 ApplicationName [TargetDirName]" - echo " This will create ../TargetDirName if necessary (default dir name = ApplicationName)," + echo " This will create ../TargetDirName if necessary (default dir name = ApplicationName)," echo " and will also put all the files there that are strictly necessary to compile and run" echo " your application." exit @@ -94,7 +94,7 @@ echo "Start building the new project" #cd $TargetDir #aclocal || exit #autoheader || exit -#automake --add-missing --copy --gnu || exit +#automake --add-missing --copy --gnu || exit # !!!!! uncompatible option: --force-missing for the latest version of automake diff --git a/eo/tutorial/Templates/eoMyStruct.tmpl b/eo/tutorial/Templates/eoMyStruct.tmpl index ddf4e008..f68def2a 100644 --- a/eo/tutorial/Templates/eoMyStruct.tmpl +++ b/eo/tutorial/Templates/eoMyStruct.tmpl @@ -14,11 +14,11 @@ Mandatory: However, if you are using dynamic memory, there are 2 places to allocate it: the default constructor (if possible?), or, more in the EO spirit, the eoInit object, that you will need to write anyway -(template file init.tmpl). +(template file init.tmpl). But remember that a COPY CONSTRUCTOR will be used in many places in EO, so make sure that the default copy constructor works, or, even better, -do write your own if in doubt. +do write your own if in doubt. And of course write the corresponding destructor! */ @@ -26,7 +26,7 @@ And of course write the corresponding destructor! #ifndef _eoMyStruct_h #define _eoMyStruct_h -/** +/** * Always write a comment in this format before class definition * if you want the class to be documented by Doxygen @@ -35,7 +35,7 @@ And of course write the corresponding destructor! * like eoVector for instance, if you handle a vector of something.... * If you create a structure from scratch, - * the only thing you need to provide are + * the only thing you need to provide are * a default constructor * IO routines printOn and readFrom * @@ -46,11 +46,11 @@ template< class FitT> class eoMyStruct: public EO { public: /** Ctor: you MUST provide a default ctor. - * though such individuals will generally be processed + * though such individuals will generally be processed * by some eoInit object */ - eoMyStruct() - { + eoMyStruct() + { // START Code of default Ctor of an eoMyStruct object // END Code of default Ctor of an eoMyStruct object } @@ -60,11 +60,11 @@ public: * If this is the case, uncomment and fill the following */ /* - eoMyStruct(const eoMyStruct &) - { + eoMyStruct(const eoMyStruct &) + { // START Code of copy Ctor of an eoMyStruct object // END Code of copy Ctor of an eoMyStruct object - } + } */ @@ -82,7 +82,7 @@ public: // First write the fitness EO::printOn(os); os << ' '; - // START Code of default output + // START Code of default output /** HINTS * in EO we systematically write the sizes of things before the things @@ -92,7 +92,7 @@ public: // END Code of default output } - /** reading... + /** reading... * of course, your readFrom must be able to read what printOn writes!!! */ void readFrom(istream& is) @@ -115,4 +115,3 @@ private: // put all data here }; #endif - diff --git a/eo/tutorial/Templates/evalFunc.tmpl b/eo/tutorial/Templates/evalFunc.tmpl index b8c9f1ed..34eae4c4 100644 --- a/eo/tutorial/Templates/evalFunc.tmpl +++ b/eo/tutorial/Templates/evalFunc.tmpl @@ -1,13 +1,13 @@ /** -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - + The above line is usefulin Emacs-like editors */ - + /* Template for evaluator in EO, a functor that computes the fitness of an EO ========================================================================== */ - + #ifndef _eoMyStructEvalFunc_h #define _eoMyStructEvalFunc_h @@ -18,7 +18,7 @@ Template for evaluator in EO, a functor that computes the fitness of an EO // include the base definition of eoEvalFunc #include "eoEvalFunc.h" -/** +/** Always write a comment in this format before class definition if you want the class to be documented by Doxygen */ @@ -29,7 +29,7 @@ public: /// Ctor - no requirement // START eventually add or modify the anyVariable argument eoMyStructEvalFunc() - // eoMyStructEvalFunc( varType _anyVariable) : anyVariable(_anyVariable) + // eoMyStructEvalFunc( varType _anyVariable) : anyVariable(_anyVariable) // END eventually add or modify the anyVariable argument { // START Code of Ctor of an eoMyStructEvalFunc object @@ -39,7 +39,7 @@ public: /** Actually compute the fitness * * @param EOT & _eo the EO object to evaluate - * it should stay templatized to be usable + * it should stay templatized to be usable * with any fitness type */ void operator()(EOT & _eo) diff --git a/eo/tutorial/Templates/init.tmpl b/eo/tutorial/Templates/init.tmpl index f3c0fbd9..d49e52ef 100644 --- a/eo/tutorial/Templates/init.tmpl +++ b/eo/tutorial/Templates/init.tmpl @@ -14,12 +14,12 @@ Template for EO objects initialization in EO // include the base definition of eoInit #include -/** +/** * Always write a comment in this format before class definition * if you want the class to be documented by Doxygen * * There is NO ASSUMPTION on the class GenoypeT. - * In particular, it does not need to derive from EO (e.g. to initialize + * In particular, it does not need to derive from EO (e.g. to initialize * atoms of an eoVector you will need an eoInit) */ template @@ -28,7 +28,7 @@ public: /// Ctor - no requirement // START eventually add or modify the anyVariable argument eoMyStructInit() - // eoMyStructInit( varType _anyVariable) : anyVariable(_anyVariable) + // eoMyStructInit( varType _anyVariable) : anyVariable(_anyVariable) // END eventually add or modify the anyVariable argument { // START Code of Ctor of an eoMyStructInit object @@ -55,4 +55,3 @@ private: }; #endif - diff --git a/eo/tutorial/Templates/lessOffspringExternalSelectorGenOp.tmpl b/eo/tutorial/Templates/lessOffspringExternalSelectorGenOp.tmpl index 9a0c3c42..fea5a2a6 100644 --- a/eo/tutorial/Templates/lessOffspringExternalSelectorGenOp.tmpl +++ b/eo/tutorial/Templates/lessOffspringExternalSelectorGenOp.tmpl @@ -10,7 +10,7 @@ i.e. that takes any number of parents and generates any number of offspring a GenOp that creates less offspring than there are parents -Second version, get parents using an external eoSelectOne +Second version, get parents using an external eoSelectOne */ #ifndef eoLessOffspringExternalSelectorGenOp_H @@ -18,21 +18,21 @@ Second version, get parents using an external eoSelectOne #include -/** +/** * Always write a comment in this format before class definition * if you want the class to be documented by Doxygen * - * ATTENTION, class EOT *must* derive from EO, as method invalidate() + * ATTENTION, class EOT *must* derive from EO, as method invalidate() * must be called if the genotypes of the indis is modified */ -template +template class eoLessOffspringExternalSelectorGenOp: public eoGenOp { public: /** * (Default) Constructor. */ - eoLessOffspringExternalSelectorGenOp(eoSelectOne & _sel, paramType _anyParameter) : + eoLessOffspringExternalSelectorGenOp(eoSelectOne & _sel, paramType _anyParameter) : sel(_sel), anyParameter(_anyParameter) {} /// The class name. Used to display statistics @@ -58,11 +58,11 @@ public: // get extra parents - use private selector // _plop.source() is the eoPop used by _plop to get parents // WARNING: you are not allowed to modify them (mandatory "const") - const EOT& parentN+1 = sel(_plop.source()); - ... - const EOT& parentN+K = sel(_plop.source()); + const EOT& parentN+1 = sel(_plop.source()); + ... + const EOT& parentN+K = sel(_plop.source()); - // modify (in place) the "true" parents + // modify (in place) the "true" parents // (i.e. parent1, ..., parentsN) ... diff --git a/eo/tutorial/Templates/lessOffspringSameSelectorGenOp.tmpl b/eo/tutorial/Templates/lessOffspringSameSelectorGenOp.tmpl index c0790f93..8fdd8ff6 100644 --- a/eo/tutorial/Templates/lessOffspringSameSelectorGenOp.tmpl +++ b/eo/tutorial/Templates/lessOffspringSameSelectorGenOp.tmpl @@ -18,21 +18,21 @@ First version, get parents from populator using the imbedded select() method #include -/** +/** * Always write a comment in this format before class definition * if you want the class to be documented by Doxygen * - * ATTENTION, class EOT *must* derive from EO, as method invalidate() + * ATTENTION, class EOT *must* derive from EO, as method invalidate() * must be called if the genotypes of the indis is modified */ -template +template class eoLessOffspringSameSelectorGenOp: public eoGenOp { public: /** * (Default) Constructor. */ - eoLessOffspringSameSelectorGenOp(paramType _anyParameter) : + eoLessOffspringSameSelectorGenOp(paramType _anyParameter) : anyParameter(_anyParameter) {} /// The class name. Used to display statistics @@ -42,7 +42,7 @@ public: unsigned max_production(void) { return NbLeftParents; } /** - * eoLesOffspringSameSelectorGenOp operator - + * eoLesOffspringSameSelectorGenOp operator - * gets extra parents from the populator * * @param _pop a POPULATOR (not a simple population) diff --git a/eo/tutorial/Templates/make_MyStruct.cpp b/eo/tutorial/Templates/make_MyStruct.cpp index cf4804ce..aaf183c9 100644 --- a/eo/tutorial/Templates/make_MyStruct.cpp +++ b/eo/tutorial/Templates/make_MyStruct.cpp @@ -126,4 +126,3 @@ void run_ea(eoAlgo >& _ga, eoPop * - * It could be here tempatized only on the fitness, as it can be used + * It could be here tempatized only on the fitness, as it can be used * to evolve structures with any fitness. - * However, for consistency reasons, it was finally chosen, as in - * the rest of EO, to templatize by the full EOT, as this eventually + * However, for consistency reasons, it was finally chosen, as in + * the rest of EO, to templatize by the full EOT, as this eventually * allows to choose the type of genotype at run time (see in es dir) * - * It returns an eoInit that can later be used to initialize + * It returns an eoInit that can later be used to initialize * the population (see make_pop.h). * * It uses a parser (to get user parameters) and a state (to store the memory) * the last argument is to disambiguate the call upon different instanciations. * - * WARNING: that last argument will generally be the result of calling - * the default ctor of EOT, resulting in most cases in an EOT + * WARNING: that last argument will generally be the result of calling + * the default ctor of EOT, resulting in most cases in an EOT * that is ***not properly initialized*** */ template eoInit & do_make_genotype(eoParser& _parser, eoState& _state, EOT) { - // read any useful parameter here from the parser + // read any useful parameter here from the parser // the param itself will belong to the parser (as far as memory is concerned) // paramType & param = _parser.createParam(deafultValue, "Keyword", "Comment to appear in help and status", 'c',"Section of status file").value(); diff --git a/eo/tutorial/Templates/make_op_MyStruct.h b/eo/tutorial/Templates/make_op_MyStruct.h index 8b43d17b..d857e895 100644 --- a/eo/tutorial/Templates/make_op_MyStruct.h +++ b/eo/tutorial/Templates/make_op_MyStruct.h @@ -3,7 +3,7 @@ //----------------------------------------------------------------------------- // make_op_MyStruct.h // (c) Marc Schoenauer, Maarten Keijzer and GeNeura Team, 2001 -/* +/* This library 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 @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact: todos@geneura.ugr.es, http://geneura.ugr.es - Marc.Schoenauer@polytechnique.fr - mkeijzer@dhi.dk + Marc.Schoenauer@polytechnique.fr + mkeijzer@dhi.dk */ //----------------------------------------------------------------------------- @@ -35,14 +35,14 @@ // combinations of simple eoOps (eoMonOp and eoQuadOp) #include -/** definition of mutation: +/** definition of mutation: * class eoMyStructMonop MUST derive from eoMonOp */ #include "eoMyStructMutation.h" -/** definition of crossover (either as eoBinOp (2->1) or eoQuadOp (2->2): +/** definition of crossover (either as eoBinOp (2->1) or eoQuadOp (2->2): * class eoMyStructBinCrossover MUST derive from eoBinOp - * OR + * OR * class eoMyStructQuadCrossover MUST derive from eoQuadOp */ // #include "eoMyStructBinOp.h" @@ -61,9 +61,9 @@ * This function builds the operators that will be applied to the eoMyStruct * * It uses a parser (to get user parameters), a state (to store the memory) - * the last parameter is an eoInit: if some operator needs some info + * the last parameter is an eoInit: if some operator needs some info * about the genotypes, the init has it all (e.g. bounds, ...) - * Simply do + * Simply do * EOT myEO; * _init(myEO); * and myEO is then an ACTUAL object @@ -85,7 +85,7 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit2) only - no time for the eoBinOp case // you can have more than one - combined in a proportional way - + // first, define the crossover objects and read their rates from the parser - - // A first crossover + + // A first crossover eoQuadOp *cross = new eoMyStructQuadCrossover /* (varType _anyVariable) */; // store in the state _state.storeFunctor(cross); @@ -106,21 +106,21 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit *propXover = + eoPropCombinedQuadOp *propXover = new eoPropCombinedQuadOp(*cross, cross1Rate); // and of course stor it in the state _state.storeFunctor(propXover); - // Optional: A second(and third, and ...) crossover + // Optional: A second(and third, and ...) crossover // of course you must create the corresponding classes // and all ***MUST*** derive from eoQuadOp /* Uncomment if necessary - and replicate as many time as you need - cross = new eoMyStructSecondCrossover(varType _anyVariable); + cross = new eoMyStructSecondCrossover(varType _anyVariable); _state.storeFunctor(cross); - double cross2Rate = _parser.createParam(1.0, "cross2Rate", "Relative rate for crossover 2", '2', "Variation Operators").value(); - propXover.add(*cross, cross2Rate); + double cross2Rate = _parser.createParam(1.0, "cross2Rate", "Relative rate for crossover 2", '2', "Variation Operators").value(); + propXover.add(*cross, cross2Rate); */ // if you want some gentle output, the last one shoudl be like // propXover.add(*cross, crossXXXRate, true); @@ -130,12 +130,12 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit *mut = new eoMyStructMutation/* (varType _anyVariable) */; _state.storeFunctor(mut); // its relative rate in the combination @@ -151,8 +151,8 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit(varType _anyVariable); _state.storeFunctor(mut); - double mut2Rate = _parser.createParam(1.0, "mut2Rate", "Relative rate for mutation 2", '2', "Variation Operators").value(); - propMutation.add(*mut, mut2Rate); + double mut2Rate = _parser.createParam(1.0, "mut2Rate", "Relative rate for mutation 2", '2', "Variation Operators").value(); + propMutation.add(*mut, mut2Rate); */ // if you want some gentle output, the last one shoudl be like // propMutation.add(*mut, mutXXXRate, true); @@ -170,7 +170,7 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit -/** +/** * Always write a comment in this format before class definition * if you want the class to be documented by Doxygen * - * ATTENTION, class EOT *must* derive from EO, as method invalidate() + * ATTENTION, class EOT *must* derive from EO, as method invalidate() * must be called if the genotypes of the indis is modified */ -template +template class eoMoreOffspringGenOp: public eoGenOp { public: /** * (Default) Constructor. */ - eoMoreOffspringGenOp(paramType _anyParameter) : + eoMoreOffspringGenOp(paramType _anyParameter) : anyParameter(_anyParameter) {} /// The class name. Used to display statistics @@ -52,16 +52,16 @@ public: ++_plop; // advance once for each selected parents ... EOT& parentN = *_plop; // select the last parent - // don't advance after the last one: _plop always - // points to the last that has already been treated + // don't advance after the last one: _plop always + // points to the last that has already been treated // apply operator to the parents (modifying them AND generating - // new individuals ofs1, ofs2, ..., ofsN + // new individuals ofs1, ofs2, ..., ofsN ++_plop; // advance before each insertion _plop.insert(ofs1); ... ++_plop; // advance before each insertion - _plop.insert(ofsN); + _plop.insert(ofsN); // oh right, and invalidate fitnesses of modified parents parent1.invalidate(); diff --git a/eo/tutorial/Templates/stat.tmpl b/eo/tutorial/Templates/stat.tmpl index c53602da..9f807d24 100644 --- a/eo/tutorial/Templates/stat.tmpl +++ b/eo/tutorial/Templates/stat.tmpl @@ -46,7 +46,7 @@ public : } void operator()(const eoPop& _pop){ - double tmpStat(0.); + double tmpStat(0.); // START Code for computing the statistics - in tmpStat // tmpStat = blablabla // END Code for computing the statistics @@ -61,4 +61,3 @@ private : }; #endif - diff --git a/website/index.html b/website/index.html index da004b87..e72daad4 100644 --- a/website/index.html +++ b/website/index.html @@ -22,57 +22,57 @@
Evolving Objects logo @@ -140,7 +140,7 @@
We have lost all the mailing-list subscriptions in a crash, please subscribe again on the eodev-main subscription page.
-

Evolutionary algorithms forms a family of algorithms inspired by the theory of evolution, that solve various problems. +

Evolutionary algorithms forms a family of algorithms inspired by the theory of evolution, that solve various problems. They evolve a set of solutions to a given problem, in order to produce the best results. These are stochastic algorithms, because they iteratively use random processes. The vast majority of these methods are used to solve optimization problems, and may be also called "metaheuristics". @@ -179,10 +179,10 @@

Component-based framework

-

Designing an algorithm with EO consists in choosing what components you want to use for your specific needs, just as building a structure with Lego blocks.

-

If you have a classical problem for which available code exists (for example if you have a black-box problem with real-valued variables), you will just choose components to form an algorithm and connect it to your fitness function (which computes the quality of a given solution).

-

If your problem is a bit more exotic, you will have to code a class that represents how your individuals (a solution to your problem) are represented, and perhaps some variations operators, but most of the other operators (selection, replacement, stopping criteria, command-line interface, etc.) are already available in EO.

-

+

Designing an algorithm with EO consists in choosing what components you want to use for your specific needs, just as building a structure with Lego blocks.

+

If you have a classical problem for which available code exists (for example if you have a black-box problem with real-valued variables), you will just choose components to form an algorithm and connect it to your fitness function (which computes the quality of a given solution).

+

If your problem is a bit more exotic, you will have to code a class that represents how your individuals (a solution to your problem) are represented, and perhaps some variations operators, but most of the other operators (selection, replacement, stopping criteria, command-line interface, etc.) are already available in EO.

+

Main Features

@@ -190,134 +190,134 @@ - - - - + + + +
Examples of problems that you can solve with the help of EO:
- -
- -
- -
Examples of problems that you can solve with the help of EO:
+ +
+ +
+ +
    -
  • Flexible design that permits to easily create virtually any algorithm
  • -
  • Solution representation for continuous and combinatorial problems: -
      -
    • binary-strings,
    • -
    • permutations,
    • -
    • vectors,
    • -
    • easily write your own,
    • -
    • …
    • -
    -
  • -
  • Several algorithm paradigms: -
      -
    • evolution strategies,
    • -
    • genetic algorithms,
    • -
    • estimation of distribution,
    • -
    • particle swarm optimization
    • -
    • …
    • -
    -
  • -
  • Many selection and replacement operators: -
      -
    • rank-based,
    • -
    • deterministic or stochastic tournaments,
    • -
    • roulette,
    • -
    • elitism,
    • -
    • …
    • -
    -
  • -
  • Ready-to-use variations operators: -
      -
    • uniform initializer, -
    • gaussian mutation, -
    • subtree crossover, -
    • …
    • -
    -
  • -
  • Easy combination of several operators: -
      -
    • proportional combination,
    • -
    • sequential call,
    • -
    • …
    • -
    -
  • -
  • Portable and human-readable parameter files
  • -
  • Suspend and load population from files
  • -
  • Versatile checkpointing and logging: -
      -
    • graphical display,
    • -
    • file dump,
    • -
    • various statistics,
    • -
    • signal catching,
    • -
    • …
    • -
    -
  • -
  • Mersenne Twister random number generator (and various distributions)
  • -
  • No useless computation (sparing fitness call, functor-based calls)
  • -
  • Fast running speed, thanks to C++
  • -
  • And more!
  • +
  • Flexible design that permits to easily create virtually any algorithm
  • +
  • Solution representation for continuous and combinatorial problems: +
      +
    • binary-strings,
    • +
    • permutations,
    • +
    • vectors,
    • +
    • easily write your own,
    • +
    • …
    • +
    +
  • +
  • Several algorithm paradigms: +
      +
    • evolution strategies,
    • +
    • genetic algorithms,
    • +
    • estimation of distribution,
    • +
    • particle swarm optimization
    • +
    • …
    • +
    +
  • +
  • Many selection and replacement operators: +
      +
    • rank-based,
    • +
    • deterministic or stochastic tournaments,
    • +
    • roulette,
    • +
    • elitism,
    • +
    • …
    • +
    +
  • +
  • Ready-to-use variations operators: +
      +
    • uniform initializer, +
    • gaussian mutation, +
    • subtree crossover, +
    • …
    • +
    +
  • +
  • Easy combination of several operators: +
      +
    • proportional combination,
    • +
    • sequential call,
    • +
    • …
    • +
    +
  • +
  • Portable and human-readable parameter files
  • +
  • Suspend and load population from files
  • +
  • Versatile checkpointing and logging: +
      +
    • graphical display,
    • +
    • file dump,
    • +
    • various statistics,
    • +
    • signal catching,
    • +
    • …
    • +
    +
  • +
  • Mersenne Twister random number generator (and various distributions)
  • +
  • No useless computation (sparing fitness call, functor-based calls)
  • +
  • Fast running speed, thanks to C++
  • +
  • And more!

Portability

-

EO should work on Windows and any Un*x-like operating system with a - standard-conforming C++ development system.

+

EO should work on Windows and any Un*x-like operating system with a + standard-conforming C++ development system.

-

Recent versions of EO have been tested on the following platforms: -

- -
    -
  • Linux x86 with GCC 3.x and 4.x
  • -
  • Linux x86_64 with GCC 3.x and GCC 4.x
  • -
  • MacOS X/Darwin PowerPC with GCC 3.x
  • -
  • MacOS X/Darwin x86 with GCC 4.x
  • -
  • Microsoft Windows using Cygwin's GCC 3.x (cygming special). -
  • Microsoft Windows using Visual Studio 2003/2005; projects files - are provided.
  • -
  • Solaris SPARC with GCC 3.x
  • -
  • Solaris x86 with GCC 3.x
  • -
+

Recent versions of EO have been tested on the following platforms: +

-

Recent versions of EO uses the CMake portable build system, that permits to easily generate a build chain for your environment.

+
    +
  • Linux x86 with GCC 3.x and 4.x
  • +
  • Linux x86_64 with GCC 3.x and GCC 4.x
  • +
  • MacOS X/Darwin PowerPC with GCC 3.x
  • +
  • MacOS X/Darwin x86 with GCC 4.x
  • +
  • Microsoft Windows using Cygwin's GCC 3.x (cygming special). +
  • Microsoft Windows using Visual Studio 2003/2005; projects files + are provided.
  • +
  • Solaris SPARC with GCC 3.x
  • +
  • Solaris x86 with GCC 3.x
  • +
-

If you have tested EO on a system not listed here, please let - us know.

+

Recent versions of EO uses the CMake portable build system, that permits to easily generate a build chain for your environment.

+ +

If you have tested EO on a system not listed here, please let + us know.

+ +

If you are working on a system with an older C++ compiler there + is a good chance that eo-0.9.3z.1 works. It is tested on Linux + with gcc-2.9x and several systems (IRIX, Solaris) with egcs.

-

If you are working on a system with an older C++ compiler there - is a good chance that eo-0.9.3z.1 works. It is tested on Linux - with gcc-2.9x and several systems (IRIX, Solaris) with egcs.

-

Presentations

- -

A functional and "philosophical" overview of EO was presented at EA'01 conference. - You can download the paper - or the - slides, or browse them right here:

- + +

A functional and "philosophical" overview of EO was presented at EA'01 conference. + You can download the paper + or the + slides, or browse them right here:

+ -

You can also read this - PowerPoint presentation, that shows the EO philosophy. - It includes a Visual Basic macro for evolving objects in Visual Basic - for Applications.

+

You can also read this + PowerPoint presentation, that shows the EO philosophy. + It includes a Visual Basic macro for evolving objects in Visual Basic + for Applications.

+ +

EO is described in the following scientific article:
+

M. Keijzer, J.J. Merelo, G. Romero, G., M. Schoenauer, + "Evolving + objects: A general purpose evolutionary computation + library", Artificial Evolution, 2310, 829--888 (2002).
+

-

EO is described in the following scientific article:
-

M. Keijzer, J.J. Merelo, G. Romero, G., M. Schoenauer, - "Evolving - objects: A general purpose evolutionary computation - library", Artificial Evolution, 2310, 829--888 (2002).
-

-

@Article{Keijzer2001,
@@ -340,187 +340,187 @@

- -

Here is a list of some known publications that used EO:

-