Dual ray from LP solved by dual algorithm

Hello
I solve an LP using CPLEX and fix the following parameters:

    set_optimizer_attribute(sub, "CPX_PARAM_REDUCE", 0)
    set_optimizer_attribute(sub, "CPX_PARAM_NUMERICALEMPHASIS", 1)  # Emphasize numerical precision
    set_optimizer_attribute(sub, "CPX_PARAM_LPMETHOD", 2)

if I have a LP which is infeasible, I need to get the dual ray.
I check
if MOI.get(sub, MOI.DualStatus()) == MOI.INFEASIBILITY_CERTIFICATE
and try :
dual_ray_balance1 = MOI.get(sub, MOI.ConstraintDual(), balance1)
and I get the following.
All constructive comments are highly appreciated.

Error accessing dual ray: MethodError(MathOptInterface.get, (A JuMP Model
Minimization problem with:
Variables: 67
Objective function type: VariableRef
VariableRef-in-MathOptInterface.GreaterThan{Float64}: 67 constraints
AffExpr-in-MathOptInterface.LessThan{Float64}: 54 constraints
AffExpr-in-MathOptInterface.GreaterThan{Float64}: 21 constraints
AffExpr-in-MathOptInterface.EqualTo{Float64}: 36 constraints
Model mode: DIRECT
Solver name: CPLEX
Names registered in the model: Cmax, E1, E2, F1, F2, balance1, balance2, cmax, ftime, loading_sequence, loading_time, operation_completion, transfer_limit, unloading_sequence, unloading_time, x, MathOptInterface.ConstraintDual(1), 2-dimensional DenseAxisArray{ConstraintRef{Model, MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}, ScalarShape},2,…} with index sets:
Dimension 1, 1:3
Dimension 2, 1:6
And data, a 3×6 Matrix{ConstraintRef{Model, MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.EqualTo{Float64}}, ScalarShape}}:
balance1[1,1] : 34 x[1,1,1] + 34 x[1,1,2] + 34 x[1,1,3] == 19 balance1[1,2] : 19 x[2,1,1] + 19 x[2,1,2] + 19 x[2,1,3] == 3 balance1[1,3] : 21 x[3,1,1] + 21 x[3,1,2] + 21 x[3,1,3] == 2 balance1[1,4] : 41 x[4,1,1] + 41 x[4,1,2] + 41 x[4,1,3] == 7 balance1[1,5] : 33 x[5,1,1] + 33 x[5,1,2] + 33 x[5,1,3] == 12 balance1[1,6] : 21 x[6,1,1] + 21 x[6,1,2] + 21 x[6,1,3] == 3
balance1[2,1] : 34 x[1,2,1] + 34 x[1,2,2] + 34 x[1,2,3] == 13 balance1[2,2] : 19 x[2,2,1] + 19 x[2,2,2] + 19 x[2,2,3] == 9 balance1[2,3] : 21 x[3,2,1] + 21 x[3,2,2] + 21 x[3,2,3] == 6 balance1[2,4] : 41 x[4,2,1] + 41 x[4,2,2] + 41 x[4,2,3] == 19 balance1[2,5] : 33 x[5,2,1] + 33 x[5,2,2] + 33 x[5,2,3] == 18 balance1[2,6] : 21 x[6,2,1] + 21 x[6,2,2] + 21 x[6,2,3] == 5
balance1[3,1] : 34 x[1,3,1] + 34 x[1,3,2] + 34 x[1,3,3] == 2 balance1[3,2] : 19 x[2,3,1] + 19 x[2,3,2] + 19 x[2,3,3] == 7 balance1[3,3] : 21 x[3,3,1] + 21 x[3,3,2] + 21 x[3,3,3] == 13 balance1[3,4] : 41 x[4,3,1] + 41 x[4,3,2] + 41 x[4,3,3] == 15 balance1[3,5] : 33 x[5,3,1] + 33 x[5,3,2] + 33 x[5,3,3] == 3 balance1[3,6] : 21 x[6,3,1] + 21 x[6,3,2] + 21 x[6,3,3] == 13), 0x0000000000007b8c)

Edit the the category to Optimization (Mathematical) and with tags JuMP, Optimization, etc. Folks there will have answers to your questions.

1 Like

Hi @ShGE,

You can query the dual of a constraint in JuMP with JuMP.dual(balance1).

You should rarely, if ever, need to use the MOI. functions. These are for a few specialized advanced use-cases.

1 Like

I assume you’re doing some sort of Benders decomposition. We should add feasibility cuts to the tutorial: Benders decomposition · JuMP

3 Likes