From 547aba3b9b5888c9d034e2bb0f46c3f7a8552b9a Mon Sep 17 00:00:00 2001 From: Jun He Date: Thu, 10 Aug 2023 17:30:09 -0400 Subject: [PATCH] replaced Cbc with HiGHS --- test/src/instance/migrate_test.jl | 2 +- test/src/instance/read_test.jl | 2 +- test/src/lmp/aelmp_test.jl | 6 +++--- test/src/lmp/conventional_test.jl | 7 +++++-- test/src/market/market_test.jl | 14 +++++++------- test/src/model/formulations_test.jl | 4 ++-- .../methods/TimeDecomposition/optimize_test.jl | 14 +++++++------- test/src/transform/randomize/XavQiuAhm2021_test.jl | 2 +- test/src/usage.jl | 14 +++++++++----- 9 files changed, 36 insertions(+), 29 deletions(-) diff --git a/test/src/instance/migrate_test.jl b/test/src/instance/migrate_test.jl index 8328e53..08b12e2 100644 --- a/test/src/instance/migrate_test.jl +++ b/test/src/instance/migrate_test.jl @@ -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. -using UnitCommitment, LinearAlgebra, Cbc, JuMP, JSON, GZip +using UnitCommitment, LinearAlgebra, JuMP, JSON, GZip function instance_migrate_test() @testset "read v0.2" begin diff --git a/test/src/instance/read_test.jl b/test/src/instance/read_test.jl index cc377d9..9ccbdc1 100644 --- a/test/src/instance/read_test.jl +++ b/test/src/instance/read_test.jl @@ -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. -using UnitCommitment, LinearAlgebra, Cbc, JuMP, JSON, GZip +using UnitCommitment, LinearAlgebra, JuMP, JSON, GZip function instance_read_test() @testset "read_benchmark" begin diff --git a/test/src/lmp/aelmp_test.jl b/test/src/lmp/aelmp_test.jl index d619207..31904bb 100644 --- a/test/src/lmp/aelmp_test.jl +++ b/test/src/lmp/aelmp_test.jl @@ -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. -using UnitCommitment, Cbc, HiGHS, JuMP +using UnitCommitment, HiGHS, JuMP import UnitCommitment: AELMP function lmp_aelmp_test() @@ -13,8 +13,8 @@ function lmp_aelmp_test() model = UnitCommitment.build_model( instance = instance, optimizer = optimizer_with_attributes( - Cbc.Optimizer, - "logLevel" => 0, + HiGHS.Optimizer, + "log_to_console" => false, ), variable_names = true, ) diff --git a/test/src/lmp/conventional_test.jl b/test/src/lmp/conventional_test.jl index bd2529e..ce893de 100644 --- a/test/src/lmp/conventional_test.jl +++ b/test/src/lmp/conventional_test.jl @@ -2,13 +2,16 @@ # Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved. # Released under the modified BSD license. See COPYING.md for more details. -using UnitCommitment, Cbc, HiGHS, JuMP +using UnitCommitment, HiGHS, JuMP function solve_conventional_testcase(path::String) instance = UnitCommitment.read(path) model = UnitCommitment.build_model( instance = instance, - optimizer = optimizer_with_attributes(Cbc.Optimizer, "logLevel" => 0), + optimizer = optimizer_with_attributes( + HiGHS.Optimizer, + "log_to_console" => false, + ), variable_names = true, ) JuMP.set_silent(model) diff --git a/test/src/market/market_test.jl b/test/src/market/market_test.jl index 40a8d56..384ade6 100644 --- a/test/src/market/market_test.jl +++ b/test/src/market/market_test.jl @@ -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. -using UnitCommitment, Cbc, HiGHS, JuMP +using UnitCommitment, HiGHS, JuMP import UnitCommitment: MarketSettings function simple_market_test() @@ -20,8 +20,8 @@ function simple_market_test() rt_paths, MarketSettings(), # keep everything default optimizer = optimizer_with_attributes( - Cbc.Optimizer, - "logLevel" => 0, + HiGHS.Optimizer, + "log_to_console" => false, ), lp_optimizer = optimizer_with_attributes( HiGHS.Optimizer, @@ -52,8 +52,8 @@ function simple_market_test() rt_paths, MarketSettings(lmp_method = nothing), # no lmp optimizer = optimizer_with_attributes( - Cbc.Optimizer, - "logLevel" => 0, + HiGHS.Optimizer, + "log_to_console" => false, ), ) @@ -115,8 +115,8 @@ function stochastic_market_test() rt_paths, MarketSettings(), # keep everything default optimizer = optimizer_with_attributes( - Cbc.Optimizer, - "logLevel" => 0, + HiGHS.Optimizer, + "log_to_console" => false, ), lp_optimizer = optimizer_with_attributes( HiGHS.Optimizer, diff --git a/test/src/model/formulations_test.jl b/test/src/model/formulations_test.jl index 2b9307d..3f7e35c 100644 --- a/test/src/model/formulations_test.jl +++ b/test/src/model/formulations_test.jl @@ -4,7 +4,7 @@ using UnitCommitment using JuMP -using Cbc +using HiGHS using JSON import UnitCommitment: ArrCon2000, @@ -28,7 +28,7 @@ function _test( model = UnitCommitment.build_model( instance = instance, formulation = formulation, - optimizer = Cbc.Optimizer, + optimizer = HiGHS.Optimizer, variable_names = true, ) set_silent(model) diff --git a/test/src/solution/methods/TimeDecomposition/optimize_test.jl b/test/src/solution/methods/TimeDecomposition/optimize_test.jl index b9076fd..3969ff9 100644 --- a/test/src/solution/methods/TimeDecomposition/optimize_test.jl +++ b/test/src/solution/methods/TimeDecomposition/optimize_test.jl @@ -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. -using UnitCommitment, DataStructures, Cbc, HiGHS +using UnitCommitment, DataStructures, HiGHS import UnitCommitment: TimeDecomposition, ConventionalLMP function solution_methods_TimeDecomposition_optimize_test() @@ -13,8 +13,8 @@ function solution_methods_TimeDecomposition_optimize_test() instance, TimeDecomposition(time_window = 3, time_increment = 2), optimizer = optimizer_with_attributes( - Cbc.Optimizer, - "logLevel" => 0, + HiGHS.Optimizer, + "log_to_console" => false, ), ) @test length(solution["Thermal production (MW)"]["g1"]) == 4 @@ -47,8 +47,8 @@ function solution_methods_TimeDecomposition_optimize_test() instance, TimeDecomposition(time_window = 3, time_increment = 2), optimizer = optimizer_with_attributes( - Cbc.Optimizer, - "logLevel" => 0, + HiGHS.Optimizer, + "log_to_console" => false, ), after_build = after_build, after_optimize = after_optimize, @@ -68,8 +68,8 @@ function solution_methods_TimeDecomposition_optimize_test() instance, TimeDecomposition(time_window = 3, time_increment = 2), optimizer = optimizer_with_attributes( - Cbc.Optimizer, - "logLevel" => 0, + HiGHS.Optimizer, + "log_to_console" => false, ), ) @test length(solution["case14"]["Thermal production (MW)"]["g3"]) == 4 diff --git a/test/src/transform/randomize/XavQiuAhm2021_test.jl b/test/src/transform/randomize/XavQiuAhm2021_test.jl index dfe397f..19796dd 100644 --- a/test/src/transform/randomize/XavQiuAhm2021_test.jl +++ b/test/src/transform/randomize/XavQiuAhm2021_test.jl @@ -7,7 +7,7 @@ import UnitCommitment: XavQiuAhm2021 using Distributions using Random -using UnitCommitment, Cbc, JuMP +using UnitCommitment, JuMP function get_scenario() return UnitCommitment.read_benchmark( diff --git a/test/src/usage.jl b/test/src/usage.jl index ea4eb20..3e5cf5f 100644 --- a/test/src/usage.jl +++ b/test/src/usage.jl @@ -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. -using UnitCommitment, LinearAlgebra, Cbc, JuMP, JSON +using UnitCommitment, LinearAlgebra, HiGHS, JuMP, JSON function _set_flow_limits!(instance) for sc in instance.scenarios @@ -18,8 +18,10 @@ function usage_test() @testset "deterministic" begin instance = UnitCommitment.read(fixture("case14.json.gz")) _set_flow_limits!(instance) - optimizer = - optimizer_with_attributes(Cbc.Optimizer, "logLevel" => 0) + optimizer = optimizer_with_attributes( + HiGHS.Optimizer, + "log_to_console" => false, + ) model = UnitCommitment.build_model( instance = instance, optimizer = optimizer, @@ -53,8 +55,10 @@ function usage_test() ]) _set_flow_limits!(instance) @test length(instance.scenarios) == 2 - optimizer = - optimizer_with_attributes(Cbc.Optimizer, "logLevel" => 0) + optimizer = optimizer_with_attributes( + HiGHS.Optimizer, + "log_to_console" => false, + ) model = UnitCommitment.build_model( instance = instance, optimizer = optimizer,