Explore Library
Code QuizAdvanced

Genetic Algorithm Broken Crossover

A single-point crossover accidentally copies one parent instead of mixing two.

Codejavascript
// Single-point crossover of two parent chromosomes
function crossover(parentA, parentB, point) {
  const child = parentA.slice(0, point)
    .concat(parentA.slice(point));
  return child;
}

The children in the population are always identical to parentA. What is the bug?