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
//! `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::lp::*;
//!     use slp::Solution;
//!     let input = "
//!         3 2 # 3 is number of constraints and 2 is number of variables
//!         2 3 # coefficients of objective function to be maximized: 2x1 + 3x2
//!         2 1 18 # Constraint 1: 2x1 +  x2 <= 18
//!         6 5 60 # Constraint 2: 6x1 + 5x2 <= 60
//!         2 5 40 # Constraint 3: 2x1 + 5x2 <= 40
//!         ## x1 >= 0 and x2 >= 0 are always assumed
//!         ";
//!     let mut solver = Solver::new(LP::new_from_buf_reader(&mut input.as_bytes()));
//!     let solution = solver.solve();
//!     assert_eq!(solution, Solution::Optimal(28.0, vec![5.0, 6.0]));
//!     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)]

/// A General Linear Programming Solver.
pub mod lp;

mod common;

/// Export structs nnd enums from common module.
pub use common::*;

/// Reexport num_rational.
pub use num_rational::*;
pub use num_traits::{One, Zero};