Update fitness_examples.py
This commit is contained in:
@ -18,8 +18,9 @@ class Fitness_Examples:
|
|||||||
|
|
||||||
|
|
||||||
def index_dependent_values(chromosome):
|
def index_dependent_values(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.
|
||||||
|
"""
|
||||||
fitness = 0
|
fitness = 0
|
||||||
for i in range(chromosome.size()):
|
for i in range(chromosome.size()):
|
||||||
if (chromosome.gene_list[i].value == i+1):
|
if (chromosome.gene_list[i].value == i+1):
|
||||||
|
|||||||
Reference in New Issue
Block a user