Skip to content

Commit 521b1e7

Browse files
committed
change type hint of population size
1 parent 34da524 commit 521b1e7

1 file changed

Lines changed: 7 additions & 16 deletions

File tree

src/optimagic/optimizers/gfo_optimizers.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class GFOParticleSwarmOptimization(Algorithm, GFOCommonOptions):
155155
156156
"""
157157

158-
population_size: PositiveInt = 10
158+
population_size: PositiveInt | None = None
159159
"""Size of the population."""
160160

161161
inertia: NonNegativeFloat = 0.5 / math.log(2.0)
@@ -241,7 +241,7 @@ class GFOParallelTempering(Algorithm, GFOCommonOptions):
241241
242242
"""
243243

244-
population_size: PositiveInt = 10
244+
population_size: PositiveInt | None = None
245245
"""Size of the population."""
246246

247247
n_iter_swap: PositiveInt = 10
@@ -329,17 +329,8 @@ class GFOSpiralOptimization(Algorithm, GFOCommonOptions):
329329
330330
"""
331331

332-
population_size: PositiveInt = 10
333-
"""Size of the population for population-based optimization algorithms.
334-
335-
Each
336-
member of the population is a separate optimizer. All population based
337-
optimizers in this package calculate the new positions one member at a time.
338-
So if the optimizer performs 10 iterations and has a population size of 10,
339-
then each member of the population would move once to a new position.
340-
Typical range: 4 to 25.
341-
342-
"""
332+
population_size: PositiveInt | None = None
333+
"""Size of the population."""
343334

344335
decay_rate: NonNegativeFloat = 0.99
345336
"""The decay rate `r` is a factor, by which the radius of the spiral movement of the
@@ -410,7 +401,7 @@ class GFOGeneticAlgorithm(Algorithm, GFOCommonOptions):
410401
411402
"""
412403

413-
population_size: PositiveInt = 10
404+
population_size: PositiveInt | None = None
414405
"""Size of the population."""
415406

416407
mutation_rate: ProbabilityFloat = 0.5
@@ -542,7 +533,7 @@ class GFOEvolutionStrategy(Algorithm, GFOCommonOptions):
542533
543534
"""
544535

545-
population_size: PositiveInt = 10
536+
population_size: PositiveInt | None = None
546537
"""Size of the population."""
547538

548539
stopping_maxiter: PositiveInt = STOPPING_MAXFUN_GLOBAL
@@ -628,7 +619,7 @@ class GFODifferentialEvolution(Algorithm, GFOCommonOptions):
628619
629620
"""
630621

631-
population_size: PositiveInt = 10
622+
population_size: PositiveInt | None = None
632623
"""Size of the population."""
633624

634625
mutation_rate: ProbabilityFloat = 0.9

0 commit comments

Comments
 (0)