[galib] Getting several genomes of only 0's...

Peter Jay Salzman p at dirac.org
Sun Dec 23 01:32:54 EST 2007

On Wed 19 Dec 07,  4:57 PM, anselmop at sc.usp.br <anselmop at sc.usp.br> said:
> > 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
> 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

Ola Anselmo,

A previous poster had asked about some code that I looked into and it
*appeared* (I haven't checked this against the source code yet) that in the
absence of an initializer, the genes were being set to their lower limit (at
least for the genome/ga combo he was using).
Dave, unless you already have a good idea where the solution is, you want to
start out with as diverse a population as possible.   If 50 people were to
look for a needle laying on the ground somewhere in a football field,
they'll find it faster if they start looking in random places than if they
all started looking in the same general location.


GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
Last night I dreamt of 09-f9-11-02-9d-74-e3-5b-d8-41-56-c5-63-56-88-c0

"A mathematician is a machine for converting coffee    p at dirac.org
 into theorems."     -- Paul Erdös                     http://www.dirac.org

More information about the galib mailing list