Try our new documentation site (beta).

Empty Environment Examples

To give a simple example, if you want your Python program to offload the optimization computation to a Compute Server named server1, you could say:
import gurobipy as gp
from gurobipy import GRB

# Set up environment
env = gp.Env(empty=True)
env.setParam('ComputeServer', 'server1:61000')
env.setParam('ServerPassword', 'passwd')

# Load model and optimize
model ='misc07.mps', env=env)

An equivalent Java program would look like this:

import gurobi.*;
  // Set up environment
  GRBenv env = new GRBEnv(true);
  env.set(GRB.StringParam.ComputeServer,  "server1:61000");
  env.set(GRB.StringParam.ServerPassword, "passwd");

  // Load model and optimize
  GRBModel model = new GRBModel(env, "misc07.mps");

An equivalent C program would look like this:

#include "gurobi_c.h"
int main(void) {
  GRBenv   *env   = NULL;
  GRBmodel *model = NULL;
  int error   = 0;

  /* Set up environment */
  error = GRBemptyenv(&env);
  if (error) goto QUIT;
  error = GRBsetstrparam(GRB_STR_PAR_COMPUTESERVER, "server1:61000");
  if (error) goto QUIT;
  error = GRBsetstrparam(GRB_STR_PAR_SERVERPASSWORD, "passwd");
  if (error) goto QUIT;
  error = GRBstartenv(env);
  if (error) goto QUIT;

  /* Load model and optimize */
  error = GRBreadmodel(env, "misc07.mps", &model);
  if (error) goto QUIT;
  error = GRBoptimize(model);
  if (error) goto QUIT;

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.