What is uniform crossover in genetic algorithm crossover operation?

  • Topic: Comp Sci 
  • Thread starter shivajikobardan
  • Start date
  • Tags Tags
    Algorithm Uniform
1 reply · 2K views · last reply
shivajikobardan
Messages
637
Reaction score
54
Homework Statement
genetic algorithm
Relevant Equations
none
Two slides on Genetic Algorithms: Uniform Crossover. The first gives the rule that each gene is taken from either parent with probability 0.5. The second gives an example with Parent 1 XXXXXXX, Parent 2 YYYYYYY, Offspring 1 XYXYYXY and Offspring 2 YXYXXYX.

https://slidetodoc.com/genetic-algorithms-an-example-genetic-algorithm-procedure-ga/
slide is taken from here. is this done total randomly or is it done pseudorandomly. I mean is there some forumula for randomness used in this case?

i learned about single point and double point crossover but confused in this stuff.
 
I don't think there is anything unclear here, but just to confirm the procedure is:

[code title=pseudocode]
for geneIndex in (0, genomeLength - 1):
if (random() < 0.5):
offspring1genome[geneIndex] = parent1genome[geneIndex]
offspring2genome[geneIndex] = parent2genome[geneIndex]
else:
offspring1genome[geneIndex] = parent2genome[geneIndex]
offspring2genome[geneIndex] = parent1genome[geneIndex]
[/code]

where random() is a (p)rng in [0, 1).