Using an API to Create a Compute Server Job

As was noted earlier, a Remote Services client program will always need to be told how to reach the Remote Services cluster. This can be done in two ways. The first is through a license file. This approach is described in an earlier discussion. It requires no changes to the application program itself. The same program can perform optimization locally or remotely, depending on the settings in the license file.

Your second option for specifying the desired Compute Servers is through API calls. You would first construct an empty environment (using GRBemptyenv in C or the appropriate GRBEnv constructor in the object-oriented interfaces), then set the appropriate parameters on this environment (typically ComputeServer and ServerPassword), and then start the empty environment (using GRBstartenv in C or env.start() 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();

We refer you to the Gurobi Reference Manual for details on these routines.