JuMP SCIP Error: no shadow price for LP

I get an error about a missing shadow price when I try to use SCIP to solve a simle LP in JuMP. I don’t get the error if I use HiGHS or COPT. I use Julia v1.9.1 and the following packages:

pkg> status
Status ~/.julia/environments/v1.9/Project.toml
[227a2e2d] COPT v1.1.1
[87dc4568] HiGHS v1.5.2
[4138dd39] JLD v0.13.3
[4076af6c] JuMP v1.12.0
[82193955] SCIP v0.11.13

The source code is:
using JuMP
using SCIP
model = Model(SCIP.Optimizer)
@variable(model, x >= 0)
@variable(model, 0 <= y <= 3)
@objective(model, Min, 12x + 20y)
@constraint(model, c1, 6x + 8y >= 100)
@constraint(model, c2, 7x + 12y >= 120)
print(model)
optimize!(model)
@show termination_status(model)
@show primal_status(model)
@show dual_status(model)
@show objective_value(model)
@show value(x)
@show value(y)
@show shadow_price(c1)
@show shadow_price(c2)

$ julia Wotan.jl
Min 12 x + 20 y
Subject to
c1 : 6 x + 8 y ≥ 100
c2 : 7 x + 12 y ≥ 120
x ≥ 0
y ≥ 0
y ≤ 3
feasible solution found by trivial heuristic after 0.0 seconds, objective value 1.200060e+06
presolving:
(round 1, fast) 0 del vars, 0 del conss, 0 add conss, 2 chg bounds, 0 chg sides, 0 chg coeffs, 0 upgd conss, 0 impls, 0 clqs
(round 2, fast) 0 del vars, 0 del conss, 0 add conss, 3 chg bounds, 0 chg sides, 0 chg coeffs, 0 upgd conss, 0 impls, 0 clqs
(0.0s) running MILP presolver
(0.0s) MILP presolver found nothing
(0.0s) symmetry computation started: requiring (bin +, int +, cont +), (fixed: bin -, int -, cont -)
(0.0s) no symmetry present
presolving (3 rounds: 3 fast, 1 medium, 1 exhaustive):
0 deleted vars, 0 deleted constraints, 0 added constraints, 3 tightened bounds, 0 added holes, 0 changed sides, 0 changed coefficients
0 implications, 0 cliques
presolved problem has 2 variables (0 bin, 0 int, 0 impl, 2 cont) and 2 constraints
2 constraints of type
Presolving Time: 0.00

time | node | left |LP iter|LP it/n|mem/heur|mdpt |vars |cons |rows |cuts |sepa|confs|strbr| dualbound | primalbound | gap | compl.
t 0.0s| 1 | 0 | 0 | - | trivial| 0 | 2 | 2 | 0 | 0 | 0 | 0 | 0 | 1.520000e+02 | 2.657143e+02 | 74.81%| unknown

  • 0.0s| 1 | 0 | 2 | - | LP | 0 | 2 | 2 | 2 | 0 | 0 | 0 | 0 | 2.050000e+02 | 2.050000e+02 | 0.00%| unknown
    0.0s| 1 | 0 | 2 | - | 578k | 0 | 2 | 2 | 2 | 0 | 0 | 0 | 0 | 2.050000e+02 | 2.050000e+02 | 0.00%| unknown

SCIP Status : problem is solved [optimal solution found]
Solving Time (sec) : 0.00
Solving Nodes : 1
Primal Bound : +2.05000000000000e+02 (3 solutions)
Dual Bound : +2.05000000000000e+02
Gap : 0.00 %
termination_status(model) = MathOptInterface.OPTIMAL
primal_status(model) = MathOptInterface.FEASIBLE_POINT
dual_status(model) = MathOptInterface.NO_SOLUTION
objective_value(model) = 205.0
value(x) = 14.999999999999993
value(y) = 1.2500000000000047
ERROR: LoadError: The shadow price is not available because no dual result is available.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] shadow_price(con_ref::ConstraintRef{Model, MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunction{Float64}, MathOptInterface.GreaterThan{Float64}}, ScalarShape})
@ JuMP ~/.julia/packages/JuMP/H2SWp/src/constraints.jl:1149
[3] top-level scope
@ show.jl:1128
in expression starting at /home/stuart/julia_code/Wotan/Wotan.jl:24

Since dual_status(model) returns MathOptInterface.NO_SOLUTION the error is expected.

Note that the MIP solver that is the one being used:

(0.0s) running MILP presolver
(0.0s) MILP presolver found nothing

According to https://www.scipopt.org/

SCIP is currently one of the fastest non-commercial solvers for mixed integer programming (MIP) and mixed integer nonlinear programming (MINLP).

It might be possible to use its LP solver.
However, an LP solver is recommended. HiGHS and COPT are reasonable choices.

1 Like

SCIP.jl does not support returning dual solutions. Use a different solver.