[galib] custom scaling scheme

Fábio Roberto Teodoro fr.teodoro at gmail.com
Mon Apr 27 14:21:23 EDT 2009


The Genome have a member function that returns the GAGeneticAlgorithm
that owns it, and the GAGeneticAlgorithm have a member function that
returns the population.

References:

* GAGenome
<http://lancet.mit.edu/galib-2.4/API.html#genome_base>
"GAGeneticAlgorithm * geneticAlgorithm() const"
"geneticAlgorithm
    The member function returns a pointer to the genetic algorithm
that 'owns' the genome. If this function returns nil then the genome
has no genetic algorithm owner. "

* GAGeneticAlgorithm
<http://lancet.mit.edu/galib-2.4/API.html#ga_base>
"const GAPopulation & population() const"
"population
    Set/Get the population. Returns a reference to the current population."

hth

2009/4/27 Michele Conconi <michele.conconi at unibo.it>:
> Hi everybody.
>
> I'm trying to define a distance function to pass to the GAShering
> scaling method. My code is
>
> float
> 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)
>  {
>      dist=fabs(a.score()-b.score())/den;
>  }
>  else
>  {
>     ...
>  }
>
>  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
> solution?
>
> Thanks in advance
>
> Michele
>
>
> --
> * 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
>
>
>
> * INFORMAZIONE RISERVATA E CONFIDENZIALE *
> 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.
>
> * CONFIDENTIALITY and WARNING NOTICE *
> 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.
> _______________________________________________
> galib mailing list
> galib at mit.edu
> http://mailman.mit.edu/mailman/listinfo/galib
>



-- 
Fábio Roberto Teodoro




More information about the galib mailing list