• Main Page
  • Modules
  • Classes
  • Files
  • File List

D:/Projekt/ECF_trunk/ECF/SelBestOp.cpp

00001 #include "ECF_base.h"
00002 #include "SelBestOp.h"
00003 
00004 bool SelBestOp::initialize(StateP state)
00005 {
00006     state_ = state;
00007     return true;
00008 }
00009 
00010 
00011 IndividualP SelBestOp::select(const std::vector<IndividualP>& pool)
00012 {
00013     if(pool.empty())
00014         return IndividualP();
00015 
00016     IndividualP best = pool[0];
00017     for (uint i = 1; i < pool.size(); i++) {
00018         if (!(best->fitness->isBetterThan(pool[i]->fitness))){
00019             best = pool[i];
00020         }
00021     }
00022 
00023     return best;
00024 }
00025 

Generated on Tue Nov 4 2014 13:04:31 for ECF by  doxygen 1.7.1