Skip to content

Commit 6fc3bbd

Browse files
committed
Used Sequence in optimize
1 parent bbee49d commit 6fc3bbd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

genetic_algorithm/function_optimization.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import random
88
from collections.abc import Callable
9+
from typing import Sequence
910

1011
# Define the parameters for the genetic algorithm
1112
N_POPULATION = 100
@@ -60,8 +61,8 @@ def select(
6061

6162
def optimize(
6263
func: Callable,
63-
param_ranges: list[tuple[float, float]],
64-
) -> tuple[list[float], float]:
64+
param_ranges: Sequence[tuple[float, float]],
65+
) -> tuple[Sequence[float], float]:
6566
"""Optimize the given function using a genetic algorithm."""
6667
# Initialize the population
6768
population = [

0 commit comments

Comments
 (0)