Trait descent::model::Model

source ·
pub trait Model {
    fn add_var(&mut self, lb: f64, ub: f64, init: f64) -> Var;
    fn add_par(&mut self, val: f64) -> Par;
    fn add_con<E: Into<Expression>>(&mut self, expr: E, lb: f64, ub: f64) -> Con;
    fn set_obj<E: Into<Expression>>(&mut self, expr: E);
    fn set_par(&mut self, par: Par, val: f64);
    fn set_init(&mut self, var: Var, init: f64);
    fn solve(&mut self) -> (SolutionStatus, Option<Solution>);
    fn warm_solve(&mut self, sol: Solution) -> (SolutionStatus, Option<Solution>);
}
Expand description

Interface for a mathematical program with continuous variables.

Panics

Expect a panic, either our of bounds or otherwise, if a variable or parameter is used in this model that was not directly returned by the add_var or add_par methods. Check individual implementations of trait for details of when these panics could occur.

Required Methods

Add variable to model with lower / upper bounds and initial value.

Add parameter to model with starting value.

Add a constraint to the model with lower and upper bounds.

To have no lower / upper bounds set them to std::f64::NEG_INFINITY / std::f64::INFINITY respectively.

Set objective of model.

Change a parameter’s value.

Change the initial value of a variable.

Solve the model.

Solve the model using a previous solution as a warm start.

Implementors