einheit-cli 0.6.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
Binary file
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: einheit-cli
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
License-File: LICENSE
|
|
5
|
+
Summary: The einheit command line: a linear and mixed-integer programming solver written in Rust.
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
9
|
+
Project-URL: Documentation, https://docs.einheit.tech
|
|
10
|
+
Project-URL: Homepage, https://einheit.tech
|
|
11
|
+
|
|
12
|
+
# einheit
|
|
13
|
+
|
|
14
|
+
Einheit is a linear and mixed-integer programming solver written in Rust. It solves LPs with a
|
|
15
|
+
primal and a dual simplex method over a sparse LU factorization, with presolve and steepest-edge
|
|
16
|
+
pricing (an interior-point method with crossover is available, off by default), and
|
|
17
|
+
mixed-integer programs (MILPs) with a branch-and-bound search that races its work across cores. **MILP is a preview**: its interfaces and defaults may change between releases.
|
|
18
|
+
|
|
19
|
+
This crate is Einheit: the LP engine (`einheit::lp`), the MILP engine (`einheit::mip`), the model
|
|
20
|
+
and its MPS and LP-format readers (`einheit::model`), the plugin host (`einheit::plugin`), the
|
|
21
|
+
einheit_form modeling layer (`einheit::form`), and the `einheit` command-line tool. Plugins are
|
|
22
|
+
written against [`einheit-plugin-sdk`](https://crates.io/crates/einheit-plugin-sdk) and installed
|
|
23
|
+
with [`cargo-einheit`](https://crates.io/crates/cargo-einheit).
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
Install the command-line tool:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
cargo install einheit
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Add the library to a project:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
cargo add einheit
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Both need Rust 1.96 or newer. The command-line tool is the default `cli` feature and the MILP
|
|
40
|
+
engine the default `mip` feature, so a project that uses only the LP library can leave both out:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
cargo add einheit --no-default-features
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For Python, install the [`einheit`](https://pypi.org/project/einheit/) package from PyPI.
|
|
47
|
+
|
|
48
|
+
## The command line
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
einheit model.mps # solve an LP, or a MILP by branch and bound
|
|
52
|
+
einheit model.mps --time-limit 60 --stats # a MILP with a time limit and a statistics block
|
|
53
|
+
einheit lp model.mps --stats # force the LP engine (a MILP's relaxation)
|
|
54
|
+
einheit mip model.mps # force branch and bound
|
|
55
|
+
einheit lp model.mps --solution-file model.sol # write the solution (.sol, or JSON for .json)
|
|
56
|
+
einheit lp --help # every LP option, grouped, with its default
|
|
57
|
+
einheit mip --help # every MILP option
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`einheit` reads MPS and CPLEX LP format, chosen by file extension. A model with integer or binary
|
|
61
|
+
variables is solved by branch and bound; `einheit lp` solves its continuous relaxation on purpose.
|
|
62
|
+
A MILP solve prints a one-line preview notice on stderr, which `--set mip.preview_notice=false`
|
|
63
|
+
turns off.
|
|
64
|
+
|
|
65
|
+
## As a library
|
|
66
|
+
|
|
67
|
+
`einheit::solve` solves any model: by the simplex when it is an LP, by branch and bound when it has
|
|
68
|
+
integer columns. `einheit::solve_with` does the same under an `einheit::Options`.
|
|
69
|
+
|
|
70
|
+
```rust
|
|
71
|
+
use einheit::lp::Sense;
|
|
72
|
+
use einheit::LpBuilder;
|
|
73
|
+
use einheit::Status;
|
|
74
|
+
|
|
75
|
+
// maximize 3x + 2y subject to x + y <= 4, x + 3y <= 6, x, y >= 0
|
|
76
|
+
let mut b = LpBuilder::new();
|
|
77
|
+
b.sense(Sense::Maximize);
|
|
78
|
+
let x = b.add_var("x", 3.0, 0.0, f64::INFINITY);
|
|
79
|
+
let y = b.add_var("y", 2.0, 0.0, f64::INFINITY);
|
|
80
|
+
b.add_constraint("c1", &[(x, 1.0), (y, 1.0)], f64::NEG_INFINITY, 4.0);
|
|
81
|
+
b.add_constraint("c2", &[(x, 1.0), (y, 3.0)], f64::NEG_INFINITY, 6.0);
|
|
82
|
+
|
|
83
|
+
let model = b.build().unwrap();
|
|
84
|
+
let solution = einheit::solve(&model);
|
|
85
|
+
|
|
86
|
+
assert_eq!(solution.status(), Status::Optimal);
|
|
87
|
+
assert!((solution.objective() - 12.0).abs() < 1e-6);
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Always match on `status()` before reading `objective()` or `x()` — they carry no meaning on a
|
|
91
|
+
non-optimal outcome. Each engine also has its own `solve`, `einheit::lp::solve` and
|
|
92
|
+
`einheit::mip::solve`, with that engine's options and result in full.
|
|
93
|
+
|
|
94
|
+
## The good_lp backend
|
|
95
|
+
|
|
96
|
+
The `good_lp` feature makes einheit a solver for [good_lp](https://crates.io/crates/good_lp):
|
|
97
|
+
|
|
98
|
+
```toml
|
|
99
|
+
[dependencies]
|
|
100
|
+
einheit = { version = "0.6", features = ["good_lp"] }
|
|
101
|
+
good_lp = "1"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Pass `einheit::good_lp::einheit` to good_lp's `.using(...)`. The backend solves the continuous
|
|
105
|
+
relaxation: integer variables are relaxed to their bounds, not branched on.
|
|
106
|
+
|
|
107
|
+
## Links
|
|
108
|
+
|
|
109
|
+
- Documentation: <https://docs.einheit.tech> — installation, guides, the option reference, and the
|
|
110
|
+
API reference
|
|
111
|
+
- Website: <https://einheit.tech>
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
MIT. See [LICENSE](../../LICENSE).
|
|
116
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
einheit_cli-0.6.0.data/scripts/einheit.exe,sha256=NUZoUfIydAa4H124VcVK1ipgkzW3keq9rVEXmtXR8Jg,7216640
|
|
2
|
+
einheit_cli-0.6.0.dist-info/METADATA,sha256=pO9eOmpDmIZTbHW44oQorsuuMWPZODpwmhUlhoaf2qc,4501
|
|
3
|
+
einheit_cli-0.6.0.dist-info/WHEEL,sha256=Uvw7WSmy7Kj2FBk8Va4L_dq4MDW8X5Ynby-pOX3ZNS0,94
|
|
4
|
+
einheit_cli-0.6.0.dist-info/licenses/LICENSE,sha256=22s0lmiDzOyT8dWj3dplwrU_1RXlUdh-k3B1xvIgwCU,1089
|
|
5
|
+
einheit_cli-0.6.0.dist-info/sboms/einheit.cyclonedx.json,sha256=t3ijLvcONEcZ4XGt_mFwmr9ZuUj05ytJjp5R_LWML4E,48993
|
|
6
|
+
einheit_cli-0.6.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dennis Cost
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|