I don’t know what you mean by “typical crossover”, but I think you could use a crossover similar to what is often used for permutations:
- take m ints from the first parent (m <n, where n is the number of ints in your sets)
- scan the second one and fill out your subset of it (nm) ints that are free (and not in the subset already).
Thus, you will have n ints from the first and nm int from the second parent without duplication.
Sounds like a valid crossover to me :-).
I think it would be useful not to take any steps on the ordered sets (or use an iterator where the order of the returned elements somehow correlates with the natural ordering of ints), otherwise either a smaller or a larger number would have a higher chance of being in the child, making Your search is biased.
If this is the best method, it depends on the problem you want to solve ...
Sandor murakozi
source share