pub trait Solver {
type Options;
// Required methods
fn name(&self) -> &str;
fn supports(&self, kind: ModelKind) -> bool;
fn solve(
&mut self,
model: &Model,
opts: &Self::Options,
) -> Result<SolverResult, SolverError>;
// Provided methods
fn supports_sos(&self, _sos_type: SosType) -> bool { ... }
fn supports_indicators(&self) -> bool { ... }
fn supports_model(&self, model: &Model) -> bool { ... }
}Expand description
Concrete solver backend.
Backends live in their own crates and the umbrella oximo crate
gates them behind cargo features. Implementors translate the
Model into their internal representation, solve, and return
a populated SolverResult.
Each backend defines its own Options type so users get
LSP autocomplete and compile-time validation on the options that actually
apply. The oximo_solver crate ships shared building blocks
(UniversalOptions,
UniversalOptionsExt)
for backends to compose into their own structs.
Required Associated Types§
Required Methods§
fn name(&self) -> &str
fn supports(&self, kind: ModelKind) -> bool
Sourcefn solve(
&mut self,
model: &Model,
opts: &Self::Options,
) -> Result<SolverResult, SolverError>
fn solve( &mut self, model: &Model, opts: &Self::Options, ) -> Result<SolverResult, SolverError>
Solves the given Model using this solver.
§Errors
Returns a SolverError if the model is unsupported or if the solver backend fails.
Provided Methods§
Sourcefn supports_sos(&self, _sos_type: SosType) -> bool
fn supports_sos(&self, _sos_type: SosType) -> bool
Whether this backend can consume native SOS constraints of sos_type.
Sourcefn supports_indicators(&self) -> bool
fn supports_indicators(&self) -> bool
Whether this backend can consume native indicator constraints.
Sourcefn supports_model(&self, model: &Model) -> bool
fn supports_model(&self, model: &Model) -> bool
Whether this backend can consume all features present in model.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".