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>;
}
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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§