diff --git a/genetic_algorithm/genetic_algorithm_optimization.py b/genetic_algorithm/genetic_algorithm_optimization.py index 9cb059553..23cc9bdf3 100644 --- a/genetic_algorithm/genetic_algorithm_optimization.py +++ b/genetic_algorithm/genetic_algorithm_optimization.py @@ -54,7 +54,7 @@ class GeneticAlgorithm: ... ) >>> len(ga.initialize_population()) 5 # The population size should be equal to 5. - >>> all(len(ind) == 2 for ind in ga.initialize_population()) + >>> all(len(ind) == 2 for ind in ga.initialize_population()) # Each individual should have 2 variables True """ @@ -134,7 +134,7 @@ class GeneticAlgorithm: parent2 (np.ndarray): The second parent. Returns: tuple[np.ndarray, np.ndarray]: The two offspring generated by crossover. - + Example: >>> ga = GeneticAlgorithm( ... lambda x, y: -(x**2 + y**2), @@ -276,7 +276,7 @@ def target_function(var_x: float, var_y: float) -> float: var_y (float): The y-coordinate. Returns: float: The value of the function at (var_x, var_y). - + Example: >>> target_function(0, 0) 0