[][src]Struct minilp::Solution

pub struct Solution { /* fields omitted */ }

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.

Implementations

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]

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.

impl<'a> IntoIterator for &'a Solution[src]

type Item = (Variable, &'a f64)

The type of the elements being iterated over.

type IntoIter = SolutionIter<'a>

Which kind of iterator are we turning this into?

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.