ADMM - Automatic Decomposition Method by MindOpt
Project description
ADMM: Automatic Decomposition Method by MindOpt
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+gradand 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-dev.txt
pip install . --no-build-isolation
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}
}
Troubleshooting
ImportError after installing admm
If import admm fails after a successful pip install admm, the most likely cause is that admmlib was not installed correctly. admmlib ships the native C library that admm depends on at runtime, and is normally installed automatically as a dependency.
To check whether admmlib is installed:
pip show admmlib
If it is missing, reinstall it explicitly:
pip install --force-reinstall admmlib
If the problem persists, please open an issue with the output of pip install admm -v and your platform information.
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
- Issues: GitHub Issues
- Email: solver.damo@list.alibaba-inc.com
- Documentation: https://admm.readthedocs.io
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file admm-1.0.2604112036.tar.gz.
File metadata
- Download URL: admm-1.0.2604112036.tar.gz
- Upload date:
- Size: 748.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92e7a0f211ab6723ee56c9f2981d7fb1b007034f18ad0e1b8311706da6542591
|
|
| MD5 |
38d8433461ae612efe7ce83d3647a02a
|
|
| BLAKE2b-256 |
23478a2530560b743f642d74a1eb522f404a29aa035f1c1175079f5936ce1d0e
|
File details
Details for the file admm-1.0.2604112036-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: admm-1.0.2604112036-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 294.3 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3aa07f2d009fa0b24f24ab3487c690b36269a191848c69274dffe463678174e1
|
|
| MD5 |
0ab271988ea081e2b1e7d844e5d3cd9b
|
|
| BLAKE2b-256 |
918877ef2e95a21a074e3eb5cc27e22fd2abdd47bbd7579fdd3362b327b83752
|
File details
Details for the file admm-1.0.2604112036-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: admm-1.0.2604112036-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
451cf3c58470a41e88c12a4acc16ccf960dfc819a5f91e30298325361288eebb
|
|
| MD5 |
e298927e1cc1b86ba331d7b98adf0400
|
|
| BLAKE2b-256 |
d7204fbcf906da5eb84f2e8dc2012064c2a322b3240bf5251d8f6db08921daa4
|
File details
Details for the file admm-1.0.2604112036-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: admm-1.0.2604112036-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 308.7 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
061c4f0c22dbe0a99e9471fb0de2d131cf23e64605adc59fb56fb2d8bd3636e2
|
|
| MD5 |
cb9e0d56b40a440dd53f5c31d5a93421
|
|
| BLAKE2b-256 |
78146ee4d41fdf9b3f985d84d8cd2512d761b5d4e8e84758ca576310e94f16fb
|
File details
Details for the file admm-1.0.2604112036-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: admm-1.0.2604112036-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 293.2 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f329262a65ce12b7182129668500719314ab0f6a7a5cfa0152050e2de1e1d528
|
|
| MD5 |
1915234a77175091e6b66a99cdb00178
|
|
| BLAKE2b-256 |
3d50a8fd48bf193a44ed2b2c109f28f7e0d77d9ff0fc0b6e177382386aa0f4a4
|
File details
Details for the file admm-1.0.2604112036-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: admm-1.0.2604112036-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68a2ace2defa874b5055a6a82cc1ca5308b794c7fd5336d9a21ae3926b6ffb32
|
|
| MD5 |
cca1ef932c95681c5ca285834723f858
|
|
| BLAKE2b-256 |
03e75f8dc587f50e24da9825f3476ef6e3dd714624e6dcd8e0ad5ff6e16f3f2d
|
File details
Details for the file admm-1.0.2604112036-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: admm-1.0.2604112036-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 310.9 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9ac793631389594d33f72be522f985c3f54f245b09a1d684c00dd146df8925f
|
|
| MD5 |
12a68753d1328c11beb291790d38fcca
|
|
| BLAKE2b-256 |
57334f90bd5624fcbd181704037e30c164c860792b7b37c159ce5409fd2149b5
|
File details
Details for the file admm-1.0.2604112036-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: admm-1.0.2604112036-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 317.3 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db5e5ae0445a0cf35e1efed909947f30d6c734a25ef87231d314b2270b6b0a26
|
|
| MD5 |
af7cb2057a9a9b309942fb81717b84d9
|
|
| BLAKE2b-256 |
1d3491e98fa7720aa793ec9005fbd126fc7790c660aadd74a21486cdd493784e
|
File details
Details for the file admm-1.0.2604112036-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: admm-1.0.2604112036-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.5 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efec15790fc848b0579aa70646527e919ea7929af30a407d2a236b9c1b24aace
|
|
| MD5 |
076a240c3e5e509291cede0b4d69551f
|
|
| BLAKE2b-256 |
20259a90cc5a6030510c885d91671879254d20271defe2a2f50ffc693140664c
|
File details
Details for the file admm-1.0.2604112036-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: admm-1.0.2604112036-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 319.4 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27a2eab580623cf735d7a76397843db86ed7295c178adf49afa8b2f1354aed21
|
|
| MD5 |
a35a216c662ef7cd0f735ad8019f9a91
|
|
| BLAKE2b-256 |
c5babda00a0ce884f7adf6a62b345563930abfe827d8f65fdd33819793ffb0cf
|
File details
Details for the file admm-1.0.2604112036-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: admm-1.0.2604112036-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 315.9 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8778ca7d272f9fee805bd1ebff2a892db0a4c9dc154e3131994bc806274eed4a
|
|
| MD5 |
4773b05e6d4e61f945e1675bbccc2ed8
|
|
| BLAKE2b-256 |
1f5908d58f070912441f0b221079db0a912e5b02d6b4143440d2f1854fe401b7
|
File details
Details for the file admm-1.0.2604112036-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: admm-1.0.2604112036-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee1e8bb2f8fca1a4db4ca94a97e7c6842c6719ed7b8f30f1cba98e0d5ec0d0af
|
|
| MD5 |
54d9fe73c87ad4d3763a4adf22c6b860
|
|
| BLAKE2b-256 |
411392d4e9f5af707cee186b9202ee45f1d5771d32b521bb828a9ebd1c546e98
|
File details
Details for the file admm-1.0.2604112036-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: admm-1.0.2604112036-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 324.9 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c39ee264ceef4ea4d9286f564aaea4ad741ad1ab568f067ebe143f88db543b7
|
|
| MD5 |
30e58fc80716b29543517b72a3dcbfc2
|
|
| BLAKE2b-256 |
0804bbb2c3db11e3ba292e51d3292c86f73a409d494912b4ba64686333973001
|