Skip to main content

Module optimize

Module optimize 

Source
Expand description

Library-backed constant refinement via scirs2-optimize.

phop’s default polish (crate::polish::polish_constants) is a small, panic-free, well-tested Levenberg–Marquardt with named-constant snapping. This module offers two alternative refinement backends drawn from the cool-japan scirs2-optimize crate so the constant fit can be swapped without touching the discovery pipeline:

  • ScirsPolish::Lmscirs2_optimize::least_squares (Levenberg–Marquardt), and
  • ScirsPolish::Lbfgsscirs2_optimize::unconstrained::minimize_lbfgs minimizing the sum of squared residuals.

They are offered as opt-in backends rather than as a drop-in replacement: phop’s hand-rolled LM makes no contiguity assumptions and never panics, whereas scirs2’s least-squares uses internal expects on as_slice(). We feed it only contiguous Array1s built with from_vec, and treat any solver error or non-finite step as a no-op (returning the starting constants), so this module upholds phop’s no-panic / no-unwrap policy.

Enums§

ScirsPolish
Which scirs2-optimize algorithm to use for the polish.

Functions§

polish_constants_scirs
Refine the constant leaves of tree against ds using a scirs2-optimize backend.