Methods
|
|
__cmp__
__init__
__str__
copy
recalculate_fitness
|
|
__cmp__
|
__cmp__ ( self, other )
Define comparisons for organisms.
Compare organisms by their genomes.
|
|
__init__
|
__init__ (
self,
genome,
fitness_calculator,
start_fitness=None,
)
Initialize an organism
Arguments:
genome -- A MutableSeq object representing the sequence of the
genome.
fitness_calculator -- A funtion that will calculate the fitness
of the organism when given the organisms genome.
start_fitness - the starting fitness corresponding with the
given genome. If not supplied, the fitness will be calculated
using fitness_calculator.
|
|
__str__
|
__str__ ( self )
Provide a string output for debugging.
|
|
copy
|
copy ( self )
Return a copy of the organism.
This makes it easy to duplicate an organism before changing it.
|
|
recalculate_fitness
|
recalculate_fitness ( self )
Calculate and reset the fitness of the current genome
This should be called after the genome is updated to ensure that
fitness always stays in sync with the current genome.
|