[galib] replacement of best individual

matthew wall mwall at oculustech.com
Wed Aug 20 08:51:15 EDT 2008

On 18 Aug 2008, at 20:02, Kupfer, Michael (ARC-AFA)[UC SANTA CRUZ]  
> Dear all,
> Under certain conditions, I would like to replace the current best  
> individual with another one:
> Each time a new best individual is found I want to run a local  
> search heuristic to improve this current best.
> If this improvement routine was successful, I would like to replace  
> the current best with the result of the local search.
> How can I do the replacement? How can I replace pop.best() with the  
> gene-values found in the improvement routine?

hi michael,

one approach is to create your own genetic algorithm object, since it  
has access to and complete control over the population.  for example,  
this is a derivative of a simple ga that does repair

class MyGA : public GASimpleGA {
   virtual void step();

MyGA::step() {
   // let the simple ga do its logic for a single step of evolution

   // this is the genome into which you stick the repairs
   MyGenome genome;

   // do your heuristic to improve the best here

   // insert the genome into the population at the appropriate location

More information about the galib mailing list