[−][src]Crate slp
slp
is a Linear Programming Solver.
To see the usage docs, visit here.
An example
fn main() { use slp::*; use slp::Rational64; use slp::Solution; let input = " vars x1>=0, x2>=0 max 2x1+3x2 subject to 2x1 + x2 <= 18, 6x1 + 5x2 <= 60, 2x1 + 5x2 <= 40 "; let mut solver = Solver::<Rational64>::new(&input); let solution = solver.solve(); assert_eq!(solution, Solution::Optimal(Rational64::from_integer(28), vec![ Rational64::from_integer(5), Rational64::from_integer(6) ])); match solution { Solution::Infeasible => println!("INFEASIBLE"), Solution::Unbounded => println!("UNBOUNDED"), Solution::Optimal(obj, model) => { println!("OPTIMAL {}", obj); print!("SOLUTION"); for v in model { print!(" {}", v); } println!(); } } }
Re-exports
pub use num; |
Modules
parser | Parser module for Linear Programming Problems. |
Structs
BigInt | A big signed integer type. |
Ratio | Represents the ratio between two numbers. |
Solver | Linear Programming Solver. |
Enums
Solution | Solution to an LP instance as returned by the solve method of an LP instance. |
SolverSettings | Solver settings that can be passed to the solver instance. |
Traits
Number | Number trait used in this library. |
Type Definitions
BigRational | Alias for arbitrary precision rationals. |
Rational | Alias for a |
Rational32 | Alias for a |
Rational64 | Alias for a |