simplex 0.1.0

Simplex linear programing algorithm
Documentation

simplex

A crate for running the simplex algorithm, used in linear programming. This simplex implementation is pure Rust and currently in alpha stage, if you want more performance or stability, check other projects.

Simplex has two interfaces: a low-level interface, which works with almost ready matrices, and a high-level (WIP) that allows to be more expressive

Low-level interface

By default, Simplex minimizes and only does equality constraint on x>=0 variables. High level interfaces allow to use to remove these restrictions. It uses ndarray.

It accepts an objetive function, a constraints matrix and right side constraints requirements vector.

For example for this linear programming problem:

Minimize z = -30x -60y

subject to:
    0.5x + 1.5y = 30
    15x + 20y = 600
    x,y >= 0

You could write:

use simplex::simplex;
use ndarray::{arr1, arr2};

fn main() {
    let objective = arr1(&[-30., -60.]);
    let constraints = arr2(&[[0.5, 1.5, 1., 0.], [15., 20., 0., 1.]]);
    let requirements = arr1(&[30., 600.]);

    let table = simplex(objective, constraints, requirements);
    println!("{:?}", table);
}