Revise docs and struct name; add basic MPI test

This commit is contained in:
2023-05-26 10:52:23 -05:00
parent 9dc3607c56
commit 3961aedaf5
13 changed files with 230 additions and 226 deletions

View File

@@ -12,6 +12,7 @@ include("model/formulations_test.jl")
include("solution/methods/XavQiuWanThi19/filter_test.jl")
include("solution/methods/XavQiuWanThi19/find_test.jl")
include("solution/methods/XavQiuWanThi19/sensitivity_test.jl")
include("solution/methods/ProgressiveHedging/usage_test.jl")
include("transform/initcond_test.jl")
include("transform/slice_test.jl")
include("transform/randomize/XavQiuAhm2021_test.jl")
@@ -37,6 +38,7 @@ function runtests()
solution_methods_XavQiuWanThi19_filter_test()
solution_methods_XavQiuWanThi19_find_test()
solution_methods_XavQiuWanThi19_sensitivity_test()
solution_methods_ProgressiveHedging_usage_test()
transform_initcond_test()
transform_slice_test()
transform_randomize_XavQiuAhm2021_test()

View File

@@ -0,0 +1,37 @@
using Cbc
using MPI
using JuMP
using UnitCommitment
UnitCommitment._setup_logger(level = Base.CoreLogging.Error)
function fixture(path::String)::String
basedir = dirname(@__FILE__)
return "$basedir/../../../../fixtures/$path"
end
# 1. Initialize MPI
MPI.Init()
# 2. Configure progressive hedging method
ph = UnitCommitment.ProgressiveHedging()
# 3. Read problem instance
instance = UnitCommitment.read(
[fixture("case14.json.gz"), fixture("case14.json.gz")],
ph,
)
# 4. Build JuMP model
model = UnitCommitment.build_model(
instance = instance,
optimizer = optimizer_with_attributes(Cbc.Optimizer, "LogLevel" => 0),
)
# 5. Run the decentralized optimization algorithm
UnitCommitment.optimize!(model, ph)
# 6. Fetch the solution
solution = UnitCommitment.solution(model, ph)
# 7. Close MPI
MPI.Finalize()

View File

@@ -0,0 +1,16 @@
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
# Released under the modified BSD license. See COPYING.md for more details.
using MPI
function solution_methods_ProgressiveHedging_usage_test()
basedir = dirname(@__FILE__)
@testset "ProgressiveHedging" begin
mpiexec() do exe
return run(
`$exe -n 2 $(Base.julia_cmd()) --project=test $basedir/ph.jl`,
)
end
end
end