1#![doc = include_str!("../README.md")]
2#![forbid(unsafe_code)]
3
4mod options;
5mod persistent;
6mod translate;
7
8#[cfg(feature = "benchmark-support")]
9#[doc(hidden)]
10pub use translate::benchmark_support;
11
12pub use options::{HighsMethod, HighsOptions, HighsPresolve};
13pub use persistent::HighsPersistent;
14pub use translate::solve;
15
16use oximo_core::{Model, ModelKind};
17use oximo_solver::{PersistentSolver, Solver, SolverError, SolverResult};
18
19#[derive(Debug, Default, Clone, Copy)]
26pub struct Highs;
27
28pub(crate) const NAME: &str = "HiGHS";
31
32pub(crate) const fn supported(kind: ModelKind) -> bool {
34 matches!(kind, ModelKind::LP | ModelKind::MILP | ModelKind::QP)
35}
36
37impl Solver for Highs {
38 type Options = HighsOptions;
39
40 fn name(&self) -> &str {
41 NAME
42 }
43
44 fn supports(&self, kind: ModelKind) -> bool {
45 supported(kind)
46 }
47
48 fn solve(&mut self, model: &Model, opts: &HighsOptions) -> Result<SolverResult, SolverError> {
49 translate::solve(model, opts)
50 }
51}
52
53impl PersistentSolver for Highs {
54 type Handle = HighsPersistent;
55
56 fn persistent(&self) -> HighsPersistent {
57 HighsPersistent::new()
58 }
59}