### Python interface

The first step in our example is to create a model. A Gurobi model holds a single optimization problem. It consists of a set of variables, a set of constraints, and the associated attributes (variable bounds, objective coefficients, variable integrality types, constraint senses, constraint right-hand side values, etc.). We start this example with an empty model object:

# Create a new model m = gp.Model("mip1")

This function takes the desired model name as its argument.

### Python Matrix interface

The first step in our example is to create a model. We start with an empty model object:

# Create a new model m = gp.Model("matrix1")

This function takes the desired model name as its argument.

### C interface

Once an environment has been created, the next step is to create a model. A Gurobi model holds a single optimization problem. It consists of a set of variables, a set of constraints, and the associated attributes (variable bounds, objective coefficients, variable integrality types, constraint senses, constraint right-hand side values, etc.). The first step towards building a model that contains all of this information is to create an empty model object:

/* Create an empty model */ error = GRBnewmodel(env, &model, "mip1", 0, NULL, NULL, NULL, NULL, NULL); if (error) goto QUIT;

The first argument to `GRBnewmodel()` is the previously created environment. The second is a pointer to the location where the pointer to the new model should be stored. The third is the name of the model. The fourth is the number of variables to initially add to the model. Since we're creating an empty model, the number of initial variables is 0. The remaining arguments would describe the initial variables (lower bounds, upper bounds, variable types, etc.), had they been present.

### C++ interface

Once an environment has been created, the next step is to create a model. A Gurobi model holds a single optimization problem. It consists of a set of variables, a set of constraints, and the associated attributes (variable bounds, objective coefficients, variable integrality types, constraint senses, constraint right-hand side values, etc.). The first step towards building a model that contains all of this information is to create an empty model object:

// Create an empty model GRBModel model = GRBModel(env);

The constructor takes the previously created environment as its argument.

### Java interface

Once an environment has been created, the next step is to create a model. A Gurobi model holds a single optimization problem. It consists of a set of variables, a set of constraints, and the associated attributes (variable bounds, objective coefficients, variable integrality types, constraint senses, constraint right-hand side values, etc.). The first step towards building a model that contains all of this information is to create an empty model object:

// Create empty model GRBModel model = new GRBModel(env);

The constructor takes the previously created environment as its argument.

### .NET interface

// Create empty model GRBModel model = new GRBModel(env);

The constructor takes the previously created environment as its argument.

### MATLAB interface

The example begins by building an optimization model. The data associated with an optimization model must be stored in a MATLAB `struct`

. Fields in this struct contain the different parts of the model.

### R interface

The example now builds an optimization model. The data associated with an optimization model must be stored in a single list variable. Named components in this list contain the different parts of the model.

## Comments

0 comments

Please sign in to leave a comment.