Struct gurobi::Model[][src]

pub struct Model { /* fields omitted */ }

Gurobi model object associated with certain environment.

Methods

impl Model
[src]

Create an empty Gurobi model from the environment.

Note that all of the parameters in given environment will copy by Gurobi API and a new environment associated with the model will create. If you want to query/modify the value of parameters, use get_env().

Arguments

  • modelname : Name of the model
  • env : An environment object.

Example

use gurobi::*;

let mut env = gurobi::Env::new("").unwrap();
env.set(param::OutputFlag, 0).unwrap();
env.set(param::Heuristics, 0.5).unwrap();
// ...

let model = Model::new("model1", &env).unwrap();

Read a model from a file

create a copy of the model

Create an fixed model associated with the model.

In fixed model, each integer variable is fixed to the value that it takes in the original MIP solution. Note that the model must be MIP and have a solution loaded.

Create an relaxation of the model (undocumented).

Perform presolve on the model.

Create a feasibility model (undocumented).

Get immutable reference of an environment object associated with the model.

Get mutable reference of an environment object associated with the model.

Apply all modification of the model to process

Optimize the model synchronously

Optimize the model asynchronously

Optimize the model with a callback function

Wait for a optimization called asynchronously.

Compute an Irreducible Inconsistent Subsystem (IIS) of the model.

Send a request to the model to terminate the current optimization process.

Reset the model to an unsolved state.

All solution information previously computed are discarded.

Perform an automated search for parameter settings that improve performance on the model. See also references on official manual.

Prepare to retrieve the results of tune(). See also references on official manual.

Deprecated

Create/retrieve a concurrent environment for the model

Note that the number of concurrent environments (num) must be contiguously numbered.

Example

This example is not tested
let env1 = model.get_concurrent_env(0).unwrap();
let env2 = model.get_concurrent_env(1).unwrap();
let env3 = model.get_concurrent_env(2).unwrap();
...

Deprecated

Discard all concurrent environments for the model.

Insert a message into log file.

When message cannot convert to raw C string, a panic is occurred.

Import optimization data of the model from a file.

Export optimization data of the model to a file.

add a decision variable to the model.

add decision variables to the model.

add a linear constraint to the model.

add linear constraints to the model.

Add a range constraint to the model.

This operation adds a decision variable with lower/upper bound, and a linear equality constraint which states that the value of variable must equal to expr.

Returns

  • An decision variable associated with the model. It has lower/upper bound constraints.
  • An linear equality constraint associated with the model.

Add range constraints to the model.

add a quadratic constraint to the model.

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

Set the objective function of the model.

Query the value of attributes which associated with variable/constraints.

Set the value of attributes which associated with variable/constraints.

Query the value of attributes which associated with variable/constraints.

Set the value of attributes which associated with variable/constraints.

Modify the model to create a feasibility relaxation.

$$ \text{minimize}\quad f(x) + \sum_{i \in IIS} penalty_i(s_i) $$ where $s_i > 0$ is the slack variable of $i$ -th constraint.

This method will modify the model. If you don't want to modify the model, copy the model before invoking this method (see also copy()).

Arguments

  • relaxtype : The type of cost function used when finding the minimum cost relaxation. See also RelaxType.
  • minrelax : The type of feasibility relaxation to perform.
  • vars : Variables whose bounds are allowed to be violated.
  • lbpen / ubpen : Penalty for violating a variable lower/upper bound. INFINITY means that the bounds doesn't allow to be violated.
  • constrs : Linear constraints that are allowed to be violated.
  • rhspen : Penalty for violating a linear constraint. INFINITY means that the bounds doesn't allow to be violated.

Returns

  • The objective value for the relaxation performed (if minrelax is true).
  • Slack variables for relaxation and linear/quadratic constraints related to theirs.

Set a piecewise-linear objective function for the variable.

The piecewise-linear objective function $f(x)$ is defined as follows: \begin{align} f(x) = \begin{cases} y_1 + \dfrac{y_2 - y_1}{x_2 - x_1} \, (x - x_1) & \text{if $x \leq x_1$}, \\ \\ y_i + \dfrac{y_{i+1} - y_i}{x_{i+1}-x_i} \, (x - x_i) & \text{if $x_i \leq x \leq x_{i+1}$}, \\ \\ y_n + \dfrac{y_n - y_{n-1}}{x_n-x_{n-1}} \, (x - x_n) & \text{if $x \geq x_n$}, \end{cases} \end{align} where $\bm{x} = \{ x_1, ..., x_n \}$, $\bm{y} = \{ y_1, ..., y_n \}$ is the points.

The attribute Obj will be set to 0. To delete the piecewise-linear function on the variable, set the value of Obj attribute to non-zero.

Arguments

  • var :
  • x : $n$-points from domain of the variable. The order of entries should be non-decreasing.
  • y : $n$-points of objective values at each point $x_i$

Retrieve the status of the model.

Important traits for Iter<'a, T>

Retrieve an iterator of the variables in the model.

Important traits for Iter<'a, T>

Retrieve an iterator of the linear constraints in the model.

Important traits for Iter<'a, T>

Retrieve an iterator of the quadratic constraints in the model.

Important traits for Iter<'a, T>

Retrieve an iterator of the special order set (SOS) constraints in the model.

Remove a variable from the model.

Retrieve a single constant matrix coefficient of the model.

Change a single constant matrix coefficient of the model.

Change a set of constant matrix coefficients of the model.

Trait Implementations

impl Drop for Model
[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl !Send for Model

impl !Sync for Model