Pyomo / mpi-sppy

MPI-based Stochastic Programming in PYthon
https://mpi-sppy.readthedocs.io
Other
65 stars 38 forks source link

XhatShuffleLooper: Restoring best first #383

Closed bknueven closed 4 months ago

bknueven commented 4 months ago

The tests pass -- but I would like to try this on a multistage problem before merging.

bknueven commented 4 months ago

Testing on the "aircond" demo:

main:

[    0.00] Initializing mpi-sppy
[    1.02] Initializing SPBase
[    1.09] Initializing PHBase
[    1.10] Starting spcomm.main()
[    1.12] Creating solvers
[    1.20] Entering solve loop in PHBase.Iter0
[    1.52] Iter.           Best Bound  Best Incumbent      Rel. Gap        Abs. Gap
[    1.52]     1  L X       1131.5603       1900.1542        67.923%        768.5938
[    1.68]     2  L X       1135.8877       1151.6297         1.386%         15.7419
[    1.84]     3  L         1139.2011       1151.6297         1.091%         12.4285
[    2.01]     4  L         1141.0152       1151.6297         0.930%         10.6145
[    2.17]     5  L         1143.1414       1151.6297         0.743%          8.4883
[    2.35]     6  L         1144.4169       1151.6297         0.630%          7.2127
[    2.52]     7  L X       1145.3666       1148.6334         0.285%          3.2668
[    2.68]     8  L         1145.9572       1148.6334         0.234%          2.6762
[    2.84]     9  L X       1146.4252       1148.0265         0.140%          1.6013
[    3.00]    10  L         1146.5654       1148.0265         0.127%          1.4611
[    3.17]    11  L         1146.8201       1148.0265         0.105%          1.2064
[    3.33]    12  L X       1147.2068       1148.0099         0.070%          0.8031
[    3.49]    13  L         1147.3424       1148.0099         0.058%          0.6675
[    3.65]    14    X       1147.3424       1147.5520         0.018%          0.2095
[    3.82]    15    X       1147.3424       1147.5398         0.017%          0.1973
[    3.98]    16    X       1147.3424       1147.4736         0.011%          0.1312
[    4.14]    17  L         1147.3560       1147.4736         0.010%          0.1177
[    4.31]    18  L         1147.3949       1147.4736         0.007%          0.0787
[    4.47]    19    X       1147.3949       1147.4423         0.004%          0.0474
[    4.63]    20    X       1147.3949       1147.4235         0.002%          0.0286
[    4.80]    21            1147.3949       1147.4235         0.002%          0.0286
[    4.96]    22            1147.3949       1147.4235         0.002%          0.0286
[    5.16]    23            1147.3949       1147.4235         0.002%          0.0286
[    5.34]    24  L         1147.3972       1147.4235         0.002%          0.0263
[    5.52]    25    X       1147.3972       1147.4123         0.001%          0.0150
[    5.78]    26    X       1147.3972       1147.4073         0.001%          0.0101
[    5.94]    27            1147.3972       1147.4073         0.001%          0.0101
[    6.11]    28  L         1147.3976       1147.4073         0.001%          0.0097
[    6.28]    29  L         1147.4028       1147.4073         0.000%          0.0045
[    6.46]    30            1147.4028       1147.4073         0.000%          0.0045
[    6.46] Reached user-specified limit=30 on number of PH iterations
[    6.46] Hub algorithm PH complete, waiting for spoke finalization
[    6.53] Spoke XhatShuffleInnerBound finalized
[    6.60] Spoke LagrangianOuterBound finalized
[    6.60] Statistics at termination
[    6.60] Iter.           Best Bound  Best Incumbent      Rel. Gap        Abs. Gap
[    6.60]    30            1147.4028       1147.4073         0.000%          0.0045
[    6.60] Windows freed
BestInnerBound=1147.4073199141924 and BestOuterBound=1147.4028446513

This PR:

[    0.00] Initializing mpi-sppy
[    1.05] Initializing SPBase
[    1.13] Initializing PHBase
[    1.14] Starting spcomm.main()
[    1.16] Creating solvers
[    1.25] Entering solve loop in PHBase.Iter0
[    1.56] Iter.           Best Bound  Best Incumbent      Rel. Gap        Abs. Gap
[    1.56]     1  L X       1131.5603       1900.1542        67.923%        768.5938
[    1.72]     2  L X       1135.8877       1151.6297         1.386%         15.7419
[    1.89]     3  L         1139.2011       1151.6297         1.091%         12.4285
[    2.08]     4  L         1141.0152       1151.6297         0.930%         10.6145
[    2.28]     5  L         1143.1414       1151.6297         0.743%          8.4883
[    2.47]     6  L         1144.4169       1151.6297         0.630%          7.2127
[    2.65]     7  L X       1145.3666       1148.6334         0.285%          3.2668
[    2.86]     8  L         1145.9572       1148.6334         0.234%          2.6762
[    3.05]     9  L X       1146.4252       1148.0265         0.140%          1.6013
[    3.25]    10  L         1146.5654       1148.0265         0.127%          1.4611
[    3.45]    11  L         1146.8201       1148.0265         0.105%          1.2064
[    3.62]    12  L X       1147.2068       1148.0099         0.070%          0.8031
[    3.80]    13  L         1147.3424       1148.0099         0.058%          0.6675
[    3.99]    14    X       1147.3424       1147.5520         0.018%          0.2095
[    4.16]    15    X       1147.3424       1147.4736         0.011%          0.1312
[    4.32]    16            1147.3424       1147.4736         0.011%          0.1312
[    4.49]    17  L         1147.3560       1147.4736         0.010%          0.1177
[    4.66]    18  L         1147.3949       1147.4736         0.007%          0.0787
[    4.82]    19    X       1147.3949       1147.4423         0.004%          0.0474
[    4.99]    20            1147.3949       1147.4423         0.004%          0.0474
[    5.18]    21    X       1147.3949       1147.4294         0.003%          0.0345
[    5.35]    22            1147.3949       1147.4294         0.003%          0.0345
[    5.50]    23            1147.3949       1147.4294         0.003%          0.0345
[    5.67]    24  L         1147.3972       1147.4294         0.003%          0.0322
[    5.83]    25    X       1147.3972       1147.4123         0.001%          0.0150
[    6.04]    26    X       1147.3972       1147.4115         0.001%          0.0143
[    6.20]    27            1147.3972       1147.4115         0.001%          0.0143
[    6.37]    28  L         1147.3976       1147.4115         0.001%          0.0139
[    6.53]    29  L         1147.4028       1147.4115         0.001%          0.0087
[    6.70]    30            1147.4028       1147.4115         0.001%          0.0087
[    6.70] Reached user-specified limit=30 on number of PH iterations
[    6.71] Hub algorithm PH complete, waiting for spoke finalization
[    6.77] Spoke XhatShuffleInnerBound finalized
[    6.83] Spoke LagrangianOuterBound finalized
[    6.83] Statistics at termination
[    6.83] Iter.           Best Bound  Best Incumbent      Rel. Gap        Abs. Gap
[    6.83]    30            1147.4028       1147.4115         0.001%          0.0087
[    6.83] Windows freed
BestInnerBound=1147.4115020115137 and BestOuterBound=1147.4028446513

Doesn't look like this change hurts multistage models.