@@ -34,7 +34,7 @@ fulfilled.
3434 each value function
3535* `count_callsolver::Int64`:
3636 number of times the solver has been called
37-
37+
3838"""
3939function solve_SDDP (model:: SPModel , param:: SDDPparameters , display= 0 :: Int64 )
4040 # initialize value functions:
@@ -180,15 +180,11 @@ function estimate_upper_bound(model::SPModel, param::SDDPparameters,
180180 n_simulation= 1000 :: Int )
181181
182182 aleas = simulate_scenarios (model. noises, n_simulation)
183-
184- callsolver:: Int = 0
185- costs, stockTrajectories, _ = forward_simulations (model,
186- param,
187- problem,
188- aleas)
189-
183+ costs, stockTrajectories, _ = forward_simulations (model, param, problem, aleas)
190184 return upper_bound (costs), costs
191185end
186+
187+
192188function estimate_upper_bound (model:: SPModel , param:: SDDPparameters ,
193189 aleas:: Array{Float64, 3} ,
194190 problem:: Vector{JuMP.Model} )
199195
200196""" Build a collection of cuts initialized at 0"""
201197function get_null_value_functions_array (model:: SPModel )
202-
203- V = Vector {PolyhedralFunction} (model. stageNumber)
204- for t = 1 : model. stageNumber
205- V[t] = PolyhedralFunction (zeros (1 ), zeros (1 , model. dimStates), 1 )
206- end
207-
208- return V
198+ return [PolyhedralFunction (zeros (1 ), zeros (1 , model. dimStates), 1 ) for i in 1 : model. stageNumber]
209199end
210200
211201
@@ -298,7 +288,6 @@ function build_models(model::SPModel, param::SDDPparameters)
298288end
299289
300290
301-
302291"""
303292Initialize value functions along a given trajectory
304293
@@ -461,7 +450,8 @@ Compute optimal control at point xt and time t.
461450# Return
462451 `Vector{Float64}`: optimal control at time t
463452"""
464- function get_control (model:: SPModel , param:: SDDPparameters , lpproblem:: Vector{JuMP.Model} , t:: Int , xt:: Vector{Float64} , xi:: Vector{Float64} )
453+ function get_control (model:: SPModel , param:: SDDPparameters , lpproblem:: Vector{JuMP.Model} ,
454+ t:: Int , xt:: Vector{Float64} , xi:: Vector{Float64} )
465455 return solve_one_step_one_alea (model, param, lpproblem[t], t, xt, xi)[2 ]. optimal_control
466456end
467457
@@ -565,3 +555,4 @@ function is_cut_relevant(model::SPModel, k::Int, Vt::PolyhedralFunction, solver;
565555 sol = getobjectivevalue (m)
566556 return sol < epsilon
567557end
558+
0 commit comments