ECJ-INTEREST-L Archives

November 2006

ECJ-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
John Woodward <[log in to unmask]>
Reply To:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Date:
Tue, 28 Nov 2006 17:50:23 +0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (34 lines)
Hi,

I am working on a problem where I would like to compare two
individuals according to one fitness function (if one beats the other
then it is promoted to the next generation).
However, it is possible that two individuals have the same fitness, so
to differentiate them I call on a second fitness function.

Something like this

ind choice(ind ind1, ind ind2) {
   if(ind1.fitness == ind2.fitness)//if they are equal
       return choice2(ind1, ind2)//call on the second fitness function
   else
      if(ind1.fitness < ind2.fitness)
         return ind1
      else
         return ind2
}

ind choice2(ind ind1, ind ind2) {
      if(ind1.fitness2 < ind2.fitness2)
                   //fitness2 is the fitness according to the second
fitness function
         return ind1
      else
         return ind2
}


-- 
Thanks,
John Woodward.

ATOM RSS1 RSS2