How to always evaluate? (revised)

Matthew Wall mbwall at MIT.EDU
Thu May 20 19:21:49 EDT 1999


oops.  no need to write a new 'step' method.  simply create your genetic
algorithm using a population that has the population evaluator that you
implemented:

  GARealGenome genome;
  GAPopulation pop(genome, 25);   // for population with 25 individuals
  pop.evaluator(PopulationAlwaysEvaluate);
  GASteadyStateGA ga(pop);
  ga.evolve();


>the 'evaluate' member of the population object is invoked by the genetic
>algorithm object, typically in the 'step' method.  this is typically done
>after all of the mating and mutating.
>
>so the simplest thing to do is derive your own genetic algorithm and write
>a new step method that does pop->evaluate(gaTrue) rather than
>pop->evaluate()
>
>
>>Ok,
>>
>>As I was browsing through the documentation of GAlib last night, I saw
>>that one can change the population evaluator, and if I want to "always
>>evaluate" I could use the following evaluator :
>>
>>1 void
>>2 PopulationAlwaysEvaluate(GAPopulation & p){
>>3   for(int i=0; i<p.size(); i++)
>>4     p.Individual(i).evaluate(gaTrue);
>>5 }
>>
>>Especially the gaTrue at line 4 makes sure every genome is evaluated
>>every generation.
>>
>>Fair enough to me, but now I have this new question... How do I tell
>>Galib, or the running genetic algorithm, that it's population has to be
>>evaluated with this population evaluator?
>>
>>thanks in advance,
>>
>>Anthony Liekens
>>liekens at alife.santafe.edu
>
>
>Matthew Wall
>mbwall at REMOVE_THE_SPAM.mit.edu
>http://mit.edu/mbwall


Matthew Wall
mbwall at REMOVE_THE_SPAM.mit.edu
http://mit.edu/mbwall





More information about the galib mailing list