Skip to content

Commit cd4f6f3

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 0697e97 commit cd4f6f3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

genetic_algorithm/genetic_algorithm_optimization.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ def crossover(self, parent1, parent2):
6767
return parent1, parent2 # No crossover needed for single-variable functions
6868

6969
if self.rng.random() < self.crossover_prob:
70-
point = self.rng.integers(1, self.num_variables) # Updated to handle edge case
70+
point = self.rng.integers(
71+
1, self.num_variables
72+
) # Updated to handle edge case
7173
child1 = np.concatenate((parent1[:point], parent2[point:]))
7274
child2 = np.concatenate((parent2[:point], parent1[point:]))
7375
return child1, child2

0 commit comments

Comments
 (0)