Algorithmic parameters#

Environments can also be used to set algorithmic parameters - parameters that control the behavior of the optimization solver. To give a few examples, the TimeLimit parameter indicates the maximum allowed runtime for any solve, while the Method parameter chooses the algorithm used to solve continuous optimization models.

Having said that, we actually recommend that you set algorithmic parameters on the model rather than on the environment. The object-oriented APIs all include model.set methods that enable you to do so. What’s the difference between setting parameters on the environment versus on the model? Parameter values are copied from the environment when the model is created, so changes to parameter values in the environment have no effect on models that have already been created. This is a frequent source of confusion.

In the C API, there is no method to set parameters on the model directly. Instead, the model environment can be retrieved by calling GRBgetenv.

Please see the Parameter Examples section for examples on how parameters are set.