osqp 0.0.1-pre.1

The OSQP (Operator Splitting Quadratic Program) solver.
Documentation

[\begin{split}\begin{array}{ll} \mbox{minimize} & \frac{1}{2} xT P x + qT x \ \mbox{subject to} & l \leq A x \leq u \end{array}\end{split}]

where (x) is the optimization variable and (P \in \mathbf{S}^{n}_{+}) a positive semidefinite matrix.

Further information about the solver is available at osqp.readthedocs.io.

Example

Consider the following QP

use osqp::{Settings, Workspace};

// Define problem data
let P = &[[4.0, 1.0],
          [1.0, 2.0]];
let q = &[1.0, 1.0];
let A = &[[1.0, 1.0],
          [1.0, 0.0],
          [0.0, 1.0]];
let l = &[1.0, 0.0, 0.0];
let u = &[1.0, 0.7, 0.7];

// Change the default alpha and disable verbose output
let settings = Settings::default()
    .alpha(1.0)
    .verbose(false);
# let settings = settings.adaptive_rho(false);

// Create an OSQP workspace
let mut workspace = Workspace::new(P, q, A, l, u, &settings);

// Solve problem
let solution = workspace.solve();

// Print the solution
println!("{:?}", solution.x());
#
# // Check the solution
# let expected = &[0.2987710845986426, 0.701227995544065];
# assert_eq!(expected.len(), solution.x().len());
# assert!(expected.iter().zip(solution.x()).all(|(&a, &b)| (a - b).abs() < 1e-9));