0

I'm trying to use fitness/function sharing on a minimization function. I'm using the standard definition of the sharing function found here which then divides the fitness by the niche count. This will lower the fitness, proportional to the amount of individuals in its niche. However, in my case the lower the fitness the more fit the individual is. How can I make my fitness sharing function increase the fitness proportionally to the amount of individuals in its niche?

Here's the code:

def evalTSPsharing(individual, radius, pop):
    individualFitness = evalTSP(individual)[0]
    nicheCount = 0
    for ind in pop:
        distance = abs(individualFitness - evalTSP(ind)[0])
        if distance < radius:
            nicheCount += (1-(distance/radius))
    return (individualFitness/nicheCount,)

I couldn't find a non-pdf of the paper, but here's a picture of the relevant parts. Again, this is from the link above.

Fitness Sharing

David
  • 1,398
  • 1
  • 14
  • 20
  • Please, do post the code. Also, your definition to the sharing function is a PDF - do you have a non-PDF link for those of us on mobiles who don't have PDF viewers? – Wai Ha Lee Apr 19 '15 at 20:03

1 Answers1

0

Question is two years old now, but I'll give it a try: You can try replacing the niche_count division penalty with a multiplication, i.e.:

individualFitness * nicheCount

instead of:

individualFitness / nicheCount
Nur L
  • 791
  • 7
  • 15
  • Please reword the answer to be an answer. Having it end with ? might lead people think you are asking a question here. Which you shouldnt – GhostCat Aug 03 '17 at 17:20