[][src]Struct linprog::Model

pub struct Model { /* fields omitted */ }

Representation of a linear program.

Methods

impl Model[src]

pub fn new(name: &str, objective: Objective) -> Self[src]

Creates a new Model. A representation of a linear program.

pub fn update(&mut self) -> &mut Self[src]

Submits the registered variables or constraints to the Model and changes it's phase to the next. This method can be called implicitly by calling reg_constr or optimize.

The Model's lifetime follows three strictly seperated phases:

  • In the first phase, variables can be registered.
  • In the second phase, constraints can be registered.
  • In the third phase, the Model can be optimized.

After the variables or constraints are submitted to the Model, they can not be changed again (The phases can not be reverted or modified).

pub fn reg_var(&mut self, objective_value: f64) -> Var[src]

Registers a variable for the Model.

Panics

This method panics if the variables were already submitted. See update.

pub fn reg_var_with_name(&mut self, objective_value: f64, name: &str) -> Var[src]

Registers a variable, with a given name, for the Model.

Panics

This method panics if the variables were already submitted. See update.

pub fn x(&self, req: &Var) -> Result<f64, &'static str>[src]

Returns the optimal value for a given, registered variable.

Errors

This method will return an Error if the Model has not been optimized. See optimize.

Panics

This method panics if the variable is not registered for the calling Model.

pub fn reg_constr(
    &mut self,
    sum: Vec<Summand>,
    op: Operator,
    b: f64
) -> &mut Self
[src]

Registers a constraint.

Panics

This method panics if the constraints were already submitted. See update.

Or if one of the variables in sum is not registered for the calling Model.

pub fn optimize(&mut self) -> &mut Self[src]

Optimizes the Model.

Panics

This method panics if the model is infeasable or might be degenerate.

pub fn optimum(&self) -> Result<f64, &'static str>[src]

Returns the optimal value.

Errors

This method will return an Error if the calling Model has not been optimized. See optimize.

Trait Implementations

impl Display for Model[src]

Auto Trait Implementations

impl Send for Model

impl Sync for Model

impl Unpin for Model

impl UnwindSafe for Model

impl RefUnwindSafe for Model

Blanket Implementations

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

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

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.

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

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

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