` 1` ` `
` 2` ` `
` 3` ` `
` 4` ` `
` 5` ` `
` 6` `"""Perform two-point crossovers between the genomes of two organisms.`
` 7`
` 8` `This module performs two-point crossover between two genomes.`
` 9` `There are two flavors: OnePointCrossover (Point) and TwoPointCrossover.`
`10`
`11` `TwoPointCrossover is the minimal crossover technique that`
`12` `facilitates diverse genome length. Do not use this if you need to`
`13` `maintain consistent genome length.`
`14`
`15` `TwoPointCrossover:`
`16` `genome 1 -- A B*C D E F`
`17` `genome 2 -- a b c*d e f`
`18`
`19` `new genome 1 -- A B d e f`
`20` `new genome 2 -- a b c C D E F`
`21`
`22` `"""`
`23` ` `
`24` `from` `.``GeneralPoint` `import` `TwoCrossover`
`25` ` `
`26` ` `
`28` ` ``"""Perform two point crossover between genomes at some defined rate.`
`29`
`30` ` This performs a crossover between two genomes at some defined frequency.`
`31` ` The location of the points of crossover are chosen randomly if the`
`32` ` crossover meets the probability to occur.`
`33` ` """`
`35` ` ``"""Initialize to do crossovers at the specified probability.`
`36` ` """`
`37` ` ``TwoCrossover``.``__init__``(``self``,` `2``,` `crossover_prob``)`
`38` ` `