Solvers.DE.SolverDE#
molass.Solvers.DE.SolverDE
Differential Evolution solver wrapping pymoo.
Drop-in replacement for SolverBH / SolverCMA in the rigorous optimization pipeline. Interface matches SolverCMA.minimize() so it can be wired into BasicOptimizer.solve() with method=’de’.
Parameters are in the normalized [0, 10] space used throughout the molass-legacy optimizer infrastructure.
Notes
DE is a population-based method: every generation evaluates pop_size candidate solutions in sequence. The evaluation budget is:
max_fevals = niter * FEVALS_PER_NITER max_gen = max_fevals // pop_size (≥ 1)
With the default pop_size=None the population is sized automatically as max(20, 5 * n_var) — i.e. 150 for a 30-param problem, 250 for 50 params.
Unlike CMA-ES (pycma), pymoo’s DE is pure Python so it does NOT trigger the ProactorEventLoop / BLAS C-extension race that caused the molass-library #193 async crash. It is therefore safe to run with in_process=True and async_=True.
Copyright (c) 2026, SAXS Team, KEK-PF
- class SolverDE(optimizer, pop_size=None, variant='DE/rand/1/bin', CR=0.5, F=0.5, warm_sigma=1.0)#
Bases:
objectDifferential Evolution solver wrapping pymoo DE.
- Parameters:
optimizer (BasicOptimizer) – Fully constructed optimizer that provides
minima_callback.pop_size (int or None) – Population size. None → max(20, 5 * n_var) (auto-sized).
variant (str) – DE variant string understood by pymoo, e.g.
"DE/rand/1/bin".CR (float) – Crossover probability (0–1).
F (float or tuple) – Differential weight (mutation factor). A tuple
(F_min, F_max)enables dithering.
- minimize(objective, init_params, niter=100, seed=1234, bounds=None, narrow_bounds=False, show_history=False)#
Run DE minimization.
- Parameters:
objective (callable) – Objective function f(x) → scalar (wrapped by
BasicOptimizer.objective_func_wrapper).init_params (ndarray) – Initial parameter vector in normalized [0, 10] space.
niter (int) – Controls evaluation budget: max_fevals = niter * FEVALS_PER_NITER.
seed (int) – RNG seed.
bounds (ndarray of shape (n, 2), optional) – Per-parameter [lower, upper] bounds in normalized space. Defaults to [0, 10] for every parameter.
narrow_bounds (bool) – If True, restrict search to [init_params ± 1.0].
show_history (bool) – Unused (kept for API parity with SolverBH).
- Returns:
.x— best parameter vector found.fun— objective value at best x.nit— number of DE generations completed.nfev— total function evaluations- Return type: