mirror of
https://github.com/ANL-CEEESA/RELOG.git
synced 2025-12-05 23:38:52 -06:00
Replace Cbc/Clp by HiGHS
This commit is contained in:
@@ -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
|
[semver]: https://semver.org/spec/v2.0.0.html
|
||||||
[pkjjl]: https://pkgdocs.julialang.org/v1/compatibility/#compat-pre-1.0
|
[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
|
## [0.6.0] -- 2022-12-15
|
||||||
### Added
|
### Added
|
||||||
- Allow RELOG to calculate approximate driving distances, instead of just straight-line distances between points.
|
- Allow RELOG to calculate approximate driving distances, instead of just straight-line distances between points.
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ version = "0.6.0"
|
|||||||
[deps]
|
[deps]
|
||||||
CRC = "44b605c4-b955-5f2b-9b6d-d2bd01d3d205"
|
CRC = "44b605c4-b955-5f2b-9b6d-d2bd01d3d205"
|
||||||
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
|
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
|
||||||
Cbc = "9961bab8-2fa3-5c5a-9d89-47fab24efd76"
|
|
||||||
Clp = "e2554f3b-3117-50c0-817c-e040a3ddf72d"
|
|
||||||
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
|
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
|
||||||
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
|
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
|
||||||
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
|
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
|
||||||
GZip = "92fee26a-97fe-5a0c-ad85-20a5f3185b63"
|
GZip = "92fee26a-97fe-5a0c-ad85-20a5f3185b63"
|
||||||
Geodesy = "0ef565a4-170c-5f04-8de2-149903a85f3d"
|
Geodesy = "0ef565a4-170c-5f04-8de2-149903a85f3d"
|
||||||
|
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
|
||||||
|
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
|
||||||
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
|
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
|
||||||
JSONSchema = "7d188eb4-7ad8-530c-ae41-71a32a6d4692"
|
JSONSchema = "7d188eb4-7ad8-530c-ae41-71a32a6d4692"
|
||||||
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
|
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
|
||||||
@@ -31,12 +31,12 @@ ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea"
|
|||||||
[compat]
|
[compat]
|
||||||
CRC = "4"
|
CRC = "4"
|
||||||
CSV = "0.10"
|
CSV = "0.10"
|
||||||
Cbc = "1"
|
|
||||||
Clp = "1"
|
|
||||||
DataFrames = "1"
|
DataFrames = "1"
|
||||||
DataStructures = "0.18"
|
DataStructures = "0.18"
|
||||||
GZip = "0.5"
|
GZip = "0.5"
|
||||||
Geodesy = "1"
|
Geodesy = "1"
|
||||||
|
HTTP = "0.9"
|
||||||
|
HiGHS = "1"
|
||||||
JSON = "0.21"
|
JSON = "0.21"
|
||||||
JSONSchema = "1"
|
JSONSchema = "1"
|
||||||
JuMP = "1"
|
JuMP = "1"
|
||||||
|
|||||||
@@ -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
|
### 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
|
```julia
|
||||||
using RELOG, Gurobi, JuMP
|
using RELOG, Gurobi, JuMP
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
# Released under the modified BSD license. See COPYING.md for more details.
|
# 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
|
function build_model(instance::Instance, graph::Graph, optimizer)::JuMP.Model
|
||||||
model = Model(optimizer)
|
model = Model(optimizer)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
# Released under the modified BSD license. See COPYING.md for more details.
|
# 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)
|
function get_solution(model::JuMP.Model; marginal_costs = true)
|
||||||
graph, instance = model[:graph], model[:instance]
|
graph, instance = model[:graph], model[:instance]
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
# Released under the modified BSD license. See COPYING.md for more details.
|
# 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()
|
function _get_default_milp_optimizer()
|
||||||
return optimizer_with_attributes(Cbc.Optimizer, "logLevel" => 0)
|
return optimizer_with_attributes(HiGHS.Optimizer)
|
||||||
end
|
end
|
||||||
|
|
||||||
function _get_default_lp_optimizer()
|
function _get_default_lp_optimizer()
|
||||||
return optimizer_with_attributes(Clp.Optimizer, "LogLevel" => 0)
|
return optimizer_with_attributes(HiGHS.Optimizer)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -87,7 +87,13 @@ function solve(filename::AbstractString; heuristic = false, kwargs...)
|
|||||||
if heuristic && instance.time > 1
|
if heuristic && instance.time > 1
|
||||||
@info "Solving single-period version..."
|
@info "Solving single-period version..."
|
||||||
compressed = _compress(instance)
|
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..."
|
@info "Filtering candidate locations..."
|
||||||
selected_pairs = []
|
selected_pairs = []
|
||||||
for (plant_name, plant_dict) in csol["Plants"]
|
for (plant_name, plant_dict) in csol["Plants"]
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ authors = ["Alinson S. Xavier <git@axavier.org>"]
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
Cbc = "9961bab8-2fa3-5c5a-9d89-47fab24efd76"
|
|
||||||
GZip = "92fee26a-97fe-5a0c-ad85-20a5f3185b63"
|
GZip = "92fee26a-97fe-5a0c-ad85-20a5f3185b63"
|
||||||
|
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
|
||||||
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
|
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
|
||||||
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
|
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
|
||||||
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
|
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
|
||||||
@@ -16,4 +16,4 @@ Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
|
|||||||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
|
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
|
||||||
|
|
||||||
[compat]
|
[compat]
|
||||||
JuliaFormatter = "1"
|
JuliaFormatter = "1"
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
# Copyright (C) 2020 Argonne National Laboratory
|
# Copyright (C) 2020 Argonne National Laboratory
|
||||||
# Written by Alinson Santos Xavier <axavier@anl.gov>
|
# Written by Alinson Santos Xavier <axavier@anl.gov>
|
||||||
|
|
||||||
using RELOG, Cbc, JuMP, Printf, JSON, MathOptInterface.FileFormats
|
using RELOG, HiGHS, JuMP, Printf, JSON, MathOptInterface.FileFormats
|
||||||
|
|
||||||
function model_build_test()
|
function model_build_test()
|
||||||
@testset "build" begin
|
@testset "build" begin
|
||||||
instance = RELOG.parsefile(fixture("s1.json"))
|
instance = RELOG.parsefile(fixture("s1.json"))
|
||||||
graph = RELOG.build_graph(instance)
|
graph = RELOG.build_graph(instance)
|
||||||
model = RELOG.build_model(instance, graph, Cbc.Optimizer)
|
model = RELOG.build_model(instance, graph, HiGHS.Optimizer)
|
||||||
set_optimizer_attribute(model, "logLevel", 0)
|
|
||||||
|
|
||||||
process_node_by_location_name =
|
process_node_by_location_name =
|
||||||
Dict(n.location.location_name => n for n in graph.process_nodes)
|
Dict(n.location.location_name => n for n in graph.process_nodes)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Copyright (C) 2020 Argonne National Laboratory
|
# Copyright (C) 2020 Argonne National Laboratory
|
||||||
# Written by Alinson Santos Xavier <axavier@anl.gov>
|
# Written by Alinson Santos Xavier <axavier@anl.gov>
|
||||||
|
|
||||||
using RELOG, Cbc, JuMP, Printf, JSON, MathOptInterface.FileFormats
|
using RELOG, JuMP, Printf, JSON, MathOptInterface.FileFormats
|
||||||
|
|
||||||
|
|
||||||
function model_solve_test()
|
function model_solve_test()
|
||||||
|
|||||||
Reference in New Issue
Block a user