pub struct ModelResult {
pub status: SolveStatus,
pub proof: SolutionProof,
pub objective_value: f64,
pub dual_solution: Option<Vec<f64>>,
pub reduced_costs: Option<Vec<f64>>,
pub slack: Option<Vec<f64>>,
pub bound_duals: Vec<f64>,
pub stats: SolveStats,
/* private fields */
}Expand description
The result of a successful solve.
Fields§
§status: SolveStatusSolver termination status associated with this returned solution.
Only success-domain variants occur here (Optimal, LocallyOptimal,
NonconvexLocal, NonconvexGlobal, MaxIterations, SuboptimalSolution,
Timeout); error variants surface as ModelError instead. Match on
ModelResult::proof for the optimality guarantee.
proof: SolutionProofOptimality proof quality for this returned solution.
objective_value: f64Optimal objective value.
dual_solution: Option<Vec<f64>>Dual solution (shadow prices), if available.
reduced_costs: Option<Vec<f64>>Reduced costs, if available.
通常は c − A^T y。例外: presolve の bound-tightened-fixed 列が 元の 上下限に
着地した場合、reduced_costs[j] には bound dual (μ_lb / μ_ub) が暗黙吸収され、
raw c − A^T y ではなく at-lb で max(·, 0) / at-ub で min(·, 0) の clamp 値
となる (presolve/postsolve.rs::BoundAbsorb)。LP path で bound_duals は default
空のため μ を分離取得することはできない (QP path のみ populate)。
slack: Option<Vec<f64>>Constraint slacks, if available.
bound_duals: Vec<f64>Variable bound dual values (QP path).
Layout: [lb_dual for each var with finite lb, ub_dual for each var with finite ub]
Empty when not provided by the solver.
stats: SolveStatsPer-solve routing and warm-start statistics (race-free, per-result).
Implementations§
Source§impl ModelResult
impl ModelResult
Sourcepub fn try_value(&self, var: Variable) -> Result<f64, ModelError>
pub fn try_value(&self, var: Variable) -> Result<f64, ModelError>
Get the primal value of a variable, returning an error instead of panicking.
Returns Err if:
varwas created by a different model than the one that produced this result.var.indexis out of range for the solution vector.
Sourcepub fn has_global_optimality_proof(&self) -> bool
pub fn has_global_optimality_proof(&self) -> bool
Returns true when the solver proved global optimality for this result.
Trait Implementations§
Source§impl Clone for ModelResult
impl Clone for ModelResult
Source§fn clone(&self) -> ModelResult
fn clone(&self) -> ModelResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelResult
impl Debug for ModelResult
Auto Trait Implementations§
impl Freeze for ModelResult
impl RefUnwindSafe for ModelResult
impl Send for ModelResult
impl Sync for ModelResult
impl Unpin for ModelResult
impl UnsafeUnpin for ModelResult
impl UnwindSafe for ModelResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more