Skip to main content

oximo_solver/
status.rs

1use thiserror::Error;
2
3#[derive(Clone, Debug, PartialEq)]
4pub enum SolverStatus {
5    Optimal,
6    Feasible,
7    Infeasible,
8    Unbounded,
9    TimeLimit,
10    NumericError,
11    NotSolved,
12    Other(String),
13}
14
15impl SolverStatus {
16    pub fn has_solution(&self) -> bool {
17        matches!(self, Self::Optimal | Self::Feasible)
18    }
19}
20
21#[derive(Debug, Error)]
22pub enum SolverError {
23    #[error("solver does not support model kind {0:?}")]
24    UnsupportedKind(oximo_core::ModelKind),
25    #[error("model is missing an objective")]
26    NoObjective,
27    #[error("nonlinear constructs are not supported by this backend")]
28    Nonlinear,
29    #[error("backend error: {0}")]
30    Backend(String),
31    #[error(transparent)]
32    Core(#[from] oximo_core::Error),
33}