Convex Optimization Primal Dual Solver
Project description
Optimus-Primal: A Lightweight primal-dual solver
optimusprimal is a light weight proximal splitting Forward Backward Primal Dual based solver for convex optimization problems. The current version supports finding the minimum of f(x) + h(A x) + p(B x) + g(x), where f, h, and p are lower semi continuous and have proximal operators, and g is differentiable. A and B are linear operators. To learn more about proximal operators and algorithms, visit proximity operator repository. We suggest that users read the tutorial “The Proximity Operator Repository. User’s guide”.
QUICK INSTALL
You can install optimusprimal with PyPi by running
pip install optimusprimal
INSTALL FROM SOURCE
Alternatively, you can install optimusprimal from GitHub by first cloning the repository
git clone git@github.com:astro-informatics/Optimus-Primal.git
cd Optimus-Primal
and running the build script and run install tests by
bash build_optimusprimal.sh
pytest --black optimusprimal/tests/
BASIC USAGE
After installing optimusprimal one can e.g. perform an constrained proximal primal dual reconstruction by
import numpy as np
import optimusprimal.primal_dual as primal_dual
import optimusprimal.linear_operators as linear_ops
import optimusprimal.prox_operators as prox_ops
options = {'tol': 1e-5, 'iter': 5000, 'update_iter': 50, 'record_iters': False}
# Load some data
y = np.load('Some observed signal y') # Load a file of observed data.
epsilon = sigma * np.sqrt(y.size + 2 np.sqrt(y.size)) # where sigma is your noise std.
# Define a forward model i.e. y = M(x) + n
M = np.ones_like(y) # Here M = Identity for simplicity.
p = prox_ops.l2_ball(epsilon, y, linear_ops.diag_matrix_operator(M)) # Create a l2-ball data-fidelity.
# Define a regularisation i.e. ||W(x)||_1
wav = ['db1', 'db3', 'db4'] # Select some wavelet dictionaries.
psi = linear_operators.dictionary(wav, levels=6, y.shape) # Define multi-dictionary wavelets.
h = prox_ops.l1_norm(gamma=1, psi) # Create an l1-norm regulariser.
# Recover an estiamte i.e. x_est = min[h(x)] s.t. p(x) <= epsilon
x_est, = primal_dual.FBPD(y, options, None, None, h, p, None) # Recover an estimate of x.
CONTRIBUTORS
LICENSE
optimusprimal is released under the GPL-3 license (see LICENSE.txt), subject to the non-commercial use condition.
optimusprimal
Copyright (C) 2021 Luke Pratley & contributors
This program is released under the GPL-3 license (see LICENSE.txt),
subject to a non-commercial use condition (see LICENSE_EXT.txt).
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
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 Distributions
Built Distribution
File details
Details for the file optimusprimal-0.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: optimusprimal-0.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 26.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32f61941b43880bf3c9a2679045c422fe0c16371ccc7ca688f14ea5d867a2210 |
|
MD5 | d15a332076def300ebb62aa8b3c27b1a |
|
BLAKE2b-256 | 564f02c4f02cddc4e1f89a918cb2d8b7c41e6aa22a609582d8b3b43454044868 |