Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/cutpruning.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ncuts(V::PolyhedralFunction) = length(V.betas)
ncuts(V::Array{PolyhedralFunction}) = sum([ncuts(v) for v in V])

# Update cut pruner
update!{T}(pruner::CutPruners.DeMatosCutPruner, x::Vector{T}, λ::Vector{T})=addposition!(pruner, x)
update!{T}(pruner::CutPruners.AvgCutPruner, x::Vector{T}, λ::Vector{T})=addusage!(pruner, λ)
update!{T}(pruner::CutPruners.DecayCutPruner, x::Vector{T}, λ::Vector{T})=addusage!(pruner, λ)
update!(pruner::CutPruners.DeMatosCutPruner, x::Vector{T}, λ::Vector{T}) where {T}=addposition!(pruner, x)
update!(pruner::CutPruners.AvgCutPruner, x::Vector{T}, λ::Vector{T}) where {T}=addusage!(pruner, λ)
update!(pruner::CutPruners.DecayCutPruner, x::Vector{T}, λ::Vector{T}) where {T}=addusage!(pruner, λ)

2 changes: 1 addition & 1 deletion src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# SDDP interface
#############################################################################

type SDDPInterface
mutable struct SDDPInterface
init::Bool
# Stochastic model to solve
spmodel::SPModel
Expand Down
2 changes: 1 addition & 1 deletion src/noises.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#############################################################################


type NoiseLaw
mutable struct NoiseLaw
# Dimension of noise
dimNoises::Int64
# Number of points in distribution:
Expand Down
30 changes: 15 additions & 15 deletions src/objects.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
abstract type RiskMeasure end

# Define an object to
type Expectation <: RiskMeasure
mutable struct Expectation <: RiskMeasure
function Expectation()
return new()
end
end

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

type WorstCase <: RiskMeasure
mutable struct WorstCase <: RiskMeasure
function WorstCase()
return new()
end
end

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

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


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

type LinearSPModel <: SPModel
mutable struct LinearSPModel <: SPModel
# problem dimension
stageNumber::Int64 #number of information step + 1
dimControls::Int64
Expand Down Expand Up @@ -139,7 +139,7 @@ type LinearSPModel <: SPModel
Vf = PolyhedralFunction(zeros(1), zeros(1, dimStates), 1, UInt64[], 0)
end

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

if (x_bounds == nothing)
Expand Down Expand Up @@ -195,7 +195,7 @@ function max_bounds(bounds::Array)
[(m_bounds[i,1], m_bounds[i,2]) for i in 1:size(bounds)[1]]
end

type StochDynProgModel <: SPModel
mutable struct StochDynProgModel <: SPModel
# problem dimension
stageNumber::Int64
dimControls::Int64
Expand Down Expand Up @@ -239,8 +239,8 @@ type StochDynProgModel <: SPModel
finalCostFunction, dynamic, constraints, aleas, search_space_builder = Nullable{Function}())
dimState = length(x0)
dimControls = size(u_bounds)[1]
u_bounds1 = ndims(u_bounds) == 1? u_bounds : max_bounds(u_bounds)
x_bounds1 = ndims(x_bounds) == 1? x_bounds : max_bounds(x_bounds)
u_bounds1 = ndims(u_bounds) == 1 ? u_bounds : max_bounds(u_bounds)
x_bounds1 = ndims(x_bounds) == 1 ? x_bounds : max_bounds(x_bounds)


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


type SDPparameters
mutable struct SDPparameters
stateSteps
controlSteps
totalStateSpaceSize
Expand Down Expand Up @@ -295,7 +295,7 @@ abstract type AbstractSDDPStats end

# Define an object to store evolution of solution
# along iterations:
type SDDPStat <: AbstractSDDPStats
mutable struct SDDPStat <: AbstractSDDPStats
# Number of iterations:
niterations::Int
# evolution of lower bound:
Expand Down Expand Up @@ -361,7 +361,7 @@ end


abstract type AbstractNLDSSolution end
type NLDSSolution <: AbstractNLDSSolution
mutable struct NLDSSolution <: AbstractNLDSSolution
# solver status:
status::Bool
# cost:
Expand All @@ -378,7 +378,7 @@ type NLDSSolution <: AbstractNLDSSolution
πc::Vector{Float64}
end

type DHNLDSSolution <: AbstractNLDSSolution
mutable struct DHNLDSSolution <: AbstractNLDSSolution
# solver status:
status::Bool
# cost:
Expand Down
2 changes: 1 addition & 1 deletion src/oneStepOneAleaProblem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function solve_one_step_one_alea(model,
end

if model.IS_SMIP
solved = relaxation ? solve_relaxed!(m, param,verbosity): solve_mip!(m, param,verbosity)
solved = relaxation ? solve_relaxed!(m, param,verbosity) : solve_mip!(m, param,verbosity)
else
status = (verbosity>3) ? solve(m, suppress_warnings=false) : solve(m, suppress_warnings=false)
solved = (status == :Optimal)
Expand Down
2 changes: 1 addition & 1 deletion src/params.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Definition of SDDP parameters
#############################################################################

type SDDPparameters
mutable struct SDDPparameters
# Solver used to solve LP
SOLVER::MathProgBase.AbstractMathProgSolver
# Solver used to solve MILP (default is nothing):
Expand Down
2 changes: 1 addition & 1 deletion src/regularization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export SDDPRegularization
abstract type AbstractRegularization end


type SDDPRegularization <: AbstractRegularization
mutable struct SDDPRegularization <: AbstractRegularization
ρ::Float64
alpha::Float64
incumbents
Expand Down
14 changes: 7 additions & 7 deletions src/stopcrit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $(TYPEDEF)

Stops if `lhs` *or* `rhs` want to stop.
"""
type OrStoppingCriterion <: AbstractStoppingCriterion
mutable struct OrStoppingCriterion <: AbstractStoppingCriterion
lhs::AbstractStoppingCriterion
rhs::AbstractStoppingCriterion
end
Expand All @@ -43,7 +43,7 @@ $(TYPEDEF)

Stops if `lhs` *and* `rhs` want to stop.
"""
type AndStoppingCriterion <: AbstractStoppingCriterion
mutable struct AndStoppingCriterion <: AbstractStoppingCriterion
lhs::AbstractStoppingCriterion
rhs::AbstractStoppingCriterion
end
Expand All @@ -61,7 +61,7 @@ $(TYPEDEF)

Stops if `iter` ≧ `limit`.
"""
type IterLimit <: AbstractStoppingCriterion
mutable struct IterLimit <: AbstractStoppingCriterion
limit::Int
end

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

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

Expand All @@ -104,7 +104,7 @@ $(TYPEDEF)

Stops if `z_UB - α * σ/√K - tol < z_LB < z_UB + α * σ/√K + tol` and `σ / √K > β * max(1, |z_LB|))`
"""
type Pereira <: AbstractStoppingCriterion
mutable struct Pereira <: AbstractStoppingCriterion
α::Float64
β::Float64
tol::Float64
Expand Down Expand Up @@ -137,7 +137,7 @@ Stops if the lower bound is stabilized
total time of execution is greater than the time limit specified.
For instance, `TimeLimit(100)` stops after 100s.
"""
type LBStabilization <: AbstractStoppingCriterion
mutable struct LBStabilization <: AbstractStoppingCriterion
epsilon::Float64
n_back::Int
end
Expand Down