Linearly Constrained Separable Optimization

Related tags

Cryptography lcso
Overview

LCSO (Linearly Constrained Separable Optimization)

Authors

The original algorithms here were developed by Nicholas Moehle, and this project was authored by Jack Gindi. See our medium post for a discussion of the design choices behind the project.

Introduction

This library contains a Rust implementation of the alternating-direction method of multipliers (ADMM) algorithm.

We solve a problem of the form:

    minimize    (1/2)x'Px + q'x + ∑ g_i(x_i)
       x
    subject to  Ax = b.

In the above:

  • A is an m x n sparse matrix.
  • b is an m-vector.
  • P is an n x n positive semidefinite sparse matrix.
  • q is an n-vector.
  • x, the decision variable, is an n-vector.
  • g_i is a piecewise quadratic function for i = 1,...,n. For more information on these, see the documentation for the PiecewiseQuadratic and BoundedQuadratic submodules of the quadratics module.

An advantage of our method is that very complicated piecewise quadratic functions (e.g., with thousands of pieces) can be used while maintaining fast algorithm run time.

Project organization

The project is organized as follows:

src
├── opto            <-- the lcso module
│   ├── admm.rs     <-- ADMM optimization routine
│   ├── mod.rs      <-- lcso namespace module file
│   ├── prox.rs     <-- proximal operator evaluation
│   ├── structs.rs  <-- structures used to hold ADMM state
|   └── term.rs     <-- termination criteria
├── lib.rs          <-- top-level module file
└── quadratics
    ├── bq.rs       <-- bounded quadratic functions
    ├── envelope.rs <-- convex envelope implementation for piecewise
                        quadratic functions
    ├── mod.rs      <-- quadratics namespace module file
    ├── pwq.rs      <-- piecewise quadratic functions
    └── utils.rs    <-- numerical utilities

Getting started

To clone the repo, run git clone https://github.com/blackrock/lcso.git.

Install

First make sure you have Rust>=1.44.1 installed in your environment The required modules are different depending on whether you are using Linux or MacOS:

Linux

On Linux, the shared libraries to install depend on your Linux distribution:

  • On Debian/Ubuntu, install libopenblas64-dev and libgfortran-{9,10}-dev (depending on your version of gcc).
  • On Redhat/Fedora, install blas-devel and libgfortran. Once installed, make sure the binaries are on your system path.

MacOS

Make sure that the following binaries are installed and on your system path:

  • openblas
  • gcc (9 or 10) These can both be installed using Homebrew.

Next, you'll need to install SuiteSparse (5.7.2). You should be able to install it and and its LDL implementation with something like the following snippet:

# create a lib directory, you could also do the installation anywhere else
mkdir lib
cd lib

# clone the SuiteSparse repository
git clone "https://github.com/DrTimothyAldenDavis/SuiteSparse.git"
cd "SuiteSparse" 

# check out version 5.7.2
git checkout v5.7.2

# install SuiteSparse_config
cd "SuiteSparse_config"
make clean
make install INSTALL="${INSTALL_LOCATION}"

# install SuiteSparse LDL matrix factorization implementation
cd "../LDL"
make clean
make install INSTALL="${INSTALL_LOCATION}"

where $INSTALL_LOCATION is where you want the binary to be installed. On package-managed Linux, you can omit the INSTALL=... part of the make install commands.

Compile

To compile the project, run cargo build. To compile in release mode, run cargo build --release.

To simply check that the code compiles, run cargo check.

Run Tests

To run tests, in the root directory of the project, run cargo test.

Example

To run the example, run cargo run --example small_example. To see the example source code, see examples/small_example.rs.

Disclaimer

This code was used to produce results in the paper linked here. We will accept contributions and improvements, but updates and new versions may be few and far between. At this time, the code is not intended to be relied upon in a production setting.

NOTE: Only MacOS and Linux are supported.

You might also like...
TP - Optimization of the energy consumption of a Matrix Multiplication

Optimization de la consommation: Multiplication de matrices Nous allons travailler sur la multiplication de matrices denses. C’est un algorithme class

A pure, low-level tensor program representation enabling tensor program optimization via program rewriting

Glenside is a pure, low-level tensor program representation which enables tensor program optimization via program rewriting, using rewriting frameworks such as the egg equality saturation library.

OptFrame is an optimization framework focused in metaheuristic techniques

optframe-rust Welcome to OptFrame project in Rust. What is OptFrame? OptFrame is an optimization framework focused in metaheuristic techniques, develo

A standalone Aleo prover build upon snarkOS and snarkVM, with multi-threading optimization

Aleo Light Prover Introduction A standalone Aleo prover build upon snarkOS and snarkVM, with multi-threading optimization. It's called "light" because

A neural network model that can approximate any non-linear function by using the random search algorithm for the optimization of the loss function.

random_search A neural network model that can approximate any non-linear function by using the random search algorithm for the optimization of the los

A library and application for lossless, format-preserving, two-pass optimization and repair of Vorbis data, reducing its size without altering any audio information.
A library and application for lossless, format-preserving, two-pass optimization and repair of Vorbis data, reducing its size without altering any audio information.

OptiVorbis A library and application for lossless, format-preserving, two-pass optimization and repair of Vorbis data, reducing its size without alter

Image optimization using Rust and Vips 🦀

Huffman Image optimization using Rust and Libvips. Requirements You must have the following packages installed before getting started Rust Vips pkg-co

A blazingly fast compiling & optimization tool for CosmWasm smart contracts.
A blazingly fast compiling & optimization tool for CosmWasm smart contracts.

cw-optimizoor A blazingly fast alternative to CosmWasm/rust-optimizer for compiling & optimizing CW smart contracts. It's primarily meant to speed up

Salty and Sweet one-line Rust Runtime Optimization Library

SAS SAS (Salty-And-Sweet) is an one-line Rust runtime optimization library. Features NUMA-aware rayon: numa feature should be enabled If you have 1 NU

Owner
BlackRock
BlackRock
A blazingly fast compiling & optimization tool for CosmWasm smart contracts.

cw-optimizoor A blazingly fast alternative to CosmWasm/rust-optimizer for compiling & optimizing CW smart contracts. It's primarily meant to speed up

Sebastian Mandrean 37 Apr 15, 2023
A merkle-based token distributor for the Solana network that allows distributing a combination of unlocked and linearly unlocked tokens.

merkle-distributor A program for distributing tokens efficiently via uploading a Merkle root. Claiming Airdrop via CLI To claim via CLI instead of usi

null 6 Dec 8, 2023
A Constrained Application Protocol(CoAP) library implemented in Rust.

coap-rs A fast and stable Constrained Application Protocol(CoAP) library implemented in Rust. Features: CoAP core protocol RFC 7252 CoAP Observe optio

Covertness 170 Dec 19, 2022
Gomez - A pure Rust framework and implementation of (derivative-free) methods for solving nonlinear (bound-constrained) systems of equations

Gomez A pure Rust framework and implementation of (derivative-free) methods for solving nonlinear (bound-constrained) systems of equations. Warning: T

Datamole 19 Dec 24, 2022
defmt is a highly efficient logging framework that targets resource-constrained devices, like microcontrollers

defmt defmt ("de format", short for "deferred formatting") is a highly efficient logging framework that targets resource-constrained devices, like mic

Knurling 476 Jan 2, 2023
Incremental computation through constrained memoization.

comemo Incremental computation through constrained memoization. [dependencies] comemo = "0.1" A memoized function caches its return values so that it

Typst 37 Dec 15, 2022
Rust implementation of real-coded GA for solving optimization problems and training of neural networks

revonet Rust implementation of real-coded genetic algorithm for solving optimization problems and training of neural networks. The latter is also know

Yury Tsoy 19 Aug 11, 2022
Mathematical optimization in pure Rust

argmin A pure Rust optimization framework This crate offers a numerical optimization toolbox/framework written entirely in Rust. It is at the moment p

argmin 549 Jan 1, 2023
Collection of Optimization algorithm in Rust

rustimization A rust optimization library which includes L-BFGS-B and Conjugate Gradient algorithm. Documentation The simplest way to use these optimi

Naushad Karim 47 Sep 23, 2022
Rust implementation of real-coded GA for solving optimization problems and training of neural networks

revonet Rust implementation of real-coded genetic algorithm for solving optimization problems and training of neural networks. The latter is also know

Yury Tsoy 19 Aug 11, 2022