1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! `slp` is a Linear Programming Solver.
//!
//! To see the usage docs, visit [here](https://docs.rs/crate/slp/).
//!
//! ## An example
//!
//! ```rust
//! 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!();
//!         }
//!     }
//! }
//! ```

#![deny(missing_docs)]

#[macro_use]
extern crate pest_derive;

mod common;
pub use common::*;
mod lp;

pub use num::rational::{BigRational, Ratio, Rational, Rational32, Rational64};
pub use num::{self, BigInt};

/// A General Linear Programming Solver.
mod solver;
pub use solver::*;

/// Parser module for Linear Programming Problems.
pub mod parser;