I'm solving a large network flow problem using Gurobi to do Benders decomposition in Python. The imported .csvs contain values that typically fall in either zero, the range of [20,200], or with a magnitude of approximately 10^9. I received a warning that the matrix coefficients and RHS were too large, so I scaled down all values that represented quantities by 10^9 and others by 10^3. This solved my coefficient error but not my right-hand side error. Please note that due to some other errors, my model is not completing all its iterations. Here's my log before scaling:
Gurobi Optimizer version 9.5.1 build v9.5.1rc2 (win64)
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
Optimize a model with 1116052 rows, 575004 columns and 1984260 nonzeros
Model fingerprint: 0x223d0add
Variable types: 355740 continuous, 219264 integer (1024 binary)
Coefficient statistics:
Matrix range [8e-02, 2e+10]
Objective range [2e-13, 2e-06]
Bounds range [1e+00, 1e+00]
RHS range [1e-01, 2e+10]
Warning: Model contains large matrix coefficients
Warning: Model contains large rhs
Consider reformulating model or setting NumericFocus parameter
to avoid numerical issues.
Found heuristic solution: objective 143424.26885
Presolve removed 1116022 rows and 574935 columns
Presolve time: 1.34s
Presolved: 30 rows, 69 columns, 120 nonzeros
Found heuristic solution: objective 135423.71070
Variable types: 57 continuous, 12 integer (0 binary)
Explored 0 nodes (0 simplex iterations) in 1.75 seconds (1.28 work units)
Thread count was 8 (of 8 available processors)
Solution count 2: 135424 143424
Optimal solution found (tolerance 1.00e-04)
Best objective 1.354237107007e+05, best bound 1.354237107007e+05, gap 0.0000%
Here's my log after scaling:
Set parameter Username
Academic license - for non-commercial use only - expires 2022-04-25
Gurobi Optimizer version 9.5.1 build v9.5.1rc2 (win64)
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
Optimize a model with 1116052 rows, 575004 columns and 1983740 nonzeros
Model fingerprint: 0x7eba86b8
Variable types: 355740 continuous, 219264 integer (1024 binary)
Coefficient statistics:
Matrix range [1e-02, 2e+01]
Objective range [2e-13, 2e-06]
Bounds range [1e+00, 1e+00]
RHS range [3e-07, 2e+09]
Warning: Model contains large rhs
Consider reformulating model or setting NumericFocus parameter
to avoid numerical issues.
Found heuristic solution: objective 0.0001434
Presolve removed 1116052 rows and 575004 columns
Presolve time: 1.09s
Presolve: All rows and columns removed
Explored 0 nodes (0 simplex iterations) in 1.54 seconds (1.04 work units)
Thread count was 1 (of 8 available processors)
Solution count 2: 0.000143426 0.000143426
Optimal solution found (tolerance 1.00e-04)
Best objective 1.434261369143e-04, best bound 1.434261369143e-04, gap 0.0000%et parameter Username
Academic license - for non-commercial use only - expires 2022-04-25
Gurobi Optimizer version 9.5.1 build v9.5.1rc2 (win64)
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
Optimize a model with 1116052 rows, 575004 columns and 1983740 nonzeros
Model fingerprint: 0x7eba86b8
Variable types: 355740 continuous, 219264 integer (1024 binary)
Coefficient statistics:
Matrix range [1e-02, 2e+01]
Objective range [2e-13, 2e-06]
Bounds range [1e+00, 1e+00]
RHS range [3e-07, 2e+09]
Warning: Model contains large rhs
Consider reformulating model or setting NumericFocus parameter
to avoid numerical issues.
Found heuristic solution: objective 0.0001434
Presolve removed 1116052 rows and 575004 columns
Presolve time: 1.09s
Presolve: All rows and columns removed
Explored 0 nodes (0 simplex iterations) in 1.54 seconds (1.04 work units)
Thread count was 1 (of 8 available processors)
Solution count 2: 0.000143426 0.000143426
Optimal solution found (tolerance 1.00e-04)
Best objective 1.434261369143e-04, best bound 1.434261369143e-04, gap 0.0000%
NumericFocus
parameter to avoid numerical issues." $\endgroup$