Package Bio :: Package GA :: Package Selection :: Module Abstract :: Class AbstractSelection
[hide private]
[frames] | no frames]

Class AbstractSelection

source code

object --+
         |
        AbstractSelection
Known Subclasses:

Base class for Selector classes.

This classes provides useful functions for different selector classes and also defines the functions that all selector classes must implement.

This class should not be used directly, but rather should be subclassed.

Instance Methods [hide private]
 
__init__(self, mutator, crossover, repairer=None)
Initialize a selector.
source code
 
mutate_and_crossover(self, org_1, org_2)
Perform mutation and crossover on the two organisms.
source code
 
select(self, population) 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, mutator, crossover, repairer=None)
(Constructor)

source code 

Initialize a selector.

Arguments:

o mutator -- A Mutation object which will perform mutation on an individual.

o crossover -- A Crossover object which will take two individuals and produce two new individuals which may have had crossover occur.

o repairer -- A class which can do repair on rearranged genomes to eliminate infeasible individuals. If set at None, so repair will be done.

Overrides: object.__init__

mutate_and_crossover(self, org_1, org_2)

source code 

Perform mutation and crossover on the two organisms.

This uses the classes mutator and crossover functions to perform the manipulations.

If a repair class is available, then the rearranged genomes will be repaired to make them feasible.

The newly created individuals are returned.