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",
|
||||
]
|
||||
formulations = Dict(
|
||||
"ArrCon00" =>
|
||||
UnitCommitment.Formulation(ramping = UnitCommitment.ArrCon00()),
|
||||
"CarArr06" => UnitCommitment.Formulation(
|
||||
pwl_costs = UnitCommitment.CarArr06(),
|
||||
"ArrCon2000" => UnitCommitment.Formulation(
|
||||
ramping = UnitCommitment.ArrCon2000(),
|
||||
),
|
||||
"DamKucRajAta16" => UnitCommitment.Formulation(
|
||||
ramping = UnitCommitment.DamKucRajAta16(),
|
||||
"CarArr2006" => UnitCommitment.Formulation(
|
||||
pwl_costs = UnitCommitment.CarArr2006(),
|
||||
),
|
||||
"Gar62" =>
|
||||
UnitCommitment.Formulation(pwl_costs = UnitCommitment.Gar62()),
|
||||
"KnuOstWat18" => UnitCommitment.Formulation(
|
||||
pwl_costs = UnitCommitment.KnuOstWat18(),
|
||||
"DamKucRajAta2016" => UnitCommitment.Formulation(
|
||||
ramping = UnitCommitment.DamKucRajAta2016(),
|
||||
),
|
||||
"MorLatRam13" => UnitCommitment.Formulation(
|
||||
ramping = UnitCommitment.MorLatRam13(),
|
||||
"Gar1962" => UnitCommitment.Formulation(
|
||||
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]
|
||||
combinations = [
|
||||
@@ -99,34 +102,18 @@ end
|
||||
dirname = "results/$name"
|
||||
mkpath(dirname)
|
||||
if isfile("$dirname/$trial.json")
|
||||
@info @sprintf(
|
||||
"%-8s %-20s %-40s",
|
||||
"skip",
|
||||
formulation_name,
|
||||
"$case/$trial",
|
||||
)
|
||||
@info @sprintf("%-4s %-16s %s", "skip", formulation_name, case)
|
||||
return
|
||||
end
|
||||
@info @sprintf(
|
||||
"%-8s %-20s %-40s",
|
||||
"start",
|
||||
formulation_name,
|
||||
"$case/$trial",
|
||||
)
|
||||
time = @elapsed open("$dirname/$trial.log", "w") do file
|
||||
@info @sprintf("%-4s %-16s %s", "run", formulation_name, case)
|
||||
open("$dirname/$trial.log", "w") do file
|
||||
redirect_stdout(file) do
|
||||
redirect_stderr(file) do
|
||||
return _run_sample(case, formulation, "$dirname/$trial")
|
||||
end
|
||||
end
|
||||
end
|
||||
@info @sprintf(
|
||||
"%-8s %-20s %-40s %12.3f",
|
||||
"finish",
|
||||
formulation_name,
|
||||
"$case/$trial",
|
||||
time
|
||||
)
|
||||
@info @sprintf("%-4s %-16s %s", "done", formulation_name, case)
|
||||
end
|
||||
|
||||
@everywhere function _run_sample(case, formulation, prefix)
|
||||
@@ -151,7 +138,7 @@ end
|
||||
BLAS.set_num_threads(1)
|
||||
UnitCommitment.optimize!(
|
||||
model,
|
||||
UnitCommitment.XavQiuWanThi19(
|
||||
UnitCommitment.XavQiuWanThi2019(
|
||||
time_limit = 3600.0,
|
||||
gap_limit = 1e-4,
|
||||
),
|
||||
|
||||
@@ -8,37 +8,37 @@ include("instance/structs.jl")
|
||||
include("model/formulations/base/structs.jl")
|
||||
include("solution/structs.jl")
|
||||
|
||||
include("model/formulations/ArrCon00/structs.jl")
|
||||
include("model/formulations/CarArr06/structs.jl")
|
||||
include("model/formulations/DamKucRajAta16/structs.jl")
|
||||
include("model/formulations/Gar62/structs.jl")
|
||||
include("model/formulations/KnuOstWat18/structs.jl")
|
||||
include("model/formulations/MorLatRam13/structs.jl")
|
||||
include("model/formulations/PanGua16/structs.jl")
|
||||
include("solution/methods/XavQiuWanThi19/structs.jl")
|
||||
include("model/formulations/ArrCon2000/structs.jl")
|
||||
include("model/formulations/CarArr2006/structs.jl")
|
||||
include("model/formulations/DamKucRajAta2016/structs.jl")
|
||||
include("model/formulations/Gar1962/structs.jl")
|
||||
include("model/formulations/KnuOstWat2018/structs.jl")
|
||||
include("model/formulations/MorLatRam2013/structs.jl")
|
||||
include("model/formulations/PanGua2016/structs.jl")
|
||||
include("solution/methods/XavQiuWanThi2019/structs.jl")
|
||||
|
||||
include("import/egret.jl")
|
||||
include("instance/read.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/line.jl")
|
||||
include("model/formulations/base/psload.jl")
|
||||
include("model/formulations/base/sensitivity.jl")
|
||||
include("model/formulations/base/system.jl")
|
||||
include("model/formulations/base/unit.jl")
|
||||
include("model/formulations/CarArr06/pwlcosts.jl")
|
||||
include("model/formulations/DamKucRajAta16/ramp.jl")
|
||||
include("model/formulations/Gar62/pwlcosts.jl")
|
||||
include("model/formulations/KnuOstWat18/pwlcosts.jl")
|
||||
include("model/formulations/MorLatRam13/ramp.jl")
|
||||
include("model/formulations/PanGua16/ramp.jl")
|
||||
include("model/formulations/CarArr2006/pwlcosts.jl")
|
||||
include("model/formulations/DamKucRajAta2016/ramp.jl")
|
||||
include("model/formulations/Gar1962/pwlcosts.jl")
|
||||
include("model/formulations/KnuOstWat2018/pwlcosts.jl")
|
||||
include("model/formulations/MorLatRam2013/ramp.jl")
|
||||
include("model/formulations/PanGua2016/ramp.jl")
|
||||
include("model/jumpext.jl")
|
||||
include("solution/fix.jl")
|
||||
include("solution/methods/XavQiuWanThi19/enforce.jl")
|
||||
include("solution/methods/XavQiuWanThi19/filter.jl")
|
||||
include("solution/methods/XavQiuWanThi19/find.jl")
|
||||
include("solution/methods/XavQiuWanThi19/optimize.jl")
|
||||
include("solution/methods/XavQiuWanThi2019/enforce.jl")
|
||||
include("solution/methods/XavQiuWanThi2019/filter.jl")
|
||||
include("solution/methods/XavQiuWanThi2019/find.jl")
|
||||
include("solution/methods/XavQiuWanThi2019/optimize.jl")
|
||||
include("solution/optimize.jl")
|
||||
include("solution/solution.jl")
|
||||
include("solution/warmstart.jl")
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
function _add_ramp_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::ArrCon00,
|
||||
formulation::ArrCon2000,
|
||||
)::Nothing
|
||||
# TODO: Move upper case constants to model[:instance]
|
||||
RESERVES_WHEN_START_UP = true
|
||||
@@ -9,4 +9,4 @@ Formulation described in:
|
||||
to an electricity spot market. IEEE Transactions on power systems, 15(3),
|
||||
1098-1104.
|
||||
"""
|
||||
struct ArrCon00 <: RampingFormulation end
|
||||
struct ArrCon2000 <: RampingFormulation end
|
||||
@@ -5,7 +5,7 @@
|
||||
function _add_production_piecewise_linear_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::CarArr06,
|
||||
formulation::CarArr2006,
|
||||
)::Nothing
|
||||
eq_prod_above_def = _init(model, :eq_prod_above_def)
|
||||
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.
|
||||
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!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::DamKucRajAta16,
|
||||
formulation::DamKucRajAta2016,
|
||||
)::Nothing
|
||||
# TODO: Move upper case constants to model[:instance]
|
||||
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
|
||||
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!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::Gar62,
|
||||
formulation::Gar1962,
|
||||
)::Nothing
|
||||
eq_prod_above_def = _init(model, :eq_prod_above_def)
|
||||
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.
|
||||
|
||||
"""
|
||||
struct Gar62 <: PiecewiseLinearCostsFormulation end
|
||||
struct Gar1962 <: PiecewiseLinearCostsFormulation end
|
||||
@@ -5,7 +5,7 @@
|
||||
function _add_production_piecewise_linear_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::KnuOstWat18,
|
||||
formulation::KnuOstWat2018,
|
||||
)::Nothing
|
||||
eq_prod_above_def = _init(model, :eq_prod_above_def)
|
||||
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),
|
||||
4496-4507.
|
||||
"""
|
||||
struct KnuOstWat18 <: PiecewiseLinearCostsFormulation end
|
||||
struct KnuOstWat2018 <: PiecewiseLinearCostsFormulation end
|
||||
@@ -5,7 +5,7 @@
|
||||
function _add_ramp_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::MorLatRam13,
|
||||
formulation::MorLatRam2013,
|
||||
)::Nothing
|
||||
# TODO: Move upper case constants to model[:instance]
|
||||
RESERVES_WHEN_START_UP = true
|
||||
@@ -9,4 +9,4 @@ Formulation described in:
|
||||
MILP formulation for the thermal unit commitment problem. IEEE Transactions
|
||||
on Power Systems, 28(4), 4897-4908.
|
||||
"""
|
||||
struct MorLatRam13 <: RampingFormulation end
|
||||
struct MorLatRam2013 <: RampingFormulation end
|
||||
@@ -1,7 +1,7 @@
|
||||
function _add_ramp_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::PanGua16,
|
||||
formulation::PanGua2016,
|
||||
)::Nothing
|
||||
# TODO: Move upper case constants to model[:instance]
|
||||
RESERVES_WHEN_SHUT_DOWN = true
|
||||
@@ -8,4 +8,4 @@ Formulation described in:
|
||||
Pan, K., & Guan, Y. (2016). Strong formulations for multistage stochastic
|
||||
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
|
||||
|
||||
function Formulation(;
|
||||
pwl_costs::PiecewiseLinearCostsFormulation = Gar62(),
|
||||
ramping::RampingFormulation = MorLatRam13(),
|
||||
pwl_costs::PiecewiseLinearCostsFormulation = Gar1962(),
|
||||
ramping::RampingFormulation = MorLatRam2013(),
|
||||
transmission::TransmissionFormulation = ShiftFactorsFormulation(),
|
||||
)
|
||||
return new(pwl_costs, ramping, transmission)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||
# 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)
|
||||
try
|
||||
JuMP.set_optimizer_attribute(model, "MIPGap", gap)
|
||||
@@ -5,7 +5,7 @@
|
||||
import DataStructures: PriorityQueue
|
||||
|
||||
"""
|
||||
struct XavQiuWanThi19 <: SolutionMethod
|
||||
struct XavQiuWanThi2019 <: SolutionMethod
|
||||
time_limit::Float64
|
||||
gap_limit::Float64
|
||||
two_phase_gap::Bool
|
||||
@@ -37,14 +37,14 @@ Fields
|
||||
formulation per time period.
|
||||
|
||||
"""
|
||||
struct XavQiuWanThi19
|
||||
struct XavQiuWanThi2019
|
||||
time_limit::Float64
|
||||
gap_limit::Float64
|
||||
two_phase_gap::Bool
|
||||
max_violations_per_line::Int
|
||||
max_violations_per_period::Int
|
||||
|
||||
function XavQiuWanThi19(;
|
||||
function XavQiuWanThi2019(;
|
||||
time_limit::Float64 = 86400.0,
|
||||
gap_limit::Float64 = 1e-3,
|
||||
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.
|
||||
"""
|
||||
function optimize!(model::JuMP.Model)::Nothing
|
||||
return UnitCommitment.optimize!(model, XavQiuWanThi19())
|
||||
return UnitCommitment.optimize!(model, XavQiuWanThi2019())
|
||||
end
|
||||
|
||||
@@ -3,19 +3,20 @@
|
||||
# Released under the modified BSD license. See COPYING.md for more details.
|
||||
|
||||
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")
|
||||
UnitCommitment._build_model(instance, formulation) # should not crash
|
||||
return
|
||||
end
|
||||
|
||||
@testset "formulations" begin
|
||||
_test(UnitCommitment.Formulation(ramping = UnitCommitment.ArrCon00()))
|
||||
_test(UnitCommitment.Formulation(ramping = UnitCommitment.DamKucRajAta16()))
|
||||
_test(UnitCommitment.Formulation(ramping = UnitCommitment.MorLatRam13()))
|
||||
_test(UnitCommitment.Formulation(ramping = UnitCommitment.PanGua16()))
|
||||
_test(UnitCommitment.Formulation(pwl_costs = UnitCommitment.Gar62()))
|
||||
_test(UnitCommitment.Formulation(pwl_costs = UnitCommitment.CarArr06()))
|
||||
_test(UnitCommitment.Formulation(pwl_costs = UnitCommitment.KnuOstWat18()))
|
||||
_test(Formulation(ramping = UnitCommitment.ArrCon2000()))
|
||||
_test(Formulation(ramping = UnitCommitment.DamKucRajAta2016()))
|
||||
_test(Formulation(ramping = UnitCommitment.MorLatRam2013()))
|
||||
_test(Formulation(ramping = UnitCommitment.PanGua2016()))
|
||||
_test(Formulation(pwl_costs = UnitCommitment.Gar1962()))
|
||||
_test(Formulation(pwl_costs = UnitCommitment.CarArr2006()))
|
||||
_test(Formulation(pwl_costs = UnitCommitment.KnuOstWat2018()))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user