pub struct SolutionView<'a> {
pub objective: f64,
pub primal: &'a [f64],
pub dual: &'a [f64],
pub reduced_costs: &'a [f64],
pub iterations: u64,
pub solve_time_seconds: f64,
}Expand description
Zero-copy view of an LP solution, borrowing directly from solver-internal buffers.
Valid until the next mutating method call on the solver (any &mut self call).
This is enforced at compile time by the Rust borrow checker: the lifetime 'a
ties the view to the solver instance that produced it.
Use SolutionView::to_owned to convert to an owned LpSolution when the
solution data must outlive the current borrow, or when the same data will be
accessed after a subsequent solver call.
Fields§
§objective: f64Optimal objective value (minimization sense).
primal: &'a [f64]Primal variable values, indexed by column (length equals num_cols).
dual: &'a [f64]Dual multipliers (shadow prices), indexed by row (length equals num_rows).
Normalized to canonical sign convention.
reduced_costs: &'a [f64]Reduced costs, indexed by column (length equals num_cols).
iterations: u64Number of simplex iterations performed for this solve.
solve_time_seconds: f64Wall-clock solve time in seconds (excluding retry overhead).
Implementations§
Source§impl SolutionView<'_>
impl SolutionView<'_>
Sourcepub fn to_owned(&self) -> LpSolution
pub fn to_owned(&self) -> LpSolution
Clones the borrowed slices into owned Vecs, producing an LpSolution.
Use this when the solution data must outlive the current solver borrow, or when the same solution will be read after a subsequent solver call.
Trait Implementations§
Source§impl<'a> Clone for SolutionView<'a>
impl<'a> Clone for SolutionView<'a>
Source§fn clone(&self) -> SolutionView<'a>
fn clone(&self) -> SolutionView<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more