totsu
Totsu (凸 in Japanese) means convex.
This crate for Rust provides a basic primal-dual interior-point method solver: PDIPM
.
Target problem
A common target problem is continuous scalar convex optimization such as LP, QP and QCQP. SOCP and SDP can also be handled with a certain effort.
Algorithm and design concepts
The overall algorithm is based on the reference: S. Boyd and L. Vandenberghe, "Convex Optimization", http://stanford.edu/~boyd/cvxbook/.
PDIPM
has a core method solve
which takes objective and constraint (derivative) functions as closures.
Therefore solving a specific problem requires an implementation of those closures.
You can use a pre-defined implementations (see predef
),
as well as construct a user-defined tailored version for the reason of functionality and efficiency.
This crate has no dependencies on other crates at all.
Necessary matrix operations are implemented in mat
, matsvd
and others.
Examples
QP
use *;
use *;
let n: usize = 2; // x0, x1
let m: usize = 1;
let p: usize = 0;
// (1/2)(x - a)^2 + const
let mat_p = new.set_iter;
let vec_q = new_vec.set_iter;
// 1 - x0/b0 - x1/b1 <= 0
let mat_g = new.set_iter;
let vec_h = new_vec.set_iter;
let mat_a = new;
let vec_b = new_vec;
let param = default;
let rslt = PDIPM new.solve_qp.unwrap;
let exp = new_vec.set_iter;
println!;
assert!;
Other Examples
You can find other test examples of pre-defined solvers in lib.rs
.
More practical examples are available here.