diff --git a/CHANGELOG.md b/CHANGELOG.md index a257a56..99a6e4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,13 @@ All notable changes to this project will be documented in this file. [semver]: https://semver.org/spec/v2.0.0.html [pkjjl]: https://pkgdocs.julialang.org/v1/compatibility/#compat-pre-1.0 +## [Unreleased] +### Added +- Allow disposal at collection centers + +### Changed +- Switch from Cbc/Clp to HiGHS + ## [0.6.0] -- 2022-12-15 ### Added - Allow RELOG to calculate approximate driving distances, instead of just straight-line distances between points. diff --git a/Project.toml b/Project.toml index f747367..da3f225 100644 --- a/Project.toml +++ b/Project.toml @@ -6,13 +6,13 @@ version = "0.6.0" [deps] CRC = "44b605c4-b955-5f2b-9b6d-d2bd01d3d205" CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" -Cbc = "9961bab8-2fa3-5c5a-9d89-47fab24efd76" -Clp = "e2554f3b-3117-50c0-817c-e040a3ddf72d" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6" GZip = "92fee26a-97fe-5a0c-ad85-20a5f3185b63" Geodesy = "0ef565a4-170c-5f04-8de2-149903a85f3d" +HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" +HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" JSONSchema = "7d188eb4-7ad8-530c-ae41-71a32a6d4692" JuMP = "4076af6c-e467-56ae-b986-b466b2749572" @@ -31,12 +31,12 @@ ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea" [compat] CRC = "4" CSV = "0.10" -Cbc = "1" -Clp = "1" DataFrames = "1" DataStructures = "0.18" GZip = "0.5" Geodesy = "1" +HTTP = "0.9" +HiGHS = "1" JSON = "0.21" JSONSchema = "1" JuMP = "1" diff --git a/docs/src/usage.md b/docs/src/usage.md index 0a05396..19cea94 100644 --- a/docs/src/usage.md +++ b/docs/src/usage.md @@ -95,7 +95,7 @@ To use the `resolve` method, the new input file should be very similar to the or ### 5.1 Changing the solver -By default, RELOG internally uses [Cbc](https://github.com/coin-or/Cbc), an open-source and freely-available Mixed-Integer Linear Programming solver developed by the [COIN-OR Project](https://www.coin-or.org/). For larger-scale test cases, a commercial solver such as Gurobi, CPLEX or XPRESS is recommended. The following snippet shows how to switch from Cbc to Gurobi, for example: +By default, RELOG internally uses [HiGHS](https://github.com/ERGO-Code/HiGHS), an open-source and freely-available Mixed-Integer Linear Programming solver. For larger-scale test cases, a commercial solver such as Gurobi, CPLEX or XPRESS is recommended. The following snippet shows how to switch to Gurobi, for example: ```julia using RELOG, Gurobi, JuMP diff --git a/src/model/build.jl b/src/model/build.jl index 1dec9d2..cda7c64 100644 --- a/src/model/build.jl +++ b/src/model/build.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 JuMP, LinearAlgebra, Geodesy, Cbc, Clp, ProgressBars, Printf, DataStructures +using JuMP, LinearAlgebra, Geodesy, ProgressBars, Printf, DataStructures function build_model(instance::Instance, graph::Graph, optimizer)::JuMP.Model model = Model(optimizer) diff --git a/src/model/getsol.jl b/src/model/getsol.jl index f5f3e91..60891d7 100644 --- a/src/model/getsol.jl +++ b/src/model/getsol.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 JuMP, LinearAlgebra, Geodesy, Cbc, Clp, ProgressBars, Printf, DataStructures +using JuMP, LinearAlgebra, Geodesy, ProgressBars, Printf, DataStructures function get_solution(model::JuMP.Model; marginal_costs = true) graph, instance = model[:graph], model[:instance] diff --git a/src/model/solve.jl b/src/model/solve.jl index 1adfc46..a8d208e 100644 --- a/src/model/solve.jl +++ b/src/model/solve.jl @@ -2,14 +2,14 @@ # Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved. # Released under the modified BSD license. See COPYING.md for more details. -using JuMP, LinearAlgebra, Geodesy, Cbc, Clp, ProgressBars, Printf, DataStructures +using JuMP, LinearAlgebra, Geodesy, ProgressBars, Printf, DataStructures, HiGHS function _get_default_milp_optimizer() - return optimizer_with_attributes(Cbc.Optimizer, "logLevel" => 0) + return optimizer_with_attributes(HiGHS.Optimizer) end function _get_default_lp_optimizer() - return optimizer_with_attributes(Clp.Optimizer, "LogLevel" => 0) + return optimizer_with_attributes(HiGHS.Optimizer) end @@ -87,7 +87,13 @@ function solve(filename::AbstractString; heuristic = false, kwargs...) if heuristic && instance.time > 1 @info "Solving single-period version..." compressed = _compress(instance) - csol = solve(compressed; output = nothing, marginal_costs = false, kwargs...) + csol, _ = solve( + compressed; + return_model = true, + output = nothing, + marginal_costs = false, + kwargs..., + ) @info "Filtering candidate locations..." selected_pairs = [] for (plant_name, plant_dict) in csol["Plants"] diff --git a/test/Project.toml b/test/Project.toml index bcf66c4..43c075d 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -4,8 +4,8 @@ authors = ["Alinson S. Xavier "] version = "0.1.0" [deps] -Cbc = "9961bab8-2fa3-5c5a-9d89-47fab24efd76" GZip = "92fee26a-97fe-5a0c-ad85-20a5f3185b63" +HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" JuMP = "4076af6c-e467-56ae-b986-b466b2749572" JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899" @@ -16,4 +16,4 @@ Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] -JuliaFormatter = "1" \ No newline at end of file +JuliaFormatter = "1" diff --git a/test/src/model/build_test.jl b/test/src/model/build_test.jl index 3c111ea..f64a4c9 100644 --- a/test/src/model/build_test.jl +++ b/test/src/model/build_test.jl @@ -1,14 +1,13 @@ # Copyright (C) 2020 Argonne National Laboratory # Written by Alinson Santos Xavier -using RELOG, Cbc, JuMP, Printf, JSON, MathOptInterface.FileFormats +using RELOG, HiGHS, JuMP, Printf, JSON, MathOptInterface.FileFormats function model_build_test() @testset "build" begin instance = RELOG.parsefile(fixture("s1.json")) graph = RELOG.build_graph(instance) - model = RELOG.build_model(instance, graph, Cbc.Optimizer) - set_optimizer_attribute(model, "logLevel", 0) + model = RELOG.build_model(instance, graph, HiGHS.Optimizer) process_node_by_location_name = Dict(n.location.location_name => n for n in graph.process_nodes) diff --git a/test/src/model/solve_test.jl b/test/src/model/solve_test.jl index ecb948a..b722976 100644 --- a/test/src/model/solve_test.jl +++ b/test/src/model/solve_test.jl @@ -1,7 +1,7 @@ # Copyright (C) 2020 Argonne National Laboratory # Written by Alinson Santos Xavier -using RELOG, Cbc, JuMP, Printf, JSON, MathOptInterface.FileFormats +using RELOG, JuMP, Printf, JSON, MathOptInterface.FileFormats function model_solve_test()