CPLEX model answer `has_duals` differently if variables were integer

Hey it is me again, XD,

I would want to know if this behavior is expected (i.e., if this behavior is expected to be solver-dependent):

import CPLEX, Gurobi, GLPK
using JuMP

function test_duals(solver_sym, relaxed_mip)
    solver_lib = getfield(Main, solver_sym)
    m = direct_model(solver_lib.Optimizer())
    set_silent(m)
    if relaxed_mip
        @variable(m, x[1:10] >= 0, Int)
    else
        @variable(m, x[1:10] >= 0)
    end
    @objective(m, Min, sum(x))
    relaxed_mip && unset_integer.(x)
    optimize!(m)
    @show solver_sym
    @show relaxed_mip
    @show has_duals(m)
end

test_duals(:GLPK, false)
test_duals(:GLPK, true)
test_duals(:CPLEX, false)
test_duals(:CPLEX, true)
test_duals(:Gurobi, false)
test_duals(:Gurobi, true)

gives

solver_sym = :GLPK
relaxed_mip = false
has_duals(m) = true
solver_sym = :GLPK
relaxed_mip = true
has_duals(m) = true
solver_sym = :CPLEX
relaxed_mip = false
has_duals(m) = true
solver_sym = :CPLEX
relaxed_mip = true
has_duals(m) = false
Academic license - for non-commercial use only
solver_sym = :Gurobi
relaxed_mip = false
has_duals(m) = true
Academic license - for non-commercial use only
solver_sym = :Gurobi
relaxed_mip = true
has_duals(m) = true

The odd case here is CPLEX, in which it makes difference if the variables were originally integer variables or not (for Gurobi and GLPK this seems to not matter, they just have duals available in both situations). If CPLEX model is built as an LP, it has duals, if it was built as a MIP but had all integer variables relaxed then it has not the duals available.

I found this issue that may be related, but it seems to be solved.

It looks like we re-introduced the bug in the MOI wrapper. Please open an issue at CPLEX.jl.