PowerSimulations.jl icon indicating copy to clipboard operation
PowerSimulations.jl copied to clipboard

Performance disparity in StandardUC between Model and Simulation

Open jd-lara opened this issue 4 years ago • 1 comments

When we solve the StandardUnitCommitment model using just the Problem framework, we implement one formulation of the duration constraints that use the initial condition of the time spent in a particular state (on/off) to decide the number of variables to add to the model. This is incompatible with in-memory updates using ParameterJuMP (can only handle RHS), so we implement a different formulation that keeps track of the state on the RHS. This has been discussed in the literature here and here

I noted that depending on the solver, this could have large performance consequences. Presumably, because the solvers perform different internal substitutions. The tradeoff here is the re-creating the UC problem for every solve vs. in-memory update. There is no straightforward rule of thumb since these outcomes are heavily dependent on the model's parameters, the number of units, and the solver heuristics.

Using the ExtremeSolarTexas case, we can see the following outcomes.

With CPLEX not using the parameters we get:

version identifier: 20.1.0.0 | 2020-11-10 | 9bedb6d68
CPXPARAM_Emphasis_MIP                            1
CPXPARAM_MIP_Tolerances_MIPGap                   0.01
Tried aggregator 3 times.
MIP Presolve eliminated 23868 rows and 12408 columns.
MIP Presolve added 108 rows and 0 columns.
MIP Presolve modified 6092 coefficients.
Aggregator did 1503 substitutions.
Reduced MIP has 103185 rows, 124689 columns, and 1100035 nonzeros.
Reduced MIP has 34301 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 1.39 sec. (924.73 ticks)
Probing fixed 1501 vars, tightened 400 bounds.
Probing changed sense of 242 constraints.
Probing time = 2.49 sec. (190.52 ticks)
Cover probing fixed 0 vars, tightened 63 bounds.
Tried aggregator 2 times.
Detecting symmetries...
MIP Presolve eliminated 3395 rows and 2959 columns.
MIP Presolve added 2 rows and 0 columns.
MIP Presolve modified 185 coefficients.
Aggregator did 2 substitutions.
Reduced MIP has 99790 rows, 121728 columns, and 1080671 nonzeros.
Reduced MIP has 32708 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 1.37 sec. (1071.98 ticks)
Probing time = 0.24 sec. (35.56 ticks)
Cover probing fixed 0 vars, tightened 63 bounds.
Clique table members: 565922.
Tightened 63 constraints.
MIP emphasis: integer feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 8 threads.
Root relaxation solution time = 33.34 sec. (10575.89 ticks)

        Nodes                                         Cuts/
   Node  Left     Objective  IInf  Best Integer    Best Bound    ItCnt     Gap

      0     0   3.09365e+07  5141                 3.09365e+07       41         
      0     0   3.21964e+07  2875                  Cuts: 8993    33612         
*     0+    0                       3.25812e+07   3.21964e+07             1.18%
      0     0   3.23820e+07   777   3.25812e+07    Cuts: 8764    40919    0.61%

GUB cover cuts applied:  2
Clique cuts applied:  1255
Implied bound cuts applied:  9557
Flow cuts applied:  2154
Mixed integer rounding cuts applied:  2520
Zero-half cuts applied:  27
Lift and project cuts applied:  82
Gomory fractional cuts applied:  76

Root node processing (before b&c):
  Real time             =  193.43 sec. (66501.28 ticks)
Parallel b&c, 8 threads:
  Real time             =    0.00 sec. (0.00 ticks)
  Sync time (average)   =    0.00 sec.
  Wait time (average)   =    0.00 sec.
                          ------------
Total (root+branch&cut) =  193.43 sec. (66501.28 ticks)

While when solving as part of the simulations with parameters, we get this from the solver:

Version identifier: 20.1.0.0 | 2020-11-10 | 9bedb6d68
CPXPARAM_Emphasis_MIP                            1
CPXPARAM_MIP_Tolerances_MIPGap                   0.01
Tried aggregator 3 times.
MIP Presolve eliminated 24854 rows and 12495 columns.
MIP Presolve added 108 rows and 0 columns.
MIP Presolve modified 4630 coefficients.
Aggregator did 1617 substitutions.
Reduced MIP has 102085 rows, 124488 columns, and 1093674 nonzeros.
Reduced MIP has 34100 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 1.03 sec. (735.24 ticks)
Probing fixed 1270 vars, tightened 400 bounds.
Probing changed sense of 41 constraints.
Probing time = 2.71 sec. (185.18 ticks)
Cover probing fixed 0 vars, tightened 30 bounds.
Tried aggregator 2 times.
Detecting symmetries...
MIP Presolve eliminated 2658 rows and 2728 columns.
MIP Presolve added 2 rows and 0 columns.
MIP Presolve modified 186 coefficients.
Aggregator did 2 substitutions.
Reduced MIP has 99427 rows, 121758 columns, and 1078905 nonzeros.
Reduced MIP has 32738 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 1.49 sec. (1067.84 ticks)
Probing fixed 30 vars, tightened 0 bounds.
Probing time = 1.51 sec. (174.14 ticks)
Cover probing fixed 0 vars, tightened 151 bounds.
Clique table members: 629960.
Tightened 151 constraints.
MIP emphasis: integer feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 8 threads.
Root relaxation solution time = 37.57 sec. (10960.13 ticks)

        Nodes                                         Cuts/
   Node  Left     Objective  IInf  Best Integer    Best Bound    ItCnt     Gap

      0     0  7817834.6638  3289                7817834.6638       42         
      0     0  8773510.4182  1597                  Cuts: 7767    33588         
*     0+    0                       3.58045e+07  8773510.4182            75.50%
      0     0  8918337.8898   756   3.58045e+07    Cuts: 5708    46617   75.09%
      0     0  8965520.7979   527   3.58045e+07    Cuts: 2188    52690   74.96%
*     0+    0                       2.57355e+07  8965520.7979            65.16%
      0     0  -1.00000e+75     0   2.57355e+07  8965520.7979    52690   65.16%
      0     2  8965520.7979   527   2.57355e+07  8965520.7979    52690   65.16%
Elapsed time = 266.30 sec. (100718.31 ticks, tree = 0.02 MB, solutions = 2)
      1     3  8993198.9894   611   2.57355e+07  8966445.0306    55322   65.16%
      2     4  8994688.6932   601   2.57355e+07  8966445.0306    56248   65.16%
      3     5  8994966.9839   607   2.57355e+07  8966445.0306    57024   65.16%
      4     6  8995193.6979   593   2.57355e+07  8966445.0306    62171   65.16%
      5     7  8996435.1007   597   2.57355e+07  8966445.0306    68279   65.16%
      6     8  9004228.9841   600   2.57355e+07  8966445.0306    73001   65.16%
      7     9  9005030.8684   592   2.57355e+07  8966445.0306    76476   65.16%
      8    10  9005422.4586   590   2.57355e+07  8966445.0306    76569   65.16%
      9    11  9005591.5063   584   2.57355e+07  8966445.0306    76854   65.16%
*    10+    1                       2.56001e+07  8966445.0306            64.97%

We should find a way to reduce the performance hit of the formulation that enables RHS updating or a new formulation that will allow RHS update without such a penalty.

jd-lara avatar Jul 25 '21 20:07 jd-lara

This can be resolved with the attributes dict in the Model object.

jd-lara avatar Aug 10 '21 17:08 jd-lara

@jd-lara is there any advantage to updating the RHS of a constraint on a varon variable instead of fixing/unfixing it?

@alefcastelli and I think we have a fix in the formulation for this -- we just want to implement it in the way that is most preferred.

bknueven avatar Feb 01 '23 22:02 bknueven

@jd-lara is there any advantage to updating the RHS of a constraint on a varon variable instead of fixing/unfixing it?

@alefcastelli and I think we have a fix in the formulation for this -- we just want to implement it in the way that is most preferred.

I don't think we have tried the approach to fix/unfix in the update code vs setting the value. I would have to check the implementation of the parameter update. My only concern would be if I the model add additional x = val constraints which is kinda solver dependent. We can try it out.

jd-lara avatar Feb 01 '23 22:02 jd-lara

After careful study, this issue couldn't be reproduce adequately, it's been open since 2021 and there have been a lot of changes already to the code.

jd-lara avatar Mar 09 '23 17:03 jd-lara