Package Bio :: Package GA :: Package Crossover :: Module GeneralPoint
[hide private]
[frames] | no frames]

Module GeneralPoint

source code

Generalized N-Point Crossover.

For even values of N, perform N point crossover
(select N/2 points each in the two genomes, and alternate)
For odd values of N, perform symmetric N+1 point crossover
(select N/2 points for both genomes)

N-Point introduction (my notation):

genome 1: A-----B-----C-----D-----E-----F-----G
genome 2: a=====b=====c=====d=====e=====f=====g

2-point, symmetric (points=1):
A-----B-----C- 1 -D-----E-----F-----G
a=====b=====c= 2 =d=====e=====f=====g
returns: (ABCdefg, abcDEFG)

2-point, asymmetric (points=2):
A-----B- 1 -C-----D-----E-----F-----G
a=====b=====c=====d=====e= 2 =f=====g
returns: (ABfg, abcdeCDEFG)

and for the drastic (n can be arbitrary to the length of the genome!):

12-point, symmetric (points=11):
A- 1 -B- 2 -C- 3 -D- 4 -E- 5 -F- 6 -G
a= 7 =b= 8 =c= 9 =d= 10 e= 11 f= 12 g
returns: (AbCdEfG, aBcDeFg)
(note that points=12 will yield the same result, but 11
may be somewhat faster)
Classes [hide private]
Perform n-point crossover between genomes at some defined rates.
Helper class for Two Point crossovers.
Demonstration class for Interleaving crossover.
Variables [hide private]
  __package__ = 'Bio.GA.Crossover'