# slp
SolHOP Linear Programming Solver.
[](https://crates.io/crates/slp)
[](https://crates.io/crates/slp)

[](https://docs.rs/slp)
[](https://dev.azure.com/solhop/slp/_build/latest?definitionId=1&branchName=master)
## Install and Run
### Install
```sh
$ cargo install slp
```
### Run
```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
```
For more options, see help.
```sh
$ slp -h
```
## Input format
The input is provided throught `stdin`.
An example of LP instance is
```
max 2x1 + 3x2
subject to 2x1 + x2 <= 18
6x1 + 5x2 <= 60
2x1 + 5x2 <= 40
x1 >= 0
x2 >= 0
```
The corresponding input format is
```
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
```
## Output format
The output of the `slp` solver is sent to `stdout` and it can be one of the following:
```
INFEASIBLE
```
or
```
UNBOUNDED
```
or
```
OPTIMAL 28
SOLUTION 5 6
```
representing the objective value to be `28` and the solution as `x1 = 5, x2 = 6`.
## License
[MIT](LICENSE)