pub struct SolutionPoint {
pub primal: FxHashMap<VarId, f64>,
pub objective: Option<f64>,
}Expand description
A single primal point returned by a solver.
Most solves yield one point, but a global solver asked to enumerate solutions
may returns several. In a SolverResult the points live in SolverResult::solutions.
Index 0 is always the best/incumbent.
Fields§
§primal: FxHashMap<VarId, f64>§objective: Option<f64>Implementations§
Source§impl SolutionPoint
impl SolutionPoint
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.
Sourcepub fn value_of_idx<V, K: Into<IndexKey>>(
&self,
var: &IndexedVar<'_, V>,
key: K,
) -> Option<f64>
pub fn value_of_idx<V, K: Into<IndexKey>>( &self, var: &IndexedVar<'_, V>, 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, V>(
&'iv self,
var: &'iv IndexedVar<'a, V>,
) -> impl Iterator<Item = (&'iv IndexKey, f64)> + 'iv
pub fn values_of<'iv, 'a, V>( &'iv self, var: &'iv IndexedVar<'a, V>, ) -> 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.
Trait Implementations§
Source§impl Clone for SolutionPoint
impl Clone for SolutionPoint
Source§fn clone(&self) -> SolutionPoint
fn clone(&self) -> SolutionPoint
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 SolutionPoint
impl Debug for SolutionPoint
Source§impl Default for SolutionPoint
impl Default for SolutionPoint
Source§fn default() -> SolutionPoint
fn default() -> SolutionPoint
Auto Trait Implementations§
impl Freeze for SolutionPoint
impl RefUnwindSafe for SolutionPoint
impl Send for SolutionPoint
impl Sync for SolutionPoint
impl Unpin for SolutionPoint
impl UnsafeUnpin for SolutionPoint
impl UnwindSafe for SolutionPoint
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