# Automated Parameter Tuning

Filter Content By
Version
Languages

## 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.