[−][src]Struct minilp::Solution
A solution of a problem: optimal objective function value and variable values.
Note that a Solution
instance contains the whole solver machinery which can require
a lot of memory for larger problems. Thus saving the Solution
instance (as opposed
to getting the values of interest and discarding the solution) is mainly useful if you
want to add more constraints to it later.
Methods
impl Solution
[src]
pub fn objective(&self) -> f64
[src]
Optimal value of the objective function.
pub fn var_value(&self, var: Variable) -> &f64
[src]
Value of the variable at optimum.
Note that you can use indexing operations to get variable values.
pub fn iter(&self) -> SolutionIter
[src]
Iterate over the variable-value pairs of the solution.
pub fn add_constraint(
self,
expr: impl Into<LinearExpr>,
cmp_op: ComparisonOp,
rhs: f64
) -> Result<Self, Error>
[src]
self,
expr: impl Into<LinearExpr>,
cmp_op: ComparisonOp,
rhs: f64
) -> Result<Self, Error>
Add another constraint and return the solution to the updated problem.
This method will consume the solution and not return it in case of error. See also
examples of specifying the left-hand side in the docs for the Problem::add_constraint
method.
Errors
Will return an error if the problem becomes infeasible with the additional constraint.
pub fn fix_var(self, var: Variable, val: f64) -> Result<Self, Error>
[src]
Fix the variable to the specified value and return the solution to the updated problem.
This method will consume the solution and not return it in case of error.
Errors
Will return an error if the problem becomes infeasible with the additional constraint.
pub fn unfix_var(self, var: Variable) -> (Self, bool)
[src]
If the variable was fixed with fix_var
before, remove that constraint
and return the solution to the updated problem and a boolean indicating if the variable was
really fixed before.
pub fn add_gomory_cut(self, var: Variable) -> Result<Self, Error>
[src]
Add a Gomory cut constraint to the problem and return the solution.
Errors
Will return an error if the problem becomes infeasible with the additional constraint.
Panics
Will panic if the variable is not basic (variable is basic if it has value other than its bounds).
Trait Implementations
impl Clone for Solution
[src]
impl Debug for Solution
[src]
impl Index<Variable> for Solution
[src]
type Output = f64
The returned type after indexing.
fn index(&self, var: Variable) -> &Self::Output
[src]
impl<'a> IntoIterator for &'a Solution
[src]
Auto Trait Implementations
impl RefUnwindSafe for Solution
impl Send for Solution
impl Sync for Solution
impl Unpin for Solution
impl UnwindSafe for Solution
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,