Package Bio :: Package GA :: Package Crossover :: Module General :: Class SafeFitnessCrossover
[hide private]
[frames] | no frames]

Class SafeFitnessCrossover

source code

object --+
         |
        SafeFitnessCrossover

Perform crossovers, but do not allow decreases in organism fitness.

This doesn't actually do any crossover work, but instead relies on
another class to do the crossover and just checks that newly created
organisms do not have less fitness. This is useful for cases where
crossovers can

Instance Methods [hide private]
 
__init__(self, actual_crossover, accept_less=0.0)
Initialize to do safe crossovers.
source code
 
do_crossover(self, org_1, org_2)
Perform a safe crossover between the two organism.
source code

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, actual_crossover, accept_less=0.0)
(Constructor)

source code 
Initialize to do safe crossovers.

Arguments:

o actual_crossover - A Crossover class which actually implements
crossover functionality.

o accept_less - A probability to accept crossovers which
generate less fitness. This allows you to accept some
crossovers which reduce fitness, but not all of them.

Overrides: object.__init__