Potential bug on relative gap calculation

Whatever the MIP tolerance I get the relative mip gap is always zero.

I am using:

MOI.get(model, MOI.RelativeGap())

JuMP v"0.20.1"
Xpress v"0.10.0"

Seems to be an issue either in JuMP or in Xpress

Do you have an example?

See below:

The expression MOI.get(model, MOI.RelativeGap()) always returns zero, regardless of the tolerance achieved by the solver.

-----------------------------------------

using JuMP
using Xpress

Preparing an optimization model

m = Model(with_optimizer(Xpress.Optimizer, OUTPUTLOG = 0, MIPRELSTOP = 0.0001 ))

Declaring variables

@variable(m, 0<= x1 <=10)
@variable(m, x2 >=0, Int)
@variable(m, x3[i=1:100000], Bin)
@variable(m, obj_function >= 0 )

Setting the objective

@objective(m, Max, obj_function )

Adding constraints

@constraint(m, constraint0, sum(x3[i] for i in 1:100000) <= 1000)
@constraint(m, constraint1, -x1 + x2 + sum(rand()*x3[i] for i in 1:100000) <= 500)
@constraint(m, constraint2, x1 + 3x2 - sum(rand()*x3[i] for i in 1:100000) <= 800)
@constraint(m, constraint3, x1 + 2x2 + sum(rand()*x3[i] for i in 1:100000) == obj_function)

Solving the optimization problem

optimize!(m)

MOI.get(m, MOI.RelativeGap())
JuMP.value(obj_function)

MOI.get(m, MOI.SolveTime())

With MIPRELSTOP = 0.9

MOI.get(m, MOI.RelativeGap()) is 0

JuMP.value(obj_function) is 798.9799221022847

With MIPRELSTOP = 0.0001

MOI.get(m, MOI.RelativeGap()) is 0

JuMP.value(obj_function) is 1888.5283814454042

I’ve opened an issue: Bug in ObjectiveBound · Issue #83 · jump-dev/Xpress.jl · GitHub