The exact option name will depend on the interface that you use to a solver. For instance, if you use the NL-file interface to Gurobi, which you specify as
SolverFactory(“gurobi”, solver_io=“nl”)
or
SolverFactory(“gurobi_ampl”) ,
then an option like the mipgap will need to be set as
opt.options[‘mipgap’] = 0.05
If you use the Python interface to Gurobi, which you specify as
SolverFactory(“gurobi”, solver_io=“python”) ,
then you likely need to set the option as
opt.options[‘MIPGap’] = 0.05
Although, it is possible that the gurobipy interface ignores the case when you set an option name.
There are no default values for options on a solver. If you directly modify the options dictionary, like what is done above, those options will persist across every call to opt.solve(…) unless you delete them from the options dictionary. You can also pass a dictionary of options into the opt.solve(…) method using the “options” keyword. Those options will only persist within that solve and temporarily override any matching options in the options dictionary on the solver object.
Gabe