Help: adding an individual to the initial population

Raj Subbu subbu at eamri.rpi.edu
Thu Oct 30 21:03:53 EST 1997


There is no need for any derivations for adding a seed member if that is
what you are after.

In order to set a gene in an array type genome you can use the array []
operators provided.

In order to add a member as a seed, you may use the add(...) function in
the population object.  If your GA is an object called "ga" and you have
a Genome object called "genome"

all you need to do is something like ga.population.add(genome)

and you should be set.  Along the same lines, you can also use the
remove(...) function in the population object to remove bad guys.

Hope this helps

------------------------------------------------------------

Cristina Malheiro Silva wrote:
> 
> On Thu, 30 Oct 1997, Roberto Olmi wrote:
> 
> > Dear GAlibbers,
> >
> > perhaps it is a stupid question, but:
> >
> I also had this problem.
> 
> > how can I add an individual of my choice to an initial population before
> > beginning the game?
> > Suppose I have a GARealGenome using a single allele set, and I want to add
> > a certain gene value,
> > which is supposedly close to the solution, in order to speed up
> > convergence. How can I do it?
> 
> This is my solution. Maybe there's a better one.
> 
> I've derived my own genome from GA*Genome, redefining the initilize method
> for initializing the genes with special values. The special values, in my
> case, are specified in a file.
> Instead of creating a population by cloning MyGenome, I've add N MyGenome
> that are initialized randomly and M MyGenome that are initialized from
> file. The initialization method depends on a flag that is a data member of
> MyGenome.
> To get the expected results I had to decomment a line of code in GALib in
> the file gasimple.ccp that initializes oldPop. You may find this line of
> code in the initialize method of GASimpleGA.
> 
> I hope my explanation will help you,
> 
> Cristina.

-- 
Raj





More information about the galib mailing list