Linear Programming Solver written with Rust
fn main() -> Result<(), std::io::Error> {
let c1 = Constraint{inequality: TypeInequality::Inf, coefficients: vec![1.0, 2.0, 0.0], b: 70.0};
let c2 = Constraint{inequality: TypeInequality::Inf, coefficients: vec![2.0, 3.0, - 1.0], b: 100.0};
let c3 = Constraint{inequality: TypeInequality::Sup, coefficients: vec![1.0, 0.0, 0.0], b: 20.0};
let c4 = Constraint{inequality: TypeInequality::Sup, coefficients: vec![0.0, 1.0, 0.0], b: 25.0};
let mut problem = Problem {
optimization: Optimization::Maximization,
objective_coefficients: vec![750.0, 900.0, - 450.0],
constraints: vec![c1, c2, c3, c4]
};
let solution = problem.solve();
println!("{}", solution);
Ok(())
}
println!("{}", solution);
Solution :
Var x0 = 20
Var x1 = 25
Var x2 = 15
Objective value : 30750
This solver implements the Simplex algorithm with the tableau method. The bigM method is used.
- Continuous variables
- Inf, Sup, Eq inequalities supported
- Maximization & Minimization supported
- Detection of unbounded problems
- Detection of degeneracy
- Detection of unfeasible problems
- TODO : Add Integer & Binary variables solved with Gomory's Cuts
- TODO : Add Branch & Cut
- TODO : Use Rayon crate on tableau iterations to multithread the solver
- TODO : Read from MPS file