From e5397f69a64698671d553aad21a0c68a42b837cd Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Wed, 10 Nov 2010 11:18:57 +0100 Subject: [PATCH 1/4] there was a warning from compiler related to a comment syntax in eoInvalidateOps.h --- eo/src/eoInvalidateOps.h | 1 - 1 file changed, 1 deletion(-) diff --git a/eo/src/eoInvalidateOps.h b/eo/src/eoInvalidateOps.h index aa5a1853..ecc470ab 100644 --- a/eo/src/eoInvalidateOps.h +++ b/eo/src/eoInvalidateOps.h @@ -31,7 +31,6 @@ /** @addtogroup Utilities -/** One of the invalidator operators. Use this one as a 'hat' on an operator that is defined to work on a generic datatype. This functor will then check the return type of the operator and invalidate the fitness of the individual. From a22e642b091656cd0f0c3270c4a968f5461aa360 Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 14 Nov 2010 15:07:50 +0100 Subject: [PATCH 2/4] a test binary for eoInterquartileRangeStat --- eo/test/CMakeLists.txt | 4 +-- eo/test/t-eoIQRStat.cpp | 69 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 eo/test/t-eoIQRStat.cpp diff --git a/eo/test/CMakeLists.txt b/eo/test/CMakeLists.txt index 2c0772de..4f194681 100644 --- a/eo/test/CMakeLists.txt +++ b/eo/test/CMakeLists.txt @@ -25,8 +25,6 @@ LINK_DIRECTORIES(${EO_BINARY_DIR}/lib) ###################################################################################### SET (TEST_LIST - t-eoParetoFitness - t-eoPareto t-eofitness t-eoRandom t-eobin @@ -65,8 +63,8 @@ SET (TEST_LIST t-eoSyncEasyPSO t-eoOrderXover t-eoExtendedVelocity - # t-eoFrontSorter t-eoLogger + t-eoIQRStat ) diff --git a/eo/test/t-eoIQRStat.cpp b/eo/test/t-eoIQRStat.cpp new file mode 100644 index 00000000..60bcff8f --- /dev/null +++ b/eo/test/t-eoIQRStat.cpp @@ -0,0 +1,69 @@ + +#include +#include +#include + +#include "real_value.h" + +typedef eoReal realVec; + +double test( eoPop& pop, double target_value ) +{ + eoEvalFuncPtr&> eval( real_value ); + + eoPopLoopEval pop_eval(eval); + + pop_eval(pop,pop); + + eoInterquartileRangeStat iqr_stat(0.0, "IQR"); + + iqr_stat( pop ); + + std::cout << iqr_stat.longName() << "=" << iqr_stat.value() << " should be " << target_value << std::endl; + + return iqr_stat.value(); +} + +int main() +{ + eoPop pop; + + // fixed test + realVec sol1(2,-1); + realVec sol2(2,-1); + realVec sol3(2,1); + realVec sol4(2,1); + pop.push_back( sol1 ); + pop.push_back( sol2 ); + pop.push_back( sol3 ); + pop.push_back( sol4 ); + // on the sphere function everyone has the same fitness of 1 + if( test(pop, 0) != 0 ) { + exit(1); + } + + pop.erase(pop.begin(),pop.end()); + + // fixed test + sol1 = realVec(2,0); + sol2 = realVec(2,0); + sol3 = realVec(2,1); + sol4 = realVec(2,1); + pop.push_back( sol1 ); + pop.push_back( sol2 ); + pop.push_back( sol3 ); + pop.push_back( sol4 ); + if( test(pop, 1) != 1 ) { + exit(1); + } + + // test on a random normal distribution + eoNormalGenerator normal(1,rng); + eoInitFixedLength init_N(2, normal); + pop = eoPop( 1000000, init_N ); + double iqr = test(pop, 1.09); + if( iqr < 1.08 || iqr > 1.11 ) { + exit(1); + } +} + From 4e36150ee8d4d176849d84efe65cc434880945b6 Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 14 Nov 2010 15:11:46 +0100 Subject: [PATCH 3/4] eoInterquartileRangeStat example link to t-eoIQRStat --- eo/src/utils/eoStat.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eo/src/utils/eoStat.h b/eo/src/utils/eoStat.h index b4e8c459..e308b8a9 100644 --- a/eo/src/utils/eoStat.h +++ b/eo/src/utils/eoStat.h @@ -449,7 +449,8 @@ public: virtual std::string className(void) const { return "eoInterquartileRangeStat"; } }; - +/** @example t-eoIQRStat.cpp + */ /** Compute the average size of indivudals over the population * From 04f12b770e3c7889adebea3bef6dbba1b59fe3c1 Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 14 Nov 2010 15:24:35 +0100 Subject: [PATCH 4/4] supress some doxygen warnings about \classes --- eo/src/eoFunctor.h | 2 +- eo/src/eoMergeReduce.h | 6 +++--- eo/src/eoReplacement.h | 6 +++--- eo/src/eoSurviveAndDie.h | 5 +++-- eo/src/utils/eoUniformInit.h | 9 ++++----- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/eo/src/eoFunctor.h b/eo/src/eoFunctor.h index 50c13664..e782328a 100644 --- a/eo/src/eoFunctor.h +++ b/eo/src/eoFunctor.h @@ -29,7 +29,7 @@ #include -/** @ddtogroup Core +/** @addtogroup Core * @{ */ diff --git a/eo/src/eoMergeReduce.h b/eo/src/eoMergeReduce.h index b4c71752..8524f1d8 100644 --- a/eo/src/eoMergeReduce.h +++ b/eo/src/eoMergeReduce.h @@ -37,9 +37,9 @@ /** Replacement strategies that combine en eoMerge and an eoReduce. -@classes: eoMergeReduce, the base (pure abstract) class - eoPlusReplacement the ES plus strategy - eoCommaReplacement the ES comma strategy +@class eoMergeReduce, the base (pure abstract) class +@class eoPlusReplacement the ES plus strategy +@class eoCommaReplacement the ES comma strategy */ /** diff --git a/eo/src/eoReplacement.h b/eo/src/eoReplacement.h index 972aa61a..2c2d8984 100644 --- a/eo/src/eoReplacement.h +++ b/eo/src/eoReplacement.h @@ -57,9 +57,9 @@ MS 12/12/2000 @see eoMerge, eoReduce, eoMergeReduce, eoReduceMerge -@classes eoReplacement, base (pure abstract) class - eoGenerationalReplacement, as it says ... - eoWeakElitistReplacement a wrapper to add elitism +@class eoReplacement, base (pure abstract) class +@class eoGenerationalReplacement, as it says ... +@class eoWeakElitistReplacement a wrapper to add elitism */ diff --git a/eo/src/eoSurviveAndDie.h b/eo/src/eoSurviveAndDie.h index 81e2e310..3650a536 100644 --- a/eo/src/eoSurviveAndDie.h +++ b/eo/src/eoSurviveAndDie.h @@ -42,8 +42,9 @@ kills the ones that are to die, puts the ones that are to survive into the second argument removes them from the first pop argument -@classes: eoSurviveAndDie, eoDeterministicSurviveAndDie, - eoDeterministicSaDReplacement +@class eoSurviveAndDie +@class eoDeterministicSurviveAndDie, +@class eoDeterministicSaDReplacement */ /** @addtogroup Replacors diff --git a/eo/src/utils/eoUniformInit.h b/eo/src/utils/eoUniformInit.h index 005b7f7e..fa1b874d 100644 --- a/eo/src/utils/eoUniformInit.h +++ b/eo/src/utils/eoUniformInit.h @@ -29,11 +29,10 @@ * eoRndGenerators, we might as well have these directly written without * overhead -@classes: - eoUniformInit uniform initialization for doubles, floats, ints, ... - eoBooleanInit biased init for booleans - eoNormalInit normal intialization for doubles and floats - eoNegExpInit negative exponential distributions " +@class eoUniformInit uniform initialization for doubles, floats, ints, ... +@class eoBooleanInit biased init for booleans +@class eoNormalInit normal intialization for doubles and floats +@class eoNegExpInit negative exponential distributions " */ #ifndef eoUniformInit_h