<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2920.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>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.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>In the previous implementation looked like
that:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2>#######################################################################<BR>#
Termination
Function
#<BR>#
#<BR># It will stop the program when the deviation is below the threshold
#<BR># value, 0.01.
#<BR>#
#<BR>#######################################################################<BR>*/</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>GABoolean
StopWhenNoDeviation(GAGeneticAlgorithm& ga){</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>
if(ga.statistics().current(GAStatistics::Deviation) <
thresh)<BR> return gaTrue;<BR>
else<BR> return gaFalse;<BR> <BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>and it was called by </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>ga.terminator(::StopWhenNoDeviation);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>where</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>GASteadyStateGA ga(genome); </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>and </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>GA1DArrayGenome<float> genome
(ComparisonMatrixSize, objective);</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>I am trying to create my own termination function
based on the following expression MV</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> float MV=0;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> for (int
i=0;i<ComparisonMatrixSize;i++)<BR> {<BR> for (int j = i+1;
j<ComparisonMatrixSize;
j++)<BR> {<BR> MV+=abs(sin(ComparisonMatrix[i][j]-1)-sin(genome.gene(i)-genome.gene(j)))/2;<BR> }<BR> }</FONT></DIV>
<DIV><FONT face=Arial size=2>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> if(MV < thresh)<BR>
return gaTrue;<BR> else<BR> return
gaFalse;<BR> <BR></FONT></FONT></DIV></DIV>
<DIV><FONT face=Arial size=2>The problem is that I cannot pass genome as
parameter. Any help would be much appreciated.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Thanks</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV></BODY></HTML>