ECJ-INTEREST-L Archives

November 2006

ECJ-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Proportional Font
Show HTML Part by Default
Condense Mail Headers

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

Print Reply
Sender:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Date:
Tue, 28 Nov 2006 14:15:44 -0500
MIME-version:
1.0 (Apple Message framework v750)
Reply-To:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Content-type:
text/plain; charset=US-ASCII; delsp=yes; format=flowed
Subject:
From:
Sean Luke <[log in to unmask]>
In-Reply-To:
Content-transfer-encoding:
7bit
Comments:
To: ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Parts/Attachments:
text/plain (45 lines)
Sure, there are lots of ways. The easiest and perhaps best:

If you're using tournament selection, then it's a piece of cake.   
Just subclass your Fitness function to (a) store both fitness  
elements inside it and (b) override the equivalentTo and betterThan  
methods to do a lexicographic ordering between the two fitness elements.

Sean

On Nov 28, 2006, at 12:50 PM, John Woodward wrote:

> 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