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

Class InterleaveCrossover

source code

           object --+    
                    |    
GeneralPointCrossover --+
                        |
                       InterleaveCrossover

Demonstration class for Interleaving crossover.

Interleaving: AbCdEfG, aBcDeFg

Instance Methods [hide private]
 
__init__(self, crossover_prob=0.1)
Initialize to do crossovers at the specified probability.
source code
 
_generate_locs(self, bound)
Generalized Location Generator:
source code
 
_crossover(self, x, no, locs)
Generalized Crossover Function:
source code

Inherited from GeneralPointCrossover: do_crossover

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, crossover_prob=0.1)
(Constructor)

source code 
Initialize to do crossovers at the specified probability.
Overrides: object.__init__
(inherited documentation)

_generate_locs(self, bound)

source code 

Generalized Location Generator:

arguments:

  • bound (int) - upper bound

returns: [0]+x_0...x_n+[bound]
where n=self._npoints-1

and 0 < x_0 < x_1 ... < bound

Overrides: GeneralPointCrossover._generate_locs
(inherited documentation)

_crossover(self, x, no, locs)

source code 

Generalized Crossover Function:

arguments:
  • x (int) - genome number [0|1]

  • no (organism,organism)

  • new organisms

  • locs (int list, int list)

  • lists of locations, [0, +n points+, bound] for each genome (sync'd with x)

return type: sequence (to replace no[x])

Overrides: GeneralPointCrossover._crossover
(inherited documentation)