Skip to content

Commit d988371

Browse files
authored
Merge pull request #165 from JuliaStochOpt/fbot/deps
Fix deprecations
2 parents 3b3f8cb + 41dd1c1 commit d988371

File tree

8 files changed

+30
-30
lines changed

8 files changed

+30
-30
lines changed

src/cutpruning.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ncuts(V::PolyhedralFunction) = length(V.betas)
5454
ncuts(V::Array{PolyhedralFunction}) = sum([ncuts(v) for v in V])
5555

5656
# Update cut pruner
57-
update!{T}(pruner::CutPruners.DeMatosCutPruner, x::Vector{T}, λ::Vector{T})=addposition!(pruner, x)
58-
update!{T}(pruner::CutPruners.AvgCutPruner, x::Vector{T}, λ::Vector{T})=addusage!(pruner, λ)
59-
update!{T}(pruner::CutPruners.DecayCutPruner, x::Vector{T}, λ::Vector{T})=addusage!(pruner, λ)
57+
update!(pruner::CutPruners.DeMatosCutPruner, x::Vector{T}, λ::Vector{T}) where {T}=addposition!(pruner, x)
58+
update!(pruner::CutPruners.AvgCutPruner, x::Vector{T}, λ::Vector{T}) where {T}=addusage!(pruner, λ)
59+
update!(pruner::CutPruners.DecayCutPruner, x::Vector{T}, λ::Vector{T}) where {T}=addusage!(pruner, λ)
6060

src/interface.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# SDDP interface
77
#############################################################################
88

9-
type SDDPInterface
9+
mutable struct SDDPInterface
1010
init::Bool
1111
# Stochastic model to solve
1212
spmodel::SPModel

src/noises.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#############################################################################
1010

1111

12-
type NoiseLaw
12+
mutable struct NoiseLaw
1313
# Dimension of noise
1414
dimNoises::Int64
1515
# Number of points in distribution:

src/objects.jl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
abstract type RiskMeasure end
1111

1212
# Define an object to
13-
type Expectation <: RiskMeasure
13+
mutable struct Expectation <: RiskMeasure
1414
function Expectation()
1515
return new()
1616
end
1717
end
1818

19-
type AVaR <: RiskMeasure
19+
mutable struct AVaR <: RiskMeasure
2020
# If the random variable is a cost and beta = 0.05,
2121
# it returns the average of the five worst costs solving the problem
2222
# minimize alpha + 1/beta * E[max(X - alpha; 0)]
@@ -28,13 +28,13 @@ type AVaR <: RiskMeasure
2828
end
2929
end
3030

31-
type WorstCase <: RiskMeasure
31+
mutable struct WorstCase <: RiskMeasure
3232
function WorstCase()
3333
return new()
3434
end
3535
end
3636

37-
type ConvexCombi <: RiskMeasure
37+
mutable struct ConvexCombi <: RiskMeasure
3838
# Define a convex combination between Expectation and AVaR_{beta}
3939
# with form lambda*E + (1-lambda)*AVaR
4040
# lambda = 1 ==> Expectation
@@ -46,7 +46,7 @@ type ConvexCombi <: RiskMeasure
4646
end
4747
end
4848

49-
type PolyhedralRisk <: RiskMeasure
49+
mutable struct PolyhedralRisk <: RiskMeasure
5050
# Define a convex polyhedral set P of probability distributions
5151
# by its extreme points p1, ..., pn
5252
# In the case of costs X, the problem solved is
@@ -61,7 +61,7 @@ end
6161
abstract type SPModel end
6262

6363

64-
type PolyhedralFunction
64+
mutable struct PolyhedralFunction
6565
#function defined by max_k betas[k] + lambdas[k,:]*x
6666
betas::Vector{Float64}
6767
lambdas::Array{Float64,2} #lambdas[k,:] is the subgradient
@@ -81,7 +81,7 @@ function fetchnewcuts!(V::PolyhedralFunction)
8181
return β, λ
8282
end
8383

84-
type LinearSPModel <: SPModel
84+
mutable struct LinearSPModel <: SPModel
8585
# problem dimension
8686
stageNumber::Int64 #number of information step + 1
8787
dimControls::Int64
@@ -139,7 +139,7 @@ type LinearSPModel <: SPModel
139139
Vf = PolyhedralFunction(zeros(1), zeros(1, dimStates), 1, UInt64[], 0)
140140
end
141141

142-
isbu = isa(control_cat, Vector{Symbol})? control_cat: [:Cont for i in 1:dimControls]
142+
isbu = isa(control_cat, Vector{Symbol}) ? control_cat : [:Cont for i in 1:dimControls]
143143
is_smip = (:Int in isbu)||(:Bin in isbu)
144144

145145
if (x_bounds == nothing)
@@ -195,7 +195,7 @@ function max_bounds(bounds::Array)
195195
[(m_bounds[i,1], m_bounds[i,2]) for i in 1:size(bounds)[1]]
196196
end
197197

198-
type StochDynProgModel <: SPModel
198+
mutable struct StochDynProgModel <: SPModel
199199
# problem dimension
200200
stageNumber::Int64
201201
dimControls::Int64
@@ -239,8 +239,8 @@ type StochDynProgModel <: SPModel
239239
finalCostFunction, dynamic, constraints, aleas, search_space_builder = Nullable{Function}())
240240
dimState = length(x0)
241241
dimControls = size(u_bounds)[1]
242-
u_bounds1 = ndims(u_bounds) == 1? u_bounds : max_bounds(u_bounds)
243-
x_bounds1 = ndims(x_bounds) == 1? x_bounds : max_bounds(x_bounds)
242+
u_bounds1 = ndims(u_bounds) == 1 ? u_bounds : max_bounds(u_bounds)
243+
x_bounds1 = ndims(x_bounds) == 1 ? x_bounds : max_bounds(x_bounds)
244244

245245

246246
return new(TF, dimControls, dimState, length(aleas[1].support[:, 1]),
@@ -252,7 +252,7 @@ type StochDynProgModel <: SPModel
252252
end
253253

254254

255-
type SDPparameters
255+
mutable struct SDPparameters
256256
stateSteps
257257
controlSteps
258258
totalStateSpaceSize
@@ -295,7 +295,7 @@ abstract type AbstractSDDPStats end
295295

296296
# Define an object to store evolution of solution
297297
# along iterations:
298-
type SDDPStat <: AbstractSDDPStats
298+
mutable struct SDDPStat <: AbstractSDDPStats
299299
# Number of iterations:
300300
niterations::Int
301301
# evolution of lower bound:
@@ -361,7 +361,7 @@ end
361361

362362

363363
abstract type AbstractNLDSSolution end
364-
type NLDSSolution <: AbstractNLDSSolution
364+
mutable struct NLDSSolution <: AbstractNLDSSolution
365365
# solver status:
366366
status::Bool
367367
# cost:
@@ -378,7 +378,7 @@ type NLDSSolution <: AbstractNLDSSolution
378378
πc::Vector{Float64}
379379
end
380380

381-
type DHNLDSSolution <: AbstractNLDSSolution
381+
mutable struct DHNLDSSolution <: AbstractNLDSSolution
382382
# solver status:
383383
status::Bool
384384
# cost:

src/oneStepOneAleaProblem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function solve_one_step_one_alea(model,
8989
end
9090

9191
if model.IS_SMIP
92-
solved = relaxation ? solve_relaxed!(m, param,verbosity): solve_mip!(m, param,verbosity)
92+
solved = relaxation ? solve_relaxed!(m, param,verbosity) : solve_mip!(m, param,verbosity)
9393
else
9494
status = (verbosity>3) ? solve(m, suppress_warnings=false) : solve(m, suppress_warnings=false)
9595
solved = (status == :Optimal)

src/params.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Definition of SDDP parameters
77
#############################################################################
88

9-
type SDDPparameters
9+
mutable struct SDDPparameters
1010
# Solver used to solve LP
1111
SOLVER::MathProgBase.AbstractMathProgSolver
1212
# Solver used to solve MILP (default is nothing):

src/regularization.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export SDDPRegularization
1212
abstract type AbstractRegularization end
1313

1414

15-
type SDDPRegularization <: AbstractRegularization
15+
mutable struct SDDPRegularization <: AbstractRegularization
1616
ρ::Float64
1717
alpha::Float64
1818
incumbents

src/stopcrit.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ $(TYPEDEF)
2525
2626
Stops if `lhs` *or* `rhs` want to stop.
2727
"""
28-
type OrStoppingCriterion <: AbstractStoppingCriterion
28+
mutable struct OrStoppingCriterion <: AbstractStoppingCriterion
2929
lhs::AbstractStoppingCriterion
3030
rhs::AbstractStoppingCriterion
3131
end
@@ -43,7 +43,7 @@ $(TYPEDEF)
4343
4444
Stops if `lhs` *and* `rhs` want to stop.
4545
"""
46-
type AndStoppingCriterion <: AbstractStoppingCriterion
46+
mutable struct AndStoppingCriterion <: AbstractStoppingCriterion
4747
lhs::AbstractStoppingCriterion
4848
rhs::AbstractStoppingCriterion
4949
end
@@ -61,7 +61,7 @@ $(TYPEDEF)
6161
6262
Stops if `iter` ≧ `limit`.
6363
"""
64-
type IterLimit <: AbstractStoppingCriterion
64+
mutable struct IterLimit <: AbstractStoppingCriterion
6565
limit::Int
6666
end
6767

@@ -75,7 +75,7 @@ $(TYPEDEF)
7575
Stops if there was less than or equal to `limit` cuts added in the iteration.
7676
For instance, `CutLimit(0)` stops when there are no cuts added.
7777
"""
78-
type CutLimit <: AbstractStoppingCriterion
78+
mutable struct CutLimit <: AbstractStoppingCriterion
7979
limit::Int
8080
end
8181

@@ -90,7 +90,7 @@ $(TYPEDEF)
9090
Stops if total time of execution is greater than the time limit specified.
9191
For instance, `TimeLimit(100)` stops after 100s.
9292
"""
93-
type TimeLimit <: AbstractStoppingCriterion
93+
mutable struct TimeLimit <: AbstractStoppingCriterion
9494
timelimit::Float64
9595
end
9696

@@ -104,7 +104,7 @@ $(TYPEDEF)
104104
105105
Stops if `z_UB - α * σ/√K - tol < z_LB < z_UB + α * σ/√K + tol` and `σ / √K > β * max(1, |z_LB|))`
106106
"""
107-
type Pereira <: AbstractStoppingCriterion
107+
mutable struct Pereira <: AbstractStoppingCriterion
108108
α::Float64
109109
β::Float64
110110
tol::Float64
@@ -137,7 +137,7 @@ Stops if the lower bound is stabilized
137137
total time of execution is greater than the time limit specified.
138138
For instance, `TimeLimit(100)` stops after 100s.
139139
"""
140-
type LBStabilization <: AbstractStoppingCriterion
140+
mutable struct LBStabilization <: AbstractStoppingCriterion
141141
epsilon::Float64
142142
n_back::Int
143143
end

0 commit comments

Comments
 (0)