Try our new documentation site (beta).


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.

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

Gurobi Optimization