|
11 | 11 |
|
12 | 12 | _options = dict( |
13 | 13 | popsize=("population size", 50), |
14 | | - maxiter=("maximum number of generations", 1e12), # very large to avoid early stopping (stopping is managed by StopCriterionReached) |
| 14 | + popsize_times_dimensions=("multiply population size with number of dimensions (True/False)", False), |
| 15 | + maxiter=("maximum number of generations", int(1e15)), # very large to avoid early stopping (stopping is managed by StopCriterionReached) |
15 | 16 | F=("mutation factor (differential weight)", 1.3), |
16 | 17 | CR=("crossover rate", 0.9), |
17 | 18 | method=("method", "best1bin"), |
@@ -39,7 +40,10 @@ def tune(searchspace: Searchspace, runner, tuning_options): |
39 | 40 | bounds = cost_func.get_bounds() |
40 | 41 |
|
41 | 42 | options = tuning_options.strategy_options |
42 | | - popsize, maxiter, F, CR, method, constraint_aware = common.get_options(options, _options) |
| 43 | + popsize, popsize_times_dimensions, maxiter, F, CR, method, constraint_aware = common.get_options(options, _options) |
| 44 | + if popsize_times_dimensions: |
| 45 | + popsize *= min(len(searchspace.get_true_tunable_params()), searchspace.size) |
| 46 | + maxiter = min(maxiter, searchspace.size) |
43 | 47 |
|
44 | 48 | if method not in supported_methods: |
45 | 49 | raise ValueError(f"Error {method} not supported, {supported_methods=}") |
|
0 commit comments