Skip to content

Forward solver kwargs to CMAEvolutionStrategy#1227

Merged
ChrisRackauckas merged 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix-cma-forward-kwargs
Jun 16, 2026
Merged

Forward solver kwargs to CMAEvolutionStrategy#1227
ChrisRackauckas merged 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix-cma-forward-kwargs

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #1226.

Problem

__map_optimizer_args for OptimizationCMAEvolutionStrategy did not forward extra solver kwargs to CMAEvolutionStrategy.minimize, so options like popsize, sigma0 (#1074), noise_handling, seed, etc. were unreachable through Optimization.jl. The equivalent methods for OptimizationBBO and OptimizationEvolutionary do forward kwargs.

Fix

  • Add a kwargs... capture to __map_optimizer_args and splat it into the mapped args, matching the OptimizationBBO/OptimizationEvolutionary pattern. Explicitly-mapped args (lower, upper, logger, maxiter, maxtime, ftol) are applied after the user kwargs so they still take precedence.
  • sigma0 is the positional s0 argument of minimize (the initial step size, previously hardcoded to 0.1), so it cannot ride along in the kwargs. It is now pulled from solver_args in __solve and passed positionally (default 0.1), and is captured (but unused) in __map_optimizer_args so it doesn't leak into the forwarded kwargs.

Tests

Added a solver kwargs are forwarded testset verifying:

  • popsize = 20 is reflected in sol.original.p.λ,
  • the default run does not use that popsize,
  • sigma0 = 0.5 runs and returns a valid retcode.

Full package test suite passes locally (16/16).

QA group

Also declares a Test = "1" [compat] entry in this sublibrary's Project.toml. Test was already listed in [extras] but had no compat bound, so Aqua's deps_compat (check_extras) assertion failed the sublibrary QA group. This fixes the extras-compat finding. Verified locally (CI-equivalent develop + Pkg.test, OPTIMIZATION_TEST_GROUP=QA):

  • QA / Julia 1: passes (12/12).
  • QA / Julia lts: extras-compat now passes.

Pre-existing QA-lts failure NOT addressed here (out of scope)

On Julia < 1.11, the QA-lts job still reports two Aqua findings — Stale dependencies and deps-compat for OptimizationLBFGSB / OptimizationManopt. These are not introduced by this PR and reproduce identically on master. Root cause: lib/OptimizationBase/Project.toml declares a [sources] table for its test-only deps OptimizationLBFGSB / OptimizationManopt, and the centralized SciML/.github tests.yml "develop in-repo [sources]" helper walks the [sources] graph transitively on Julia < 1.11 — so when any sublibrary develops OptimizationBase, those two test-only path-deps get Pkg.developed into the sublibrary's environment as phantom direct deps, which Aqua then flags. On Julia ≥ 1.11 the helper is a no-op, which is why QA / Julia 1 is green. The proper fix belongs in OptimizationBase (don't expose test-only [sources]) or in the .github develop helper (don't transitively develop a dep's test [sources]), and affects every OptimizationBase-dependent sublibrary — out of scope for a CMAES-kwargs PR.


Please ignore until reviewed by @ChrisRackauckas.

Co-Authored-By: Chris Rackauckas accounts@chrisrackauckas.com

`__map_optimizer_args` for `OptimizationCMAEvolutionStrategy` dropped any
extra solver kwargs, so options like `popsize`, `noise_handling`, etc. were
unreachable through Optimization.jl (issue SciML#1226). Add a `kwargs...` capture
and forward it to `CMAEvolutionStrategy.minimize`, matching the pattern used
by OptimizationBBO/OptimizationEvolutionary.

`sigma0` is the positional `s0` (initial step size) of `minimize`, so it is
pulled from `solver_args` in `__solve` and passed positionally (default 0.1),
while being captured in `__map_optimizer_args` to keep it out of the
forwarded kwargs.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Aqua's deps/compat check (check_extras) requires a [compat] entry for
every package in [extras]. Test was listed in [extras] but had no compat
bound, so the sublibrary QA group failed on the deps_compat assertion.
Add Test = "1" to fix it.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisRackauckas ChrisRackauckas marked this pull request as ready for review June 16, 2026 09:01
@ChrisRackauckas ChrisRackauckas merged commit ede95b2 into SciML:master Jun 16, 2026
35 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

__map_optimizer_args does not forward kwargs to CMAEvolutionStrategy solver

2 participants