@@ -109,6 +109,13 @@ function run_SDDP!(model::SPModel,
109109 # Initialization of the counter
110110 stats = SDDPStat ()
111111
112+ # Initialize cuts container for cuts pruning:
113+ if isa (param. pruning[:type ], Union{Type{Territory}, Type{LevelOne}})
114+ activecuts = [ActiveCutsContainer (model. dimStates) for i in 1 : model. stageNumber- 1 ]
115+ else
116+ activecuts = [nothing for i in 1 : model. stageNumber- 1 ]
117+ end
118+
112119 (verbose > 0 ) && println (" Initialize cuts" )
113120
114121 # If computation of upper-bound is needed, a set of scenarios is built
@@ -134,26 +141,30 @@ function run_SDDP!(model::SPModel,
134141 # Backward pass : update polyhedral approximation of Bellman functions
135142 callsolver_backward = backward_pass! (model, param, V, problems, stockTrajectories, model. noises)
136143
144+ # ###################
145+ # Update stats
146+ lwb = get_bellman_value (model, param, 1 , V[1 ], model. initialState)
147+ updateSDDPStat! (stats, callsolver_forward+ callsolver_backward, lwb, upb, toq ())
148+ print_current_stats (stats,verbose)
149+
137150 # ###################
138151 # cut pruning
139- prune_cuts! (model,param,V,stats. niterations,verbose)
152+ if param. pruning[:pruning ]
153+ prune_cuts! (model, param, V, stockTrajectories, activecuts, stats. niterations, verbose)
154+ if (stats. niterations% param. pruning[:period ]== 0 )
155+ problems = hotstart_SDDP (model, param, V)
156+ end
157+ end
140158
141159 # ###################
142160 # In iteration upper bound estimation
143161 upb = in_iteration_upb_estimation (model, param, stats. niterations, verbose,
144162 upperbound_scenarios, upb, problems)
145163
146- # ###################
147- # Update stats
148- lwb = get_bellman_value (model, param, 1 , V[1 ], model. initialState)
149- updateSDDPStat! (stats, callsolver_forward+ callsolver_backward, lwb, upb, toq ())
150-
151- print_current_stats (stats,verbose)
152164
153165 # ###################
154166 # Stopping test
155167 stopping_test = test_stopping_criterion (param,stats)
156- stats. niterations += 1
157168 end
158169
159170 # #########
@@ -465,3 +476,4 @@ function add_cuts_to_model!(model::SPModel, t::Int64, problem::JuMP.Model, V::Po
465476 @constraint (problem, V. betas[i] + dot (lambda, xf) <= alpha)
466477 end
467478end
479+
0 commit comments