# Benders Subproblem Infeasibility

**URL:** <https://discourse.julialang.org/t/benders-subproblem-infeasibility/102622>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump\
**Created:** [August 9, 2023, 7:57am UTC](https://discourse.julialang.org/t/benders-subproblem-infeasibility/102622 "2023-08-09T07:57:40Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [August 10, 2023, 8:57pm UTC](https://discourse.julialang.org/t/benders-subproblem-infeasibility/102622/2 "2023-08-10T20:57:04Z")

</div>

Hi there, welcome to the forum.

For the dual ray, you need to use `dual` instead of `shadow_price`.

Here’s an example:

```plaintext
julia> using JuMP, HiGHS

julia> model = Model(HiGHS.Optimizer)
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: HiGHS

julia> set_attribute(model, "presolve", "off")

julia> @variable(model, x[1:2] >= 0)
2-element Vector{VariableRef}:
 x[1]
 x[2]

julia> @objective(model, Min, -sum(x))
-x[1] - x[2]

julia> @constraint(model, c1, x[1] <= 1)
c1 : x[1] ≤ 1

julia> @constraint(model, c2, sum(x) >= 3)
c2 : x[1] + x[2] ≥ 3

julia> @constraint(model, c3, x[2] <= 1)
c3 : x[2] ≤ 1

julia> optimize!(model)
Running HiGHS 1.5.3 [date: 1970-01-01, git hash: 45a127b78]
Copyright (c) 2023 HiGHS under MIT licence terms
Solving LP without presolve or with basis
Using EKK dual simplex solver - serial
  Iteration Objective Infeasibilities num(sum)
          0 -1.9999961998e+00 Ph1: 3(3); Du: 2(2) 0s
          3 -1.9999961998e+00 0s
Model status : Infeasible
Simplex iterations: 3
Objective value : -2.0000000000e+00
HiGHS run time : 0.00

julia> dual_status(model)
INFEASIBILITY_CERTIFICATE::ResultStatusCode = 4

julia> cons = [c1, c2, c3]
3-element Vector{ConstraintRef{Model, C, ScalarShape} where C}:
 c1 : x[1] ≤ 1
 c2 : x[1] + x[2] ≥ 3
 c3 : x[2] ≤ 1

julia> ray = dual.(cons)
3-element Vector{Float64}:
 -1.0
  1.0
 -1.0

julia> ray = shadow_price.(cons)
3-element Vector{Float64}:
 -1.0
 -1.0
 -1.0

```

(Note the change in sign!)

`shadow_price` is really just a helper function for querying the dual solution of an LP at it is taught in some textbooks. See [Constraints · JuMP](https://jump.dev/JuMP.jl/stable/manual/constraints/#constraint_duality).

---

_[View the full topic](https://discourse.julialang.org/t/benders-subproblem-infeasibility/102622)._
