Model infeasible after using GRBfixmodel
AnsweredAfter using the GRBfixmodel function my MILP is reported to be infeasible since the upper bound of some variables that are zero in the optimal solution is set to a (small) negative value instead of zero. The basic workflow is the following:
error = GRBoptimize(model);
if (error) goto QUIT;
GRBmodel* fixed_model;
error = GRBfixmodel(model, &fixed_model);
if (error) goto QUIT;
// Solve the fixed model
error = GRBoptimize(fixed_model);
if (error) goto QUIT;
The output of the solver is:
Gurobi 11.0.3 (win64) logging started Mon Oct 21 12:08:32 2024
Set parameter LogToConsole to value 0
Set parameter Username
Set parameter ScaleFlag to value 0
Set parameter BarHomogeneous to value 1
Set parameter AggFill to value 1000
Set parameter IISMethod to value 1
Set parameter LogFile to value "solver_output_master_model_it_7.log"
Set parameter Threads to value 32
Academic license - for non-commercial use only - expires 2025-07-28
Warning for adding constraints: zero or small (< 1e-13) coefficients, ignored
Gurobi Optimizer version 11.0.3 build v11.0.3rc0 (win64 - Windows Server 2022.0 (20348.2))
CPU model: AMD EPYC 7763 64-Core Processor, instruction set [SSE2|AVX|AVX2]
Thread count: 128 physical cores, 256 logical processors, using up to 32 threads
Optimize a model with 2404 rows, 1848 columns and 23642 nonzeros
Model fingerprint: 0x32bfd8fc
Variable types: 6 continuous, 1842 integer (1842 binary)
Coefficient statistics:
Matrix range [1e-04, 4e+07]
Objective range [1e+00, 7e+03]
Bounds range [1e+00, 1e+00]
RHS range [2e-02, 2e+07]
Found heuristic solution: objective 1612051.4466
Presolve removed 1642 rows and 816 columns
Presolve time: 0.05s
Presolved: 762 rows, 1032 columns, 9260 nonzeros
Found heuristic solution: objective 1604865.1691
Variable types: 6 continuous, 1026 integer (1020 binary)
Found heuristic solution: objective 1602926.2589
Root relaxation: objective 1.035236e+05, 423 iterations, 0.01 seconds (0.01 work units)
Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
0 0 103523.570 0 88 1602926.26 103523.570 93.5% - 0s
H 0 0 109458.40944 103523.570 5.42% - 0s
H 0 0 107526.31544 103523.570 3.72% - 0s
H 0 0 107358.10584 103523.570 3.57% - 0s
H 0 0 106568.91183 103523.570 2.86% - 0s
0 0 104592.455 0 115 106568.912 104592.455 1.85% - 0s
H 0 0 106526.05024 104592.990 1.81% - 0s
H 0 0 106100.40066 104592.990 1.42% - 0s
0 0 104738.983 0 101 106100.401 104738.983 1.28% - 0s
0 0 104738.983 0 104 106100.401 104738.983 1.28% - 0s
0 0 104738.983 0 105 106100.401 104738.983 1.28% - 0s
0 0 104903.676 0 135 106100.401 104903.676 1.13% - 0s
H 0 0 105415.29629 105005.433 0.39% - 0s
0 0 105005.433 0 123 105415.296 105005.433 0.39% - 0s
0 0 105045.491 0 108 105415.296 105045.491 0.35% - 0s
0 0 105047.990 0 107 105415.296 105047.990 0.35% - 0s
0 0 105093.758 0 129 105415.296 105093.758 0.31% - 0s
H 0 0 105298.19033 105093.758 0.19% - 0s
0 0 105110.346 0 95 105298.190 105110.346 0.18% - 0s
0 0 105116.532 0 117 105298.190 105116.532 0.17% - 0s
0 0 105117.017 0 117 105298.190 105117.017 0.17% - 0s
0 0 105121.968 0 112 105298.190 105121.968 0.17% - 0s
H 0 0 105290.62758 105123.489 0.16% - 0s
0 0 105123.489 0 114 105290.628 105123.489 0.16% - 0s
0 0 105127.587 0 84 105290.628 105127.587 0.15% - 0s
0 0 105145.406 0 84 105290.628 105145.406 0.14% - 0s
0 0 105145.406 0 86 105290.628 105145.406 0.14% - 0s
0 0 105145.406 0 75 105290.628 105145.406 0.14% - 0s
0 0 105145.406 0 136 105290.628 105145.406 0.14% - 0s
0 0 105145.406 0 119 105290.628 105145.406 0.14% - 0s
0 0 105145.406 0 94 105290.628 105145.406 0.14% - 0s
0 0 105145.406 0 58 105290.628 105145.406 0.14% - 0s
0 0 105145.406 0 110 105290.628 105145.406 0.14% - 0s
0 0 105145.406 0 70 105290.628 105145.406 0.14% - 0s
0 0 105145.406 0 77 105290.628 105145.406 0.14% - 0s
0 0 105145.406 0 86 105290.628 105145.406 0.14% - 0s
0 0 105145.406 0 88 105290.628 105145.406 0.14% - 0s
0 0 105145.406 0 77 105290.628 105145.406 0.14% - 0s
0 0 105145.406 0 77 105290.628 105145.406 0.14% - 0s
0 0 105145.406 0 78 105290.628 105145.406 0.14% - 0s
0 0 105145.406 0 78 105290.628 105145.406 0.14% - 0s
0 2 105145.943 0 78 105290.628 105145.943 0.14% - 1s
H 17 9 105264.45633 105196.370 0.06% 63.0 1s
H 31 10 105264.45622 105222.128 0.04% 56.2 1s
* 92 4 12 105264.45620 105252.412 0.01% 32.8 1s
Cutting planes:
Gomory: 21
Lift-and-project: 1
Cover: 47
MIR: 49
StrongCG: 11
GUB cover: 1
RLT: 7
Explored 104 nodes (5422 simplex iterations) in 1.42 seconds (0.64 work units)
Thread count was 32 (of 256 available processors)
Solution count 10: 105264 105291 105298 ... 109458
Optimal solution found (tolerance 1.00e-04)
Warning: max constraint violation (3.0938e-06) exceeds tolerance
Best objective 1.052644559181e+05, best bound 1.052564402231e+05, gap 0.0076%
Gurobi Optimizer version 11.0.3 build v11.0.3rc0 (win64 - Windows Server 2022.0 (20348.2))
CPU model: AMD EPYC 7763 64-Core Processor, instruction set [SSE2|AVX|AVX2]
Thread count: 128 physical cores, 256 logical processors, using up to 32 threads
Optimize a model with 2404 rows, 1848 columns and 23642 nonzeros
Model fingerprint: 0x1dbfc7d3
Coefficient statistics:
Matrix range [1e-04, 4e+07]
Objective range [1e+00, 7e+03]
Bounds range [4e-07, 1e+00]
RHS range [2e-02, 2e+07]
Presolve removed 1207 rows and 1842 columns
Presolve time: 0.00s
Solved in 0 iterations and 0.00 seconds (0.00 work units)
Infeasible model
Gurobi Optimizer version 11.0.3 build v11.0.3rc0 (win64 - Windows Server 2022.0 (20348.2))
CPU model: AMD EPYC 7763 64-Core Processor, instruction set [SSE2|AVX|AVX2]
Thread count: 128 physical cores, 256 logical processors, using up to 32 threads
IIS computed: 1 constraints, 3 bounds
IIS runtime: 0.00 seconds (0.00 work units)
I guess the problem is related to the reported warning of the constraint violation. However, I am not sure on how to fix this. I tried to improve the coefficient range but am not able to. Setting NumericFocus to 3 did not solve this issue either. Is there anything else I could try? I can also provide the .lp file if that is of any help.
-
Hi Christian,
You are right. The infeasibility of the fixed model comes from the violated constraint in the solution.
The best thing to do is indeed to try to improve the coefficient range and to reduce the large rhs values.
There is also this warningWarning for adding constraints: zero or small (< 1e-13) coefficients, ignored
you might want to check.
Did you try different parameter settings, and in any case, the optimal solution shows a constraint violation?
What happens if you tighten the feasibility tolerance FeasibilityTol to, e.g., 1e-8 or 1e-9? Is the model then reported as infeasible? Or do you get a solution with a smaller violation?
If the solution with the violation is acceptable for you, you could run the fixed model with a relaxed FeasibilityTol.Cheers,
Marika1 -
Hi Marika,
thanks for the hint to FeasibilityTol. That´s seems to do the trick. Still I will try to reduce the coefficient range. Thank you very much!
Best regards,
Christian
0
Please sign in to leave a comment.
Comments
2 comments