Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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)

AltStyle によって変換されたページ (->オリジナル) /