# slp-cli SolHOP Linear Programming Solver. [![Crates.io](https://img.shields.io/crates/v/slp-cli.svg?style=for-the-badge)](https://crates.io/crates/slp-cli) [![Crates.io](https://img.shields.io/crates/d/slp-cli.svg?style=for-the-badge)](https://crates.io/crates/slp-cli) ![Crates.io](https://img.shields.io/crates/l/slp-cli?style=for-the-badge) Currently, the simplex method is implemented. Soon ILP and MIP will be supported. This projetct is still in development. The APIs can change a lot before the first stable release v1.0.0. ## Install and Run ### Install ```sh cargo install slp-cli ``` ### Help ```sh $ slp --help slp 0.1.0 SolHOP Linear Programming Solver USAGE: slp [FLAGS] FLAGS: -h, --help Prints help information -p, --parallel Enable data parallelism -r, --rat64 Use Rational64 -V, --version Prints version information ARGS: Input file ``` ### Usage ```sh slp input.txt ``` where `input.txt` contains the LP instance to be solved. If no file is provided then input is taken from `stdin`. To enable data parallelism use `-p` flag. ```sh slp input.txt -p ``` ## Examples ### Example 1 Input: ```txt vars x1>=0, x2>=0 max 2x1 + 3x2 subject to 2x1 + x2 <= 18, 6x1 + 5x2 <= 60, 2x1 + 5x2 <= 40 ``` Output: ```txt OPTIMAL 28 SOLUTION 5 6 ``` representing the objective value to be `28` and the solution as `x1 = 5, x2 = 6`. ### Example 2 Input: ```txt vars x1>=0, x2>=0 max 2x1 + 3x2 subject to 2x1 + x2 <= 18, 6x1 + 5x2 <= 60, 2x1 + 5x2 <= -40 ``` Output: ```txt INFEASIBLE ``` ### Example 3 Input: ```txt vars x>=0, y>=0 min 6x+3y subject to x+y>=1, 2x-y>=1, 3y<=2 ``` Output when run using command `slp input.txt`: ```txt OPTIMAL -5 SOLUTION 0.6666666666666666 0.33333333333333337 ``` To use Rational64 numbers, use `-r` flag. Output when run using command `slp -r input.txt`: ```txt OPTIMAL -5 SOLUTION 2/3 1/3 ``` ## License [MIT](LICENSE)