A class which calculates the fitness of a Program in a particular Environment.
Use a FitnessEvalulator to set all fitness-related instance variables on a Program
instance.
Methods
|
|
__init__
best
evaluate
punish
setInput
setOutput
worst
|
|
__init__
|
__init__ (
self,
input,
output,
interpreter,
deviancecalculator,
)
|
|
best
|
best (
self,
p1,
p2,
)
Compares one program to another, returning the most fit
Programs are compared based on their rawfitness.
|
|
evaluate
|
evaluate ( self, p )
Evaluate and update specified program with its basic fitness information
The deviance of the Program is calculated using the DevianceCalculator instance.
The basic fitness properties of the Program are set (rawfitness and hits).
|
|
punish
|
punish ( self, p )
Severely punish this program
Only use this when a program has been most inappropriate.
This sets its fitness to be very bad.
|
|
setInput
|
setInput ( self, input )
|
|
setOutput
|
setOutput ( self, output )
|
|
worst
|
worst (
self,
p1,
p2,
)
Compares one program to another, returning the least fit
Programs are compared based on their rawfitness.
|
|