Custom Population Initialiser problem

Martin MacRobert martin at mediavillage.org.au
Sat Oct 28 00:04:08 EDT 2000


Hi all,
I'm trying to create a custom population intialiser function, but I
having a few problems.

The intent is to intialise a population with each candidate value spaced

linearly within the search space, instead of the default random
initialiser. The problem I am solving invloves time-stepping and I
intend to constrict the intial spread of candidates, based on the answer

of the previous timestep, to accelerate convergence to a solution.The
mapping range will remain the same just in case the answer is outside
that intial spread, so there is a chance that a solution might still be
obtained.

There seems to be a problem with my intialiser, that I am unaware of. It

seems fairly straight forward:
a static function is defined thus:

void CGeneticSolver::LinearInitializer(GAPopulation &pop)
{
    CGeneticInfo& GeneticInfo =
*(static_cast<CGeneticInfo*>(pop.userData()));

    double dMin,dMax;
    dMin = GeneticInfo.m_dMin;
    dMax = GeneticInfo.m_dMax;

    float value;
    int nPopulation = pop.size();
    // create an even spread of candidates across dMin->dMax using  y =
a + bx
    for (int i = 0; i < nPopulation; i++)
    {
        GABin2DecGenome& g = (GABin2DecGenome&)pop.individual(i);
        value = (dMin + float(i)/(float(nPopulation)*(dMax - dMin));
        g.phenotype(0,value);
    }
}

Stepping through the code indeed produces a value that increments
appropriately, but is the individual genome-phenotype being set
correctly? Are these values retained?

When I use my initialiser the solution to the problem returns 0. After
analysing the mathematics, I know that 0 is not a solution. When I
disable my initialiser, the code behaves normally, yielding correct
solutions.

Any help would be greatly appreciated.
Thanks once again.
Martin







More information about the galib mailing list