[galib] Getting several genomes of only 0's...
anselmop@sc.usp.br
anselmop at sc.usp.br
Wed Dec 19 13:57:28 EST 2007
> Message: 1
> Date: Tue, 18 Dec 2007 15:14:11 -0700
> From: David Love <wvpryde at hotmail.com>
> Subject: [galib] Getting several genomes of only 0's after completion
> of first generation, before mutation and crosso
> To: <galib at mit.edu>
> Message-ID: <BAY101-W1050FE12A5C28FF3DD0D83B4630 at phx.gbl>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
> Hi everyone,
>
> I'm doing a GASimpleGA using the GA1DArrayGenome data type. I've
> noticed that after the GA has finished evaluating the first
> generation I receive several genomes for evaluation where every gene
> is given by 0.0, which occurs before the mutation and crossover
> operations. For my problem, a genome with only zero entries is
> invalid, so the algorithm cannot continue.
>
> Is it possible for me to avoid getting these zero genomes? If so, how?
>
> If you need any more information about what I am doing, I can try to
> provide that.
>
> Thanks,
> David
> _________________________________________________________________
> The best games are on Xbox 360. Click here for a special offer on
> an Xbox 360 Console.
> http://www.xbox.com/en-US/hardware/wheretobuy/
Hi, David.
Did you provide the genome with an initialization function? If not,
GALib will use a default initialization, which (hopefully) initializes
each gene of the genome with zero value. Quoting GALib's manual, "This
operator does not actually create new genomes, rather it 'stuffs' the
genomes with the primordial genetic material from which all solutions
will evolve."
When you create a GAPopulation or a GAGeneticAlgorithm object, you
must pass a GAGenome object as argument. It is then cloned to create
all the n population individuals. In other words, after that, all the
individuals in the population are identical. The initialization
function must be called for each individual so that they get diverse
genetic material. Your initialization function must do some sort of
variation in order to accomplish this, using, for example, random
numbers.
What may be happenning with your code is that you didn't provide an
initialization function, and all the individuals are identical to the
first one, which may have all its genes initializes to zero.
In case this isn't your problem, a code snnipet may help to clarify things
Good luck
Anselmo
Eng. Anselmo Pitombeira
Laboratório de Simulação e Controle
NUMA - Núcleo de Manufatura Avançada
Programa de Pós-Graduação em Engenharia Mecânica
EESC-USP
www.simulacao.eesc.sc.usp.br
"As pessoas sem imaginação podem ter tido as mais imprevistas aventuras,
podem ter visitado as terras mais estranhas...Nada lhes ficou. Nada
lhes sobrou.
Uma vida não basta apenas ser vivida: Também precisa ser sonhada."
Mário Quintana
More information about the galib
mailing list