Commit a1101002 authored by Tjerk Vreeken's avatar Tjerk Vreeken

Fix big-M in goal programming example

Not sure why a very large value was chosen, as it is well established
that big-M values should typically be as small as possible. Very high
values can result in bad relaxations and make branching very hard.

In this case, a more reasonable M of 2 is both faster (~2x), and also
results in a better solution. The first two priorities remain the same,
but the third priority goes from 12.23 to 10.85.
parent 3b721607
time,Q_orifice,Q_pump,is_downhill,sea_level,storage_level
2013-05-19 22:00:00,0.000000,0.000000,1.000000,0.000000,0.400000
2013-05-19 23:00:00,0.000000,0.000000,1.000000,0.100000,0.418000
2013-05-20 00:00:00,1.671714,0.000000,1.000000,0.200000,0.429982
2013-05-20 01:00:00,3.889201,0.000000,1.000000,0.300000,0.433981
2013-05-20 02:00:00,2.125117,1.202160,1.000000,0.400000,0.440003
2013-05-20 03:00:00,0.000000,6.046332,0.000000,0.500000,0.436236
2013-05-20 04:00:00,0.000000,5.318681,0.000000,0.600000,0.435088
2013-05-20 05:00:00,0.000000,5.062000,0.000000,0.700000,0.434865
2013-05-20 06:00:00,0.000000,5.009117,0.000000,0.800000,0.434832
2013-05-20 07:00:00,0.000000,5.000202,0.000000,0.900000,0.434832
2013-05-20 08:00:00,0.000000,4.999319,0.000000,1.000000,0.434834
2013-05-20 09:00:00,0.000000,5.000742,0.000000,0.900000,0.434831
2013-05-20 10:00:00,0.000000,5.000108,0.000000,0.800000,0.434831
2013-05-20 11:00:00,0.000000,4.992524,0.000000,0.700000,0.434858
2013-05-20 12:00:00,0.000000,4.944152,0.000000,0.600000,0.435059
2013-05-20 13:00:00,0.000000,4.622809,0.000000,0.500000,0.436417
2013-05-20 14:00:00,2.125114,1.878932,1.000000,0.400000,0.440002
2013-05-20 15:00:00,3.975640,1.024350,1.000000,0.300000,0.440002
2013-05-20 16:00:00,5.105053,0.000000,1.000000,0.200000,0.439624
2013-05-20 17:00:00,5.543917,0.000000,1.000000,0.100000,0.437666
2013-05-20 18:00:00,5.286357,0.000000,1.000000,0.000000,0.436635
2013-05-20 00:00:00,1.669620,0.000000,1.000000,0.200000,0.429989
2013-05-20 01:00:00,3.889305,0.000000,1.000000,0.300000,0.433988
2013-05-20 02:00:00,2.125114,1.204191,1.000000,0.400000,0.440002
2013-05-20 03:00:00,0.000000,5.040872,0.000000,0.500000,0.439855
2013-05-20 04:00:00,0.000000,5.422016,0.000000,0.600000,0.438336
2013-05-20 05:00:00,0.000000,5.426202,0.000000,0.700000,0.436802
2013-05-20 06:00:00,0.000000,5.341535,0.000000,0.800000,0.435572
2013-05-20 07:00:00,0.000000,5.264185,0.000000,0.900000,0.434621
2013-05-20 08:00:00,0.000000,5.221975,0.000000,1.000000,0.433822
2013-05-20 09:00:00,0.000000,5.202363,0.000000,0.900000,0.433093
2013-05-20 10:00:00,0.000000,5.156304,0.000000,0.800000,0.432531
2013-05-20 11:00:00,0.000000,4.994088,0.000000,0.700000,0.432552
2013-05-20 12:00:00,0.000000,4.576840,0.000000,0.600000,0.434075
2013-05-20 13:00:00,0.000000,3.755049,0.000000,0.500000,0.438557
2013-05-20 14:00:00,2.125106,2.473546,1.000000,0.400000,0.440002
2013-05-20 15:00:00,3.975632,1.024423,1.000000,0.300000,0.440002
2013-05-20 16:00:00,5.105254,0.000000,1.000000,0.200000,0.439623
2013-05-20 17:00:00,5.544216,0.000000,1.000000,0.100000,0.437664
2013-05-20 18:00:00,5.286836,0.000000,1.000000,0.000000,0.436631
......@@ -77,7 +77,7 @@ class Example(GoalProgrammingMixin, CSVMixin, ModelicaMixin,
# Make sure is_downhill is true only when the sea is lower than the
# water level in the storage.
M = 1e10 # M is a handy big number
M = 2 # The so-called "big-M"
constraints.append((self.state('H_sea') - self.state('storage.HQ.H') -
(1 - self.state('is_downhill')) * M, -np.inf, 0.0))
constraints.append((self.state('H_sea') - self.state('storage.HQ.H') +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment