Solvers.CMA.SolverCMA

Solvers.CMA.SolverCMA#

molass.Solvers.CMA.SolverCMA

CMA-ES (Covariance Matrix Adaptation Evolution Strategy) solver. Drop-in replacement for SolverBH in the rigorous optimization pipeline.

Interface matches SolverBH.minimize() so it can be wired into BasicOptimizer.solve() with method=’cma’.

Parameters are in the normalized [0, 10] space used throughout the molass-legacy optimizer infrastructure.

Copyright (c) 2026, SAXS Team, KEK-PF

class SolverCMA(optimizer, sigma0=2.0)#

Bases: object

CMA-ES solver wrapping the cma package.

Parameters:
  • optimizer (BasicOptimizer) – Fully constructed optimizer that provides minima_callback and accept_test.

  • sigma0 (float, optional) – Initial step size in normalized [0,10] space. Default 2.0.

minimize(objective, init_params, niter=100, seed=1234, bounds=None, narrow_bounds=False, show_history=False)#

Run CMA-ES minimization.

Parameters:
  • objective (callable) – Objective function f(x) → scalar (already wrapped by BasicOptimizer.objective_func_wrapper).

  • init_params (ndarray) – Initial parameter vector in normalized [0,10] space.

  • niter (int) – Controls the evaluation budget: max_fevals = niter * FEVALS_PER_NITER. Default 100 (→ 20,000 evaluations).

  • seed (int) – RNG seed for CMA-ES.

  • bounds (ndarray of shape (n, 2), optional) – Per-parameter [lower, upper] bounds in normalized space. If None, defaults to [0, 10] for every parameter.

  • narrow_bounds (bool) – If True and bounds is None, restrict to [init_params ± NARROW_BOUNDS_ALLOW].

  • 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 CMA-ES generations .nfev— total function evaluations

Return type:

scipy.optimize.OptimizeResult