[][src]Trait descent::model::Model

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_lb(&mut self, var: Var, lb: f64);
fn set_ub(&mut self, var: Var, ub: f64);
fn set_init(&mut self, var: Var, init: f64);
fn solve(&mut self) -> Result<(SolutionStatus, Solution)>;
fn warm_solve(
        &mut self,
        sol: Solution
    ) -> Result<(SolutionStatus, Solution)>; }

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

fn add_var(&mut self, lb: f64, ub: f64, init: f64) -> Var[src]

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

fn add_par(&mut self, val: f64) -> Par[src]

Add parameter to model with starting value.

fn add_con<E: Into<Expression>>(&mut self, expr: E, lb: f64, ub: f64) -> Con[src]

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.

fn set_obj<E: Into<Expression>>(&mut self, expr: E)[src]

Set objective of model.

fn set_par(&mut self, par: Par, val: f64)[src]

Change a parameter's value.

fn set_lb(&mut self, var: Var, lb: f64)[src]

Change the variable lower bound.

fn set_ub(&mut self, var: Var, ub: f64)[src]

Change the variable upper bound.

fn set_init(&mut self, var: Var, init: f64)[src]

Change the initial value of a variable.

fn solve(&mut self) -> Result<(SolutionStatus, Solution)>[src]

Solve the model.

fn warm_solve(&mut self, sol: Solution) -> Result<(SolutionStatus, Solution)>[src]

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

Loading content...

Implementors

Loading content...