Search code examples
gurobijulia-jump

Set the gap for Gurobi.Optimizer in Julia-JuMP


I am trying to understand how to set the gap for Gurobi.Optimizer, because it solves too long when the default gap threshold is used (10e-4). I couldn't find it anywhere (they might be referred to as attributes or parameters).

PS: Also, I am trying to find the right tutorial or instructions on how to use the solver in JuMP. I checked here https://juliahub.com/docs/Gurobi/do9v6/0.7.7, but they don't reveal the meanings of different attributes and inputs. Please, send me one in case somebody knows.

Best, A.


Solution

  • You can set the MIP gap via the MIPGap parameter:

    using JuMP, Gurobi
    
    model = Model(Gurobi.Optimizer)
    set_optimizer_attribute(model, "MIPGap", 0.1)
    

    You can read more about JuMP here: https://github.com/jump-dev/Gurobi.jl