Merge branch 'master' of ssh://eodev/gitroot/eodev/eodev
This commit is contained in:
commit
ec70859622
9 changed files with 86 additions and 19 deletions
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <functional>
|
||||
|
||||
/** @ddtogroup Core
|
||||
/** @addtogroup Core
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -454,7 +454,8 @@ public:
|
|||
|
||||
virtual std::string className(void) const { return "eoInterquartileRangeStat"; }
|
||||
};
|
||||
|
||||
/** @example t-eoIQRStat.cpp
|
||||
*/
|
||||
|
||||
/** Compute the average size of indivudals over the population
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
69
eo/test/t-eoIQRStat.cpp
Normal file
69
eo/test/t-eoIQRStat.cpp
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
|
||||
#include <eo>
|
||||
#include <es.h>
|
||||
#include <utils/eoStat.h>
|
||||
|
||||
#include "real_value.h"
|
||||
|
||||
typedef eoReal<eoMinimizingFitness> realVec;
|
||||
|
||||
double test( eoPop<realVec>& pop, double target_value )
|
||||
{
|
||||
eoEvalFuncPtr<realVec, double, const std::vector<double>&> eval( real_value );
|
||||
|
||||
eoPopLoopEval<realVec> pop_eval(eval);
|
||||
|
||||
pop_eval(pop,pop);
|
||||
|
||||
eoInterquartileRangeStat<realVec> 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<realVec> 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<double> normal(1,rng);
|
||||
eoInitFixedLength<realVec> init_N(2, normal);
|
||||
pop = eoPop<realVec>( 1000000, init_N );
|
||||
double iqr = test(pop, 1.09);
|
||||
if( iqr < 1.08 || iqr > 1.11 ) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in a new issue