totsu
Totsu (凸 in Japanese) means convex.
This crate for Rust provides a first-order conic linear program solver.
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.
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].
See documentation for more details.
Features
Using linalg::F64LAPACK
[]
= "0.8.0"
= ["f64lapack"]
In addition you need a BLAS/LAPACK source to link.
Without std
This crate can be used without the standard library (#![no_std]
).
Use this in Cargo.toml
:
[]
= "0.8.0"
= false
= ["libm"]
Some module and structs are not availale in this case.
Changelog
Changelog is available in CHANGELOG.md.
Examples
QP
use assert_float_eq;
use *;
use MatBuild;
use ProbQP;
//env_logger::init();
type LA = ;
type AMatBuild = ;
type AProbQP = ;
type ASolver = ;
let n = 2; // x0, x1
let m = 1;
let p = 0;
// (1/2)(x - a)^2 + const
let mut sym_p = new;
sym_p = 1.;
sym_p = 1.;
let mut vec_q = new;
vec_q = -; // -a0
vec_q = -; // -a1
// 1 - x0/b0 - x1/b1 <= 0
let mut mat_g = new;
mat_g = -1. / 2.; // -1/b0
mat_g = -1. / 3.; // -1/b1
let mut vec_h = new;
vec_h = -1.;
let mat_a = new;
let vec_b = new;
let s = new.par;
let mut qp = new;
let rslt = s.solve.unwrap;
assert_float_eq!;
Other examples
You can find other tests of pre-defined problems. More practical examples are also available.