Skip to content

sebasv/ripped

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A pure-Rust Interior Point solver for linear programs with equality and inequality constraints.

The algorithm is heavily based on the MOSEK solver (open-access link) , and the implementation thereof in SciPy.

Linear programs

A linear program is a mathematical optimization problem defined as (using ' as the dot product):

   min_x c ' x
   st A_eq ' x == b_eq
      A_ub ' x <= b_ub
             x >= 0

Example

use ripped::prelude::*;
use approx::assert_abs_diff_eq;
use ndarray::array;

let A_ub = array![[-3f64, 1.], [1., 2.]];
let b_ub = array![6., 4.];
let A_eq = array![[1., 1.]];
let b_eq = array![1.];
let c = array![-1., 4.];

let problem = Problem::target(&c)
    .ub(&A_ub, &b_ub)
    .eq(&A_eq, &b_eq)
    .build()
    .unwrap();

let solver = InteriorPoint::default();

let solution = solver.solve(&problem);

assert_abs_diff_eq!(solution.x, array![1., 0.], epsilon = 1e-6);

About

Linear Programming in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages