Added self to parameters
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
def is_it_5(chromosome):
|
def is_it_5(self, chromosome):
|
||||||
"""A very simple case test function - If the chromosome's gene value
|
"""A very simple case test function - If the chromosome's gene value
|
||||||
is equal to 5 add one to the chromosomes overall fitness value.
|
is equal to 5 add one to the chromosomes overall fitness value.
|
||||||
"""
|
"""
|
||||||
@ -15,7 +15,7 @@ def is_it_5(chromosome):
|
|||||||
return fitness
|
return fitness
|
||||||
|
|
||||||
|
|
||||||
def near_5(chromosome):
|
def near_5(self, chromosome):
|
||||||
"""Test's the GA's ability to handle floats. Computes how close each gene is to 5."""
|
"""Test's the GA's ability to handle floats. Computes how close each gene is to 5."""
|
||||||
|
|
||||||
# Overall fitness value
|
# Overall fitness value
|
||||||
@ -29,7 +29,7 @@ def near_5(chromosome):
|
|||||||
return fitness
|
return fitness
|
||||||
|
|
||||||
|
|
||||||
def index_dependent_values(chromosome):
|
def index_dependent_values(self, chromosome):
|
||||||
"""Test of the GA's ability to improve fitness when the value is index-dependent.
|
"""Test of the GA's ability to improve fitness when the value is index-dependent.
|
||||||
If a gene is equal to its index in the chromosome + 1, fitness is incremented.
|
If a gene is equal to its index in the chromosome + 1, fitness is incremented.
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user