[galib] Multiple evaluations

Miguel Nicolau Miguel.Nicolau at ul.ie
Fri Mar 18 17:03:22 EST 2005


On Tue, 15 Mar 2005, Ulises Estrada wrote:

> Hi, I'm trying to make an evaluation function that changes randomly
> but, I want all the individuals that belongs to the same generation be
> evaluated with the same evaluation function. Since the info about the
> evaluations is inside the GA object and not inside the GENOME object,
> how can I give such information to the evaluation function? Any ideas
> how I might be able to do this ?

(I hope it's ok if I answer this)

Hello Ulises,

You need to break down the evolutionary cycle onto generational steps. 
That is, rather than calling ga.evolve(), which makes the whole 
evolutionary process in one go, use something like the following:

while(!ga.done()){
         ga.step();
         (...)
}

That way, after each generation, you can let your evalution function know 
that a generation has passed (for example, through a global variable, or 
through a call to the function that randomises your evaluation).

See "examples/ex16.C" for a complete example.

Hope this helps

Miguel


More information about the galib mailing list