Crate quadprog[][src]

Expand description

Solve dense quadratic programs.

This crate implements the Goldfarb Indiani method1 for solving quadratic programs of the form:

    minimize     1/2 x' Q x + c' x
    subject to   A1 x  = b1
                 A2 x <= b2

in pure rust. These are solved via the only exported function solve_qp which returns a Solution struct.

Examples

If we want to solve

    minimize     1/2 x^2 + 1/2 y^2 + x
    subject to   x + 2 y >= 1

we can do so with the following example:

let mut q = [1., 0., 0., 1.];
let c = [1., 0.];
let a = [-1., -2.];
let b = [-1.];
let sol = solve_qp(&mut q, &c, &a, &b, 0, false).unwrap();
assert_eq!(sol.sol, &[-0.6, 0.8]);

1 D. Goldfarb and A. Idnani (1983). A numerically stable dual method for solving strictly convex quadratic programs. Mathematical Programming, 27, 1-33.


  1.  

Structs

The solution to a quadratic program

Functions

Solve a strictly convex quadratic program.