Help: adding an individual to the initial population

Cristina Malheiro Silva l35572 at alfa.ist.utl.pt
Fri Oct 31 03:35:50 EST 1997


On Thu, 30 Oct 1997, Raj Subbu wrote:

> 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.
> 

What you're saying is: first initialize population and then add a genome?
And after that, what will you do? ga.step till ga.done?
I had several problems dealing with changing some population parameters
such as the evaluation function. I had to change the parameters, step,
change the parameters again and then step till done.
When I tried to add special genomes to current population I had the same
problem. I think that oldPop isn't correctly updated.
In my case, I needed to initialize all population with special values and, 
as I already had a GA*Genome, it was simpler to implement my solution,
decommenting that line of code.

Thanks for you suggestion,
Cristina.


> ------------------------------------------------------------
> 
> 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