|
14 | 14 | using StochDynamicProgramming, Clp |
15 | 15 | println("library loaded") |
16 | 16 |
|
17 | | -run_expectation = true # false if you don't want to test expectation |
18 | | -run_AVaR = true # false if you don't want to test AVaR |
19 | | -run_WorstCase = true # false if you don't want to test WorstCase |
| 17 | +run_Expectation = true # false if you don't want to test Expectation |
| 18 | +run_AVaR = true # false if you don't want to test AVaR |
| 19 | +run_WorstCase = true # false if you don't want to test WorstCase |
| 20 | +run_ConvexCombi = true # false if you don't want to test Convex Combination |
| 21 | +run_Polyhedral = true # false if you don't want to test Polyhedral Risk Measure |
20 | 22 |
|
21 | 23 | ######## Optimization parameters ######## |
22 | 24 | # choose the LP solver used. |
@@ -71,7 +73,7 @@ sddp = solve_SDDP(spmodel, paramSDDP, 0) # display information every 2 iteration |
71 | 73 | lb_sddp = StochDynamicProgramming.get_lower_bound(spmodel, paramSDDP, sddp.bellmanfunctions) |
72 | 74 |
|
73 | 75 | ######### Solving the problem via SDDP with Expectation |
74 | | -if run_expectation |
| 76 | +if run_Expectation |
75 | 77 | tic() |
76 | 78 | spmodel = LinearSPModel(N_STAGES,u_bounds,[S0],cost_t,dynamic,xi_laws, riskMeasure = Expectation()) |
77 | 79 | set_state_bounds(spmodel, s_bounds) # adding the bounds to the model |
|
90 | 92 | ######### Solving the problem via SDDP with AVaR |
91 | 93 | if run_AVaR |
92 | 94 | tic() |
93 | | - spmodel = LinearSPModel(N_STAGES,u_bounds,[S0],cost_t,dynamic,xi_laws, riskMeasure = AVaR(0.5)) |
| 95 | + spmodel = LinearSPModel(N_STAGES,u_bounds,[S0],cost_t,dynamic,xi_laws, riskMeasure = AVaR((N_XI-1)/N_XI)) |
94 | 96 | set_state_bounds(spmodel, s_bounds) # adding the bounds to the model |
95 | 97 | println("AVaR's model set up") |
96 | 98 | println("Starting resolution with AVaR") |
@@ -120,3 +122,41 @@ if run_WorstCase |
120 | 122 | println("Lower bound obtained by SDDP: "*string(round(lb_sddp,4))) |
121 | 123 | toc(); println(); |
122 | 124 | end |
| 125 | + |
| 126 | +if run_ConvexCombi |
| 127 | + tic() |
| 128 | + spmodel = LinearSPModel(N_STAGES,u_bounds,[S0],cost_t,dynamic,xi_laws, riskMeasure = ConvexCombi((N_XI-1)/N_XI,0.5)) |
| 129 | + set_state_bounds(spmodel, s_bounds) # adding the bounds to the model |
| 130 | + println("Convex Combination's model set up") |
| 131 | + println("Starting resolution with Convex Combination") |
| 132 | + # 10 forward pass, stop at MAX_ITER |
| 133 | + paramSDDP = SDDPparameters(SOLVER, |
| 134 | + passnumber=10, |
| 135 | + max_iterations=MAX_ITER) |
| 136 | + sddp = solve_SDDP(spmodel, paramSDDP, 2) # display information every 2 iterations |
| 137 | + lb_sddp = StochDynamicProgramming.get_lower_bound(spmodel, paramSDDP, sddp.bellmanfunctions) |
| 138 | + println("Lower bound obtained by SDDP: "*string(round(lb_sddp,4))) |
| 139 | + toc(); println(); |
| 140 | +end |
| 141 | + |
| 142 | +if run_Polyhedral |
| 143 | + beta = (N_XI-1)/N_XI |
| 144 | + prob = 1/N_XI*ones(N_XI) |
| 145 | + polyset = repmat(1/beta*prob',N_XI) |
| 146 | + for i = 1:N_XI |
| 147 | + polyset[i,i] = (beta*N_XI-N_XI+1)/(N_XI*beta) |
| 148 | + end |
| 149 | + tic() |
| 150 | + spmodel = LinearSPModel(N_STAGES,u_bounds,[S0],cost_t,dynamic,xi_laws, riskMeasure = PolyhedralRisk(polyset)) |
| 151 | + set_state_bounds(spmodel, s_bounds) # adding the bounds to the model |
| 152 | + println("Polyhedral's model set up") |
| 153 | + println("Starting resolution with Polyhedral") |
| 154 | + # 10 forward pass, stop at MAX_ITER |
| 155 | + paramSDDP = SDDPparameters(SOLVER, |
| 156 | + passnumber=10, |
| 157 | + max_iterations=MAX_ITER) |
| 158 | + sddp = solve_SDDP(spmodel, paramSDDP, 2) # display information every 2 iterations |
| 159 | + lb_sddp = StochDynamicProgramming.get_lower_bound(spmodel, paramSDDP, sddp.bellmanfunctions) |
| 160 | + println("Lower bound obtained by SDDP: "*string(round(lb_sddp,4))) |
| 161 | + toc(); println(); |
| 162 | +end |
0 commit comments