Skip to main content

ProfiledSolver

Struct ProfiledSolver 

Source
pub struct ProfiledSolver<S: SolverInterface> { /* private fields */ }
Expand description

Wraps any SolverInterface implementor with per-phase profile configuration.

Tracks the currently-applied profile (typed as S::Profile) and skips no-op FFI calls when the same profile is reapplied (delta-only dispatch via PartialEq). The wrapper itself implements SolverInterface by transparently forwarding all method calls to the inner solver. ProfiledSolver::set_profile is the only non-trait-method addition.

§Generic parameter

S must implement SolverInterface. The wrapper is resolved at compile time (monomorphization) to preserve zero-cost forwarding on the hot path.

Implementations§

Source§

impl<S: SolverInterface> ProfiledSolver<S>

Source

pub fn new(inner: S) -> Self

Wrap an existing solver with the default profile.

The wrapper does NOT issue any FFI calls on construction — the inner solver is assumed to be in a state consistent with S::Profile::default(), which is exactly how it has been constructed historically.

Source

pub fn set_profile(&mut self, profile: &S::Profile)

Apply a new profile to the inner solver.

If profile == current_profile, this method returns immediately with zero inner method calls. Otherwise it delegates to inner.apply_profile(profile) which issues all necessary FFI calls.

After the call returns, current_profile() == profile.

§Call-site contract

Callers invoke this once per phase boundary. It is NOT intended to be called inside the hot solve loop.

Source

pub fn current_profile(&self) -> &S::Profile

Read-only access to the currently applied profile.

Returns the profile that was last successfully applied via ProfiledSolver::set_profile, or S::Profile::default() if no profile has been applied yet.

Source

pub fn inner(&self) -> &S

Shared reference to the wrapped inner solver.

Intended for test code and rare adapter sites that need to inspect mock-specific fields on the inner solver. Not used on the hot path.

Source

pub fn inner_mut(&mut self) -> &mut S

Exclusive reference to the wrapped inner solver.

Intended for test code and rare adapter sites that need to mutate mock-specific state on the inner solver. Not used on the hot path.

Trait Implementations§

Source§

impl<S: SolverInterface> SolverInterface for ProfiledSolver<S>

Source§

type Profile = <S as SolverInterface>::Profile

The solver-specific profile type. Read more
Source§

fn apply_profile(&mut self, profile: &S::Profile)

Apply all profile options to the underlying solver. Read more
Source§

fn load_model(&mut self, template: &StageTemplate)

Bulk-loads a pre-assembled structural LP (first step of rebuild sequence). Read more
Source§

fn add_rows(&mut self, rows: &RowBatch)

Append constraint rows to the dynamic constraint region. Read more
Source§

fn set_row_bounds(&mut self, indices: &[usize], lower: &[f64], upper: &[f64])

Updates row bounds (step 3 of rebuild; patching for scenario realization). Read more
Source§

fn set_col_bounds(&mut self, indices: &[usize], lower: &[f64], upper: &[f64])

Updates column bounds (per-scenario variable bound patching). Read more
Source§

fn solve( &mut self, basis: Option<&Basis>, ) -> Result<SolutionView<'_>, SolverError>

Solve the LP currently loaded on the backend. Read more
Source§

fn get_basis(&mut self, out: &mut Basis)

Writes solver-native i32 status codes into a caller-owned Basis buffer. Read more
Source§

fn statistics(&self) -> SolverStatistics

Returns accumulated solve metrics (snapshot of monotonically increasing counters). Read more
Source§

fn statistics_into(&self, out: &mut SolverStatistics)

Copy accumulated solve metrics into a caller-owned buffer, reusing its retry_level_histogram allocation. Read more
Source§

fn name(&self) -> &'static str

Returns a static string identifying the solver backend (e.g., "HiGHS"). Read more
Source§

fn solver_name_version(&self) -> String

Returns the solver name and version as a human-readable string. Read more
Source§

fn record_reconstruction_stats(&mut self)

Record that reconstruct_basis applied a stored basis via slot reconciliation. Default implementation is a no-op; HighsSolver overrides to increment SolverStatistics::basis_reconstructions by 1. A non-zero count indicates basis reconstruction is active on this solver instance.
Source§

fn reset_solver_state(&mut self)

Reset the solver’s internal working state to a clean baseline between independent solve sequences (e.g. at simulation/forward scenario boundaries), discarding any simplex state — factorization and, crucially, the pricing/edge-weight reference frame — carried over from prior solves. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.