7 kyu
Genetic Algorithm Series - #3 Crossover
745 of 2,070gabrielsiedler
Description:
In genetic algorithms, crossover is a genetic operator used to vary the programming of chromosomes from one generation to the next.
The one-point crossover consists in swapping one's cromosome part with another in a specific given point. The image bellow shows the crossover being applied on chromosomes 1011011001111
and 1011100100110
with the cut point (index) 4
:
In this kata you have to implement a function crossover
that receives two chromosomes chromosome1
, chromosome2
and a zero-based index
and it has to return an array with the crossover result on both chromosomes [chromosome1, chromosome2]
.
Example:
crossover('111000', '000110', 3)
should return ['111110', 000000']
See other katas from this series
- Genetic Algorithm Series - #1 Generate
- Genetic Algorithm Series - #2 Mutation
- Genetic Algorithm Series - #3 Crossover
- Genetic Algorithm Series - #4 Get population and fitnesses
- Genetic Algorithm Series - #5 Roulette wheel selection
This kata is a piece of Binary Genetic Algorithm
Strings
Algorithms
Genetic Algorithms
Similar Kata:
Stats:
Created | Dec 25, 2015 |
Published | Dec 25, 2015 |
Warriors Trained | 3092 |
Total Skips | 159 |
Total Code Submissions | 4934 |
Total Times Completed | 2070 |
JavaScript Completions | 745 |
C# Completions | 303 |
Python Completions | 795 |
Ruby Completions | 101 |
PHP Completions | 143 |
TypeScript Completions | 103 |
CoffeeScript Completions | 10 |
Total Stars | 39 |
% of votes with a positive feedback rating | 93% of 402 |
Total "Very Satisfied" Votes | 348 |
Total "Somewhat Satisfied" Votes | 48 |
Total "Not Satisfied" Votes | 6 |
Total Rank Assessments | 16 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |