pub struct SolutionPoint {
pub model_id: ModelId,
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§
§model_id: ModelId§primal: FxHashMap<VarId, f64>§objective: Option<f64>Implementations§
Source§impl SolutionPoint
impl SolutionPoint
Sourcepub fn value(&self, id: VarId) -> Option<f64>
pub fn value(&self, id: VarId) -> Option<f64>
Look up a primal value by raw VarId. Raw IDs carry no model provenance;
prefer Self::value_of when an expression handle is available.
Sourcepub fn value_of(
&self,
expr: Expr<'_>,
) -> Result<Option<f64>, ModelMismatchError>
pub fn value_of( &self, expr: Expr<'_>, ) -> Result<Option<f64>, ModelMismatchError>
Evaluate an expression at this primal point.
Returns Ok(None) when any variable needed by the expression is absent
and ModelMismatchError when the expression belongs to another model.
Parameter values are read from the expression’s model arena at query
time.
§Errors
Returns ModelMismatchError if expr belongs to another model.
Sourcepub fn value_of_idx<V, K: Into<IndexKey>>(
&self,
var: &IndexedVar<'_, V>,
key: K,
) -> Result<Option<f64>, ModelMismatchError>
pub fn value_of_idx<V, K: Into<IndexKey>>( &self, var: &IndexedVar<'_, V>, key: K, ) -> Result<Option<f64>, ModelMismatchError>
Look up the primal value for a specific index of an IndexedVar.
Returns Ok(None) if key is not in the variable’s set or the solver did
not return a primal value for that scalar. Returns ModelMismatchError
when the indexed variable belongs to another model.
§Errors
Returns ModelMismatchError if var belongs to another model.
Sourcepub fn values_of<'iv, 'a, V>(
&'iv self,
var: &'iv IndexedVar<'a, V>,
) -> Result<impl Iterator<Item = (&'iv IndexKey, f64)> + 'iv, ModelMismatchError>
pub fn values_of<'iv, 'a, V>( &'iv self, var: &'iv IndexedVar<'a, V>, ) -> Result<impl Iterator<Item = (&'iv IndexKey, f64)> + 'iv, ModelMismatchError>
Iterate over primal values for all entries of an IndexedVar.
Yields (&IndexKey, f64) for every index whose primal value is present
in the solution.
§Errors
Returns ModelMismatchError if var belongs to another model.
Trait Implementations§
Source§impl Clone for SolutionPoint
impl Clone for SolutionPoint
Source§impl Debug for SolutionPoint
impl Debug for 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