diff --git a/eo/src/utils/eoStat.h b/eo/src/utils/eoStat.h index b4e8c4592..b7b912785 100644 --- a/eo/src/utils/eoStat.h +++ b/eo/src/utils/eoStat.h @@ -38,7 +38,7 @@ Contact: http://eodev.sourceforge.net #include #include #include -#include +//#include /** @defgroup Stats Statistics computation * @@ -435,16 +435,21 @@ public: virtual void operator()( const eoPop & _pop ) { - eoPop pop = _pop; + if( _pop.size() == 0 ) { + // how to implement value() = 0 ? - unsigned int quartile = pop.size()/4; - std::nth_element( pop.begin(), pop.begin()+quartile*1, pop.end() ); - typename EOT::Fitness Q1 = pop[quartile].fitness(); - - std::nth_element( pop.begin(), pop.begin()+quartile*3, pop.end() ); - typename EOT::Fitness Q3 = pop[quartile*3].fitness(); + } else { + eoPop pop = _pop; - value() = Q1 - Q3; + unsigned int quartile = pop.size()/4; + std::nth_element( pop.begin(), pop.begin()+quartile*1, pop.end() ); + typename EOT::Fitness Q1 = pop[quartile].fitness(); + + std::nth_element( pop.begin(), pop.begin()+quartile*3, pop.end() ); + typename EOT::Fitness Q3 = pop[quartile*3].fitness(); + + value() = Q1 - Q3; + } } virtual std::string className(void) const { return "eoInterquartileRangeStat"; }