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"); GRBModel model = new GRBModel(env, "misc07.mps"); model.optimize();








