mirror of
https://github.com/ANL-CEEESA/UnitCommitment.jl.git
synced 2025-12-06 16:28:51 -06:00
Break down model.jl
This commit is contained in:
@@ -16,14 +16,14 @@ function fix!(model::JuMP.Model, solution::AbstractDict)::Nothing
|
||||
for g in instance.units
|
||||
for t in 1:T
|
||||
is_on_value = round(solution["Is on"][g.name][t])
|
||||
production_value =
|
||||
prod_value =
|
||||
round(solution["Production (MW)"][g.name][t], digits = 5)
|
||||
reserve_value =
|
||||
round(solution["Reserve (MW)"][g.name][t], digits = 5)
|
||||
JuMP.fix(is_on[g.name, t], is_on_value, force = true)
|
||||
JuMP.fix(
|
||||
prod_above[g.name, t],
|
||||
production_value - is_on_value * g.min_power[t],
|
||||
prod_value - is_on_value * g.min_power[t],
|
||||
force = true,
|
||||
)
|
||||
JuMP.fix(reserve[g.name, t], reserve_value, force = true)
|
||||
|
||||
@@ -9,6 +9,8 @@ import DataStructures: PriorityQueue
|
||||
time_limit::Float64
|
||||
gap_limit::Float64
|
||||
two_phase_gap::Bool
|
||||
max_violations_per_line::Int
|
||||
max_violations_per_period::Int
|
||||
end
|
||||
|
||||
Lazy constraint solution method described in:
|
||||
@@ -17,8 +19,8 @@ Lazy constraint solution method described in:
|
||||
constraint filtering in large-scale security-constrained unit commitment.
|
||||
IEEE Transactions on Power Systems, 34(3), 2457-2460.
|
||||
|
||||
Fields
|
||||
=========
|
||||
## Fields
|
||||
|
||||
- `time_limit`:
|
||||
the time limit over the entire optimization procedure.
|
||||
- `gap_limit`:
|
||||
@@ -26,6 +28,13 @@ Fields
|
||||
- `two_phase_gap`:
|
||||
if true, solve the problem with large gap tolerance first, then reduce
|
||||
the gap tolerance when no further violated constraints are found.
|
||||
- `max_violations_per_line`:
|
||||
maximum number of violated transmission constraints to add to the
|
||||
formulation per transmission line.
|
||||
- `max_violations_per_period`:
|
||||
maximum number of violated transmission constraints to add to the
|
||||
formulation per time period.
|
||||
|
||||
"""
|
||||
struct _XaQiWaTh19
|
||||
time_limit::Float64
|
||||
@@ -35,11 +44,11 @@ struct _XaQiWaTh19
|
||||
max_violations_per_period::Int
|
||||
|
||||
function _XaQiWaTh19(;
|
||||
time_limit::Float64,
|
||||
gap_limit::Float64,
|
||||
two_phase_gap::Bool,
|
||||
max_violations_per_line::Int,
|
||||
max_violations_per_period::Int,
|
||||
time_limit::Float64 = 86400.0,
|
||||
gap_limit::Float64 = 1e-3,
|
||||
two_phase_gap::Bool = true,
|
||||
max_violations_per_line::Int = 1,
|
||||
max_violations_per_period::Int = 5,
|
||||
)
|
||||
return new(
|
||||
time_limit,
|
||||
|
||||
@@ -10,14 +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,
|
||||
_XaQiWaTh19(
|
||||
time_limit = 3600.0,
|
||||
gap_limit = 1e-4,
|
||||
two_phase_gap = true,
|
||||
max_violations_per_line = 1,
|
||||
max_violations_per_period = 5,
|
||||
),
|
||||
)
|
||||
return UnitCommitment.optimize!(model, _XaQiWaTh19())
|
||||
end
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
function set_warm_start!(model::JuMP.Model, solution::AbstractDict)::Nothing
|
||||
instance, T = model[:instance], model[:instance].time
|
||||
is_on = model[:is_on]
|
||||
prod_above = model[:prod_above]
|
||||
reserve = model[:reserve]
|
||||
for g in instance.units
|
||||
for t in 1:T
|
||||
JuMP.set_start_value(is_on[g.name, t], solution["Is on"][g.name][t])
|
||||
|
||||
Reference in New Issue
Block a user