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
59
60
//! Contracts for LP and mixed-integer LP solvers: a validated model, a solver
//! trait, typed results with explicit bound/gap and dual conventions, and
//! solver-independent checks.
//!
//! This crate has no dependencies. Real optimization is in the sibling crate
//! `lp-ip-craft-native`, our pure-Rust simplex/branch-and-bound
//! implementation of [`LpIpSolver`]. [`DummySolver`] remains a contract fixture:
//! it evaluates
//! one candidate and returns it with [`Status::Stub`].
//!
//! ```
//! use lp_ip_craft::{
//! Bounds, CancellationToken, CsrMatrix, DummySolver, LpIpSolver, Model, ModelData,
//! Options, Sense, Status, VariableKind, WarmStart,
//! };
//!
//! // minimize 2 x0 + 3 x1 + 5 subject to x0 + x1 = 1, x binary
//! let model = Model::new(ModelData {
//! sense: Sense::Minimize,
//! objective: vec![2.0, 3.0],
//! objective_offset: 5.0,
//! variables: Bounds::new(vec![0.0, 0.0], vec![1.0, 1.0]),
//! kinds: vec![VariableKind::Binary; 2],
//! matrix: CsrMatrix::from_dense(1, 2, &[1.0, 1.0])?,
//! rows: Bounds::fixed(vec![1.0]),
//! })?;
//! let start = WarmStart::from_primal(vec![1.0, 0.0]);
//! let result = DummySolver.solve(
//! &model, &Options::default(), Some(&start), &CancellationToken::default(),
//! )?;
//! assert_eq!(result.status, Status::Stub); // never an optimality claim
//! let evaluation = result.evaluation.as_ref().unwrap();
//! assert_eq!(evaluation.objective, 7.0);
//! assert!(evaluation.feasible_candidate);
//! assert!(result.best_bound.is_none() && result.gap(model.sense())?.is_none());
//! # Ok::<(), lp_ip_craft::Error>(())
//! ```
pub use ;
pub use evaluate;
pub use DummySolver;
pub use ;
pub use ;
pub use ;
pub use ;