https://github.com/cvxgrp/a2dr
Anderson accelerated Douglas-Rachford splitting
Science Score: 20.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
✓Committers with academic emails
2 of 5 committers (40.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.8%) to scientific vocabulary
Repository
Anderson accelerated Douglas-Rachford splitting
Basic Info
Statistics
- Stars: 29
- Watchers: 4
- Forks: 8
- Open Issues: 1
- Releases: 0
Metadata Files
README.md
a2dr
a2dr is a Python package for solving large-scale non-smooth convex optimization problems with general linear constraints, with separable objective functions accessible through their proximal operators. It exploits the separability of the objective functions and the sparsity in the linear constraints, and utilizes the power of Anderson acceleration to achieve fast and robust convergence and scalability to multiple processors. The current version is 0.2.3.post3.
It is an implementation of type-II Anderson accelerated Douglas-Rachford splitting, based on our paper A. Fu, J. Zhang, and S. Boyd (2019).
Installation
To install using pip (recommended), run:
console
pip install a2dr
To install a2dr from source, first make sure that you have setuptools
installed. Then follow the steps below:
- Clone the
a2drgit repository. - Navigate to the top-level of the cloned directory and run:
python
python setup.py install
To test the installation with nose, first make sure that you have nose installed. Then run:
python
nosetests a2dr
The requirements are: * Matplotlib * CVXPY * NumPy * SciPy * Python 3.x
Please file an issue on Github if you want Python 2 support.
Problem
a2dr solves problems of the following form:
minimize f_1(x_1) + ... + f_N(x_N)
subject to A_1x_1 + ... + A_Nx_N = b.
where fi (i=1,...,N) are convex, closed and proper, and are only accessible through their proximal operators. Notice that fi can take infinite values, and in particular constraints can be included in the objectives with the help of indicator functions.
Prox-affine forms
The above formulation is also referred to as prox-affine forms in the literature (see e.g., Epsilon). When it is seen as a standard form for generic convex optimization problems, the major advantage of prox-affine forms compared to the more widely used conic forms include:
* Privacy: suitable for distributed optimization with privacy requirements.
* In practice, the data and source code that define the proximal oracle can be securely encrypted (e.g., via compilation) so that privacy is preserved. For example, in Python, we can convert the .py file containing the proximal operator function into an encrypted .so file via the Cython extension.
* Compactness: straightforward canonicalization/transformation and lower dimensional representations.
* In general, the prox-affine form often requires less variables than the conic form (see e.g., the portfolio optimization example here). The compactness advantage is also partly exemplified by the comparison between a2dr and SCS in the sparse covariance estimation example in our paper.
For a bit more detailed introduction to prox-affine forms and the comparisons with conic forms, see our companion slides.
Usage
After installing a2dr, you can import a2dr using
python
import a2dr
This module exposes a function a2dr (the solver), which can be used via a2dr.a2dr, or directly imported using
python
from a2dr import a2dr
The function a2dr is called with the command
python
a2dr_result = a2dr(p_list,
A_list=[],
b=np.array([]),
v_init=None,
n_list=None,
max_iter=1000,
t_init=1/10,
eps_abs=1e-6,
eps_rel=1e-8,
precond=True,
ada_reg=True,
anderson=True,
m_accel=10,
lam_accel=1e-8,
aa_method='lstsq',
D_safe=1e6,
eps_safe=1e-6,
M_safe=int(max_iter/100),
verbose=True)
Parameters:
The arguments p_list, A_list and b correspond to the problem data.
* p_list is the list of proximal operators of fi. Each element of `plistis a Python function,
which takes as input a vector v and parameter t > 0 and outputs the proximal operator of f_i evaluated at (v,t).
*Alist` is the list of Ai. The lists p_list and A_list must be given in the same order i = 1,...,N.
* b is the vector b.
Notice that A_list and b are optional, and when omitted, the solver recognizes the problem as one without linear constraints. Also notice that in such cases, A_list and b have to be omitted together, and either v_init or n_list has to be provided to declare the dimension of each x_i.
For information on the other optional hyper-parameters, please refer to our companion paper (Algorithm 2) and the source code comments of the function a2dr in solver.py.
Returns:
The returned object a2dr_result is a dictionary containing the keys 'x_vals', 'primal', 'dual', 'num_iters' and 'solve_time':
* The output x_vals is a list of x1,...,xN from the iteration with the smallest residuals.
* primal and dual are arrays containing the primal and dual residual norms for the entire iteration process, respectively.
* The value num_iters is the total number of iterations, and solve_time is the algorithm runtime.
When the linear equality constraint is infeasible, the solver will print the corresponding flag and return None for all the outputs.
Other tools
The module a2dr also comes with several additional tools that facilitates the transformation of the problems into the required input format described above as well as tests and visualization. In particular, it come with a package for proximal operators, which can be imported via
python
import a2dr.proximal
It also comes with some tests and visualization tools, which can be imported via
python
import a2dr.tests
Example
We showcase the usage of the solver function a2dr as well as the the tool packages a2dr.proximal and a2dr.tests with the following example. More examples can be found in the examples/ directory.
```python
Non-negative least squares (see our companion paper for more details)
import numpy as np import numpy.linalg from scipy import sparse from a2dr import a2dr from a2dr.proximal import * from a2dr.tests.base_test import BaseTest
Problem data.
np.random.seed(1) m, n = 150, 300 density = 0.001 X = sparse.random(m, n, density=density, data_rvs=np.random.randn) y = np.random.randn(m)
Convert problem to standard form.
proxlist = [lambda v, t: proxsumsquaresaffine(v, t, F=X, g=y), proxnonnegconstr] A_list = [sparse.eye(n), -sparse.eye(n)] b = np.zeros(n)
Solve with DRS.
drsresult = a2dr(proxlist, A_list, b, anderson=False)
Solve with A2DR.
a2drresult = a2dr(proxlist, Alist, b, anderson=True) bt = BaseTest() bt.comparetotal(drsresult, a2drresult)
```
Citing
If you wish to cite a2dr, please use the following:
```
@article{a2dr,
author = {Fu, A. and Zhang, J. and Boyd, S.},
title = {Anderson Accelerated {D}ouglas-{R}achford Splitting},
journal = {SIAM Journal on Scientific Computing},
year = {2020},
volume = {42},
number = {6},
pages = {A3560–A3583},
url = {http://stanford.edu/~boyd/papers/a2dr.html},
}
@misc{a2dr_code, author = {Fu, A. and Zhang, J. and Boyd, S.}, title = {{a2dr}: Anderson Accelerated {D}ouglas-{R}achford Splitting, version 0.2.3.post3}, howpublished = {\url{https://github.com/cvxgrp/a2dr}}, year = {2020} } ```
Owner
- Name: Stanford University Convex Optimization Group
- Login: cvxgrp
- Kind: organization
- Location: Stanford, CA
- Website: www.stanford.edu/~boyd
- Repositories: 102
- Profile: https://github.com/cvxgrp
GitHub Events
Total
Last Year
Committers
Last synced: over 3 years ago
All Time
- Total Commits: 311
- Total Committers: 5
- Avg Commits per committer: 62.2
- Development Distribution Score (DDS): 0.569
Top Committers
| Name | Commits | |
|---|---|---|
| Anqi Fu | a****7@g****m | 134 |
| junziz | j****z@s****u | 107 |
| anqif | a****f@s****u | 68 |
| anqif | a****i@0****m | 1 |
| Shane Barratt | s****t@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 3
- Total pull requests: 1
- Average time to close issues: 1 day
- Average time to close pull requests: 7 minutes
- Total issue authors: 3
- Total pull request authors: 1
- Average comments per issue: 2.67
- Average comments per pull request: 1.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- lukevolpatti (1)
- sbarratt (1)
- rkern (1)
Pull Request Authors
- sbarratt (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 128 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 3
- Total maintainers: 2
pypi.org: a2dr
A Python package for type-II Anderson accelerated Douglas-Rachford splitting (A2DR).
- Homepage: https://github.com/cvxgrp/a2dr
- Documentation: https://a2dr.readthedocs.io/
- License: Apache License, Version 2.0
-
Latest release: 0.2.3
published over 6 years ago
Rankings
Maintainers (2)
Dependencies
- cvxpy *
- matplotlib *
- numpy *
- scipy *