Closed chriscoey closed 2 years ago
Do you have the Gurobi log? I don't have a good solution for you. That's an internal Gurobi error, not from us.
What happens if you use Gurobi directly? There might be other parameters that you need to set.
OK I think I figured it out. the problem being solved is continuous, not MISOCP. so we can't call objective_bound:
using Test
import JuMP
import Gurobi
const MOI = JuMP.MOI
TOL = 1e-4
m = JuMP.Model(Gurobi.Optimizer)
JuMP.@variable(m, x)
JuMP.@objective(m, Min, -x)
JuMP.@constraint(m, [3.5, x] in JuMP.SecondOrderCone())
JuMP.optimize!(m)
@test JuMP.termination_status(m) == MOI.OPTIMAL
@test JuMP.primal_status(m) == MOI.FEASIBLE_POINT
@test isapprox(JuMP.objective_value(m), -3.5, atol = TOL)
@test isapprox(JuMP.value(x), 3.5, atol = TOL)
@test isapprox(JuMP.dual_objective_value(m), -3.5, atol = TOL) # EDIT: also ERROR
@test isapprox(JuMP.objective_bound(m), -3.5, atol = TOL) # ERROR
So I can fix this in MOIPajarito.
In general I don't know whether it is intended that objective_bound only work for MIPs and not for continuous problems. But I guess it was Gurobi's choice in this case.
actually, JuMP.dual_objective_value(m)
errors too (same error). so I can't get dual obj or obj bound for this SOCP. that's a bit surprising
Yeah that's a deliberate Gurobi choice. The perils of solver-independence...
You should probably use a try-catch.
eh i'll just use the primal objective value
changed my mind. does this look OK? I'm not 100% sure if there's a problem with using return inside try.
# try to get an objective bound or dual objective value, else use the primal objective value
function get_objective_bound(model::JuMP.Model)
try
return JuMP.objective_bound(model)
catch
end
try
return JuMP.dual_objective_value(model)
catch
end
return JuMP.objective_value(model)
end
Using return
inside try
is fine.
Is this for MILP models? What even is the dual objective value?
the OA solver isn't necessarily a MIP solver. at some point with a separation-cuts-only algorithm, we can give cuts to a conic solver that doesn't support all the cones we want
@odow
the issue is reproduced if you run
include("test/myruntests.jl")
(not the usual "runtests.jl")what I see is:
here is the line where it occurs: https://github.com/chriscoey/MOIPajarito.jl/blob/e161bc8f0a1559f970b66eb8b3b2ca141277f063/src/optimize.jl#L498
it is solving a MISOCP with Gurobi just a few lines above that (MOIPajarito does not use outer approximation because Gurobi already supports MISOCP and this instance is MISOCP).