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 elaboration.
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 a 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
and matsvd
.
Example: 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 pdipm = PDIPM new;
let rslt = pdipm.solve_qp.unwrap;
let exp = new_vec.set_iter;
println!;
assert!;
You can find other test examples of pre-defined solvers in lib.rs
.