pub struct SolverResult {
pub status: SolverStatus,
pub objective: Option<f64>,
pub primal: FxHashMap<VarId, f64>,
pub dual: FxHashMap<ConstraintId, f64>,
pub reduced_costs: FxHashMap<VarId, f64>,
pub solve_time: Duration,
pub iterations: u64,
pub raw_log: Option<String>,
}Expand description
A solver’s final result on a model. primal and dual are sparse maps so a
solver that does not return duals (e.g. MILP) can simply leave them empty.
Fields§
§status: SolverStatus§objective: Option<f64>§primal: FxHashMap<VarId, f64>§dual: FxHashMap<ConstraintId, f64>§reduced_costs: FxHashMap<VarId, f64>§solve_time: Duration§iterations: u64§raw_log: Option<String>Implementations§
Source§impl SolverResult
impl SolverResult
Sourcepub fn value_of(&self, expr: Expr<'_>) -> Option<f64>
pub fn value_of(&self, expr: Expr<'_>) -> Option<f64>
Look up the primal value for an Expr that points at a Var node.
Returns None for any expression that is not a single variable, so
callers that need the value of a derived expression should evaluate it
against the primal solution explicitly.
pub fn dual_of(&self, c: ConstraintId) -> Option<f64>
Sourcepub fn value_of_idx<K: Into<IndexKey>>(
&self,
var: &IndexedVar<'_>,
key: K,
) -> Option<f64>
pub fn value_of_idx<K: Into<IndexKey>>( &self, var: &IndexedVar<'_>, key: K, ) -> Option<f64>
Look up the primal value for a specific index of an IndexedVar.
Returns None if key is not in the variable’s set or the solver did
not return a primal value for that scalar.
Sourcepub fn values_of<'iv, 'a>(
&'iv self,
var: &'iv IndexedVar<'a>,
) -> impl Iterator<Item = (&'iv IndexKey, f64)> + 'iv
pub fn values_of<'iv, 'a>( &'iv self, var: &'iv IndexedVar<'a>, ) -> impl Iterator<Item = (&'iv IndexKey, f64)> + 'iv
Iterate over primal values for all entries of an IndexedVar.
Yields (&IndexKey, f64) for every index whose primal value is present
in the solution. To keep only nonzero values (common for sparse
solutions) chain .filter(|(_, v)| *v != 0.0).
Trait Implementations§
Source§impl Clone for SolverResult
impl Clone for SolverResult
Source§fn clone(&self) -> SolverResult
fn clone(&self) -> SolverResult
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 SolverResult
impl Debug for SolverResult
Auto Trait Implementations§
impl Freeze for SolverResult
impl RefUnwindSafe for SolverResult
impl Send for SolverResult
impl Sync for SolverResult
impl Unpin for SolverResult
impl UnsafeUnpin for SolverResult
impl UnwindSafe for SolverResult
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> 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