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

Source Code for Module Bio.GA.Crossover.Point

 1  # This code is part of the Biopython distribution and governed by its 
 2  # license.  Please see the LICENSE file that should have been included 
 3  # as part of this package. 
 4  # 
 5   
 6  """Perform two-point crossovers between the genomes of two organisms. 
 7   
 8  This module performs single-point crossover between two genomes. 
 9   
10  SinglePointCrossover: 
11  genome 1 --       A B C*D E F 
12  genome 2 --       a b c*d e f 
13   
14  new genome 1 --   A B C d e f 
15  new genome 2 --   a b c D E F 
16   
17  """ 
18  # standard modules 
19  from .GeneralPoint import TwoCrossover 
20   
21   
22 -class SinglePointCrossover(TwoCrossover):
23 """Perform point crossover between genomes at some defined rate. 24 25 This performs a crossover between two genomes at some defined 26 frequency. Length of genome is preserved, as the crossover 27 point is the same for either genome. 28 """
29 - def __init__(self, crossover_prob=.1):
30 """Initialize to do crossovers at the specified probability. 31 """ 32 TwoCrossover.__init__(self, 1, crossover_prob)
33