8000 Fix Documentation User-Defined Mutation Operator Example: the number … · madprog/GeneticAlgorithmPython@06ed09d · GitHub
[go: up one dir, main page]

Skip to content

Commit 06ed09d

Browse files
Fix Documentation User-Defined Mutation Operator Example: the number of genes is the offspring shape dimension index 1.
1 parent 2510727 commit 06ed09d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/source/README_pygad_ReadTheDocs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2261,7 +2261,7 @@ gene's value.
22612261
def mutation_func(offspring, ga_instance):
22622262
22632263
for chromosome_idx in range(offspring.shape[0]):
2264-
random_gene_idx = numpy.random.choice(range(offspring.shape[0]))
2264+
random_gene_idx = numpy.random.choice(range(offspring.shape[1]))
22652265
22662266
offspring[chromosome_idx, random_gene_idx] += numpy.random.random()
22672267

0 commit comments

Comments
 (0)
0