1- srand(2713 )
2- push!(LOAD_PATH , " ../src" )
3- # include("../src/objects.jl")
4- # include("../src/SDPoptimize.jl")
1+ # Copyright 2015, Vincent Leclere, Francois Pacaud and Henri Gerard
2+ # This Source Code Form is subject to the terms of the Mozilla Public
3+ # License, v. 2.0. If a copy of the MPL was not distributed with this
4+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5+ # ############################################################################
6+ # Compare different ways of solving a stock problem
7+ # ############################################################################
58
9+ push!(LOAD_PATH , " ../src" )
610using StochDynamicProgramming, JuMP, Clp, Distributions
711
12+ # ####### Optimization parameters ########
13+ # choose the LP solver used.
814const SOLVER = ClpSolver()
915# const SOLVER = CplexSolver(CPX_PARAM_SIMDISPLAY=0)
16+ # const SOLVER = GurobiSolver()
1017
18+ # Stopping test parameters
1119const EPSILON = .05
1220const MAX_ITER = 20
1321
22+
23+ # ####### Stochastic problem parameters ########
24+
1425# Define number of stages and scenarios:
1526const N_STAGES = 3
1627const N_SCENARIOS = 10
@@ -19,7 +30,7 @@ const N_SCENARIOS = 10
1930const TF = N_STAGES- 1
2031
2132# Randomnly generate a cost scenario fixed for the whole problem:
22- const COST = [ - 12 , - 200 , - 67 ]
33+ const COST = - rand(N_STAGES)
2334
2435# Define bounds for states and controls:
2536const VOLUME_MAX = 50
@@ -81,7 +92,7 @@ function constraints(t, x1, u, w)
8192end
8293
8394
84- """ Solve the problem with a solver, supposing the aleas are known
95+ """ Solve the optimization problem assuming the aleas are known
8596in advance."""
8697function solve_determinist_problem()
8798 m = Model(solver= SOLVER)
0 commit comments