simpleGA + deriving classes

Vieri Di Paola vieridipaola at
Thu Oct 26 13:55:45 EDT 2000

I'm a beginner in GA programming and downloaded GAlib
recently. I was wondering if someone could help me
with the following problem.

The algorithm is SGA. I have a population of 400
chromosomes and I use GA1Dbinarystrings of length 32,
max generations is user definable. I need to define my
objective function which analyzes the bit values of
the chromosomes and compares them with
separately-defined proteins (1Dbinarystrings). Should
I do the following?

Objective(GAGenome& g){
  GA1DBinaryString& genome = (GA1DBinaryString &)g;
  // here I compare protein bit values and chromosome
bit values
  return *the result*;
(No decoding must be performed)

I would also like the program to consider, regardless
of user input, a mutation probability of 0.1 up to
generation 50 and a probability of 0.0 for successive
generations. How can I do that in a simple way?

Do I need to define a crossover() function in order
 1 - pick a random number from 1 to 3
 2 - if I get 1 then cross site is 8
     if I get 2 then cross site is 16
     if I get 3 then cross site is 24
(it's a single point crossover)?

I hope I've been clear enough. Let me put it another
way. I am adapting the SGA of David E. Goldberg's book
"Genetic Algorithms in Search, Optimization & Machine
Learning" to GAlib with the above mentioned

Thank you in advance for your help,

Vieri Di Paola

Vieri Di Paola
dipaola at
vieridipaola at
University of Pisa

Do You Yahoo!?
Yahoo! Messenger - Talk while you surf!  It's FREE.

More information about the galib mailing list