pub struct Solution {
pub values: Vec<f64>,
pub objective_value: Option<f64>,
pub status: SolveStatus,
}Expand description
Represents the result of solving an optimization problem.
Contains the values assigned to each variable, the value of the objective function, and the solver status.
§Examples
use cnvx_core::{Solution, SolveStatus, VarId};
// Example solution with 3 variables
let solution = Solution {
values: vec![1.0, 2.0, 3.0],
objective_value: Some(10.0),
status: SolveStatus::Optimal,
};
assert_eq!(solution.value(VarId(0)), 1.0);
assert_eq!(solution.value(VarId(2)), 3.0);Fields§
§values: Vec<f64>Variable assignments, indexed by variable ID.
The value at index i corresponds to the variable with ID VarId(i).
objective_value: Option<f64>The value of the objective function at the solution.
None if the solver did not produce an objective value (e.g., infeasible or unbounded problem).
status: SolveStatusThe solver status indicating whether the solution is optimal, feasible, infeasible, or unbounded.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Solution
impl RefUnwindSafe for Solution
impl Send for Solution
impl Sync for Solution
impl Unpin for Solution
impl UnsafeUnpin for Solution
impl UnwindSafe for Solution
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
Mutably borrows from an owned value. Read more