I've been experimenting with JuMP using QPLIB instances and discovered that the known optima evaluate to incorrect objective values. It turns out that the off-diagonal quadratic terms are inflated by a factor of 2 when reading a model from an .lp file.
Test file:
Minimize
obj: 1.0 b2 + 1.0 b3 + [ 1.0 b2 * b3 + 1.0 b2^2 ]/2
Binary
b2 b3
End
Reading from JuMP:
julia> model = read_from_file("test.lp")
JuMP.objective_function(model)
b2*b3 + 0.5 b2² + b2 + b3
Reading from MOI:
julia> filename = "test.lp"
src = MOI.FileFormats.Model(; format = MOI.FileFormats.FORMAT_AUTOMATIC, filename = filename)
MOI.read_from_file(src, filename)
src.objective.scalar_quadratic
0.0 + 1.0 MOI.VariableIndex(1) + 1.0 MOI.VariableIndex(2) + 1.0 MOI.VariableIndex(1)*MOI.VariableIndex(2) + 0.5 MOI.VariableIndex(1)²
I've been experimenting with JuMP using QPLIB instances and discovered that the known optima evaluate to incorrect objective values. It turns out that the off-diagonal quadratic terms are inflated by a factor of 2 when reading a model from an .lp file.
Test file:
Reading from JuMP:
Reading from MOI: