New In Galib, please HELP

Stavros Natsios s.natsios at ntlworld.com
Sat Jan 19 13:49:39 EST 2002


I am new in galib and I am working on a Genetic Algorithm to obtain the priority vector from a given pairwise comparison matrix using user defined parameters. I have been given a previous implemenation of the problem and I need to modify it. More specifically I need to modify the termination function.

In the previous implementation looked like that:

#######################################################################
# Termination Function            #
#               #
# It will stop the program when the deviation is below the threshold  #
# value, 0.01.               #
#                                  #
#######################################################################
*/

GABoolean StopWhenNoDeviation(GAGeneticAlgorithm& ga){

  if(ga.statistics().current(GAStatistics::Deviation) < thresh)
    return gaTrue;
  else
    return gaFalse;
 
}

and it was called by 
 
ga.terminator(::StopWhenNoDeviation);

where
 
GASteadyStateGA ga(genome); 

and 

GA1DArrayGenome<float> genome (ComparisonMatrixSize, objective);


I am trying to create my own termination function based on the following expression MV

 float MV=0;

 for (int i=0;i<ComparisonMatrixSize;i++)
 {
  for (int j = i+1; j<ComparisonMatrixSize; j++)
  {
   MV+=abs(sin(ComparisonMatrix[i][j]-1)-sin(genome.gene(i)-genome.gene(j)))/2;
  }
 }

  if(MV < thresh)
    return gaTrue;
  else
    return gaFalse;
 

The problem is that I cannot pass genome as parameter. Any help would be much appreciated.

Thanks





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/galib/attachments/20020119/ddff4416/attachment.htm


More information about the galib mailing list