This is the pseudocode for using deterministic crowding:

for _ in (0, ..., n/2):
    p1, p2 = random_individual(), random_individual()
    c1 = mutate(crossover(p1, p2))
    c2 = mutate(crossover(p2, p1))

    if d(p1, c1) + d(p2, c2) < d(p1, c2) + d(p2, c1):
        population.add(winner_of(p1, c1))
        population.add(winner_of(p2, c2))
        population.add(winner_of(p1, c2))
        population.add(winner_of(p2, c1))

where d is a function that determines the difference between two individuals.

The question is: Do I end up with duplicate individuals in the new population if an individual gets selected two times as one of parents, and wins over its child both times?

  • $\begingroup$ Is d using the fitness function, i.e., is d(p,q) the same as fitness(p) - fitness(q)? $\endgroup$ – Pål GD Feb 13 '20 at 10:45
  • $\begingroup$ There is always a risk of ending up with duplicates in the pool. How you choose to deal with this is up to you (there are pros and cons). I usually filter out all duplicates and so that I have room for a higher number of (distinct) individuals. However, that obviously decreases the average fitness, but on the other hand it means a greater span. $\endgroup$ – Pål GD Feb 13 '20 at 10:47
  • $\begingroup$ @PålGD No. d is Hamming Distance. The number of different genes in two individuals. If two individuals have nothing in common, d will be at its maximum. If two individuals have same genes, d will be 0. $\endgroup$ – Md Narimani Feb 13 '20 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.