setParam ( paramname, newvalue )

Set the value of a parameter to a new value. Note that this method only affects the parameter setting for this model. Use global function setParam to change the parameter for all models.

You can also set parameters using the Model.Params class. For example, to set parameter MIPGap to value 0 for model m, you can do either m.setParam('MIPGap', 0) or m.Params.MIPGap=0.

Please consult the parameter section for a complete list of Gurobi parameters, including descriptions of their purposes and their minimum, maximum, and default values.


paramname: String containing the name of parameter that you would like to modify. The name can include '*' and '?' wildcards. If more than one parameter matches, the matching names are listed and none are modified. Note that case is ignored.

newvalue: Desired new value for parameter. Can be 'default', which indicates that the parameter should be reset to its default value.

Example usage:

  model.setParam("heu*", 0.5)
  model.setParam(GRB.Param.heuristics, 0.5)
  model.setParam("heu*", "default")

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.