Skip to main content

Solver

Trait Solver 

Source
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§

Source

type Options

Backend-specific options struct. Use () for solvers without any tunables.

Required Methods§

Source

fn name(&self) -> &str

Source

fn supports(&self, kind: ModelKind) -> bool

Source

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§

Source

fn supports_sos(&self, _sos_type: SosType) -> bool

Whether this backend can consume native SOS constraints of sos_type.

Source

fn supports_indicators(&self) -> bool

Whether this backend can consume native indicator constraints.

Source

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".

Implementors§