Skip to main content

ADMM: Automatic Decomposition Method by MindOpt

PyPI version Documentation Status License: MIT Build and Publish

ADMM (Automatic Decomposition Method by MindOpt) is a Python library for building and solving structured optimization models. You describe objectives and constraints in a natural mathematical style, and ADMM turns that model into an efficient numerical solve through automatic canonicalization, decomposition, and a high-performance C++ backend.

The core idea is simple: model the problem, not the solver internals. ADMM is designed for formulations that combine linear or quadratic terms, smooth fitting losses, nonsmooth regularization, affine constraints, matrix structure, and custom proximal terms.

For convex models, ADMM targets the global optimum. Through user-defined proximal extensions, it also supports selected nonconvex formulations such as exact sparsity, rank constraints, and manifold-style projections, where the solver acts as a practical local method.

Features

  • Model-first optimization workflow: Write the mathematics directly and let ADMM handle canonicalization, decomposition, and solver orchestration automatically.
  • Rich structured problem support: Combine linear and quadratic objectives, smooth losses, nonsmooth regularizers, affine constraints, and matrix-valued structure such as symmetry and PSD constraints.
  • Beyond standard convex modeling: 48 ready-to-use UDF classes ship out of the box — from L0 sparsity and rank constraints to Cauchy, Welsch, and Tukey robust losses, KL divergence, logistic regression, and graph Laplacian smoothing. For any new smooth loss, supply just eval + grad and the C++ backend solves the proximal subproblem automatically.
  • Built for real applications: Use the same interface for portfolio optimization, sparse and regularized learning, covariance estimation, semidefinite modeling, compressed sensing, and signal or image processing.
  • NumPy-friendly Python API: Work naturally with scalars, vectors, and matrices in a concise Python interface instead of hand-coding low-level updates.
  • Fast backend, practical deployment: Run on a C++ backend with Python bindings across Linux, macOS, and Windows.

When to Use ADMM

ADMM is a strong fit when your model combines several structured ingredients in one formulation, such as:

  • linear or quadratic objectives
  • smooth fitting terms such as least squares, logistic regression, or Huber loss
  • nonsmooth regularization such as L1 or nuclear norm
  • affine equality or inequality constraints
  • structural constraints on variables such as nonnegativity, symmetry, or PSD
  • matrix-valued objectives such as trace, log-determinant, or Frobenius norm
  • custom proximal terms for advanced nonconvex modeling
  • custom smooth losses via gradient-based UDFs (Cauchy, log-cosh, quantile regression, etc.)

Installation

From PyPI

pip install admm

This will automatically install all dependencies including admmlib (the pre-built admm C++ core dependency library).

From Source

git clone https://github.com/alibaba-damo-academy/admm.git
cd admm
pip install . -r requirements.txt

Quick Start

The following example shows a mean-variance portfolio optimization problem:

min    -mu^T w + gamma * w^T Sigma w
s.t.   sum(w) = 1,   w >= 0

The corresponding ADMM code:

import admm
import numpy as np

n = 20
mu = np.abs(np.random.randn(n))
F = np.random.randn(n + 3, n)              # random factor matrix
Sigma = F.T @ F + 0.1 * np.eye(n)          # covariance matrix (PSD)
gamma = 0.5                                # risk-aversion parameter

model = admm.Model()
w = admm.Var("w", n)
model.setObjective(-mu.T @ w + gamma * (w.T @ Sigma @ w))
model.addConstr(admm.sum(w) == 1)
model.addConstr(w >= 0)
model.optimize()

print(f"status: {model.StatusString}")
print(f"obj:    {model.ObjVal:.6f}")

Examples

The examples/ folder contains 40 standalone scripts covering every documented use case — from basic LP/QP to UDF-based nonconvex models and gradient-based smooth losses. Each script runs independently:

python examples/portfolio_optimization.py
python examples/sparse_logistic_regression.py
python examples/udf_l0_norm.py

See examples/README.md for the full list.

User-Defined Proximal Functions

The udf/ folder ships 48 ready-to-use UDF classes — 15 proximal operators for nonconvex and convex penalties (L0, rank, manifold projections, etc.) and 33 gradient-based smooth losses covering robust M-estimators (Cauchy, Welsch, Tukey, Geman-McClure, etc.), classification losses (logistic, hinge, cross-entropy), divergences (KL, Itakura-Saito, χ²), barriers (log barrier, negative entropy), and structural penalties (smooth TV, graph Laplacian) — that go beyond standard convex modeling tools.

ADMM supports two UDF paths — supply the proximal operator (argmin) or just the gradient (grad):

# Path 1: argmin — closed-form proximal operator (nonconvex penalties, indicators)
from udf.L0Norm import L0Norm
model.setObjective(0.5 * admm.sum(admm.square(x - y)) + lam * L0Norm(x))
# Path 2: grad — gradient only (smooth custom losses)
from udf.CauchyLoss import CauchyLoss
model.setObjective(CauchyLoss(A @ x - b, c=2.0))

The grad path lets you add any differentiable custom loss without deriving a proximal formula — the C++ backend handles the proximal solve via gradient descent with backtracking line search.

See udf/README.md for the full class list, how to write your own, and how to contribute.

Documentation

Building from Source

Prerequisites

  • Python >= 3.10
  • C++ compiler (GCC, Clang, or MSVC)
  • Cython >= 0.29.0, setuptools >= 61, NumPy >= 1.20.0, SciPy >= 1.7.0
  • admmlib >= 2026.4.9 (pre-built C++ core dependency)
  • xelatex / latexmk (only needed for PDF documentation)

Supported Platforms

  • Linux: x86_64 (GCC)
  • macOS: ARM64 (Apple Silicon, Clang)
  • Windows: x86_64 (MSVC)

Build and Install

pip install . -r requirements.txt

Run Tests

pytest tests/                    # all tests
pytest tests/test_ut.py          # unit tests
pytest tests/test_admm.py        # application tests
pytest tests/test_udf.py         # user-defined function tests (argmin path)
pytest tests/test_udf_grad.py    # user-defined function tests (grad path)
pytest tests/test_doc.py         # documentation example tests

Build Documentation Locally

cd docs
bash build.sh

Open docs/_build/html/index.html in your browser. To build HTML only (without LaTeX/PDF):

cd docs
python -c "import genrst; genrst.writeRst()"
python -m sphinx -b dirhtml ./ ./_build/html

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines, including how to contribute new user-defined proximal function classes under udf/.

Citing ADMM

If you use ADMM in your research or work, please cite:

@software{admm2026,
  title  = {{ADMM}: {A}utomatic {D}ecomposition {M}ethod by {MindOpt}},
  author = {{MindOpt Team, Alibaba DAMO Academy}},
  year   = {2026},
  url    = {https://github.com/alibaba-damo-academy/admm},
  note   = {Open-source Python library for structured optimization}
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

This project is maintained by the MindOpt Team at Alibaba DAMO Academy.

Support

Metadata

Release files for admm 1.0.2604112003

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for admm 1.0.2604112003
File Size Uploaded
admm-1.0.2604112003.tar.gz 748.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for admm 1.0.2604112003
File
admm-1.0.2604112003-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
admm-1.0.2604112003-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
admm-1.0.2604112003-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
admm-1.0.2604112003-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
admm-1.0.2604112003-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
admm-1.0.2604112003-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
admm-1.0.2604112003-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
admm-1.0.2604112003-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
admm-1.0.2604112003-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
admm-1.0.2604112003-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
admm-1.0.2604112003-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
admm-1.0.2604112003-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details

Total release size: 12.8 MB

Release files / admm-1.0.2604112003.tar.gz

Download URL admm-1.0.2604112003.tar.gz
Size 748.5 kB
Tags Source
SHA-256 checksum
How to use checksums
aa493abf4ad631e7c6d20bfd904a1e316869ff7dc3762aac0f02c3d4a1feda7e
BLAKE2b-256 checksum
How to use checksums
ef786886274cc5d865db43ceb954dc2ca0e054f38da0b8ba285e9bb7f2d5afc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / admm-1.0.2604112003-cp313-cp313-win_amd64.whl

Download URL admm-1.0.2604112003-cp313-cp313-win_amd64.whl
Size 294.0 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
77c522fefccbdefb2df07c6b9580f1af512f4b2208a58d81a72fc2570714187c
BLAKE2b-256 checksum
How to use checksums
99c1eeb98f95a2a6e12b8ef0d14fdfb0bff143207d270a2bde999d9ec97c381b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / admm-1.0.2604112003-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL admm-1.0.2604112003-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.4 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
e83ba1d79f5f5a0f37b09a967854de785bc7bd501f64dc6ac84b897d0578f200
BLAKE2b-256 checksum
How to use checksums
46cda42dac1ea2756f2e5c40d23d737d147f1131a0c6eb5fa9ce53f55489133a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / admm-1.0.2604112003-cp313-cp313-macosx_11_0_arm64.whl

Download URL admm-1.0.2604112003-cp313-cp313-macosx_11_0_arm64.whl
Size 308.4 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3c2aad6798da473e4362d9c65a6f5d6b3ab916538df84ad85b7b71b55f8871d8
BLAKE2b-256 checksum
How to use checksums
02d0525dd53df4063d2260a248348369c63bebbf3da00a0f1f357824b17d9c20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / admm-1.0.2604112003-cp312-cp312-win_amd64.whl

Download URL admm-1.0.2604112003-cp312-cp312-win_amd64.whl
Size 293.0 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
9ad2fc661a0c3255e0d045194ed4389c254879f09d46eafb08d9db35c68788fd
BLAKE2b-256 checksum
How to use checksums
86b8a54d920be53b2ad4ab44e96cf4b30fb308346b9cc8c48619a2bc2060623d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / admm-1.0.2604112003-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL admm-1.0.2604112003-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.4 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c1a9e08458ba6a8f1f4ae16f1401155c11678c13748eb8cf81dff248da48ca27
BLAKE2b-256 checksum
How to use checksums
ba85a31fed463e2e6e2f0a0c1841aa554d169bf10f1768931bf5f398667c9872
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / admm-1.0.2604112003-cp312-cp312-macosx_11_0_arm64.whl

Download URL admm-1.0.2604112003-cp312-cp312-macosx_11_0_arm64.whl
Size 310.6 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8d0e57661373c5b73d9c3e31741e96e52742bbe59b8914a2b1b0bf0587622688
BLAKE2b-256 checksum
How to use checksums
569f7bd415f4ab0febe2bc085f8a6634d4f2e4c56a5b3c07ce0cbfb8d067f01c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / admm-1.0.2604112003-cp311-cp311-win_amd64.whl

Download URL admm-1.0.2604112003-cp311-cp311-win_amd64.whl
Size 317.0 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
bdd3426cee3d4089254fb24ba1521b5487dade5f7f78745081cb28f9a90378a8
BLAKE2b-256 checksum
How to use checksums
040396b9bdd791b50246c79d43a0848ca80f467d5558e42024614123cdf0fb45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / admm-1.0.2604112003-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL admm-1.0.2604112003-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.5 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
d3e0509226076085698f65edc0942086e35e3fe01de8f6d2b5267ef43c7f19a0
BLAKE2b-256 checksum
How to use checksums
f316d0251a9b9c93af258046e92f6fe205865589b73aaa521219dc3c0ad88feb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / admm-1.0.2604112003-cp311-cp311-macosx_11_0_arm64.whl

Download URL admm-1.0.2604112003-cp311-cp311-macosx_11_0_arm64.whl
Size 319.1 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1c99313e75c77cbdbf2ee4726d063a36e7c7da581b16c89a968a48e1a7f8c846
BLAKE2b-256 checksum
How to use checksums
217b4b4d98b8d91f2f10d591785fc90a8a22ec0ab3252fc2d40511a72c70486c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / admm-1.0.2604112003-cp310-cp310-win_amd64.whl

Download URL admm-1.0.2604112003-cp310-cp310-win_amd64.whl
Size 315.7 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
17f01beb619327e01c872ac3f80c3750cb00d8dacc743b3cd7507f5310233210
BLAKE2b-256 checksum
How to use checksums
7937daf62880bc57640ef26a38276533782aafecc79ebc42f838a96d6d160eaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / admm-1.0.2604112003-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL admm-1.0.2604112003-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.3 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
fca5bb06682b53be20188e79c4adfaefb7a91f33d4dfe87bbbfb4bf3a8a58008
BLAKE2b-256 checksum
How to use checksums
5c78fbfacaccfdf8fe26095f52bab481fe2d67d235c063368e15988b82de7f0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / admm-1.0.2604112003-cp310-cp310-macosx_11_0_arm64.whl

Download URL admm-1.0.2604112003-cp310-cp310-macosx_11_0_arm64.whl
Size 324.6 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c717bbfd1f87cb1e7a33848829603359f323d7f9d24dfa8422f7dfc006a53053
BLAKE2b-256 checksum
How to use checksums
46f0ffee109453d6442de0ace33e4b194eaa70a1d25aac13ef68054e1a4d69d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page