mirror of
https://github.com/ANL-CEEESA/UnitCommitment.jl.git
synced 2025-12-06 00:08:52 -06:00
optimize: Return stats with violations
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
# 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::XavQiuWanThi2019.Method)::Nothing
|
||||
using DataStructures
|
||||
|
||||
function optimize!(model::JuMP.Model, method::XavQiuWanThi2019.Method)::Dict
|
||||
if !occursin("Gurobi", JuMP.solver_name(model))
|
||||
method.two_phase_gap = false
|
||||
end
|
||||
@@ -22,6 +24,9 @@ function optimize!(model::JuMP.Model, method::XavQiuWanThi2019.Method)::Nothing
|
||||
large_gap = true
|
||||
end
|
||||
end
|
||||
stats = Dict(
|
||||
"violations" => []
|
||||
)
|
||||
while true
|
||||
time_elapsed = time() - initial_time
|
||||
time_remaining = method.time_limit - time_elapsed
|
||||
@@ -68,6 +73,7 @@ function optimize!(model::JuMP.Model, method::XavQiuWanThi2019.Method)::Nothing
|
||||
|
||||
if violations_found
|
||||
for (i, v) in enumerate(violations)
|
||||
append!(stats["violations"], v)
|
||||
_enforce_transmission(model, v, model[:instance].scenarios[i])
|
||||
end
|
||||
else
|
||||
@@ -80,5 +86,5 @@ function optimize!(model::JuMP.Model, method::XavQiuWanThi2019.Method)::Nothing
|
||||
end
|
||||
end
|
||||
end
|
||||
return
|
||||
return stats
|
||||
end
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
# Released under the modified BSD license. See COPYING.md for more details.
|
||||
|
||||
"""
|
||||
optimize!(model::JuMP.Model)::Nothing
|
||||
optimize!(model::JuMP.Model)::Dict
|
||||
|
||||
Solve the given unit commitment model. Unlike `JuMP.optimize!`, this uses more
|
||||
advanced methods to accelerate the solution process and to enforce transmission
|
||||
and N-1 security constraints.
|
||||
"""
|
||||
function optimize!(model::JuMP.Model)::Nothing
|
||||
function optimize!(model::JuMP.Model)::Dict
|
||||
return UnitCommitment.optimize!(model, XavQiuWanThi2019.Method())
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user