[galib] Concerning minimization.

Eugene dame_eugene at mail.ru
Mon Jun 6 13:48:20 EDT 2005


Hi!
There is a way to tune GA parameters explicitly to minimize objective
instead of maximizing.
You can write something like this (replace GASteadyStateGA with the
GA type you use):

    GAParameterList params;  //create parameters object

    //fill it with default values
    GASteadyStateGA::registerDefaultParameters(params);

    //this is it -
    //gaNminimaxi == GASteadyStateGA::MAXIMIZE by default!
    params.set(gaNminimaxi, GASteadyStateGA::MINIMIZE);

    //set other parameters you need:
    //    population size, probabilities etc.
    //See complete list of GA settings in GALib documentation
    //(/doc/API.html, chapter "Parameter Names and Command-Line Options")

    //Then create your 'template' genome, GA, register those new settings...
    GASteadyStateGA ga(g);
    ga.parameters(params);  //register GA settings

    //...and when ready - run evolution as usual
    ga.evolve();

It may look a bit clumsy but it works. At least with GALib 2.4.5 and
MS VC++ 6.0.
This is not the only way of course. For instance, you could also use
GAGeneticAlgorithm::minimaxi() to set this parameter (see API.html for
details).

As for those who prefer to transform the objective itself - they could
play a little with GA scaling objects. (Scaling transforms objective
score into fitness score.) There are several predefined scaling
schemes in GALib that may fit your needs. Or (as always in GALib) you
can write a brand new scaling scheme and attach it to any existing or
user-defined GA. Again - see API.html and Extensions.html in GALib
docs for a detailed description of GAScalingScheme class and
predefined scaling schemes.

There is almost nothing you cannot customize in this library.

Best regards,
 Eugene Shatokhin




More information about the galib mailing list