Struct gurobi::model::Model [] [src]

pub struct Model<'a> {
    // some fields omitted
}

Gurobi Model

Methods

impl<'a> Model<'a>
[src]

fn new(env: &'a Env, model: *mut GRBmodel) -> Model<'a>

create an empty model which associated with certain environment.

fn update(&mut self) -> Result<()>

apply all modification of the model to process.

fn copy(&self) -> Result<Model>

create a copy of the model

fn optimize(&mut self) -> Result<()>

optimize the model.

fn write(&self, filename: &str) -> Result<()>

write information of the model to file.

fn add_var(&mut self, name: &str, vtype: VarType, obj: f64) -> Result<Var>

add a decision variable to the model.

fn add_constr(&mut self, name: &str, expr: LinExpr, sense: ConstrSense, rhs: f64) -> Result<i32>

add a linear constraint to the model.

fn add_qconstr(&mut self, constrname: &str, expr: QuadExpr, sense: ConstrSense, rhs: f64) -> Result<i32>

add a quadratic constraint to the model.

fn set_objective<Expr: Into<QuadExpr>>(&mut self, expr: Expr, sense: ModelSense) -> Result<()>

Set the objective function of the model.

fn add_sos(&mut self, vars: &[Var], weights: &[f64], sostype: SOSType) -> Result<()>

add Special Order Set (SOS) constraint to the model.

fn get<A: Attr>(&self, attr: A) -> Result<A::Output>

Query the value of a scalar attribute of the model.

fn set<A: Attr>(&mut self, attr: A, value: A::Output) -> Result<()>

Set the value of a scalar attribute of the model.

fn get_element<A: AttrArray>(&self, attr: A, element: i32) -> Result<A::Output>

Query one of the value of a vector attribute from the model.

fn set_element<A: AttrArray>(&mut self, attr: A, element: i32, value: A::Output) -> Result<()>

Set one of the value of a vector attribute to the model.

fn get_array<A: AttrArray>(&self, attr: A, first: usize, len: usize) -> Result<Vec<A::Output>>

fn set_array<A: AttrArray>(&mut self, attr: A, first: usize, values: &[A::Output]) -> Result<()>

fn get_list<A: AttrArray>(&self, attr: A, ind: &[i32]) -> Result<Vec<A::Output>>

fn set_list<A: AttrArray>(&mut self, attr: A, ind: &[i32], values: &[A::Output]) -> Result<()>

fn add_var_scalar(&mut self, name: &str, vtype: VarType, obj: f64, _: ()) -> Result<Var>

add a decision variable to the model.

fn add_var_array(&mut self, name: &str, vtype: VarType, obj: f64, size: usize) -> Result<Vec<Var>>

add an array of decision variables to the model.

  • The name of each variable is set to name[i]
  • All of the variable have the same VarType and ranges.

fn add_var_matrix(&mut self, name: &str, vtype: VarType, obj: f64, rows: usize, cols: usize) -> Result<Vec<Var>>

add a matrix of decision variables to the model.

  • The name of each variable is set to name[i][j]
  • The return value means the index of added variables ([0][0], [0][1], ..., [0][N], [1][0], ...
  • All of the variable have the same VarType and ranges.

Trait Implementations

impl<'a> Drop for Model<'a>
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more