File tree 1 file changed +2
-2
lines changed
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -1961,7 +1961,7 @@ second parent.
1961
1961
parent1 = parents[idx % parents.shape[0 ], :].copy()
1962
1962
parent2 = parents[(idx + 1 ) % parents.shape[0 ], :].copy()
1963
1963
1964
- random_split_point = numpy.random.choice(range (offspring_size[0 ]))
1964
+ random_split_point = numpy.random.choice(range (offspring_size[1 ]))
1965
1965
1966
1966
parent1[random_split_point:] = parent2[random_split_point:]
1967
1967
@@ -2018,7 +2018,7 @@ gene's value.
2018
2018
def mutation_func (offspring , ga_instance ):
2019
2019
2020
2020
for chromosome_idx in range (offspring.shape[0 ]):
2021
- random_gene_idx = numpy.random.choice(range (offspring.shape[0 ]))
2021
+ random_gene_idx = numpy.random.choice(range (offspring.shape[1 ]))
2022
2022
2023
2023
offspring[chromosome_idx, random_gene_idx] += numpy.random.random()
2024
2024
You can’t perform that action at this time.
0 commit comments