[−][src]Struct linprog::Model
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]
&mut self,
sum: Vec<Summand>,
op: Operator,
b: f64
) -> &mut Self
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]
pub fn optimum(&self) -> Result<f64, &'static str>
[src]
Trait Implementations
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]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,