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.2.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.2-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jax_cadre-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 33f3aa246a238ac1012945fed562118829ae947cf083e6ddf5141d543fae6f00
MD5 e3cd7cd9a5efce6c260d59a02c95560d
BLAKE2b-256 6c58bccdb59c6da692332c7e254e43c5eae9ccbb6e491af465ac7dbae40bfc7a

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: jax_cadre-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3a232acd5a1eb61df96ad2567837562e146be7b302e9c0e22906591c6dbdb999
MD5 791628d77787a337115cca1a2f45e89f
BLAKE2b-256 c4bd8b6dffdb0921b620939bf9c7ef41c770a501489872aa6ed830c8e24339e0

See more details on using hashes here.

Provenance

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