Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Genetic algorithms: How to do crossover in "subset" problems?

I have a problem which I am trying to solve with genetic algorithms. The problem is selecting some subset (say 4) of 100 integers (these integers are just ids that represent something else). Order does not matter, the solution to the problem is a SET of integers not an ordered list. I have a good fitness function but am having trouble with the crossover function.

I want to be able to mate the following two chromosomes:

[1 2 3 4] and [3 4 5 6] into something useful. Clearly I cannot use the typical crossover function because I could end up with duplicates in my children which would represent invalid solutions. What is the best crossover method in this case.

like image 297
aloo Avatar asked Dec 14 '10 04:12

aloo


People also ask

How do you do a crossover in genetic algorithm?

Create two random crossover points in the parent and copy the segment between them from the first parent to the first offspring. Now, starting from the second crossover point in the second parent, copy the remaining unused numbers from the second parent to the first child, wrapping around the list.

What are the various types of crossover techniques?

The eight evolutionary crossover operators are order crossover, partially mapped crossover, edge recombination crossover, cycle crossover, alternating edges crossover, heuristic greedy crossovers, random crossover and probabilistic crossover.

What does crossover in genetic algorithms matches with genetics?

Crossover is a genetic operator used to vary the programming of a chromosome or chromosomes from one generation to the next. Crossover is sexual reproduction. Two strings are picked from the mating pool at random to crossover in order to produce superior offspring. The method chosen depends on the Encoding Method.

What is the difference between crossover and mutation in GA?

The crossover of two parent strings produces offspring (new solutions) by swapping parts or genes of the chromosomes. Crossover has a higher probability, typically 0.8-0.95. On the other hand, mutation is carried out by flipping some digits of a string, which generates new solutions.


1 Answers

Just ignore any element that occurs in both of the sets (i.e. in their intersection.), that is leave such elements unchanged in both sets.

The rest of the elements form two disjoint sets, to which you can apply pretty much any random transformation (e.g. swapping some pairs randomly) without getting duplicates.

This can be thought of as ordering and aligning both sets so that matching elements face each other and applying one of the standard crossover algorithms.

like image 113
Rafał Dowgird Avatar answered Sep 21 '22 06:09

Rafał Dowgird