Empty Environment

Some parameters must be set before the Gurobi environment is fully configured. For example, creating a Compute Server environment requires you to first indicate the name of the server. This can be done through the Gurobi license file (gurobi.lic), but we also provide a means of doing this through the programming language APIs. Specifically, you can do this using an empty environment.

The first step is to construct the empty environment. This is done using GRBemptyenv in C, or through one of the provided GRBEnv constructors in the object-oriented interfaces. You then set parameters on this environment using the standard parameter API. Finally, you start the environment, using the GRBstartenv in C, or using the env.start() method in the object-oriented interfaces.

To give a simple example, if you'd like your Python program to offload the optimization computation to a Compute Server named server1, you could say:

  env = Env(empty=True)
  env.setParam(GRB.Param.ComputeServer, "server1:61000")
  env.setParam(GRB.Param.ServerPassword, "passwd")
  env.start()
  model = read("misc07.mps", env)
  model.optimize()

An equivalent Java program would look like this:

  GRBEnv env = new GRBEnv(true);
  env.set(GRB.StringParam.ComputeServer, "server1:61000");
  env.set(GRB.StringParam.ServerPassword, "passwd");
  env.start();
  GRBModel model = new GRBModel(env, "misc07.mps");
  model.optimize();

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.

Search