In the context of Gurobi, parameter tuning refers to the search for algorithmic parameter settings to improve solver performance, typically on a specific set of model instances.
Gurobi's solution algorithm comprises many distinct algorithmic components that work together to optimize your model. Many aspects of this solution process can be modified by setting parameters. You can select methods and strategies for solving LP relaxations, presolving, primal heuristics, cutting plane generation, and more. Parameters are also used to enable some Gurobi features that are turned off by default, such as the NoRel Heuristic.
Why tune parameters?
It is important to understand that parameter tuning is not necessary to get good performance out of Gurobi. The default parameter settings are selected through extensive experimentation on Gurobi's collection of thousands of customer models. They work well on a wide range of model types. Several algorithmic choices are made automatically based on the model structure, or updated during the solution process.
However, for any specific model, non-default parameter settings might outperform these defaults. Users who will solve many instances of the same model type (e.g., the same mathematical model but with different data) may find that identifying and using parameters tuned for their models will help them get even better performance out of Gurobi.
How do I tune parameters?
The large number of algorithmic parameters leads to a truly astronomical number of possible setting combinations. Searching for better parameters can be difficult since the default parameters already perform well on most models. This search can be conducted with the help of our automatic Parameter Tuning Tool or done manually.
Parameter Tuning Tool
Gurobi installations include a Parameter Tuning Tool that helps to automate the search for improved parameter settings. It works especially well when the solution time is not excessive to start out with, which allows it to quickly evaluate many combinations of settings. The following resources describe the usage of this tool:
- Parameter Tuning Tool (Reference Manual Section)
- What is the parameter tuning tool? (Knowledge base article)
Manual Tuning
Users can also tune parameters by experimenting with adjusting them manually. Gurobi log files are often helpful for gaining insights about the behavior of the solution algorithms to understand which parameter settings are promising choices. For example, if Gurobi takes a long time to find good solutions for a MIP, one might try setting the parameter MIPFocus to 1, which will modify the high-level MIP solution strategy to focus extra effort on finding good solutions quickly. While for other models, it may be helpful to set MIPFocus to 2, focusing more on improving the bound.
Users interested in manually tuning their models can read the Parameter Guidelines section of our reference manual to understand more about the parameters available and their effect on the solution process.
Things to look out for
This section outlines some essential points to consider when parameter tuning.
Generating robust results
To reduce the effects of performance variability, which can result in "overfitting" of tuning results, parameter tuning experiments should be conducted using multiple random seeds and multiple representative model instances. Additionally, using too many non-default parameters at the same time may lead to negative side effects when they partly conflict with each other and may prevent the solver from automatically adapting to new models.
Know when to retune
Parameters tuned for one specific model type would not be expected to outperform Gurobi's default settings on other models. Whenever users change their model formulation or the input data changes significantly regarding value ranges or size, they should also retune any non-default parameters (or at least validate their settings against Gurobi's default parameters). The same holds after updating to a newer version of Gurobi.
Numerical Issues
Numerical issues resulting from the model formulation or data can degrade performance. Although some parameter settings, such as NumericFocus, can help remedy these issues, addressing numerical issues through model reformulation or scaling can offer the best solution. For more information on numerical issues and how to address them, please consult our Guidelines for Numerical Issues.
Model reformulation
Although parameter tuning is one way to improve Gurobi's performance on a model, there are limitations on what can be achieved. If a model is taking too long to solve, sometimes the biggest opportunity for improving performance is model reformulation. Changing the choice of decision variables, representation of constraints, and granularity of the decisions can all help. It is not always easy to find a reformulation of your model, but some examples of how to improve the performance of models can be found in our webinar series Converting Weak to Strong Formulations (part 1, part 2).
Tuning Support for Customers
Commercial Gurobi users are eligible for tuning support from our team of experts. This service is part of our Maintenance and Support agreement and is not charged extra. To receive tuning support, please open a support request in our help center. When you request tuning support, providing more than one model of interest (via our File Uploader) and telling us about your performance goals is helpful.
Comments
0 comments
Article is closed for comments.