I am trying to change the MIPGap
parameter for Guorbi:
using JuMP, Gurobi, BilevelJuMP
model = BilevelModel(Gurobi.Optimizer, mode = BilevelJuMP.SOS1Mode())
set_optimizer_attribute(model, "MIPGap", 1e-5)
Throws error:
Error: UndefVarError: RawParameter not defined
What’s the cause? Any help is appreciated. Thank you.
Julia 1.6.1
Package versions:
Gurobi v0.11.1
JuMP v1.0.0
BilevelJuMP v0.5.0
The symbol RawParameter
has now been changed to RawOptimizerAttribute
in new versions of JuMP.
Where does the error actually occur?
@jd-foster This is the full stack trace. Apparently, it seems to occur in BilevelJuMP.
ERROR: UndefVarError: RawParameter not defined
Stacktrace:
[1] set_optimizer_attribute(bm::BilevelModel, name::String, value::Float64)
@ BilevelJuMP C:\Users\math_opt\.julia\packages\BilevelJuMP\re5gQ\src\jump_attributes.jl:10
[2] top-level scope
@ REPL[3]:1
Any clue on how to get around this? Thanks!
function JuMP.solve_time(bm::BilevelModel)
return bm.solve_time
end
function build_time(bm::BilevelModel)
return bm.build_time
end
function JuMP.set_optimizer_attribute(bm::BilevelModel, name::String, value)
_check_solver(bm)
return JuMP.set_optimizer_attribute(bm, MOI.RawParameter(name), value)
end
function JuMP.set_optimizer_attribute(
bm::BilevelModel, attr::MOI.AbstractOptimizerAttribute, value
)
_check_solver(bm)
return MOI.set(bm.solver, attr, value)
end
function JuMP.set_optimizer_attributes(bm::BilevelModel, pairs::Pair...)
for (name, value) in pairs
JuMP.set_optimizer_attribute(bm.solver, name, value)
Replacing MOI.RawParameter(name)
with MOI.RawOptimizerAttribute(name)
should work?
Apparently there is a recent pull request for the same issue.
@joaquimg Any plans on merging the PR anytime soon? Or should I manually make the changes in my locally installed BilevelJuMP package for now?
Thanks a lot!
Just released BilevelJuMP 0.5.1 with this fix.
2 Likes
Works perfectly now. Thanks!