cobre_solver/lib.rs
1//! # cobre-solver
2//!
3//! LP/MIP solver abstraction for the [Cobre](https://github.com/cobre-rs/cobre) power systems ecosystem.
4//!
5//! This crate defines a backend-agnostic interface for mathematical programming
6//! solvers, with a default [HiGHS](https://highs.dev) backend:
7//!
8//! - **Solver trait**: unified API for LP and MIP problem construction, solving,
9//! and dual/basis extraction.
10//! - **`HiGHS` backend**: production-grade open-source solver, well-suited for
11//! iterative LP solving in power system optimization.
12//! - **Basis management**: warm-starting support for iterative algorithms
13//! that solve sequences of related LPs.
14//!
15//! Additional solver backends (e.g., Clp, CPLEX, Gurobi) can be added
16//! behind feature flags.
17//!
18//! ## Status
19//!
20//! This crate is in early development. The API **will** change.
21//!
22//! See the [repository](https://github.com/cobre-rs/cobre) for the current status.
23
24// Relax strict production lints for test builds. These lints (unwrap_used,
25// expect_used, etc.) guard library code but are normal in tests.
26#![cfg_attr(
27 test,
28 allow(
29 clippy::unwrap_used,
30 clippy::expect_used,
31 clippy::float_cmp,
32 clippy::panic,
33 clippy::too_many_lines
34 )
35)]
36
37pub mod ffi;
38
39pub mod trait_def;
40pub use trait_def::SolverInterface;
41
42pub mod types;
43pub use types::{
44 Basis, LpSolution, RowBatch, SolutionView, SolverError, SolverStatistics, StageTemplate,
45};
46
47pub mod profile;
48pub use profile::{
49 DEFAULT_PROFILE_HEURISTIC_SENTINEL, DEFAULT_PROFILE_IPM_UNBOUNDED_SENTINEL, SolveProfile,
50};
51
52pub mod profiled;
53pub use profiled::ProfiledSolver;
54
55pub mod baking;
56pub use baking::bake_rows_into_template;
57
58pub mod highs;
59pub use highs::HighsSolver;
60pub use highs::highs_version;
61
62#[cfg(feature = "test-support")]
63pub mod test_support {
64 //! Test-only utilities for configuring solver options from integration tests.
65 //!
66 //! Do **not** enable this feature in production builds. The re-exported functions
67 //! call into the `HiGHS` C API directly and bypass all safe-wrapper validation.
68
69 pub use crate::ffi::{
70 cobre_highs_get_double_option, cobre_highs_get_int_option, cobre_highs_set_double_option,
71 cobre_highs_set_int_option, cobre_highs_set_string_option,
72 };
73}