Skip to main content

Constraint-Aware Descent Routine Executor — JAX-native constrained optimization

Project description

CADRE

Constraint-Aware Descent Routine Executor — JAX-native constrained optimization.

PyPI pre-commit License: MIT Docs: minimization

CADRE provides a unified interface to multiple JAX-compatible optimization backends, with first-class support for box-constrained problems via an active-set method (ADABK family).

This is the minimizer used in Furax-CS package for CMB component separation.

Installation

pip install jax-cadre

With optional scipy solvers (scipy_tnc, scipy_cobyqa):

pip install jax-cadre[scipy]

Quick start

from cadre import minimize
import jax.numpy as jnp

def loss(params, target):
    return jnp.sum((params - target) ** 2)

target = jnp.array([1.0, 2.0, 3.0])
lower  = jnp.zeros(3)
upper  = jnp.ones(3) * 5.0

params, state = minimize(
    loss,
    init_params=jnp.zeros(3),
    solver_name="ADABK0",   # or "optax_lbfgs"
    lower_bound=lower,
    upper_bound=upper,
    target=target,
)

print(f"Optimal params: {params}")

Solvers

Solver Description
ADABK0 Active-set + AdaBelief, 1 constraint released/step. Best for noisy landscapes.
ADABK{N} Active-set + AdaBelief, up to N×10 % constraints released/step.
optax_lbfgs L-BFGS with zoom linesearch. Best for smooth landscapes.
adam, adabelief, adaw, sgd First-order optax solvers with optional projection.
optimistix_bfgs/lbfgs/ncg_* Optimistix solvers.
scipy_tnc, scipy_cobyqa Scipy solvers via jaxopt (requires cadre[scipy]).

Full solver documentation and ADABK internals: docs

Advanced usage

from cadre import get_solver
import optimistix as optx

solver, _ = get_solver("ADABK0", rtol=1e-6, atol=1e-6)

state = solver.init(loss, init_params, target, {}, f_struct, None, frozenset())
# ... step manually

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jax_cadre-0.1.0.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jax_cadre-0.1.0-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file jax_cadre-0.1.0.tar.gz.

File metadata

  • Download URL: jax_cadre-0.1.0.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for jax_cadre-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1e353594f5eb933ce09f6db83da60e30ad2fa21cd37b5a02f3bec71957a76caf
MD5 8a1e71c70acf7d1026b819df0964c9a6
BLAKE2b-256 88a537b7c1bc58df0b3ce0a1ff6277006ceb1a6803fb0f5e1c1e873e32495629

See more details on using hashes here.

Provenance

The following attestation bundles were made for jax_cadre-0.1.0.tar.gz:

Publisher: python-publish.yml on CMBSciPol/CADRE

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jax_cadre-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: jax_cadre-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for jax_cadre-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40e4fc9427960b7ef5551fc53d376e2a7369ac9062f7116c91f4c1c83d7fd510
MD5 0fd19cc01fb5e5e787675890f31671a6
BLAKE2b-256 e115edb4461ca40d90b814a99f0db0a470c8833b6823c1937e7e020e5736c1ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for jax_cadre-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on CMBSciPol/CADRE

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page