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>
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
S::Profile::default(), which is exactly how it has been
constructed historically.
Sourcepub fn set_profile(&mut self, profile: &S::Profile)
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.
Sourcepub fn current_profile(&self) -> &S::Profile
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.
Trait Implementations§
Source§impl<S: SolverInterface> SolverInterface for ProfiledSolver<S>
impl<S: SolverInterface> SolverInterface for ProfiledSolver<S>
Source§fn apply_profile(&mut self, profile: &S::Profile)
fn apply_profile(&mut self, profile: &S::Profile)
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 statistics_into(&self, out: &mut SolverStatistics)
fn statistics_into(&self, out: &mut SolverStatistics)
retry_level_histogram allocation. Read moreSource§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.