slsqp_jax.results¶
Granular RESULTS enumeration extending Optimistix’s RESULTS, plus the is_successful helper.
slsqp_jax.results
SLSQP-specific termination codes.
This module defines RESULTS, a subclass of
optimistix.RESULTS that adds finer-grained classification for the
SLSQP solver’s failure modes. The base class’ members
(successful, nonlinear_max_steps_reached,
nonlinear_divergence, nonfinite, …) are inherited; the
SLSQP-specific failure cases below replace what previously all mapped
to optx.RESULTS.nonlinear_divergence.
Note
Cross-class equality between members of optx.RESULTS and
slsqp_jax.RESULTS raises ValueError per equinox’s
Enumeration semantics:
sol.result == optx.RESULTS.successful # raises ValueError
sol.result == slsqp_jax.RESULTS.successful # works
Use is_successful() if you want a comparison that is robust
to the parent/subclass distinction, or call
slsqp_jax.RESULTS.promote(parent_result) to lift an
optx.RESULTS value into this enumeration.
- class slsqp_jax.results.RESULTS[source]¶
Bases:
RESULTSSLSQP-specific termination codes.
Subclasses
optimistix.RESULTSand adds finer classifications for the failure modes that the upstream solver lumps intooptimistix.RESULTS.nonlinear_divergence.Note
equinox.Enumerationreports its concrete subclasses as@finalvia the metaclass, but optimistix itself does the same trick (optx.RESULTSsubclasseslx.RESULTS) and the docstring example forEnumeration.promoteshows the pattern is supported.ty: ignore[subclass-of-final-class]suppresses the false positive.
- slsqp_jax.results.is_successful(result)[source]¶
Return
Trueifresultrepresents successful convergence.Robust to both
optimistix.RESULTSandslsqp_jax.RESULTSinputs by promoting the value before comparison. Useful for downstream code that may receive results from either enumeration:from slsqp_jax import is_successful if is_successful(sol.result): ...
- Args:
- result: A
RESULTSmember from eitheroptx.RESULTSor its
RESULTSsubclass.
- result: A
- Returns:
Trueiff the result equalsRESULTS.successful.