` 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`
`17` ` genome 1 -- A B*C D E F`
`18` ` genome 2 -- a b c*d e f`
`19`
`20` ` new genome 1 -- A B d e f`
`21` ` new genome 2 -- a b c C D E F`
`22`
`23` `"""`
`24` ` `
`25` `from` `.``GeneralPoint` `import` `TwoCrossover`
`26` ` `
`27` ` `
`29` ` ``"""Perform two point crossover between genomes at some defined rate.`
`30`
`31` ` This performs a crossover between two genomes at some defined frequency.`
`32` ` The location of the points of crossover are chosen randomly if the`
`33` ` crossover meets the probability to occur.`
`34` ` """`
`35` ` `
`37` ` ``"""Initialize to do crossovers at the specified probability."""`
`38` ` ``TwoCrossover``.``__init__``(``self``,` `2``,` `crossover_prob``)`
`39` ` `