Crate totsu_core

source ·
Expand description

Totsu ( in Japanese) means convex.

This crate for Rust provides a first-order conic linear program solver for convex optimization.

Target problem

A common target problem is continuous scalar convex optimization such as LP, QP, QCQP, SOCP and SDP. Each of those problems can be represented as a conic linear program: \[ \begin{array}{ll} {\rm minimize} & c^T x \\ {\rm subject \ to} & A x + s = b \\ & s \in \mathcal{K}, \end{array} \] where

  • variables \( x \in \mathbb{R}^n,\ s \in \mathbb{R}^m \)
  • \( c \in \mathbb{R}^n \) as an objective linear operator
  • \( A \in \mathbb{R}^{m \times n} \) and \( b \in \mathbb{R}^m \) as constraint linear operators
  • a nonempty, closed, convex cone \( \mathcal{K} \).

Algorithm and design concepts

The author combines the two papers [1] [2] so that the homogeneous self-dual embedding matrix in [2] is formed as a linear operator in [1].

A core method solver::Solver::solve takes the following arguments:

  • objective and constraint linear operators that implement solver::Operator trait and
  • a projection onto a cone that implements solver::Cone trait.

Therefore solving a specific problem requires an implementation of those traits. You can use pre-defined implementations: totsu crate, as well as construct a user-defined tailored version for the reason of functionality and efficiency. This crate also contains several basic structs that implement solver::Operator and solver::Cone trait.

Core linear algebra operations that solver::Solver requires are abstracted by solver::LinAlg trait, while subtrait LinAlgEx is used for the basic structs. This crate contains a LinAlgEx implementor:

  • FloatGeneric - num::Float-generic implementation (pure Rust but slow).

Other crates are also available:

Features

This crate can be used without the standard library (#![no_std]). Use this in Cargo.toml:

[dependencies.totsu_core]
version = "0.*"
default-features = false
features = ["libm"]

Examples

See examples in GitHub.

References

  1. T. Pock and A. Chambolle. “Diagonal preconditioning for first order primal-dual algorithms in convex optimization.” 2011 International Conference on Computer Vision. IEEE, 2011.
  2. B. O’donoghue, et al. “Conic optimization via operator splitting and homogeneous self-dual embedding.” Journal of Optimization Theory and Applications 169.3 (2016): 1042-1068.
  3. N. Parikh and S. Boyd. “Proximal algorithms.” Foundations and Trends in optimization 1.3 (2014): 127-239.
  4. Mosek ApS. “MOSEK modeling cookbook.” (2020).
  5. S. Boyd and L. Vandenberghe. “Convex Optimization.” (2004).

Modules

First-order conic linear program solver

Macros

Splits a SliceRef into multiple ones.
Splits a SliceMut into multiple ones.

Structs

Positive semidefinite cone
Nonnegative orthant cone
Rotated second-order (or quadratic) cone
Second-order (or quadratic) cone
Zero cone
num::Float-generic LinAlgEx implementation
Matrix operator

Enums

Matrix type and size

Traits

Linear algebra extended subtrait