Optimization with Gurobi

I am solving an optimization problem with Gurobi package. I set the non-convex parameter to be 2 which helped me with the bilinear constraints. But, I am getting an infeasible solution with a warning
Model contains large rhs
Consider reformulating model or setting NumericFocus parameter
to avoid numerical issues
How do I set the NumericFocus Parameter?

From the documentation:

To construct a Gurobi Environment, one can write:

env = Gurobi.Env()

This package provides functions to get and set parameters:

getparam(env, name) # get the value of a parameter
setparam!(env, name, v) # set the value of a parameter
setparams!(env, name1=value1, name2=value2, …) # set parameters using keyword arguments

You may refer to Gurobi’s Parameter Reference for the whole list of parameters.

Here is the Gurobi page for NumericFocus.

1 Like

The documentation you liked to is out-of-date.


model = Model(Gurobi.Optimizer)
set_optimizer_attribute(model, "NumericFocus", 2)
1 Like

Oh, sorry. I trusted Google. Will never happen again;)


Thank you very much. My model later worked. I reformulated after setting the NumericFocus.

1 Like