Skip to main content

oximo_solver/
persistent.rs

1use crate::solver::Solver;
2
3/// A [`Solver`] that can hand out a stateful handle keeping the built backend model
4/// resident across solves.
5///
6/// The returned [`Handle`](PersistentSolver::Handle) is itself a [`Solver`]: build it
7/// once, then call [`solve`](Solver::solve) on it repeatedly. When only objective
8/// coefficients or variable bounds changed between calls it updates the resident
9/// model in place and warm-starts from the previous basis. Any structural change
10/// rebuilds transparently, so results always match a one-shot solve.
11pub trait PersistentSolver: Solver {
12    /// The stateful, resident handle. Solving the same (or a structurally identical)
13    /// model on it repeatedly reuses the build.
14    type Handle: Solver<Options = Self::Options>;
15
16    /// Create a fresh resident handle with no model loaded yet.
17    /// The first [`solve`](Solver::solve) builds it.
18    fn persistent(&self) -> Self::Handle;
19}