We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bbee49d commit 6fc3bbdCopy full SHA for 6fc3bbd
genetic_algorithm/function_optimization.py
@@ -6,6 +6,7 @@
6
7
import random
8
from collections.abc import Callable
9
+from typing import Sequence
10
11
# Define the parameters for the genetic algorithm
12
N_POPULATION = 100
@@ -60,8 +61,8 @@ def select(
60
61
62
def optimize(
63
func: Callable,
- param_ranges: list[tuple[float, float]],
64
-) -> tuple[list[float], float]:
+ param_ranges: Sequence[tuple[float, float]],
65
+) -> tuple[Sequence[float], float]:
66
"""Optimize the given function using a genetic algorithm."""
67
# Initialize the population
68
population = [
0 commit comments