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: RESULTS

SLSQP-specific termination codes.

Subclasses optimistix.RESULTS and adds finer classifications for the failure modes that the upstream solver lumps into optimistix.RESULTS.nonlinear_divergence.

Note

equinox.Enumeration reports its concrete subclasses as @final via the metaclass, but optimistix itself does the same trick (optx.RESULTS subclasses lx.RESULTS) and the docstring example for Enumeration.promote shows the pattern is supported. ty: ignore[subclass-of-final-class] suppresses the false positive.

slsqp_jax.results.is_successful(result)[source]

Return True if result represents successful convergence.

Robust to both optimistix.RESULTS and slsqp_jax.RESULTS inputs 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):
    ...
Return type:

bool

Parameters:

result (Any)

Args:
result: A RESULTS member from either optx.RESULTS or

its RESULTS subclass.

Returns:

True iff the result equals RESULTS.successful.