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.3.tar.gz (24.7 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.3-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jax_cadre-0.1.3.tar.gz
  • Upload date:
  • Size: 24.7 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.3.tar.gz
Algorithm Hash digest
SHA256 c2c47bdca71c000f96a798fcd6350415646d9b963d5626f3fe3954c6bfa63591
MD5 acba9bf8508a4ff28c336744ab1a85c8
BLAKE2b-256 f548996e719969c7bbc9de621deee651b7b9e420dd3c51514d81226923ec0446

See more details on using hashes here.

Provenance

The following attestation bundles were made for jax_cadre-0.1.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: jax_cadre-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 23.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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d1950e499843517cf5ac47cbb73619e0667f23db3bc0420c235b8a90fd6dc792
MD5 8138882a3f0f65397af3bc277c44f9a8
BLAKE2b-256 9d44db66a2de5f5d4065a824c4db617a5a7c715bd83d0732392b7b31814da62b

See more details on using hashes here.

Provenance

The following attestation bundles were made for jax_cadre-0.1.3-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