Variable vector violates upper and lower bounds when I hit iteration limit

I have an application where I want to monitor the variables over time. I declare all the variables in my model like this:

x = model.addVars(np.size(distances, axis = 0), np.size(distances, axis=1), lb=0.0,ub=1.0, name="x")


I set the following parameters:

model.Params.IterationLimit = 1.
model.Params.Method = 0
model.Params.Presolve = 0
model.Params.Sifting = 0


This is what gets written to model when I perform model.optimize:

Changed value of parameter IterationLimit to 1.0
Prev: inf  Min: 0.0  Max: inf  Default: inf
Parameter Method unchanged
Value: 0  Min: -1  Max: 5  Default: -1
Parameter Presolve unchanged
Value: 0  Min: -1  Max: 2  Default: -1
Changed value of parameter Sifting to 0
Prev: -1  Min: -1  Max: 2  Default: -1
Gurobi Optimizer version 9.0.1 build v9.0.1rc0 (win64)
Optimize a model with 35 rows, 125 columns and 375 nonzeros
Coefficient statistics:
Matrix range     [1e+00, 1e+00]
Objective range  [1e+01, 2e+02]
Bounds range     [1e+00, 1e+00]
RHS range        [1e+00, 6e+00]
Iteration    Objective       Primal Inf.    Dual Inf.      Time
0    2.6665428e+03   2.000000e+00   5.000035e+07      0s

Stopped in 1 iterations and 0.01 seconds


However when reaching my iteration limit and retrieve the variables I get the following vector:


[0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, -1.0, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0,
1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 1.0, 0.0,
0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]



The problem is the -1 and 2 which violate my bounds.

Is there something I need to do when my IterationLimit is reached to clean up where my gurobi model currently stopped to get a variable vector that is observing my upper and lower bounds?

Furthermore, I do have a feasible cbasis and vbasis that I am using as a starting point for this problem and the params specify that I am forcing the primal simplex method. Presolver is also turned off.

The problem is that I start in the feasible region and then I leave the feasible region in this iteration.

(Edit: added sentence at the end to clarify why this vector being infeasible is so confusing)

• Any good reason to cripple gurobi like that? Anyway, if you want feasible solutions, you will need to wait until gurobi found one. Jul 22 at 21:14
• I want to record changes in basis from my feasible start to the optimal Jul 25 at 3:04
• It seems the advanced basis was not feasible, not complete, or it was loaded incorrectly. Jul 25 at 3:40