@@ -177,7 +177,7 @@ Parameters:
177177- param (SDPparameters)
178178 the parameters for the SDP algorithm
179179
180- - display (Bool )
180+ - display (Int )
181181 the output display or verbosity parameter
182182
183183
@@ -187,9 +187,9 @@ Returns :
187187 of the system at each time step
188188
189189"""
190- function sdp_optimize (model:: SPModel ,
190+ function solve_DP (model:: SPModel ,
191191 param:: SDPparameters ,
192- display= true :: Bool )
192+ display= true :: Int64 )
193193
194194 SDPmodel = build_sdpmodel_from_spmodel (model:: SPModel )
195195
@@ -217,7 +217,7 @@ Parameters:
217217- param (SDPparameters)
218218 the parameters for the SDP algorithm
219219
220- - display (Bool )
220+ - display (Int )
221221 the output display or verbosity parameter
222222
223223
@@ -229,7 +229,7 @@ Returns :
229229"""
230230function sdp_solve_DH (model:: StochDynProgModel ,
231231 param:: SDPparameters ,
232- display= true :: Bool )
232+ display= 0 :: Int64 )
233233
234234 TF = model. stageNumber
235235 next_state = zeros (Float64, model. dimStates)
@@ -253,23 +253,19 @@ function sdp_solve_DH(model::StochDynProgModel,
253253 end
254254
255255 # Construct a progress meter
256- if display
256+ if display > 0
257257 p = Progress ((TF- 1 )* param. totalStateSpaceSize, 1 )
258- end
259-
260- # Display start of the algorithm in DH and HD cases
261- if display
262258 println (" Starting stochastic dynamic programming decision hazard computation" )
263259 end
264260
265- # Loop over time
261+ # Loop over time:
266262 for t = (TF- 1 ): - 1 : 1
267263 Vitp = value_function_interpolation (model, V, t+ 1 )
268264
269265 # Loop over states
270266 for x in product_states
271267
272- if display
268+ if display > 0
273269 next! (p)
274270 end
275271
@@ -342,7 +338,7 @@ Parameters:
342338- param (SDPparameters)
343339 the parameters for the SDP algorithm
344340
345- - display (Bool )
341+ - display (Int )
346342 the output display or verbosity parameter
347343
348344
@@ -354,7 +350,7 @@ Returns :
354350"""
355351function sdp_solve_HD (model:: StochDynProgModel ,
356352 param:: SDPparameters ,
357- display= true :: Bool )
353+ display= 0 :: Int64 )
358354
359355 TF = model. stageNumber
360356 next_state = zeros (Float64, model. dimStates)
@@ -378,11 +374,8 @@ function sdp_solve_HD(model::StochDynProgModel,
378374 end
379375
380376 # Construct a progress meter
381- if display
377+ if display > 0
382378 p = Progress ((TF- 1 )* param. totalStateSpaceSize, 1 )
383- end
384-
385- if display
386379 println (" Starting stochastic dynamic programming hazard decision computation" )
387380 end
388381
@@ -393,7 +386,7 @@ function sdp_solve_HD(model::StochDynProgModel,
393386 # Loop over states
394387 for x in product_states
395388
396- if display
389+ if display > 0
397390 next! (p)
398391 end
399392
@@ -474,7 +467,7 @@ Returns :
474467- V(x0) (Float64)
475468
476469"""
477- function get_value (model:: SPModel ,param:: SDPparameters ,V:: Array{Float64} )
470+ function get_bellman_value (model:: SPModel , param:: SDPparameters , V:: Array{Float64} )
478471 ind_x0 = real_index_from_variable (model. initialState, model. xlim, param. stateSteps)
479472 Vi = value_function_interpolation (model, V, 1 )
480473 return Vi[ind_x0... ,1 ]
@@ -495,7 +488,7 @@ Parameters:
495488 the scenarios of uncertainties realizations we want to simulate on
496489 scenarios[t,k,:] is the alea at time t for scenario k
497490
498- - value_functions (Array)
491+ - V (Array)
499492 the vector representing the value functions as functions of the state
500493 of the system at each time step
501494
@@ -517,8 +510,8 @@ Returns :
517510function sdp_forward_simulation (model:: SPModel ,
518511 param:: SDPparameters ,
519512 scenarios:: Array{Float64,3} ,
520- value :: Array ,
521- display= true :: Bool )
513+ V :: Array ,
514+ display= false :: Bool )
522515
523516 SDPmodel = build_sdpmodel_from_spmodel (model)
524517 TF = SDPmodel. stageNumber
@@ -530,7 +523,6 @@ function sdp_forward_simulation(model::SPModel,
530523
531524
532525 for k = 1 : nb_scenarios
533- # println(k)
534526 costs[k], states[:,k], controls[:,k] = sdp_forward_single_simulation (SDPmodel,
535527 param,scenarios[:,k],model. initialState,value,display)
536528 end
@@ -701,7 +693,7 @@ Parameters:
701693- X0 (SDPparameters)
702694 the initial state of the system
703695
704- - value_functions (Array)
696+ - V (Array)
705697 the vector representing the value functions as functions of the state
706698 of the system at each time step
707699
@@ -724,7 +716,7 @@ function sdp_forward_single_simulation(model::StochDynProgModel,
724716 param:: SDPparameters ,
725717 scenario:: Array ,
726718 X0:: Array ,
727- value :: Array ,
719+ V :: Array ,
728720 display= true :: Bool )
729721
730722 TF = model. stageNumber
@@ -757,7 +749,7 @@ function sdp_forward_single_simulation(model::StochDynProgModel,
757749 x = states[t,1 ,:]
758750
759751 best_V = Inf
760- Vitp = value_function_interpolation (model, value , t+ 1 )
752+ Vitp = value_function_interpolation (model, V , t+ 1 )
761753
762754 for u in product_controls
763755
@@ -816,7 +808,7 @@ function sdp_forward_single_simulation(model::StochDynProgModel,
816808
817809 x = states[t,1 ,:]
818810
819- Vitp = value_function_interpolation (model, value , t+ 1 )
811+ Vitp = value_function_interpolation (model, V , t+ 1 )
820812
821813 best_V = Inf
822814
0 commit comments