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