pub struct ProfiledSolver<S: SolverInterface> { /* private fields */ }Expand description
Wraps any SolverInterface implementor with per-phase profile
configuration.
Tracks the currently-applied profile and skips no-op FFI calls when the
same profile is reapplied. 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>
impl<S: SolverInterface> ProfiledSolver<S>
Sourcepub fn new(inner: S) -> Self
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
SolveProfile::default(), which is exactly how it has been
constructed historically.
Sourcepub fn set_profile(&mut self, profile: &SolveProfile)
pub fn set_profile(&mut self, profile: &SolveProfile)
Apply a new profile to the inner solver.
Only fields that differ from current_profile trigger trait-method
calls on the inner solver. The dispatch order is deterministic:
primal feasibility → dual feasibility → simplex cap → IPM cap.
If profile == current_profile, this method returns immediately with
zero inner method 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.
Sourcepub fn current_profile(&self) -> &SolveProfile
pub fn current_profile(&self) -> &SolveProfile
Read-only access to the currently applied profile.
Returns the profile that was last successfully applied via
ProfiledSolver::set_profile, or SolveProfile::default() if no
profile has been applied yet.
Trait Implementations§
Source§impl<S: SolverInterface> SolverInterface for ProfiledSolver<S>
impl<S: SolverInterface> SolverInterface for ProfiledSolver<S>
Source§fn load_model(&mut self, template: &StageTemplate)
fn load_model(&mut self, template: &StageTemplate)
Source§fn add_rows(&mut self, rows: &RowBatch)
fn add_rows(&mut self, rows: &RowBatch)
Source§fn set_row_bounds(&mut self, indices: &[usize], lower: &[f64], upper: &[f64])
fn set_row_bounds(&mut self, indices: &[usize], lower: &[f64], upper: &[f64])
Source§fn set_col_bounds(&mut self, indices: &[usize], lower: &[f64], upper: &[f64])
fn set_col_bounds(&mut self, indices: &[usize], lower: &[f64], upper: &[f64])
Source§fn solve(
&mut self,
basis: Option<&Basis>,
) -> Result<SolutionView<'_>, SolverError>
fn solve( &mut self, basis: Option<&Basis>, ) -> Result<SolutionView<'_>, SolverError>
Source§fn statistics(&self) -> SolverStatistics
fn statistics(&self) -> SolverStatistics
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
"HiGHS"). Read moreSource§fn solver_name_version(&self) -> String
fn solver_name_version(&self) -> String
Source§fn record_reconstruction_stats(&mut self)
fn record_reconstruction_stats(&mut self)
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.