Search code examples
pyomogurobi

How to tune Gurobi parameters using Pyomo


I know that I can use an automatic tool from Gurobi to find the best parameters for my model. https://www.gurobi.com/documentation/9.5/refman/py_model_tune.html

Someone knows how can run this tool using Pyomo? I have a model coded using Pyomo and I would like to call this tune function.

Thanks


Solution

  • Thanks to Greg Glockner.

    First, before calling the solver in Pyomo: model.write("mymodel.mps")

    After that, create a new .py file with this script:

    from gurobipy import *
    model = read("mymodel.mps")
    model.setParam('TuneOutput', 3)
    model.tune()