[galib] Help about the GARealGenome

LarryZhang larryzzl at sohu.com
Thu Jul 8 02:50:37 EDT 2004

Hello every one:
	I'm a Chinese student at ECNU, also I'm a new user of GALib. Today I
wrote some codes about the GARealGenome, I success in compiling it but fault
in running it. I don't know why it is, can anybody run it for me and tell me
the reason?
Thanks a lot.

Here's the code

float objective(GAGenome &);


  GARealAlleleSetArray alleles;
  alleles.add(6, 15);
  alleles.add(0, 5);
  GARealGenome genome(alleles, objective);

// It faults here
  GASimpleGA ga(genome);


float objective(GAGenome & c)
  GARealGenome& genome = (GARealGenome &)c;

  float y;
  y = genome.gene(0) * genome.gene(0);
  y -= genome.gene(1) * genome.gene(1);
  return y;

Larry Zhang
ECNU Radiophysics Dept.
Sunny Every Day

More information about the galib mailing list