JuMP: infeasibility ray when variable bounds are present

Hi all,
I am stuck in a riddle with JuMP for which there might be an easier solution. Assume you are given an infeasible JuMP model with variable bounds. How to get a infeasibility ray for the dual taking into account the variable bounds? For instance, in the case of:

using JuMP, GLPKMathProgInterface
m = Model(solver=GLPKSolverLP())
@variable(m, -0.5 <= x[1:2] <= 0.5)
@constraint(m, x[1] + x[2] <= -2)
@objective(m, Min, x[1] - x[2])

I could do the following to obtain a ray with respect to the linear constraints

solve(m)
intm = internalmodel(m)
infray = MathProgBase.getinfeasibilityray(intm)

however, that would not take into account the bounds. I know I could simple state all bounds as constraints but that would be inefficient and my situation is a bit more complicated than this example (it involves constraints generated programmatically and binaries that are relaxed with solve(m, relaxation=true)).
The question is then, is it possible to obtain a full infeasibility ray without writing all variable bounds as constraints? if so, how?

I am solving this type of problem within a Benders scheme, hence, I do not really need the entire infeasibility ray, but just the dual objective evaluated at the ray. If there is an easy way to obtain that, it would also solve my problem.

Any help would be appreciated :slight_smile:

The short answer is that it should work on JuMP master with MathOptInterface.
With MathOptInterface, variable bounds constraints are treated like classical constraints so you can get the dual value on them.
On JuMP master, you can simply do

lbref = JuMP.LowerBoundRef.(x)
ubref = JuMP.UpperBoundRef.(x)
lbduals = JuMP.resultdual.(lbref)
ubduals = JuMP.resultdual.(ubref)

If JuMP.dualstatus(m) is MOI.InfeasibilityCertificate (it should be if the problem is infeasible) then lbduals and ubduals will be the value of the certificate for the variable bound constraints.

I see, thanks Benoit :smiley: