Gurobi Error 10005: Unable to retrieve attribute 'Slack'

Hi,

I’m getting the above error when using Gurobi to solve an LP and then querying the value of a constraint. The LP has been solved such that @assert(termination_status(𝓜) == MOI.OPTIMAL) passes. Unfortunately, I haven’t been able to replicate the problem with a small test case yet, so this is more of a “has anyone else seen this?” than a helpful report.

Code that doesn’t exhibit the problem is:

using JuMP, Gurobi

M = Model(Gurobi.Optimizer)

@variable M a >= 0
@variable M b >= 0

@constraint M c a + b <= 1
@constraint M d a + b <= 1
@constraint M e a + b <= 2
@objective M Max a + 2 * b

optimize!(M)

value(M[:c])
value(M[:d])
value(M[:e])

Where I was guessing that perhaps it would have a problem with one of the constraints, but it doesn’t. The model causing the problem works with GLPK, and, until a recent change that I can’t pin down, seemed to work with Gurobi.

Sorry for the vague report, but, any ideas?

Thanks!
Geoff

1 Like

What is primal_status(M)? What type was the constraint that it failed on? Do you have a complete stack trace of the error?

This error can arise if you modify a model after optimizing, and then try to query.

This error can arise if you modify a model after optimizing, and then try to query.

D’oh! That’s it. This is a sequential objective problem and I dropped the last objective because I don’t have any good data on it for this case, but I didn’t remove the bit that added the constraint from the (new) last solve.

This is the second time this stuff has bitten me.

Thanks, as always, @odow

1 Like

This is the second time this stuff has bitten me.

I think in the next version of JuMP we’re going to error or throw a warning, because it’s a pain point that keeps coming up.