[galib] custom scaling scheme

Michele Conconi michele.conconi at unibo.it
Mon Apr 27 05:49:02 EDT 2009

Hi everybody.

I'm trying to define a distance function to pass to the GAShering 
scaling method. My code is

MyDistance(const GAGenome & c1, const GAGenome & c2, const GAPopulation 
& pi){
  GARealGenome & a = (GARealGenome &)c1;
  GARealGenome & b = (GARealGenome &)c2;

  float den=pi.best().score()-pi.worst().score();
  float dist=0;

  if(den!= 0)

  return dist;

This not works, returning the error message

error C2664: 'GASharing::GASharing(GAGenome::Comparator,float,float)' : 
cannot convert parameter 1 from 'float (__cdecl *)(const GAGenome 
&,const GAGenome &,const GAPopulation &)' to 'GAGenome::Comparator'

Clearly i can not pass GAPopulation as a third argument to the 
comparator. So, how could pass information about best and worst score in 
the population to my distance function?

Basically I'm trying to do this because, evaluating my objective 
function for different genome, I obtain  very large values which differ 
not much compared with their magnitude, so that the fitness scores of 
different genomes are close each other. Could this method represent a 

Thanks in advance


* Eng. Michele Conconi*
Ph.D. student
DIEM - Dept. of Mechanical Engineering
Alma Mater Studiorum - University of Bologna
Viale Risorgimento 2, 40136, Bologna, Italy
Email: michele.conconi at unibo.it
Website: http://www.diem.ing.unibo.it/grab
Office: (+39) 051 20 93451
Mobile: (+39) 329 0287996

Questo messaggio contiene informazioni riservate e confidenziali.
Se il lettore non fosse il destinatario del messaggio, inoltrato e 
ricevuto per errore,
il testo dovrà essere immediatamente cancellato dal computer del ricevente.
E' assolutamente proibita qualunque circolazione, disseminazione o
copia del messaggio spedito e/o ricevuto per errore.

This message may contain legally privileged or confidential information.
If the reader is not the intended recipient, you received this message 
in error
and it should therefore be deleted from your computer at once.
Any dissemination, distribution and copying of a message
mistakenly sent or received is strictly forbidden.

More information about the galib mailing list