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

Class GeneralPointCrossover

Known Subclasses:
InterleaveCrossover, TwoCrossover

Perform n-point crossover between genomes at some defined rates.

Ideas on how to use this class:
    - Call it directly ( construct, do_crossover )
    - Use one of the provided subclasses
    - Inherit from it:
        * replace _generate_locs with a more domain 
          specific technique
        * replace _crossover with a more efficient 
          technique for your point-count

Method Summary
  __init__(self, points, crossover_prob)
Initialize to do crossovers at the specified probability.
  do_crossover(self, org_1, org_2)
Potentially do a crossover between the two organisms.
  _crossover(self, x, no, locs)
Generalized Crossover Function:...
  _generate_locs(self, bound)
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 ...

Method Details

__init__(self, points, crossover_prob=0.10000000000000001)
(Constructor)

Initialize to do crossovers at the specified probability.

do_crossover(self, org_1, org_2)

Potentially do a crossover between the two organisms.

_crossover(self, x, no, locs)

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])

_generate_locs(self, bound)

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

Generated by Epydoc 2.1 on Wed Jan 31 09:57:59 2007 http://epydoc.sf.net