diff --git a/src/sddp.jl b/src/sddp.jl index 9d4d0fc..67b11f8 100644 --- a/src/sddp.jl +++ b/src/sddp.jl @@ -76,7 +76,7 @@ function generate_model(n_weeks::Int, n_scenarios::Int, reservoirs::Vector{Main. stages = 3*n_weeks, sense = :Min, lower_bound = 0.0, - optimizer = Xpress.Optimizer, + optimizer = Clp.Optimizer, # optimizer = HiGHS.Optimizer, # cut_oracle = SDDP.LevelOneCutOracle() ) do subproblem, stage diff --git a/tests/test_iterative_two_stocks.py b/tests/test_iterative_two_stocks.py index 604a4e9..c6b066d 100644 --- a/tests/test_iterative_two_stocks.py +++ b/tests/test_iterative_two_stocks.py @@ -257,8 +257,8 @@ def test_bellman_value_iterative_method_with_sddp() -> None: ] ), normalization={"euro": 1e9, "energy": 1e4}, - name_solver="XPRESS_LP", - maxiter=10, + name_solver="CLP", + maxiter=3, precision=1e-2, interp_mode=False, verbose=False, @@ -268,19 +268,6 @@ def test_bellman_value_iterative_method_with_sddp() -> None: np.array( [ [ - 6.67042708e08, - 6.15382916e08, - 5.63723124e08, - 5.12063332e08, - 4.60403540e08, - 4.08743748e08, - 3.57083955e08, - 3.05424163e08, - 2.53764371e08, - 2.02104579e08, - 1.50444787e08, - 9.87849950e07, - 4.71252030e07, 0.00000000e00, 0.00000000e00, 0.00000000e00, @@ -332,69 +319,58 @@ def test_bellman_value_iterative_method_with_sddp() -> None: 0.00000000e00, 0.00000000e00, 0.00000000e00, - 4.08074257e06, - 2.99106386e07, - 5.57405347e07, - 8.15704307e07, - 1.07400327e08, - 1.33230223e08, - 1.59060119e08, - 1.84890015e08, - 2.10719911e08, - 2.36549807e08, - 2.62379703e08, - 2.88209599e08, - 3.14039495e08, - 3.39869391e08, - 3.65699287e08, - 3.91529183e08, - 4.17359079e08, - 4.43188975e08, - 4.69018871e08, - 4.94848767e08, - 5.20678663e08, - 5.46508559e08, - 5.72338455e08, - 5.98168351e08, - 6.23998248e08, - 6.49828144e08, - 6.75658040e08, - 7.01487936e08, - 7.27317832e08, - 7.53147728e08, - 7.78977624e08, - 8.04807520e08, - 8.30637416e08, - 8.56467312e08, - 8.82297208e08, - 9.08127104e08, - 9.33957000e08, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, ], [ - 5.95069604e08, - 5.69239708e08, - 5.43409812e08, - 5.17579916e08, - 4.91750020e08, - 4.65920124e08, - 4.40090228e08, - 4.14260332e08, - 3.88430436e08, - 3.62600540e08, - 3.36770644e08, - 3.10940748e08, - 2.85110851e08, - 2.59280955e08, - 2.33451059e08, - 2.07621163e08, - 1.81791267e08, - 1.55961371e08, - 1.30131475e08, - 1.04301579e08, - 7.84716832e07, - 5.26417871e07, - 2.68118911e07, - 9.81995050e05, 0.00000000e00, 0.00000000e00, 0.00000000e00, @@ -435,58 +411,69 @@ def test_bellman_value_iterative_method_with_sddp() -> None: 0.00000000e00, 0.00000000e00, 0.00000000e00, - 1.19077426e07, - 3.77376386e07, - 6.35675347e07, - 8.93974307e07, - 1.15227327e08, - 1.41057223e08, - 1.66887119e08, - 1.92717015e08, - 2.18546911e08, - 2.44376807e08, - 2.70206703e08, - 2.96036599e08, - 3.21866495e08, - 3.47696391e08, - 3.73526287e08, - 3.99356183e08, - 4.25186079e08, - 4.51015975e08, - 4.76845871e08, - 5.02675767e08, - 5.28505663e08, - 5.54335559e08, - 5.88614911e08, - 6.40274703e08, - 6.91934495e08, - 7.43594287e08, - 7.95254079e08, - 8.46913871e08, - 8.98573663e08, - 9.50233455e08, - 1.00189325e09, - 1.05355304e09, - 1.10521283e09, - 1.15687262e09, - 1.20853242e09, - 1.26019221e09, - 1.31185200e09, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, ], [ - 6.36051208e08, - 5.84391416e08, - 5.32731624e08, - 4.81071832e08, - 4.29412040e08, - 3.77752248e08, - 3.26092455e08, - 2.74432663e08, - 2.22772871e08, - 1.71113079e08, - 1.19453287e08, - 6.77934950e07, - 1.61337030e07, 0.00000000e00, 0.00000000e00, 0.00000000e00, @@ -538,68 +525,58 @@ def test_bellman_value_iterative_method_with_sddp() -> None: 0.00000000e00, 0.00000000e00, 0.00000000e00, - 2.23432426e07, - 4.81731386e07, - 7.40030347e07, - 9.98329307e07, - 1.25662827e08, - 1.51492723e08, - 1.77322619e08, - 2.03152515e08, - 2.28982411e08, - 2.54812307e08, - 2.80642203e08, - 3.06472099e08, - 3.32301995e08, - 3.58131891e08, - 3.83961787e08, - 4.09791683e08, - 4.35621579e08, - 4.61451475e08, - 4.87281371e08, - 5.13111267e08, - 5.38941163e08, - 5.64771059e08, - 5.90600955e08, - 6.16430851e08, - 6.42260748e08, - 6.68090644e08, - 6.93920540e08, - 7.19750436e08, - 7.45580332e08, - 7.71410228e08, - 7.97240124e08, - 8.23070020e08, - 8.48899916e08, - 8.74729812e08, - 9.00559708e08, - 9.26389604e08, - 9.52219500e08, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, ], [ - 5.79415604e08, - 5.53585708e08, - 5.27755812e08, - 5.01925916e08, - 4.76096020e08, - 4.50266124e08, - 4.24436228e08, - 3.98606332e08, - 3.72776436e08, - 3.46946540e08, - 3.21116644e08, - 2.95286748e08, - 2.69456851e08, - 2.43626955e08, - 2.17797059e08, - 1.91967163e08, - 1.66137267e08, - 1.40307371e08, - 1.14477475e08, - 8.86475792e07, - 6.28176832e07, - 3.69877871e07, - 1.11578911e07, 0.00000000e00, 0.00000000e00, 0.00000000e00, @@ -640,66 +617,89 @@ def test_bellman_value_iterative_method_with_sddp() -> None: 0.00000000e00, 0.00000000e00, 0.00000000e00, - 4.33884653e06, - 3.01687426e07, - 5.59986386e07, - 8.18285347e07, - 1.07658431e08, - 1.33488327e08, - 1.59318223e08, - 1.85148119e08, - 2.10978015e08, - 2.36807911e08, - 2.62637807e08, - 2.88467703e08, - 3.14297599e08, - 3.40127495e08, - 3.65957391e08, - 3.91787287e08, - 4.17617183e08, - 4.43447079e08, - 4.69276975e08, - 4.95106871e08, - 5.20936767e08, - 5.46766663e08, - 5.72596559e08, - 5.98426455e08, - 6.24256351e08, - 6.50086248e08, - 6.75916144e08, - 7.01746040e08, - 7.27575936e08, - 7.53405832e08, - 7.79235728e08, - 8.05065624e08, - 8.30895520e08, - 8.56725416e08, - 8.82555312e08, - 9.08385208e08, - 9.34215104e08, - 9.60045000e08, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, ], [ - 1.13780352e09, - 1.06330105e09, - 9.88798574e08, - 9.14296099e08, - 8.39793624e08, - 7.65291149e08, - 6.90788673e08, - 6.16286198e08, - 5.41783723e08, - 4.67281248e08, - 3.92778772e08, - 3.18276297e08, - 2.43773822e08, - 2.00261436e08, - 1.77418752e08, - 1.54576069e08, - 1.31733386e08, - 1.08890703e08, - 8.60480198e07, - 6.32053366e07, + 1.08894279e09, + 1.03183608e09, + 9.74729376e08, + 9.17622668e08, + 8.60515960e08, + 8.03409252e08, + 7.46302545e08, + 6.89195837e08, + 6.32089129e08, + 5.74982421e08, + 5.17875713e08, + 4.60769005e08, + 4.03662297e08, + 3.46555589e08, + 2.89448881e08, + 2.32342173e08, + 1.75235465e08, + 1.36094554e08, + 1.01830530e08, + 6.75665050e07, 4.03626535e07, 1.75199703e07, 3.19143564e05, @@ -733,54 +733,54 @@ def test_bellman_value_iterative_method_with_sddp() -> None: 0.00000000e00, 0.00000000e00, 0.00000000e00, - 1.90694554e06, - 1.33282871e07, - 2.47496287e07, - 3.61709703e07, - 6.09407822e07, - 9.81920198e07, - 1.35443257e08, - 1.72694495e08, - 2.09945733e08, - 2.47196970e08, - 2.84448208e08, - 3.21699446e08, - 3.58950683e08, - 3.96201921e08, - 4.33453158e08, - 4.70704396e08, - 5.07955634e08, - 5.45206871e08, - 5.82458109e08, - 6.19709347e08, - 6.56960584e08, - 6.94211822e08, - 7.31463059e08, - 7.68714297e08, - 8.05965535e08, - 8.43216772e08, - 8.80468010e08, - 9.17719248e08, - 9.54970485e08, - 9.92221723e08, - 1.02947296e09, - 1.06672420e09, - 1.10397544e09, - 1.14122667e09, - 1.17847791e09, - 1.21572915e09, - 1.25298039e09, - 1.29023162e09, - 1.32748286e09, - 1.36473410e09, - 1.40198534e09, - 1.43923657e09, - 1.47648781e09, - 1.51373905e09, - 1.55099029e09, - 1.58824152e09, - 1.62549276e09, - 1.66274400e09, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 0.00000000e00, + 1.33484703e07, + 3.91783663e07, + 6.50082624e07, + 9.08381584e07, + 1.16668054e08, + 1.42497950e08, + 1.68327847e08, + 1.94157743e08, + 2.19987639e08, + 2.45817535e08, + 2.71647431e08, + 2.97477327e08, + 3.23307223e08, + 3.49137119e08, + 3.74967015e08, + 4.09547347e08, + 4.46798584e08, + 4.84049822e08, + 5.21301059e08, + 5.58552297e08, + 5.95803535e08, + 6.33054772e08, + 6.70306010e08, + 7.07557248e08, + 7.44808485e08, + 7.82059723e08, + 8.19310960e08, + 8.56562198e08, + 8.93813436e08, + 9.31064673e08, + 9.68315911e08, + 1.00556715e09, + 1.04281839e09, + 1.08006962e09, + 1.11732086e09, + 1.15457210e09, + 1.19182334e09, + 1.22907457e09, + 1.26632581e09, + 1.30357705e09, + 1.34082829e09, + 1.37807952e09, + 1.41533076e09, + 1.45258200e09, ], ] )