Try our new documentation site (beta).


Automated parameter tuning

Example: tune

The next example we consider is tune, which demonstrates the use of our automated parameter tuning tool. This tool searches for parameter settings that improve performance on a model. While you would typically invoke the tool through the command line, using our grbtune program, it can also be invoked from our APIs. We'll provide only a cursory description of the tool here. We recommend that you consult the Parameter Tuning Tool section of the Gurobi Reference Manual for more precise details.

Our tuning example demonstrates a typical use of the tuning tool. You would start by invoking the tool on a model. In C:

  error = GRBtunemodel(model);
In Java:
  model.tune();
This routine solves the model multiple times, with different parameter settings, to find settings that improve performance.

Once tuning is complete, you would then use GetTuneResult to retrieve the result. In C:

  error = GRBgettuneresult(model, 0);
In Java:
  model.getTuneResult(0);
The numerical argument indicates which tuning result to retrieve (0 is the best result, 1 is the second-best, etc.). This routine loads the requested parameter set into the environment associated with the argument model.

Once the tune parameter settings have been loaded into the model, you can then call Optimize to use these parameters to solve the model, or you can call Write to write these parameters to a .prm file.

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