mirror of
https://github.com/ANL-CEEESA/UnitCommitment.jl.git
synced 2025-12-06 08:18:51 -06:00
Use 4-digit years
This commit is contained in:
@@ -59,24 +59,27 @@ function main()
|
|||||||
"tejada19/UC_168h_199g",
|
"tejada19/UC_168h_199g",
|
||||||
]
|
]
|
||||||
formulations = Dict(
|
formulations = Dict(
|
||||||
"ArrCon00" =>
|
"ArrCon2000" => UnitCommitment.Formulation(
|
||||||
UnitCommitment.Formulation(ramping = UnitCommitment.ArrCon00()),
|
ramping = UnitCommitment.ArrCon2000(),
|
||||||
"CarArr06" => UnitCommitment.Formulation(
|
|
||||||
pwl_costs = UnitCommitment.CarArr06(),
|
|
||||||
),
|
),
|
||||||
"DamKucRajAta16" => UnitCommitment.Formulation(
|
"CarArr2006" => UnitCommitment.Formulation(
|
||||||
ramping = UnitCommitment.DamKucRajAta16(),
|
pwl_costs = UnitCommitment.CarArr2006(),
|
||||||
),
|
),
|
||||||
"Gar62" =>
|
"DamKucRajAta2016" => UnitCommitment.Formulation(
|
||||||
UnitCommitment.Formulation(pwl_costs = UnitCommitment.Gar62()),
|
ramping = UnitCommitment.DamKucRajAta2016(),
|
||||||
"KnuOstWat18" => UnitCommitment.Formulation(
|
|
||||||
pwl_costs = UnitCommitment.KnuOstWat18(),
|
|
||||||
),
|
),
|
||||||
"MorLatRam13" => UnitCommitment.Formulation(
|
"Gar1962" => UnitCommitment.Formulation(
|
||||||
ramping = UnitCommitment.MorLatRam13(),
|
pwl_costs = UnitCommitment.Gar1962(),
|
||||||
|
),
|
||||||
|
"KnuOstWat2018" => UnitCommitment.Formulation(
|
||||||
|
pwl_costs = UnitCommitment.KnuOstWat2018(),
|
||||||
|
),
|
||||||
|
"MorLatRam2013" => UnitCommitment.Formulation(
|
||||||
|
ramping = UnitCommitment.MorLatRam2013(),
|
||||||
|
),
|
||||||
|
"PanGua2016" => UnitCommitment.Formulation(
|
||||||
|
ramping = UnitCommitment.PanGua2016(),
|
||||||
),
|
),
|
||||||
"PanGua16" =>
|
|
||||||
UnitCommitment.Formulation(ramping = UnitCommitment.PanGua16()),
|
|
||||||
)
|
)
|
||||||
trials = [i for i in 1:5]
|
trials = [i for i in 1:5]
|
||||||
combinations = [
|
combinations = [
|
||||||
@@ -99,34 +102,18 @@ end
|
|||||||
dirname = "results/$name"
|
dirname = "results/$name"
|
||||||
mkpath(dirname)
|
mkpath(dirname)
|
||||||
if isfile("$dirname/$trial.json")
|
if isfile("$dirname/$trial.json")
|
||||||
@info @sprintf(
|
@info @sprintf("%-4s %-16s %s", "skip", formulation_name, case)
|
||||||
"%-8s %-20s %-40s",
|
|
||||||
"skip",
|
|
||||||
formulation_name,
|
|
||||||
"$case/$trial",
|
|
||||||
)
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@info @sprintf(
|
@info @sprintf("%-4s %-16s %s", "run", formulation_name, case)
|
||||||
"%-8s %-20s %-40s",
|
open("$dirname/$trial.log", "w") do file
|
||||||
"start",
|
|
||||||
formulation_name,
|
|
||||||
"$case/$trial",
|
|
||||||
)
|
|
||||||
time = @elapsed open("$dirname/$trial.log", "w") do file
|
|
||||||
redirect_stdout(file) do
|
redirect_stdout(file) do
|
||||||
redirect_stderr(file) do
|
redirect_stderr(file) do
|
||||||
return _run_sample(case, formulation, "$dirname/$trial")
|
return _run_sample(case, formulation, "$dirname/$trial")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@info @sprintf(
|
@info @sprintf("%-4s %-16s %s", "done", formulation_name, case)
|
||||||
"%-8s %-20s %-40s %12.3f",
|
|
||||||
"finish",
|
|
||||||
formulation_name,
|
|
||||||
"$case/$trial",
|
|
||||||
time
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@everywhere function _run_sample(case, formulation, prefix)
|
@everywhere function _run_sample(case, formulation, prefix)
|
||||||
@@ -151,7 +138,7 @@ end
|
|||||||
BLAS.set_num_threads(1)
|
BLAS.set_num_threads(1)
|
||||||
UnitCommitment.optimize!(
|
UnitCommitment.optimize!(
|
||||||
model,
|
model,
|
||||||
UnitCommitment.XavQiuWanThi19(
|
UnitCommitment.XavQiuWanThi2019(
|
||||||
time_limit = 3600.0,
|
time_limit = 3600.0,
|
||||||
gap_limit = 1e-4,
|
gap_limit = 1e-4,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -8,37 +8,37 @@ include("instance/structs.jl")
|
|||||||
include("model/formulations/base/structs.jl")
|
include("model/formulations/base/structs.jl")
|
||||||
include("solution/structs.jl")
|
include("solution/structs.jl")
|
||||||
|
|
||||||
include("model/formulations/ArrCon00/structs.jl")
|
include("model/formulations/ArrCon2000/structs.jl")
|
||||||
include("model/formulations/CarArr06/structs.jl")
|
include("model/formulations/CarArr2006/structs.jl")
|
||||||
include("model/formulations/DamKucRajAta16/structs.jl")
|
include("model/formulations/DamKucRajAta2016/structs.jl")
|
||||||
include("model/formulations/Gar62/structs.jl")
|
include("model/formulations/Gar1962/structs.jl")
|
||||||
include("model/formulations/KnuOstWat18/structs.jl")
|
include("model/formulations/KnuOstWat2018/structs.jl")
|
||||||
include("model/formulations/MorLatRam13/structs.jl")
|
include("model/formulations/MorLatRam2013/structs.jl")
|
||||||
include("model/formulations/PanGua16/structs.jl")
|
include("model/formulations/PanGua2016/structs.jl")
|
||||||
include("solution/methods/XavQiuWanThi19/structs.jl")
|
include("solution/methods/XavQiuWanThi2019/structs.jl")
|
||||||
|
|
||||||
include("import/egret.jl")
|
include("import/egret.jl")
|
||||||
include("instance/read.jl")
|
include("instance/read.jl")
|
||||||
include("model/build.jl")
|
include("model/build.jl")
|
||||||
include("model/formulations/ArrCon00/ramp.jl")
|
include("model/formulations/ArrCon2000/ramp.jl")
|
||||||
include("model/formulations/base/bus.jl")
|
include("model/formulations/base/bus.jl")
|
||||||
include("model/formulations/base/line.jl")
|
include("model/formulations/base/line.jl")
|
||||||
include("model/formulations/base/psload.jl")
|
include("model/formulations/base/psload.jl")
|
||||||
include("model/formulations/base/sensitivity.jl")
|
include("model/formulations/base/sensitivity.jl")
|
||||||
include("model/formulations/base/system.jl")
|
include("model/formulations/base/system.jl")
|
||||||
include("model/formulations/base/unit.jl")
|
include("model/formulations/base/unit.jl")
|
||||||
include("model/formulations/CarArr06/pwlcosts.jl")
|
include("model/formulations/CarArr2006/pwlcosts.jl")
|
||||||
include("model/formulations/DamKucRajAta16/ramp.jl")
|
include("model/formulations/DamKucRajAta2016/ramp.jl")
|
||||||
include("model/formulations/Gar62/pwlcosts.jl")
|
include("model/formulations/Gar1962/pwlcosts.jl")
|
||||||
include("model/formulations/KnuOstWat18/pwlcosts.jl")
|
include("model/formulations/KnuOstWat2018/pwlcosts.jl")
|
||||||
include("model/formulations/MorLatRam13/ramp.jl")
|
include("model/formulations/MorLatRam2013/ramp.jl")
|
||||||
include("model/formulations/PanGua16/ramp.jl")
|
include("model/formulations/PanGua2016/ramp.jl")
|
||||||
include("model/jumpext.jl")
|
include("model/jumpext.jl")
|
||||||
include("solution/fix.jl")
|
include("solution/fix.jl")
|
||||||
include("solution/methods/XavQiuWanThi19/enforce.jl")
|
include("solution/methods/XavQiuWanThi2019/enforce.jl")
|
||||||
include("solution/methods/XavQiuWanThi19/filter.jl")
|
include("solution/methods/XavQiuWanThi2019/filter.jl")
|
||||||
include("solution/methods/XavQiuWanThi19/find.jl")
|
include("solution/methods/XavQiuWanThi2019/find.jl")
|
||||||
include("solution/methods/XavQiuWanThi19/optimize.jl")
|
include("solution/methods/XavQiuWanThi2019/optimize.jl")
|
||||||
include("solution/optimize.jl")
|
include("solution/optimize.jl")
|
||||||
include("solution/solution.jl")
|
include("solution/solution.jl")
|
||||||
include("solution/warmstart.jl")
|
include("solution/warmstart.jl")
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
function _add_ramp_eqs!(
|
function _add_ramp_eqs!(
|
||||||
model::JuMP.Model,
|
model::JuMP.Model,
|
||||||
g::Unit,
|
g::Unit,
|
||||||
formulation::ArrCon00,
|
formulation::ArrCon2000,
|
||||||
)::Nothing
|
)::Nothing
|
||||||
# TODO: Move upper case constants to model[:instance]
|
# TODO: Move upper case constants to model[:instance]
|
||||||
RESERVES_WHEN_START_UP = true
|
RESERVES_WHEN_START_UP = true
|
||||||
@@ -9,4 +9,4 @@ Formulation described in:
|
|||||||
to an electricity spot market. IEEE Transactions on power systems, 15(3),
|
to an electricity spot market. IEEE Transactions on power systems, 15(3),
|
||||||
1098-1104.
|
1098-1104.
|
||||||
"""
|
"""
|
||||||
struct ArrCon00 <: RampingFormulation end
|
struct ArrCon2000 <: RampingFormulation end
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
function _add_production_piecewise_linear_eqs!(
|
function _add_production_piecewise_linear_eqs!(
|
||||||
model::JuMP.Model,
|
model::JuMP.Model,
|
||||||
g::Unit,
|
g::Unit,
|
||||||
formulation::CarArr06,
|
formulation::CarArr2006,
|
||||||
)::Nothing
|
)::Nothing
|
||||||
eq_prod_above_def = _init(model, :eq_prod_above_def)
|
eq_prod_above_def = _init(model, :eq_prod_above_def)
|
||||||
eq_segprod_limit = _init(model, :eq_segprod_limit)
|
eq_segprod_limit = _init(model, :eq_segprod_limit)
|
||||||
@@ -9,4 +9,4 @@ Formulation described in:
|
|||||||
mixed-integer linear formulation for the thermal unit commitment problem.
|
mixed-integer linear formulation for the thermal unit commitment problem.
|
||||||
IEEE Transactions on power systems, 21(3), 1371-1378.
|
IEEE Transactions on power systems, 21(3), 1371-1378.
|
||||||
"""
|
"""
|
||||||
struct CarArr06 <: PiecewiseLinearCostsFormulation end
|
struct CarArr2006 <: PiecewiseLinearCostsFormulation end
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
function _add_ramp_eqs!(
|
function _add_ramp_eqs!(
|
||||||
model::JuMP.Model,
|
model::JuMP.Model,
|
||||||
g::Unit,
|
g::Unit,
|
||||||
formulation::DamKucRajAta16,
|
formulation::DamKucRajAta2016,
|
||||||
)::Nothing
|
)::Nothing
|
||||||
# TODO: Move upper case constants to model[:instance]
|
# TODO: Move upper case constants to model[:instance]
|
||||||
RESERVES_WHEN_START_UP = true
|
RESERVES_WHEN_START_UP = true
|
||||||
@@ -8,4 +8,4 @@ Formulation described in:
|
|||||||
Damcı-Kurt, P., Küçükyavuz, S., Rajan, D., & Atamtürk, A. (2016). A polyhedral
|
Damcı-Kurt, P., Küçükyavuz, S., Rajan, D., & Atamtürk, A. (2016). A polyhedral
|
||||||
study of production ramping. Mathematical Programming, 158(1), 175-205.
|
study of production ramping. Mathematical Programming, 158(1), 175-205.
|
||||||
"""
|
"""
|
||||||
struct DamKucRajAta16 <: RampingFormulation end
|
struct DamKucRajAta2016 <: RampingFormulation end
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
function _add_production_piecewise_linear_eqs!(
|
function _add_production_piecewise_linear_eqs!(
|
||||||
model::JuMP.Model,
|
model::JuMP.Model,
|
||||||
g::Unit,
|
g::Unit,
|
||||||
formulation::Gar62,
|
formulation::Gar1962,
|
||||||
)::Nothing
|
)::Nothing
|
||||||
eq_prod_above_def = _init(model, :eq_prod_above_def)
|
eq_prod_above_def = _init(model, :eq_prod_above_def)
|
||||||
eq_segprod_limit = _init(model, :eq_segprod_limit)
|
eq_segprod_limit = _init(model, :eq_segprod_limit)
|
||||||
@@ -10,4 +10,4 @@ Formulation described in:
|
|||||||
of Electrical Engineers. Part III: Power Apparatus and Systems, 81(3), 730-734.
|
of Electrical Engineers. Part III: Power Apparatus and Systems, 81(3), 730-734.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
struct Gar62 <: PiecewiseLinearCostsFormulation end
|
struct Gar1962 <: PiecewiseLinearCostsFormulation end
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
function _add_production_piecewise_linear_eqs!(
|
function _add_production_piecewise_linear_eqs!(
|
||||||
model::JuMP.Model,
|
model::JuMP.Model,
|
||||||
g::Unit,
|
g::Unit,
|
||||||
formulation::KnuOstWat18,
|
formulation::KnuOstWat2018,
|
||||||
)::Nothing
|
)::Nothing
|
||||||
eq_prod_above_def = _init(model, :eq_prod_above_def)
|
eq_prod_above_def = _init(model, :eq_prod_above_def)
|
||||||
eq_segprod_limit_a = _init(model, :eq_segprod_limit_a)
|
eq_segprod_limit_a = _init(model, :eq_segprod_limit_a)
|
||||||
@@ -9,4 +9,4 @@ Formulation described in:
|
|||||||
generators in unit commitment. IEEE Transactions on Power Systems, 33(4),
|
generators in unit commitment. IEEE Transactions on Power Systems, 33(4),
|
||||||
4496-4507.
|
4496-4507.
|
||||||
"""
|
"""
|
||||||
struct KnuOstWat18 <: PiecewiseLinearCostsFormulation end
|
struct KnuOstWat2018 <: PiecewiseLinearCostsFormulation end
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
function _add_ramp_eqs!(
|
function _add_ramp_eqs!(
|
||||||
model::JuMP.Model,
|
model::JuMP.Model,
|
||||||
g::Unit,
|
g::Unit,
|
||||||
formulation::MorLatRam13,
|
formulation::MorLatRam2013,
|
||||||
)::Nothing
|
)::Nothing
|
||||||
# TODO: Move upper case constants to model[:instance]
|
# TODO: Move upper case constants to model[:instance]
|
||||||
RESERVES_WHEN_START_UP = true
|
RESERVES_WHEN_START_UP = true
|
||||||
@@ -9,4 +9,4 @@ Formulation described in:
|
|||||||
MILP formulation for the thermal unit commitment problem. IEEE Transactions
|
MILP formulation for the thermal unit commitment problem. IEEE Transactions
|
||||||
on Power Systems, 28(4), 4897-4908.
|
on Power Systems, 28(4), 4897-4908.
|
||||||
"""
|
"""
|
||||||
struct MorLatRam13 <: RampingFormulation end
|
struct MorLatRam2013 <: RampingFormulation end
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
function _add_ramp_eqs!(
|
function _add_ramp_eqs!(
|
||||||
model::JuMP.Model,
|
model::JuMP.Model,
|
||||||
g::Unit,
|
g::Unit,
|
||||||
formulation::PanGua16,
|
formulation::PanGua2016,
|
||||||
)::Nothing
|
)::Nothing
|
||||||
# TODO: Move upper case constants to model[:instance]
|
# TODO: Move upper case constants to model[:instance]
|
||||||
RESERVES_WHEN_SHUT_DOWN = true
|
RESERVES_WHEN_SHUT_DOWN = true
|
||||||
@@ -8,4 +8,4 @@ Formulation described in:
|
|||||||
Pan, K., & Guan, Y. (2016). Strong formulations for multistage stochastic
|
Pan, K., & Guan, Y. (2016). Strong formulations for multistage stochastic
|
||||||
self-scheduling unit commitment. Operations Research, 64(6), 1482-1498.
|
self-scheduling unit commitment. Operations Research, 64(6), 1482-1498.
|
||||||
"""
|
"""
|
||||||
struct PanGua16 <: RampingFormulation end
|
struct PanGua2016 <: RampingFormulation end
|
||||||
@@ -12,8 +12,8 @@ struct Formulation
|
|||||||
transmission::TransmissionFormulation
|
transmission::TransmissionFormulation
|
||||||
|
|
||||||
function Formulation(;
|
function Formulation(;
|
||||||
pwl_costs::PiecewiseLinearCostsFormulation = Gar62(),
|
pwl_costs::PiecewiseLinearCostsFormulation = Gar1962(),
|
||||||
ramping::RampingFormulation = MorLatRam13(),
|
ramping::RampingFormulation = MorLatRam2013(),
|
||||||
transmission::TransmissionFormulation = ShiftFactorsFormulation(),
|
transmission::TransmissionFormulation = ShiftFactorsFormulation(),
|
||||||
)
|
)
|
||||||
return new(pwl_costs, ramping, transmission)
|
return new(pwl_costs, ramping, transmission)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
# Released under the modified BSD license. See COPYING.md for more details.
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
function optimize!(model::JuMP.Model, method::XavQiuWanThi19)::Nothing
|
function optimize!(model::JuMP.Model, method::XavQiuWanThi2019)::Nothing
|
||||||
function set_gap(gap)
|
function set_gap(gap)
|
||||||
try
|
try
|
||||||
JuMP.set_optimizer_attribute(model, "MIPGap", gap)
|
JuMP.set_optimizer_attribute(model, "MIPGap", gap)
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
import DataStructures: PriorityQueue
|
import DataStructures: PriorityQueue
|
||||||
|
|
||||||
"""
|
"""
|
||||||
struct XavQiuWanThi19 <: SolutionMethod
|
struct XavQiuWanThi2019 <: SolutionMethod
|
||||||
time_limit::Float64
|
time_limit::Float64
|
||||||
gap_limit::Float64
|
gap_limit::Float64
|
||||||
two_phase_gap::Bool
|
two_phase_gap::Bool
|
||||||
@@ -37,14 +37,14 @@ Fields
|
|||||||
formulation per time period.
|
formulation per time period.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
struct XavQiuWanThi19
|
struct XavQiuWanThi2019
|
||||||
time_limit::Float64
|
time_limit::Float64
|
||||||
gap_limit::Float64
|
gap_limit::Float64
|
||||||
two_phase_gap::Bool
|
two_phase_gap::Bool
|
||||||
max_violations_per_line::Int
|
max_violations_per_line::Int
|
||||||
max_violations_per_period::Int
|
max_violations_per_period::Int
|
||||||
|
|
||||||
function XavQiuWanThi19(;
|
function XavQiuWanThi2019(;
|
||||||
time_limit::Float64 = 86400.0,
|
time_limit::Float64 = 86400.0,
|
||||||
gap_limit::Float64 = 1e-3,
|
gap_limit::Float64 = 1e-3,
|
||||||
two_phase_gap::Bool = true,
|
two_phase_gap::Bool = true,
|
||||||
@@ -10,5 +10,5 @@ advanced methods to accelerate the solution process and to enforce transmission
|
|||||||
and N-1 security constraints.
|
and N-1 security constraints.
|
||||||
"""
|
"""
|
||||||
function optimize!(model::JuMP.Model)::Nothing
|
function optimize!(model::JuMP.Model)::Nothing
|
||||||
return UnitCommitment.optimize!(model, XavQiuWanThi19())
|
return UnitCommitment.optimize!(model, XavQiuWanThi2019())
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,19 +3,20 @@
|
|||||||
# Released under the modified BSD license. See COPYING.md for more details.
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
using UnitCommitment
|
using UnitCommitment
|
||||||
|
import UnitCommitment: Formulation
|
||||||
|
|
||||||
function _test(formulation::UnitCommitment.Formulation)::Nothing
|
function _test(formulation::Formulation)::Nothing
|
||||||
instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01")
|
instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01")
|
||||||
UnitCommitment._build_model(instance, formulation) # should not crash
|
UnitCommitment._build_model(instance, formulation) # should not crash
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@testset "formulations" begin
|
@testset "formulations" begin
|
||||||
_test(UnitCommitment.Formulation(ramping = UnitCommitment.ArrCon00()))
|
_test(Formulation(ramping = UnitCommitment.ArrCon2000()))
|
||||||
_test(UnitCommitment.Formulation(ramping = UnitCommitment.DamKucRajAta16()))
|
_test(Formulation(ramping = UnitCommitment.DamKucRajAta2016()))
|
||||||
_test(UnitCommitment.Formulation(ramping = UnitCommitment.MorLatRam13()))
|
_test(Formulation(ramping = UnitCommitment.MorLatRam2013()))
|
||||||
_test(UnitCommitment.Formulation(ramping = UnitCommitment.PanGua16()))
|
_test(Formulation(ramping = UnitCommitment.PanGua2016()))
|
||||||
_test(UnitCommitment.Formulation(pwl_costs = UnitCommitment.Gar62()))
|
_test(Formulation(pwl_costs = UnitCommitment.Gar1962()))
|
||||||
_test(UnitCommitment.Formulation(pwl_costs = UnitCommitment.CarArr06()))
|
_test(Formulation(pwl_costs = UnitCommitment.CarArr2006()))
|
||||||
_test(UnitCommitment.Formulation(pwl_costs = UnitCommitment.KnuOstWat18()))
|
_test(Formulation(pwl_costs = UnitCommitment.KnuOstWat2018()))
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user