mirror of
https://github.com/ANL-CEEESA/RELOG.git
synced 2025-12-06 07:48:50 -06:00
Compare commits
9 Commits
circular
...
feature/st
| Author | SHA1 | Date | |
|---|---|---|---|
|
8231f9da32
|
|||
|
48ccf0d180
|
|||
|
7f475a0914
|
|||
|
4b0fc7327c
|
|||
|
dde0d40282
|
|||
|
74606897cd
|
|||
|
07ca3abb4f
|
|||
| e915a57e58 | |||
| 57b7d09c08 |
@@ -1,4 +0,0 @@
|
|||||||
build
|
|
||||||
jobs
|
|
||||||
relog-web/node_modules
|
|
||||||
relog-web/build
|
|
||||||
4
.github/workflows/lint.yml
vendored
4
.github/workflows/lint.yml
vendored
@@ -14,10 +14,10 @@ jobs:
|
|||||||
shell: julia --color=yes {0}
|
shell: julia --color=yes {0}
|
||||||
run: |
|
run: |
|
||||||
using Pkg
|
using Pkg
|
||||||
Pkg.add(PackageSpec(name="JuliaFormatter", version="1"))
|
Pkg.add(PackageSpec(name="JuliaFormatter", version="0.14.4"))
|
||||||
using JuliaFormatter
|
using JuliaFormatter
|
||||||
format("src", verbose=true)
|
format("src", verbose=true)
|
||||||
format("test/src", verbose=true)
|
format("test", verbose=true)
|
||||||
out = String(read(Cmd(`git diff`)))
|
out = String(read(Cmd(`git diff`)))
|
||||||
if isempty(out)
|
if isempty(out)
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|||||||
14
.github/workflows/test.yml
vendored
14
.github/workflows/test.yml
vendored
@@ -21,15 +21,5 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
arch: ${{ matrix.arch }}
|
arch: ${{ matrix.arch }}
|
||||||
- name: Run tests
|
- uses: julia-actions/julia-buildpkg@v1
|
||||||
shell: julia --color=yes --project=test {0}
|
- uses: julia-actions/julia-runtest@v1
|
||||||
run: |
|
|
||||||
using Pkg
|
|
||||||
Pkg.develop(path=".")
|
|
||||||
Pkg.update()
|
|
||||||
using RELOGT
|
|
||||||
try
|
|
||||||
runtests()
|
|
||||||
catch
|
|
||||||
exit(1)
|
|
||||||
end
|
|
||||||
|
|||||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -12,8 +12,4 @@ Manifest.toml
|
|||||||
data
|
data
|
||||||
build
|
build
|
||||||
benchmark
|
benchmark
|
||||||
run.jl
|
**/*.log
|
||||||
relog-web-legacy
|
|
||||||
.vscode
|
|
||||||
jobs
|
|
||||||
tmp
|
|
||||||
|
|||||||
28
.zenodo.json
28
.zenodo.json
@@ -1,28 +0,0 @@
|
|||||||
{
|
|
||||||
"creators": [
|
|
||||||
{
|
|
||||||
"orcid": "0000-0002-5022-9802",
|
|
||||||
"affiliation": "Argonne National Laboratory",
|
|
||||||
"name": "Santos Xavier, Alinson"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"orcid": "0000-0002-3426-9425",
|
|
||||||
"affiliation": "Argonne National Laboratory",
|
|
||||||
"name": "Iloeje, Chukwunwike"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"affiliation": "Argonne National Laboratory",
|
|
||||||
"name": "Atkins, John"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"affiliation": "Argonne National Laboratory",
|
|
||||||
"name": "Sun, Kyle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"affiliation": "Argonne National Laboratory",
|
|
||||||
"name": "Gallier, Audrey"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"title": "RELOG: Reverse Logistics Optimization",
|
|
||||||
"description": "<b>RELOG</b> is a supply chain optimization package focusing on reverse logistics and reverse manufacturing. For example, the package can be used to determine where to build recycling plants, what sizes should they have and which customers should be served by which plants. The package supports customized reverse logistics pipelines, with multiple types of plants, multiple types of product and multiple time periods."
|
|
||||||
}
|
|
||||||
58
CHANGELOG.md
Normal file
58
CHANGELOG.md
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
- The format is based on [Keep a Changelog][changelog].
|
||||||
|
- This project adheres to [Semantic Versioning][semver].
|
||||||
|
- For versions before 1.0, we follow the [Pkg.jl convention][pkjjl]
|
||||||
|
that `0.a.b` is compatible with `0.a.c`.
|
||||||
|
|
||||||
|
[changelog]: https://keepachangelog.com/en/1.0.0/
|
||||||
|
[semver]: https://semver.org/spec/v2.0.0.html
|
||||||
|
[pkjjl]: https://pkgdocs.julialang.org/v1/compatibility/#compat-pre-1.0
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
- Allow product disposal at collection centers
|
||||||
|
- Implement stochastic optimization
|
||||||
|
|
||||||
|
## [0.5.2] -- 2022-08-26
|
||||||
|
### Changed
|
||||||
|
- Update to JuMP 1.x
|
||||||
|
|
||||||
|
## [0.5.1] -- 2021-07-23
|
||||||
|
### Added
|
||||||
|
- Allow user to specify locations as unique identifiers, instead of latitude and longitude (e.g. `us-state:IL` or `2018-us-county:17043`)
|
||||||
|
- Add what-if scenarios.
|
||||||
|
- Add products report.
|
||||||
|
|
||||||
|
## [0.5.0] -- 2021-01-06
|
||||||
|
### Added
|
||||||
|
- Allow plants to store input material for processing in later years
|
||||||
|
|
||||||
|
## [0.4.0] -- 2020-09-18
|
||||||
|
### Added
|
||||||
|
- Generate simplified solution reports (CSV)
|
||||||
|
|
||||||
|
## [0.3.3] -- 2020-10-13
|
||||||
|
### Added
|
||||||
|
- Add option to write solution to JSON file in RELOG.solve
|
||||||
|
- Improve error message when instance is infeasible
|
||||||
|
- Make output file more readable
|
||||||
|
|
||||||
|
## [0.3.2] -- 2020-10-07
|
||||||
|
### Added
|
||||||
|
- Add "building period" parameter
|
||||||
|
|
||||||
|
## [0.3.1] -- 2020-07-17
|
||||||
|
### Fixed
|
||||||
|
- Fix expansion cost breakdown
|
||||||
|
|
||||||
|
## [0.3.0] -- 2020-06-25
|
||||||
|
### Added
|
||||||
|
- Track emissions and energy (transportation and plants)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Minor changes to input file format:
|
||||||
|
- Make all dictionary keys lowercase
|
||||||
|
- Rename "outputs (tonne)" to "outputs (tonne/tonne)"
|
||||||
25
COPYING.md
Normal file
25
COPYING.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
Copyright © 2020, UChicago Argonne, LLC
|
||||||
|
|
||||||
|
All Rights Reserved
|
||||||
|
|
||||||
|
Software Name: RELOG
|
||||||
|
|
||||||
|
By: Argonne National Laboratory
|
||||||
|
|
||||||
|
OPEN SOURCE LICENSE
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
|
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
********************************************************************************
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
----------
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
********************************************************************************
|
||||||
19
Makefile
Normal file
19
Makefile
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
VERSION := 0.5
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rfv build Manifest.toml test/Manifest.toml deps/formatter/build deps/formatter/Manifest.toml
|
||||||
|
|
||||||
|
docs:
|
||||||
|
cd docs; julia --project=. make.jl; cd ..
|
||||||
|
rsync -avP --delete-after docs/build/ ../docs/$(VERSION)/
|
||||||
|
|
||||||
|
format:
|
||||||
|
cd deps/formatter; ../../juliaw format.jl
|
||||||
|
|
||||||
|
test: test/Manifest.toml
|
||||||
|
./juliaw test/runtests.jl
|
||||||
|
|
||||||
|
test/Manifest.toml: test/Project.toml
|
||||||
|
julia --project=test -e "using Pkg; Pkg.instantiate()"
|
||||||
|
|
||||||
|
.PHONY: docs test format
|
||||||
37
Project.toml
37
Project.toml
@@ -1,18 +1,45 @@
|
|||||||
name = "RELOG"
|
name = "RELOG"
|
||||||
uuid = "7cafaa7a-b311-45f0-b313-80bf15b5e5e5"
|
uuid = "a2afcdf7-cf04-4913-85f9-c0d81ddf2008"
|
||||||
authors = ["Alinson S. Xavier <git@axavier.org>"]
|
authors = ["Alinson S Xavier <axavier@anl.gov>"]
|
||||||
version = "0.8.0"
|
version = "0.5.2"
|
||||||
|
|
||||||
[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"
|
||||||
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
|
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"
|
Geodesy = "0ef565a4-170c-5f04-8de2-149903a85f3d"
|
||||||
|
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
|
||||||
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
|
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
|
||||||
|
JSONSchema = "7d188eb4-7ad8-530c-ae41-71a32a6d4692"
|
||||||
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
|
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
|
||||||
NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce"
|
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
|
||||||
|
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
|
||||||
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
|
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
|
||||||
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
|
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
|
||||||
|
ProgressBars = "49802e3a-d2f1-5c88-81d8-b72133a6f568"
|
||||||
|
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
|
||||||
|
Shapefile = "8e980c4a-a4fe-5da2-b3a7-4b4b0353a2f4"
|
||||||
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
|
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
|
||||||
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
|
StochasticPrograms = "8b8459f2-c380-502b-8633-9aed2d6c2b35"
|
||||||
|
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
|
||||||
ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea"
|
ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea"
|
||||||
|
|
||||||
|
[compat]
|
||||||
|
CRC = "4"
|
||||||
|
CSV = "0.10"
|
||||||
|
DataFrames = "1"
|
||||||
|
DataStructures = "0.18"
|
||||||
|
GZip = "0.5"
|
||||||
|
Geodesy = "1"
|
||||||
|
JSON = "0.21"
|
||||||
|
JSONSchema = "1"
|
||||||
|
JuMP = "1"
|
||||||
|
MathOptInterface = "1"
|
||||||
|
OrderedCollections = "1"
|
||||||
|
ProgressBars = "1"
|
||||||
|
Shapefile = "0.8"
|
||||||
|
ZipFile = "0.10"
|
||||||
|
julia = "1"
|
||||||
|
|||||||
46
README.md
46
README.md
@@ -1,5 +1,8 @@
|
|||||||
<h1 align="center">RELOG: Supply Chain Analysis and Optimization</h1>
|
<h1 align="center">RELOG: Reverse Logistics Optimization</h1>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
|
<a href="https://github.com/ANL-CEEESA/RELOG/actions">
|
||||||
|
<img src="https://github.com/ANL-CEEESA/RELOG/workflows/CI/badge.svg">
|
||||||
|
</a>
|
||||||
<a href="https://doi.org/10.5281/zenodo.4302341">
|
<a href="https://doi.org/10.5281/zenodo.4302341">
|
||||||
<img src="https://zenodo.org/badge/DOI/10.5281/zenodo.4302341.svg">
|
<img src="https://zenodo.org/badge/DOI/10.5281/zenodo.4302341.svg">
|
||||||
</a>
|
</a>
|
||||||
@@ -8,44 +11,31 @@
|
|||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
**RELOG** is an open-source package designed to optimize supply chains for
|
**RELOG** is a supply chain optimization package focusing on reverse logistics and reverse manufacturing. For example, the package can be used to determine where to build recycling plants, what sizes should they have and which customers should be served by which plants. The package supports customized reverse logistics pipelines, with multiple types of plants, multiple types of product and multiple time periods.
|
||||||
forward, reverse and circular manufacturing. Using mixed-integer linear
|
|
||||||
optimization, RELOG helps users determine strategic decisions such as:
|
|
||||||
|
|
||||||
- Where and when to build manufacturing and recycling plants
|
|
||||||
- The size of these plants, when to expand them, and by how much
|
|
||||||
- The sources for each plant's input materials and the destinations for their
|
|
||||||
processed outputs
|
|
||||||
- Whether to process input materials immediately or store them for later use
|
|
||||||
|
|
||||||
RELOG has been successfully applied in research at various laboratories and
|
|
||||||
universities, focusing on areas like critical material recovery from spent NiMH
|
|
||||||
and Li-Ion batteries, biomass processing for hydrogen production, and the
|
|
||||||
recycling of electronics, plastics and solar PV materials, among others. See
|
|
||||||
references for more details.
|
|
||||||
|
|
||||||
## Screenshots
|
<img src="https://anl-ceeesa.github.io/RELOG/0.5/assets/ex_transportation.png" width="1000px"/>
|
||||||
|
|
||||||
<img src="https://raw.githubusercontent.com/ANL-CEEESA/RELOG/refs/heads/circular/docs/src/assets/relog.png" width="1000px"/>
|
### Documentation
|
||||||
|
|
||||||
## Documentation
|
* [Usage](https://anl-ceeesa.github.io/RELOG/0.5/usage)
|
||||||
|
* [Input and Output Data Formats](https://anl-ceeesa.github.io/RELOG/0.5/format)
|
||||||
|
* [Simplified Solution Reports](https://anl-ceeesa.github.io/RELOG/0.5/reports)
|
||||||
|
* [Optimization Model](https://anl-ceeesa.github.io/RELOG/0.5/model)
|
||||||
|
|
||||||
See official documentation at: https://anl-ceeesa.github.io/RELOG/
|
### Authors
|
||||||
|
|
||||||
## Authors
|
* **Alinson S. Xavier** <<axavier@anl.gov>>
|
||||||
|
* **Nwike Iloeje** <<ciloeje@anl.gov>>
|
||||||
|
* **John Atkins**
|
||||||
|
* **Kyle Sun**
|
||||||
|
|
||||||
- **Alinson S. Xavier,** Argonne National Laboratory <axavier@anl.gov>
|
### License
|
||||||
- **Nwike Iloeje,** Argonne National Laboratory <ciloeje@anl.gov>
|
|
||||||
- **Kavitha G. Menon,** Argonne National Laboratory
|
|
||||||
- **John Atkins,** Argonne National Laboratory
|
|
||||||
- **Kyle Sun,** Argonne National Laboratory
|
|
||||||
- **Audrey Gallier,** Argonne National Laboratory
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
```text
|
```text
|
||||||
RELOG: Reverse Logistics Optimization
|
RELOG: Reverse Logistics Optimization
|
||||||
Copyright © 2020-2025, UChicago Argonne, LLC. All Rights Reserved.
|
Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are permitted
|
Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||||
provided that the following conditions are met:
|
provided that the following conditions are met:
|
||||||
|
|||||||
5
deps/formatter/Project.toml
vendored
Normal file
5
deps/formatter/Project.toml
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[deps]
|
||||||
|
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
|
||||||
|
|
||||||
|
[compat]
|
||||||
|
JuliaFormatter = "0.14.4"
|
||||||
8
deps/formatter/format.jl
vendored
Normal file
8
deps/formatter/format.jl
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
using JuliaFormatter
|
||||||
|
format(
|
||||||
|
[
|
||||||
|
"../../src",
|
||||||
|
"../../test",
|
||||||
|
],
|
||||||
|
verbose=true,
|
||||||
|
)
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
[deps]
|
[deps]
|
||||||
BetterFileWatching = "c9fd44ac-77b5-486c-9482-9798bd063cc6"
|
|
||||||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
|
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
|
||||||
RELOG = "a2afcdf7-cf04-4913-85f9-c0d81ddf2008"
|
RELOG = "a2afcdf7-cf04-4913-85f9-c0d81ddf2008"
|
||||||
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
|
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
|
||||||
|
|||||||
19
docs/make.jl
19
docs/make.jl
@@ -1,16 +1,14 @@
|
|||||||
using Documenter
|
using Documenter, RELOG
|
||||||
using RELOG
|
|
||||||
using BetterFileWatching
|
|
||||||
|
|
||||||
function make()
|
function make()
|
||||||
makedocs(
|
makedocs(
|
||||||
sitename="RELOG",
|
sitename="RELOG",
|
||||||
pages=[
|
pages=[
|
||||||
"Home" => "index.md",
|
"Home" => "index.md",
|
||||||
"User guide" => [
|
"usage.md",
|
||||||
"problem.md",
|
"format.md",
|
||||||
"format.md",
|
"reports.md",
|
||||||
]
|
"model.md",
|
||||||
],
|
],
|
||||||
format = Documenter.HTML(
|
format = Documenter.HTML(
|
||||||
assets=["assets/custom.css"],
|
assets=["assets/custom.css"],
|
||||||
@@ -18,9 +16,4 @@ function make()
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function watch()
|
make()
|
||||||
make()
|
|
||||||
watch_folder("src") do event
|
|
||||||
make()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.0 MiB |
@@ -1,220 +1,230 @@
|
|||||||
# Input data format
|
# Input and Output Data Formats
|
||||||
|
|
||||||
RELOG accepts as input a JSON file with four sections: `parameters`, `products`,
|
In this page, we describe the input and output JSON formats used by RELOG. In addition to these, RELOG can also produce [simplified reports](reports.md) in tabular data format.
|
||||||
`centers` and `plants`. Below, we describe each section in more detail.
|
|
||||||
|
|
||||||
## Parameters
|
## Input Data Format (JSON)
|
||||||
|
|
||||||
| Key | Description |
|
RELOG accepts as input a JSON file with three sections: `parameters`, `products` and `plants`. Below, we describe each section in more detail.
|
||||||
| :------------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
||||||
| `time horizon (years)` | Number of years in the simulation. |
|
### Parameters
|
||||||
| `building period (years)` | List of years in which we are allowed to open new plants. For example, if this parameter is set to `[1,2,3]`, we can only open plants during the first three years. By default, this equals `[1]`; that is, plants can only be opened during the first year. |
|
|
||||||
| `distance metric` | Metric used to compute distances between pairs of locations. Valid options are: `"Euclidean"`, for the straight-line distance between points; or `"driving"` for an approximated driving distance. If not specified, defaults to `"Euclidean"`. |
|
The **parameters** section describes details about the simulation itself.
|
||||||
|
|
||||||
|
| Key | Description
|
||||||
|
|:--------------------------|:---------------|
|
||||||
|
|`time horizon (years)` | Number of years in the simulation.
|
||||||
|
|`building period (years)` | List of years in which we are allowed to open new plants. For example, if this parameter is set to `[1,2,3]`, we can only open plants during the first three years. By default, this equals `[1]`; that is, plants can only be opened during the first year. |
|
||||||
|
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"time horizon (years)": 2,
|
||||||
|
"building period (years)": [1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Products
|
||||||
|
|
||||||
|
The **products** section describes all products and subproducts in the simulation. The field `instance["Products"]` is a dictionary mapping the name of the product to a dictionary which describes its characteristics. Each product description contains the following keys:
|
||||||
|
|
||||||
|
| Key | Description
|
||||||
|
|:--------------------------------------|:---------------|
|
||||||
|
|`transportation cost ($/km/tonne)` | The cost to transport this product. Must be a time series.
|
||||||
|
|`transportation energy (J/km/tonne)` | The energy required to transport this product. Must be a time series. Optional.
|
||||||
|
|`transportation emissions (tonne/km/tonne)` | A dictionary mapping the name of each greenhouse gas, produced to transport one tonne of this product along one kilometer, to the amount of gas produced (in tonnes). Must be a time series. Optional.
|
||||||
|
|`initial amounts` | A dictionary mapping the name of each location to its description (see below). If this product is not initially available, this key may be omitted. Must be a time series.
|
||||||
|
| `disposal limit (tonne)` | Total amount of product that can be disposed of across all collection centers. If omitted, all product must be processed. This parameter has no effect on product disposal at plants.
|
||||||
|
| `disposal cost ($/tonne)` | Cost of disposing one tonne of this product at a collection center. If omitted, defaults to zero. This parameter has no effect on product disposal costs at plants.
|
||||||
|
|
||||||
|
Each product may have some amount available at the beginning of each time period. In this case, the key `initial amounts` maps to a dictionary with the following keys:
|
||||||
|
|
||||||
|
| Key | Description
|
||||||
|
|:------------------------|:---------------|
|
||||||
|
| `latitude (deg)` | The latitude of the location.
|
||||||
|
| `longitude (deg)` | The longitude of the location.
|
||||||
|
| `amount (tonne)` | The amount of the product initially available at the location. Must be a time series.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"parameters": {
|
"products": {
|
||||||
"time horizon (years)": 4,
|
"P1": {
|
||||||
"building period (years)": [1],
|
"initial amounts": {
|
||||||
"distance metric": "driving"
|
"C1": {
|
||||||
}
|
"latitude (deg)": 7.0,
|
||||||
}
|
"longitude (deg)": 7.0,
|
||||||
```
|
"amount (tonne)": [934.56, 934.56]
|
||||||
|
},
|
||||||
## Products
|
"C2": {
|
||||||
|
"latitude (deg)": 7.0,
|
||||||
| Key | Description |
|
"longitude (deg)": 19.0,
|
||||||
| :------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
"amount (tonne)": [198.95, 198.95]
|
||||||
| `transportation cost ($/km/tonne)` | The cost to transport this product. Must be a time series. |
|
},
|
||||||
| `transportation energy (J/km/tonne)` | The energy required to transport this product. Must be a time series. Optional. |
|
"C3": {
|
||||||
| `transportation emissions (tonne/km/tonne)` | A dictionary mapping the name of each greenhouse gas, produced to transport one tonne of this product along one kilometer, to the amount of gas produced (in tonnes). Must be a time series. Optional. |
|
"latitude (deg)": 84.0,
|
||||||
| `disposal limit (tonne)` | Global disposal limit for this product, per year, across all plants and centers. Entry may be `null` if unlimited. Note that individual plants and centers may also have their individual disposal limits for this product. |
|
"longitude (deg)": 76.0,
|
||||||
|
"amount (tonne)": [212.97, 212.97]
|
||||||
#### Example
|
}
|
||||||
|
},
|
||||||
```json
|
"transportation cost ($/km/tonne)": [0.015, 0.015],
|
||||||
{
|
"transportation energy (J/km/tonne)": [0.12, 0.11],
|
||||||
"products": {
|
"transportation emissions (tonne/km/tonne)": {
|
||||||
"P1": {
|
"CO2": [0.052, 0.050],
|
||||||
"transportation cost ($/km/tonne)": 0.015,
|
"CH4": [0.003, 0.002]
|
||||||
"transportation energy (J/km/tonne)": 0.12,
|
},
|
||||||
"transportation emissions (tonne/km/tonne)": {
|
"disposal cost ($/tonne)": [-10.0, -12.0],
|
||||||
"CO2": 0.052,
|
"disposal limit (tonne)": [1.0, 1.0],
|
||||||
"CH4": 0.003
|
|
||||||
},
|
|
||||||
"disposal limit (tonne)": 100.0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Centers
|
|
||||||
|
|
||||||
| Key | Description |
|
|
||||||
| :------------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
||||||
| `latitude (deg)` | The latitude of the center. |
|
|
||||||
| `longitude (deg)` | The longitude of the center. |
|
|
||||||
| `input` | The name of the product this center takes as input from the plants. May be `null` if the center accept no input product. |
|
|
||||||
| `outputs` | List of output products collected by the center. May be `[]` if none. |
|
|
||||||
| `fixed output (tonne)` | Dictionary mapping the name of each output product to the amount generated by this center each year, regardless of how much input the center receives. For example, if this field equals to `{"P1": [1.0, 2.0, 3.0, 4.0]}`, then this center generates 1.0, 2.0, 3.0 and 4.0 tonnes of P2 in years 1, 2, 3 and 4, respectively. |
|
|
||||||
| `variable output (tonne/tonne)` | Dictionary mapping the name of each output product to the amount of output generated, for each tonne of input material, and for each year after the input is received. For example, in a 4-year simulation, if this field equals to `{"P1": [0.1, 0.3, 0.6, 0.0]}` and the center receives 1.0, 2.0, 3.0 and 4.0 tonnes of input material in years 1, 2, 3 and 4, then the center will produce $1.0 * 0.1 = 0.1$ of P1 in the first year, $1.0 * 0.3 + 2.0 * 0.1 = 0.5$ the second year, $1.0 * 0.6 + 2.0 * 0.3 + 3.0 * 0.1 = 1.5$ in the third year, and $2.0 * 0.6 + 3.0 * 0.3 + 4.0 * 0.1 = 2.5$ in the final year. |
|
|
||||||
| `revenue ($/tonne)` | Revenue generated by each tonne of input material sent to the center. If the center accepts no input, this should be `null` |
|
|
||||||
| `collection cost ($/tonne)` | Dictionary mapping the name of each output product to the cost of collecting one tonne of the product. |
|
|
||||||
| `operating cost ($)` | Fixed cost to operate the center for one year, regardless of amount of product received or generated. |
|
|
||||||
| `disposal limit (tonne)` | Dictionary mapping the name of each output product to the maximum disposal amount allowed per year of the product at the center. Entry may be `null` if unlimited. |
|
|
||||||
| `disposal cost ($/tonne)` | Dictionary mapping the name of each output product to the cost to dispose one tonne of the product at the center. |
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"centers": {
|
|
||||||
"C1": {
|
|
||||||
"latitude (deg)": 41.881,
|
|
||||||
"longitude (deg)": -87.623,
|
|
||||||
"input": "P1",
|
|
||||||
"outputs": ["P2", "P3"],
|
|
||||||
"fixed output (tonne)": {
|
|
||||||
"P2": [100, 50, 0, 0],
|
|
||||||
"P3": [20, 10, 0, 0]
|
|
||||||
},
|
|
||||||
"variable output (tonne/tonne)": {
|
|
||||||
"P2": [0.12, 0.25, 0.12, 0.0],
|
|
||||||
"P3": [0.25, 0.25, 0.25, 0.0]
|
|
||||||
},
|
|
||||||
"revenue ($/tonne)": [12.0, 12.0, 12.0, 12.0],
|
|
||||||
"collection cost ($/tonne)": {
|
|
||||||
"P2": [0.25, 0.25, 0.25, 0.25],
|
|
||||||
"P3": [0.37, 0.37, 0.37, 0.37]
|
|
||||||
},
|
|
||||||
"operating cost ($)": [150.0, 150.0, 150.0, 150.0],
|
|
||||||
"disposal limit (tonne)": {
|
|
||||||
"P2": [0, 0, 0, 0],
|
|
||||||
"P3": [null, null, null, null]
|
|
||||||
},
|
|
||||||
"disposal cost ($/tonne)": {
|
|
||||||
"P2": [0.23, 0.23, 0.23, 0.23],
|
|
||||||
"P3": [1.0, 1.0, 1.0, 1.0]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"C2": {
|
|
||||||
"latitude (deg)": 41.881,
|
|
||||||
"longitude (deg)": -87.623,
|
|
||||||
"input": null,
|
|
||||||
"outputs": ["P4"],
|
|
||||||
"variable output (tonne/tonne)": {
|
|
||||||
"P4": [0, 0, 0, 0]
|
|
||||||
},
|
|
||||||
"fixed output (tonne)": {
|
|
||||||
"P4": [50, 60, 70, 80]
|
|
||||||
},
|
|
||||||
"revenue ($/tonne)": null,
|
|
||||||
"collection cost ($/tonne)": {
|
|
||||||
"P4": [0.25, 0.25, 0.25, 0.25]
|
|
||||||
},
|
|
||||||
"operating cost ($)": [150.0, 150.0, 150.0, 150.0],
|
|
||||||
"disposal limit (tonne)": {
|
|
||||||
"P4": [null, null, null, null]
|
|
||||||
},
|
|
||||||
"disposal cost ($/tonne)": {
|
|
||||||
"P4": [0, 0, 0, 0]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"C3": {
|
|
||||||
"latitude (deg)": 41.881,
|
|
||||||
"longitude (deg)": -87.623,
|
|
||||||
"input": "P1",
|
|
||||||
"outputs": [],
|
|
||||||
"variable output (tonne/tonne)": {},
|
|
||||||
"constant output (tonne)": {},
|
|
||||||
"revenue ($/tonne)": [12.0, 12.0, 12.0, 12.0],
|
|
||||||
"collection cost ($/tonne)": {},
|
|
||||||
"operating cost ($)": [150.0, 150.0, 150.0, 150.0],
|
|
||||||
"disposal limit (tonne)": {},
|
|
||||||
"disposal cost ($/tonne)": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Plants
|
|
||||||
|
|
||||||
| Key | Description |
|
|
||||||
| :----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
||||||
| `latitude (deg)` | The latitude of the plant, in degrees. |
|
|
||||||
| `longitude (deg)` | The longitude of the plant, in degrees. |
|
|
||||||
| `input mix (%)` | Dictionary mapping the name of each input product to the amount required (as a percentage). Must sum to 100%. |
|
|
||||||
| `output (tonne)` | Dictionary mapping the name of each output product to the amount produced (in tonne) for one tonne of input mix. |
|
|
||||||
| `processing emissions (tonne)` | A dictionary mapping the name of each greenhouse gas, produced to process each tonne of input, to the amount of gas produced (in tonne). |
|
|
||||||
| `storage cost ($/tonne)` | Dictionary mapping the name of each input product to the cost of storing the product for one year at the plant for later processing. |
|
|
||||||
| `storage limit (tonne)` | Dictionary mapping the name of each input product to the maximum amount allowed in storage at any time. May be `null` if unlimited. |
|
|
||||||
| `disposal cost ($/tonne)` | Dictionary mapping the name of each output product to the cost of disposing it at the plant. |
|
|
||||||
| `disposal limit (tonne)` | Dictionary mapping the name of each output product to the maximum amount allowed to be disposed of at the plant. May be `null` if unlimited. |
|
|
||||||
| `capacities` | List describing what plant sizes are allowed, and their characteristics. |
|
|
||||||
|
|
||||||
The entries in the `capacities` list should be dictionaries with the following
|
|
||||||
keys:
|
|
||||||
|
|
||||||
| Key | Description |
|
|
||||||
| :---------------------------------- | :-------------------------------------------------------------------------------------------------- |
|
|
||||||
| `size (tonne)` | The size of the plant. |
|
|
||||||
| `opening cost ($)` | The cost to open a plant of this size. |
|
|
||||||
| `fixed operating cost ($)` | The cost to keep the plant open, even if the plant doesn't process anything. Must be a time series. |
|
|
||||||
| `variable operating cost ($/tonne)` | The cost that the plant incurs to process each tonne of input. Must be a time series. |
|
|
||||||
| `initial capacity (tonne)` | Capacity already available. If the plant has not been built yet, this should be `0`. |
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"plants": {
|
|
||||||
"L1": {
|
|
||||||
"latitude (deg)": 41.881,
|
|
||||||
"longitude (deg)": -87.623,
|
|
||||||
"input mix (%)": {
|
|
||||||
"P1": 95.3,
|
|
||||||
"P2": 4.7
|
|
||||||
},
|
|
||||||
"output (tonne)": {
|
|
||||||
"P3": 0.25,
|
|
||||||
"P4": 0.12,
|
|
||||||
"P5": 0.1
|
|
||||||
},
|
|
||||||
"processing emissions (tonne)": {
|
|
||||||
"CO2": 0.1
|
|
||||||
},
|
|
||||||
"storage cost ($/tonne)": {
|
|
||||||
"P1": 0.1,
|
|
||||||
"P2": 0.1
|
|
||||||
},
|
|
||||||
"storage limit (tonne)": {
|
|
||||||
"P1": 100,
|
|
||||||
"P2": null
|
|
||||||
},
|
|
||||||
"disposal cost ($/tonne)": {
|
|
||||||
"P3": 0,
|
|
||||||
"P4": 0.86,
|
|
||||||
"P5": 0.25,
|
|
||||||
},
|
|
||||||
"disposal limit (tonne)": {
|
|
||||||
"P3": null,
|
|
||||||
"P4": 1000.0,
|
|
||||||
"P5": 1000.0
|
|
||||||
},
|
|
||||||
"capacities": [
|
|
||||||
{
|
|
||||||
"size": 100,
|
|
||||||
"opening cost ($)": 500,
|
|
||||||
"fixed operating cost ($)": 300,
|
|
||||||
"variable operating cost ($/tonne)": 5.0
|
|
||||||
},
|
},
|
||||||
{
|
"P2": {
|
||||||
"size": 500,
|
"transportation cost ($/km/tonne)": [0.022, 0.020]
|
||||||
"opening cost ($)": 1000.0,
|
},
|
||||||
"fixed operating cost ($)": 400.0,
|
"P3": {
|
||||||
"variable operating cost ($/tonne)": 5.0.
|
"transportation cost ($/km/tonne)": [0.0125, 0.0125]
|
||||||
|
},
|
||||||
|
"P4": {
|
||||||
|
"transportation cost ($/km/tonne)": [0.0175, 0.0175]
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"initial capacity (tonne)": 0,
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Processing plants
|
||||||
|
|
||||||
|
The **plants** section describes the available types of reverse manufacturing plants, their potential locations and associated costs, as well as their inputs and outputs. The field `instance["Plants"]` is a dictionary mapping the name of the plant to a dictionary with the following keys:
|
||||||
|
|
||||||
|
| Key | Description
|
||||||
|
|:------------------------|:---------------|
|
||||||
|
| `input` | The name of the product that this plant takes as input. Only one input is accepted per plant.
|
||||||
|
| `outputs (tonne/tonne)` | A dictionary specifying how many tonnes of each product is produced for each tonnes of input. For example, if the plant outputs 0.5 tonnes of P2 and 0.25 tonnes of P3 for each tonnes of P1 provided, then this entry should be `{"P2": 0.5, "P3": 0.25}`. If the plant does not output anything, this key may be omitted.
|
||||||
|
|`energy (GJ/tonne)` | The energy required to process 1 tonne of the input. Must be a time series. Optional.
|
||||||
|
|`emissions (tonne/tonne)` | A dictionary mapping the name of each greenhouse gas, produced to process each tonne of input, to the amount of gas produced (in tonne). Must be a time series. Optional.
|
||||||
|
| `locations` | A dictionary mapping the name of the location to a dictionary which describes the site characteristics (see below).
|
||||||
|
|
||||||
|
Each type of plant is associated with a set of potential locations where it can be built. Each location is represented by a dictionary with the following keys:
|
||||||
|
|
||||||
|
| Key | Description
|
||||||
|
|:------------------------------|---------------|
|
||||||
|
| `latitude (deg)` | The latitude of the location, in degrees.
|
||||||
|
| `longitude (deg)` | The longitude of the location, in degrees.
|
||||||
|
| `disposal` | A dictionary describing what products can be disposed locally at the plant.
|
||||||
|
| `storage` | A dictionary describing the plant's storage.
|
||||||
|
| `capacities (tonne)` | A dictionary describing what plant sizes are allowed, and their characteristics.
|
||||||
|
|
||||||
|
The `storage` dictionary should contain the following keys:
|
||||||
|
|
||||||
|
| Key | Description
|
||||||
|
|:------------------------|:---------------|
|
||||||
|
| `cost ($/tonne)` | The cost to store a tonne of input product for one time period. Must be a time series.
|
||||||
|
| `limit (tonne)` | The maximum amount of input product this plant can have in storage at any given time.
|
||||||
|
|
||||||
|
The keys in the `disposal` dictionary should be the names of the products. The values are dictionaries with the following keys:
|
||||||
|
|
||||||
|
| Key | Description
|
||||||
|
|:------------------------|:---------------|
|
||||||
|
| `cost ($/tonne)` | The cost to dispose of the product. Must be a time series.
|
||||||
|
| `limit (tonne)` | The maximum amount that can be disposed of. If an unlimited amount can be disposed, this key may be omitted. Must be a time series.
|
||||||
|
|
||||||
|
|
||||||
|
The keys in the `capacities (tonne)` dictionary should be the amounts (in tonnes). The values are dictionaries with the following keys:
|
||||||
|
|
||||||
|
| Key | Description
|
||||||
|
|:--------------------------------------|:---------------|
|
||||||
|
| `opening cost ($)` | The cost to open a plant of this size.
|
||||||
|
| `fixed operating cost ($)` | The cost to keep the plant open, even if the plant doesn't process anything. Must be a time series.
|
||||||
|
| `variable operating cost ($/tonne)` | The cost that the plant incurs to process each tonne of input. Must be a time series.
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"plants": {
|
||||||
|
"F1": {
|
||||||
|
"input": "P1",
|
||||||
|
"outputs (tonne/tonne)": {
|
||||||
|
"P2": 0.2,
|
||||||
|
"P3": 0.5
|
||||||
|
},
|
||||||
|
"energy (GJ/tonne)": [0.12, 0.11],
|
||||||
|
"emissions (tonne/tonne)": {
|
||||||
|
"CO2": [0.052, 0.050],
|
||||||
|
"CH4": [0.003, 0.002]
|
||||||
|
},
|
||||||
|
"locations": {
|
||||||
|
"L1": {
|
||||||
|
"latitude (deg)": 0.0,
|
||||||
|
"longitude (deg)": 0.0,
|
||||||
|
"disposal": {
|
||||||
|
"P2": {
|
||||||
|
"cost ($/tonne)": [-10.0, -12.0],
|
||||||
|
"limit (tonne)": [1.0, 1.0]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"storage": {
|
||||||
|
"cost ($/tonne)": [5.0, 5.3],
|
||||||
|
"limit (tonne)": 100.0,
|
||||||
|
},
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"100": {
|
||||||
|
"opening cost ($)": [500, 530],
|
||||||
|
"fixed operating cost ($)": [300.0, 310.0],
|
||||||
|
"variable operating cost ($/tonne)": [5.0, 5.2],
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"opening cost ($)": [750, 760],
|
||||||
|
"fixed operating cost ($)": [400.0, 450.0],
|
||||||
|
"variable operating cost ($/tonne)": [5.0, 5.2]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Geographic database
|
||||||
|
|
||||||
|
Instead of specifying locations using latitudes and longitudes, it is also possible to specify them using unique identifiers, such as the name of a US state, or the county FIPS code. This works anywhere `latitude (deg)` and `longitude (deg)` are expected. For example, instead of:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"initial amounts": {
|
||||||
|
"C1": {
|
||||||
|
"latitude (deg)": 37.27182,
|
||||||
|
"longitude (deg)": -119.2704,
|
||||||
|
"amount (tonne)": [934.56, 934.56]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
is is possible to write:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"initial amounts": {
|
||||||
|
"C1": {
|
||||||
|
"location": "us-state:CA",
|
||||||
|
"amount (tonne)": [934.56, 934.56]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Location names follow the format `db:id`, where `db` is the name of the database and `id` is the identifier for a specific location. RELOG currently includes the following databases:
|
||||||
|
|
||||||
|
Database | Description | Examples
|
||||||
|
:--------|:------------|:---------
|
||||||
|
`us-state`| List of states of the United States. | `us-state:IL` (State of Illinois)
|
||||||
|
`2018-us-county` | List of United States counties, as of 2018. IDs are 5-digit FIPS codes. | `2018-us-county:17043` (DuPage county in Illinois)
|
||||||
|
|
||||||
|
### Current limitations
|
||||||
|
|
||||||
|
* Each plant can only be opened exactly once. After open, the plant remains open until the end of the simulation.
|
||||||
|
* Plants can be expanded at any time, even long after they are open.
|
||||||
|
* All material available at the beginning of a time period must be entirely processed by the end of that time period. It is not possible to store unprocessed materials from one time period to the next.
|
||||||
|
* Up to two plant sizes are currently supported. Variable operating costs must be the same for all plant sizes.
|
||||||
|
|
||||||
|
## Output Data Format (JSON)
|
||||||
|
|
||||||
|
To be documented.
|
||||||
|
|||||||
@@ -1,42 +1,35 @@
|
|||||||
# RELOG -- Supply Chain Analysis and Optimization
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
|
||||||
**RELOG** is an open-source package designed to optimize supply chains for
|
**RELOG** is an open-source supply chain optimization package focusing on reverse logistics and reverse manufacturing. The package uses Mixed-Integer Linear Programming to determine where to build recycling plants, what size should these plants have and which customers should be served by which plants. The package supports custom reverse logistics pipelines, with multiple types of plants, multiple types of product and multiple time periods.
|
||||||
forward, reverse and circular manufacturing. Using mixed-integer linear
|
|
||||||
optimization, RELOG helps users determine strategic decisions such as:
|
|
||||||
|
|
||||||
- Where and when to build manufacturing and recycling plants
|
|
||||||
- The size of these plants, when to expand them, and by how much
|
|
||||||
- The sources for each plant's input materials and the destinations for their
|
|
||||||
processed outputs
|
|
||||||
- Whether to process input materials immediately or store them for later use
|
|
||||||
|
|
||||||
RELOG has been successfully applied in research at various laboratories and
|
|
||||||
universities, focusing on areas like critical material recovery from spent NiMH
|
|
||||||
and Li-Ion batteries, biomass processing for hydrogen production, and the
|
|
||||||
recycling of electronics, plastics and solar PV materials, among others. See
|
|
||||||
references for more details.
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
```@raw html
|
```@raw html
|
||||||
<center>
|
<center>
|
||||||
<img src="assets/relog.png" width="1000px"/>
|
<img src="assets/ex_transportation.png" width="1000px"/>
|
||||||
</center>
|
</center>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Authors
|
|
||||||
|
|
||||||
- **Alinson S. Xavier,** Argonne National Laboratory <axavier@anl.gov>
|
### Table of Contents
|
||||||
- **Nwike Iloeje,** Argonne National Laboratory <ciloeje@anl.gov>
|
|
||||||
- **Kavitha G. Menon,** Argonne National Laboratory
|
|
||||||
- **John Atkins,** Argonne National Laboratory
|
|
||||||
- **Kyle Sun,** Argonne National Laboratory
|
|
||||||
- **Audrey Gallier,** Argonne National Laboratory
|
|
||||||
|
|
||||||
## License
|
```@contents
|
||||||
|
Pages = ["usage.md", "format.md", "reports.md", "model.md"]
|
||||||
|
Depth = 3
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Source Code
|
||||||
|
|
||||||
|
* [https://github.com/ANL-CEEESA/RELOG](https://github.com/ANL-CEEESA/RELOG)
|
||||||
|
|
||||||
|
### Authors
|
||||||
|
* **Alinson S. Xavier,** Argonne National Laboratory <axavier@anl.gov>
|
||||||
|
* **Nwike Iloeje,** Argonne National Laboratory <ciloeje@anl.gov>
|
||||||
|
|
||||||
|
### License
|
||||||
|
|
||||||
```text
|
```text
|
||||||
RELOG: Reverse Logistics Optimization
|
RELOG: Reverse Logistics Optimization
|
||||||
Copyright © 2020-2025, UChicago Argonne, LLC. All Rights Reserved.
|
Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are permitted
|
Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||||
provided that the following conditions are met:
|
provided that the following conditions are met:
|
||||||
@@ -59,4 +52,4 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSE
|
|||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
```
|
```
|
||||||
196
docs/src/model.md
Normal file
196
docs/src/model.md
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
# Optimization Model
|
||||||
|
|
||||||
|
In this page, we describe the precise mathematical optimization model used by RELOG to find the optimal logistics plan. This model is a variation of the classical Facility Location Problem, which has been widely studied in the operations research literature. To simplify the exposition, we present the simplified case where there is only one type of plant.
|
||||||
|
|
||||||
|
## Mathematical Description
|
||||||
|
|
||||||
|
### Sets
|
||||||
|
|
||||||
|
Symbol | Description
|
||||||
|
:-------|:------------
|
||||||
|
$L$ | Set of locations holding the original material to be recycled
|
||||||
|
$M$ | Set of materials recovered during the reverse manufacturing process
|
||||||
|
$P$ | Set of potential plants to open
|
||||||
|
$T = \{ 1, \ldots, t^{max} \}$ | Set of time periods
|
||||||
|
|
||||||
|
### Constants
|
||||||
|
|
||||||
|
#### Plants
|
||||||
|
|
||||||
|
Symbol | Description | Unit
|
||||||
|
:-------|:------------|:---
|
||||||
|
$c^\text{disp}_{pmt}$ | Cost of disposing one tonne of material $m$ at plant $p$ during time $t$ | \$/tonne/km
|
||||||
|
$c^\text{exp}_{pt}$ | Cost of adding one tonne of capacity to plant $p$ at time $t$ | \$/tonne
|
||||||
|
$c^\text{open}_{pt}$ | Cost of opening plant $p$ at time $t$, at minimum capacity | $
|
||||||
|
$c^\text{f-base}_{pt}$ | Fixed cost of keeping plant $p$ open during time period $t$ | $
|
||||||
|
$c^\text{f-exp}_{pt}$ | Increase in fixed cost for each additional tonne of capacity | \$/tonne
|
||||||
|
$c^\text{var}_{pt}$ | Variable cost of processing one tonne of input at plant $p$ at time $t$ | \$/tonne
|
||||||
|
$c^\text{store}_{pt}$ | Cost of storing one tonne of original material at plant $p$ at time $t$ | \$/tonne
|
||||||
|
$m^\text{min}_p$ | Minimum capacity of plant $p$ | tonne
|
||||||
|
$m^\text{max}_p$ | Maximum capacity of plant $p$ | tonne
|
||||||
|
$m^\text{disp}_{pmt}$ | Maximum amount of material $m$ that plant $p$ can dispose of during time $t$ | tonne
|
||||||
|
$m^\text{store}_p$ | Maximum amount of original material that plant $p$ can store for later processing. | tonne
|
||||||
|
|
||||||
|
#### Products
|
||||||
|
|
||||||
|
Symbol | Description | Unit
|
||||||
|
:-------|:------------|:---
|
||||||
|
$\alpha_{pm}$ | Amount of material $m$ recovered by plant $t$ for each tonne of original material | tonne/tonne
|
||||||
|
$m^\text{initial}_{lt}$ | Amount of original material to be recycled at location $l$ during time $t$ | tonne
|
||||||
|
|
||||||
|
#### Transportation
|
||||||
|
|
||||||
|
Symbol | Description | Unit
|
||||||
|
:-------|:------------|:---
|
||||||
|
$c^\text{tr}_{t}$ | Transportation cost during time $t$ | \$/tonne/km
|
||||||
|
$d_{lp}$ | Distance between plant $p$ and location $l$ | km
|
||||||
|
|
||||||
|
|
||||||
|
### Decision variables
|
||||||
|
|
||||||
|
Symbol | Description | Unit
|
||||||
|
:-------|:------------|:---
|
||||||
|
$q_{mpt}$ | Amount of material $m$ recovered by plant $p$ during time $t$ | tonne
|
||||||
|
$u_{pt}$ | Binary variable that equals 1 if plant $p$ starts operating at time $t$ | Boolean
|
||||||
|
$w_{pt}$ | Extra capacity (amount above the minimum) added to plant $p$ during time $t$ | tonne
|
||||||
|
$x_{pt}$ | Binary variable that equals 1 if plant $p$ is operational at time $t$ | Boolean
|
||||||
|
$y_{lpt}$ | Amount of product sent from location $l$ to plant $p$ during time $t$ | tonne
|
||||||
|
$z^{\text{disp}}_{mpt}$ | Amount of material $m$ disposed of by plant $p$ during time $t$ | tonne
|
||||||
|
$z^{\text{store}}_{pt}$ | Amount of original material in storage at plant $p$ by the end of time period $t$ | tonne
|
||||||
|
$z^{\text{proc}}_{mpt}$ | Amount of original material processed by plant $p$ during time period $t$ | tonne
|
||||||
|
|
||||||
|
|
||||||
|
### Objective function
|
||||||
|
|
||||||
|
RELOG minimizes the overall capital, production and transportation costs:
|
||||||
|
|
||||||
|
```math
|
||||||
|
\begin{align*}
|
||||||
|
\text{minimize} \;\; &
|
||||||
|
\sum_{t \in T} \sum_{p \in P} \left[
|
||||||
|
c^\text{open}_{pt} u_{pt} +
|
||||||
|
c^\text{f-base}_{pt} x_{pt} +
|
||||||
|
\sum_{i=1}^t c^\text{f-exp}_{pt} w_{pi} +
|
||||||
|
c^{\text{exp}}_{pt} w_{pt}
|
||||||
|
\right] + \\
|
||||||
|
&
|
||||||
|
\sum_{t \in T} \sum_{p \in P} \left[
|
||||||
|
c^{\text{store}}_{pt} z^{\text{store}}_{pt} +
|
||||||
|
c^{\text{proc}}_{pt} z^{\text{proc}}_{pt}
|
||||||
|
\right] + \\
|
||||||
|
&
|
||||||
|
\sum_{t \in T} \sum_{l \in L} \sum_{p \in P}
|
||||||
|
c^{\text{tr}}_t d_{lp} y_{lpt}
|
||||||
|
\\
|
||||||
|
&
|
||||||
|
\sum_{t \in T} \sum_{p \in P} \sum_{m \in M} c^{\text{disp}}_{pmt} z_{pmt}
|
||||||
|
\end{align*}
|
||||||
|
```
|
||||||
|
|
||||||
|
In the first line, we have (i) opening costs, if plant starts operating at time $t$, (ii) fixed operating costs, if plant is operational, (iii) additional fixed operating costs coming from expansion performed in all previous time periods up to the current one, and finally (iv) the expansion costs during the current time period.
|
||||||
|
In the second line, we have storage and variable processing costs.
|
||||||
|
In the third line, we have transportation costs.
|
||||||
|
In the fourth line, we have the disposal costs.
|
||||||
|
|
||||||
|
### Constraints
|
||||||
|
|
||||||
|
* All original materials must be sent to a plant:
|
||||||
|
|
||||||
|
```math
|
||||||
|
\begin{align*}
|
||||||
|
& \sum_{p \in P} y_{lpt} = m^\text{initial}_{lt}
|
||||||
|
& \forall l \in L, t \in T
|
||||||
|
\end{align*}
|
||||||
|
```
|
||||||
|
|
||||||
|
* Amount received equals amount processed plus stored. Furthermore, all original material should be processed by the end of the simulation.
|
||||||
|
|
||||||
|
```math
|
||||||
|
\begin{align*}
|
||||||
|
& \sum_{l \in L} y_{lpt} + z^{\text{store}}_{p,t-1}
|
||||||
|
= z^{\text{proc}}_{pt} + z^{\text{store}}_{p,t}
|
||||||
|
& \forall p \in P, t \in T \\
|
||||||
|
& z^{\text{store}}_{p,0} = 0
|
||||||
|
& \forall p \in P \\
|
||||||
|
& z^{\text{store}}_{p,t^{\max}} = 0
|
||||||
|
& \forall p \in P
|
||||||
|
\end{align*}
|
||||||
|
```
|
||||||
|
|
||||||
|
* Plants have a limited processing capacity. Furthermore, if a plant is closed, it has zero processing capacity:
|
||||||
|
|
||||||
|
```math
|
||||||
|
\begin{align*}
|
||||||
|
& z^{\text{proc}}_{pt} \leq m^\text{min}_p x_p + \sum_{i=1}^t w_p
|
||||||
|
& \forall p \in P, t \in T
|
||||||
|
\end{align*}
|
||||||
|
```
|
||||||
|
|
||||||
|
* Plants have limited storage capacity. Furthermore, if a plant is closed, is has zero storage capacity:
|
||||||
|
|
||||||
|
```math
|
||||||
|
\begin{align*}
|
||||||
|
& z^{\text{store}}_{pt} \leq m^\text{store}_p x_p
|
||||||
|
& \forall p \in P, t \in T
|
||||||
|
\end{align*}
|
||||||
|
```
|
||||||
|
|
||||||
|
* Plants can only be expanded up to their maximum capacity. Furthermore, if a plant is closed, it cannot be expanded:
|
||||||
|
|
||||||
|
```math
|
||||||
|
\begin{align*}
|
||||||
|
& \sum_{i=1}^t w_p \leq m^\text{max}_p x_p
|
||||||
|
& \forall p \in P, t \in T
|
||||||
|
\end{align*}
|
||||||
|
```
|
||||||
|
|
||||||
|
* Amount of recovered material is proportional to amount processed:
|
||||||
|
|
||||||
|
```math
|
||||||
|
\begin{align*}
|
||||||
|
& q_{mpt} = \alpha_{pm} z^{\text{proc}}_{pt}
|
||||||
|
& \forall m \in M, p \in P, t \in T
|
||||||
|
\end{align*}
|
||||||
|
```
|
||||||
|
|
||||||
|
* Because we only consider a single type of plant, all recovered material must be immediately disposed of. In RELOG's full model, recovered materials may be sent to another plant for further processing.
|
||||||
|
|
||||||
|
```math
|
||||||
|
\begin{align*}
|
||||||
|
& q_{mpt} = z_{mpt}
|
||||||
|
& \forall m \in M, p \in P, t \in T
|
||||||
|
\end{align*}
|
||||||
|
```
|
||||||
|
|
||||||
|
* A plant is operational at time $t$ if it was operational at time $t-1$ or it was built at time $t$. This constraint also prevents a plant from being built multiple times.
|
||||||
|
|
||||||
|
```math
|
||||||
|
\begin{align*}
|
||||||
|
& x_{pt} = x_{p,t-1} + u_{pt}
|
||||||
|
& \forall p \in P, t \in T \setminus \{1\} \\
|
||||||
|
& x_{p,1} = u_{p,1}
|
||||||
|
& \forall p \in P
|
||||||
|
\end{align*}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
* Variable bounds:
|
||||||
|
|
||||||
|
```math
|
||||||
|
\begin{align*}
|
||||||
|
& q_{mpt} \geq 0
|
||||||
|
& \forall m \in M, p \in P, t \in T \\
|
||||||
|
& u_{pt} \in \{0,1\}
|
||||||
|
& \forall p \in P, t \in T \\
|
||||||
|
& w_{pt} \geq 0
|
||||||
|
& \forall p \in P, t \in T \\
|
||||||
|
& x_{pt} \in \{0,1\}
|
||||||
|
& \forall p \in P, t \in T \\
|
||||||
|
& y_{lpt} \geq 0
|
||||||
|
& \forall l \in L, p \in P, t \in T \\
|
||||||
|
& z^{\text{store}}_{pt} \geq 0
|
||||||
|
& p \in P, t \in T \\
|
||||||
|
& z^{\text{disp}}_{mpt}, z^{\text{proc}}_{mpt} \geq 0
|
||||||
|
& \forall m \in M, p \in P, t \in T
|
||||||
|
\end{align*}
|
||||||
|
```
|
||||||
@@ -1,279 +0,0 @@
|
|||||||
# Mathematical problem definition
|
|
||||||
|
|
||||||
## Overview and assumptions
|
|
||||||
|
|
||||||
The mathematical model employed by RELOG is based on three main components:
|
|
||||||
|
|
||||||
1. **Products and Materials:** Inputs and outputs for both manufacturing and
|
|
||||||
recycling plants. This include raw materials, whether virgin or recovered,
|
|
||||||
and final products, whether new or at their end-of-life. Each product has
|
|
||||||
associated transportation parameters, such as costs, energy and emissions.
|
|
||||||
|
|
||||||
2. **Manufacturing and Recycling Plants:** Facilities that take in specific
|
|
||||||
materials and produce certain products. The outputs can be sent to another
|
|
||||||
plant for further processing, to a collection & distribution center for
|
|
||||||
customer sale, or simply disposed of at landfill. Plants have associated
|
|
||||||
costs (capital, fixed and operating), as well as various limits (processing
|
|
||||||
capacity, storage and disposal limits).
|
|
||||||
|
|
||||||
3. **Collection and Distribution Centers:** Facilities that receive final
|
|
||||||
products from the plants, sell them to customers, and then collect them back
|
|
||||||
once they reach their end-of-life. Collected products can either be sent to a
|
|
||||||
plant for recycling or disposed of at a local landfill. Centers have
|
|
||||||
associated revenue and various costs, such as operating cost, collection cost
|
|
||||||
and disposal cost. The amount of material collected by a center can either be
|
|
||||||
a fixed rate per year, or depend on the amount of product sold at the center
|
|
||||||
in previous years.
|
|
||||||
|
|
||||||
!!! note
|
|
||||||
|
|
||||||
- We assume that transportation costs, energy and emissions scale linearly with transportation distance and amount being transported. Distances between locations are calculated using either approximated driving distances (continental U.S. only) or straight-line distances.
|
|
||||||
- Once a plant is opened, we assume that it remains open until the end of the planning horizon. Similarly, once a plant is expanded, its size cannot be reduced at a later time.
|
|
||||||
- In addition to serving as a source of end-of-life products, centers can also serve as a source for virgin materials. In this case, the center does not receive any inputs from manufacturing or recycling plants, and it generates the desired material at a fixed rate. Collection cost, in this case, refers to the cost to produce the virgin material.
|
|
||||||
- We assume that centers accept either no input product, or a single input product.
|
|
||||||
|
|
||||||
## Sets
|
|
||||||
|
|
||||||
| Symbol | Description |
|
|
||||||
| :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
||||||
| $C$ | Set of collection and distribution centers |
|
|
||||||
| $P$ | Set of manufacturing and recycling plants |
|
|
||||||
| $M$ | Set of products and materials |
|
|
||||||
| $G$ | Set of greenhouse gases |
|
|
||||||
| $M^+_u$ | Set of output products of plant/center $u$. |
|
|
||||||
| $M^-_u$ | Set of input products of plant/center $u$. |
|
|
||||||
| $T$ | Set of time periods in the planning horizon. We assume $T=\{1,\ldots,t^{max}\}.$ |
|
|
||||||
| $E$ | Set of transportation edges. Specifically, $(u,v,m) \in E$ if $m$ is an output of $u$ and an input of $v$, where $m \in M$ and $u, v \in P \cup C$. |
|
|
||||||
| $E^-(v)$ | Set of incoming edges for plant/center v. Specifically, edges $(u,m)$ such that $(u,v,m) \in E$. |
|
|
||||||
| $E^+(u)$ | Set of outgoing edges for plant/center u. Specifically, edges $(v,m)$ such that $(u,v,m) \in E$. |
|
|
||||||
|
|
||||||
## Constants
|
|
||||||
|
|
||||||
| Symbol | Description | Unit |
|
|
||||||
| :-------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------- |
|
|
||||||
| $K^{\text{dist}}_{uv}$ | Distance between plants/centers $u$ and $v$ | km |
|
|
||||||
| $K^\text{cap}_{p}$ | Capacity of plant $p$, if the plant is open | tonne |
|
|
||||||
| $K^\text{disp-limit}_{mt}$ | Maximum amount of material $m$ that can be disposed of (globally) at time $t$ | tonne |
|
|
||||||
| $K^\text{disp-limit}_{mut}$ | Maximum amount of material $m$ that can be disposed of at plant/center $u$ at time $t$ | tonne |
|
|
||||||
| $K^\text{mix}_{pmt}$ | If plant $p$ receives one tonne of input material at time $t$, then $K^\text{mix}_{pmt}$ is the amount of product $m$ in this mix. Must be between zero and one, and the sum of these amounts must equal to one. | tonne |
|
|
||||||
| $K^\text{output}_{pmt}$ | Amount of material $m$ produced by plant $p$ at time $t$ for each tonne of input material processed | tonne |
|
|
||||||
| $K^\text{tr-em}_{gmt}$ | Amount of greenhouse gas $g$ released by transporting 1 tonne of material $m$ over one km at time $t$ | tonne/km-tonne |
|
|
||||||
| $R^\text{tr}_{mt}$ | Cost to send material $m$ at time $t$ | \$/km-tonne |
|
|
||||||
| $R^\text{collect}_{cmt}$ | Cost of collecting material $m$ at center $c$ at time $t$ | \$/tonne |
|
|
||||||
| $R^\text{disp}_{umt}$ | Cost to dispose of material at plant/center $u$ at time $t$ | \$/tonne |
|
|
||||||
| $R^\text{fix}_{ut}$ | Fixed operating cost for plant/center $u$ at time $t$ | \$ |
|
|
||||||
| $R^\text{open}_{pt}$ | Cost to open plant $p$ at time $t$ | \$ |
|
|
||||||
| $R^\text{rev}_{ct}$ | Revenue for selling the input product of center $c$ at this center at time $t$ | \$/tonne |
|
|
||||||
| $R^\text{var}_{pt}$ | Cost to process one tonne of input material at plant $p$ at time $t$ | \$/tonne |
|
|
||||||
| $K^\text{out-fix}_{cmt}$ | Fixed amount of material $m$ collected at center $m$ at time $t$ | \$/tonne |
|
|
||||||
| $K^\text{out-var}_{c,m,i}$ | Factor used to calculate variable amount of material $m$ collected at center $m$. See `eq_z_collected` for more details. | -- |
|
|
||||||
| $K^\text{out-var-len}_{cm}$ | Length of the $K^\text{out-var}_{c,m,*}$ vector. | -- |
|
|
||||||
|
|
||||||
## Decision variables
|
|
||||||
|
|
||||||
| Symbol | JuMP name | Description | Unit |
|
|
||||||
| :--------------------------- | :------------------------------------------- | :------------------------------------------------------------------------------------------------------ | :----- |
|
|
||||||
| $x_{pt}$ | `x[p.name, t]` | One if plant $p$ is operational at time $t$ | binary |
|
|
||||||
| $y_{uvmt}$ | `y[u.name, v.name, m.name, t]` | Amount of product $m$ sent from plant/center $u$ to plant/center $v$ at time $t$ | tonne |
|
|
||||||
| $z^{\text{collected}}_{cmt}$ | `z_collected[c.name, m.name, t]` | Amount of material $m$ collected by center $c$ at time $t$ | tonne |
|
|
||||||
| $z^{\text{disp}}_{umt}$ | `z_disp[u.name, m.name, t]` | Amount of product $m$ disposed of at plant/center $u$ at time $t$ | tonne |
|
|
||||||
| $z^{\text{input}}_{ut}$ | `z_input[u.name, t]` | Total plant/center input at time $t$ | tonne |
|
|
||||||
| $z^{\text{prod}}_{umt}$ | `z_prod[u.name, m.name, t]` | Amount of product $m$ produced by plant/center $u$ at time $t$ | tonne |
|
|
||||||
| $z^{\text{tr-em}}_{guvmt}$ | `z_tr_em[g.name, u.name, v.name, m.name, t]` | Amount of greenhouse gas $g$ released at time $t$ due to transportation of material $m$ from $u$ to $v$ | tonne |
|
|
||||||
|
|
||||||
## Objective function
|
|
||||||
|
|
||||||
The goals is to minimize a linear objective function with the following terms:
|
|
||||||
|
|
||||||
- Transportation costs, which depend on transportation distance
|
|
||||||
$K^{\text{dist}}_{uv}$ and product-specific factor $R^\text{tr}_{mt}$:
|
|
||||||
|
|
||||||
```math
|
|
||||||
\sum_{(u, v, m) \in E} \sum_{t \in T} K^{\text{dist}}_{uv} R^\text{tr}_{mt} y_{uvmt}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Center revenue, obtained by selling products received from manufacturing and
|
|
||||||
recycling plants:
|
|
||||||
|
|
||||||
```math
|
|
||||||
- \sum_{c \in C} \sum_{(p,m) \in E^-(c)} \sum_{t \in T} R^\text{rev}_{ct} y_{pcmt}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Center collection cost, incurred for each tonne of output material sent to a
|
|
||||||
plant:
|
|
||||||
|
|
||||||
```math
|
|
||||||
\sum_{c \in C} \sum_{(p,m) \in E^+(c)} \sum_{t \in T} R^\text{collect}_{cmt} y_{cpmt}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Center disposal cost, incurred when disposing of output material, instead of
|
|
||||||
sending it to a plant:
|
|
||||||
|
|
||||||
```math
|
|
||||||
\sum_{c \in C} \sum_{m \in M^+_c} \sum_{t \in T} R^\text{disp}_{cmt} z^\text{disp}_{cmt}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Center fixed operating cost, incurred for every time period, regardless of
|
|
||||||
input or output amounts:
|
|
||||||
|
|
||||||
```math
|
|
||||||
\sum_{c \in C} \sum_{t \in T} R^\text{fix}_{ct}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Plant disposal cost, incurred for each tonne of product discarded at the
|
|
||||||
plant:
|
|
||||||
|
|
||||||
```math
|
|
||||||
\sum_{p \in P} \sum_{m \in M^+_p} \sum_{t \in T} R^\text{disp}_{pmt} z^\text{disp}_{pmt}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Plant opening cost:
|
|
||||||
|
|
||||||
```math
|
|
||||||
\sum_{p \in P} \sum_{t \in T} R^\text{open}_{pt} \left(
|
|
||||||
x_{pt} - x_{p,t-1}
|
|
||||||
\right)
|
|
||||||
```
|
|
||||||
|
|
||||||
- Plant fixed operating cost, incurred for every time period, regardless of
|
|
||||||
input or output amounts, as long as the plant is operational:
|
|
||||||
|
|
||||||
```math
|
|
||||||
\sum_{p \in P} \sum_{t \in T} R^\text{fix}_{pt} x_{pt}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Plant variable operating cost, incurred for each tonne of input material
|
|
||||||
received by the plant:
|
|
||||||
|
|
||||||
```math
|
|
||||||
\sum_{p \in P} \sum_{(u,m) \in E^-(p)} \sum_{t \in T} R^\text{var}_{pt} y_{upmt}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Constraints
|
|
||||||
|
|
||||||
- Definition of plant input (`eq_z_input[p.name, t]`):
|
|
||||||
|
|
||||||
```math
|
|
||||||
\begin{align*}
|
|
||||||
& z^{\text{input}}_{pt} = \sum_{(u,m) \in E^-(p)} y_{upmt}
|
|
||||||
& \forall p \in P, t \in T
|
|
||||||
\end{align*}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Plant input mix must have correct proportion
|
|
||||||
(`eq_input_mix[p.name, m.name, t]`):
|
|
||||||
|
|
||||||
```math
|
|
||||||
\begin{align*}
|
|
||||||
& \sum_{u : (u,m) \in E^-(p)} y_{upmt}
|
|
||||||
= K^\text{mix}_{pmt} z^{\text{input}}_{pt}
|
|
||||||
& \forall p \in P, m \in M^-_p, t \in T
|
|
||||||
\end{align*}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Definition of amount produced by a plant (`eq_z_prod[p.name, m.name, t]`):
|
|
||||||
|
|
||||||
```math
|
|
||||||
\begin{align*}
|
|
||||||
& z^\text{prod}_{pmt} = K^\text{output}_{pmt} z^\text{input}_{pt}
|
|
||||||
& \forall p \in P, m \in M^+_p, t \in T
|
|
||||||
\end{align*}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Material produced by a plant must be sent somewhere or disposed of
|
|
||||||
(`eq_balance[p.name, m.name, t]`):
|
|
||||||
|
|
||||||
```math
|
|
||||||
\begin{align*}
|
|
||||||
& z^\text{prod}_{pmt} = \sum_{v : (v,m) \in E^+(p)} y_{pvmt} + z^\text{disp}_{pmt}
|
|
||||||
& \forall p \in P, m \in M^+_p, t \in T
|
|
||||||
\end{align*}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Plants have a maximum capacity; furthermore, if the plant is not open, its
|
|
||||||
capacity is zero (`eq_capacity[p.name,t]`)
|
|
||||||
|
|
||||||
```math
|
|
||||||
\begin{align*}
|
|
||||||
& z^\text{input}_{pt} \leq K^\text{cap}_p x_{pt}
|
|
||||||
& \forall p \in P, t \in T
|
|
||||||
\end{align*}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Disposal limit at the plants (`eq_disposal_limit[p.name, m.name, t]`):
|
|
||||||
|
|
||||||
```math
|
|
||||||
\begin{align*}
|
|
||||||
& z^\text{disp}_{pmt} \leq K^\text{disp-limit}_{pmt}
|
|
||||||
& \forall p \in P, m \in M^+_p, t \in T
|
|
||||||
\end{align*}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Once a plant is built, it must remain open until the end of the planning
|
|
||||||
horizon (`eq_keep_open[p.name, t]`):
|
|
||||||
|
|
||||||
```math
|
|
||||||
\begin{align*}
|
|
||||||
& x_{pt} \geq x_{p,t-1}
|
|
||||||
& \forall p \in P, t \in T
|
|
||||||
\end{align*}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Definition of center input (`eq_z_input[c.name, t]`):
|
|
||||||
|
|
||||||
```math
|
|
||||||
\begin{align*}
|
|
||||||
& z^\text{input}_{ct} = \sum_{u : (u,m) \in E^-(c)} y_{ucmt}
|
|
||||||
& \forall c \in C, t \in T
|
|
||||||
\end{align*}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Calculation of amount collected by the center
|
|
||||||
(`eq_z_collected[c.name, m.name, t]`). In the equation below,
|
|
||||||
$K^\text{out-var-len}$ is the length of the $K^\text{out-var}_{c,m,*}$ vector.
|
|
||||||
|
|
||||||
```math
|
|
||||||
\begin{align*}
|
|
||||||
& z^\text{collected}_{cmt}
|
|
||||||
= \sum_{i=0}^{\min\{K^\text{out-var-len}_{cm}-1,t-1\}} K^\text{out-var}_{c,m,i+1} z^\text{input}_{c,t-i}
|
|
||||||
+ K^\text{out-fix}_{cmt}
|
|
||||||
& \forall c \in C, m \in M^+_c, t \in T
|
|
||||||
\end{align*}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Products collected at centers must be sent somewhere or disposed of
|
|
||||||
(`eq_balance[c.name, m.name, t]`):
|
|
||||||
|
|
||||||
```math
|
|
||||||
\begin{align*}
|
|
||||||
& z^\text{collected}_{cmt} = \sum_{v : (v,m) \in E^+(c)} y_{cvmt} + z^\text{disp}_{cmt}
|
|
||||||
& \forall c \in C, m \in M^+_c, t \in T
|
|
||||||
\end{align*}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Disposal limit at the centers (`eq_disposal_limit[c.name, m.name, t]`):
|
|
||||||
|
|
||||||
```math
|
|
||||||
\begin{align*}
|
|
||||||
& z^\text{disp}_{cmt} \leq K^\text{disp-limit}_{cmt}
|
|
||||||
& \forall c \in C, m \in M^+_c, t \in T
|
|
||||||
\end{align*}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Global disposal limit (`eq_disposal_limit[m.name, t]`)
|
|
||||||
|
|
||||||
```math
|
|
||||||
\begin{align*}
|
|
||||||
& \sum_{p \in P} z^\text{disp}_{pmt} + \sum_{c \in C} z^\text{disp}_{cmt} \leq K^\text{disp-limit}_{mt}
|
|
||||||
& \forall m \in M, t \in T
|
|
||||||
\end{align*}
|
|
||||||
```
|
|
||||||
|
|
||||||
- Computation of transportation emissions (`eq_tr_em[g.name, u.name, v.name, m.name, t`)
|
|
||||||
|
|
||||||
```math
|
|
||||||
\begin{align*}
|
|
||||||
& z^{\text{tr-em}}_{guvmt} = K^{\text{dist}}_{uv} K^\text{tr-em}_{gmt} y_{uvmt}
|
|
||||||
& \forall g \in G, (u, v, m) \in E, t \in T
|
|
||||||
\end{align*}
|
|
||||||
```
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# Solution reports
|
# Simplified Solution Reports
|
||||||
|
|
||||||
In addition to the full output format described in [data formats](format.md), RELOG can also generate a number of simplified reports in tabular data format (CSV), which can be more easily processed by spreadsheet software (such as Microsoft Excel), by data analysis libraries (such as Pandas) or by relational databases (such as SQLite).
|
In addition to the full output format described in [data formats](format.md), RELOG can also generate a number of simplified reports in tabular data format (CSV), which can be more easily processed by spreadsheet software (such as Microsoft Excel), by data analysis libraries (such as Pandas) or by relational databases (such as SQLite).
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# Usage
|
Usage
|
||||||
|
=====
|
||||||
|
|
||||||
## 1. Installation
|
## 1. Installation
|
||||||
|
|
||||||
@@ -6,7 +7,13 @@ To use RELOG, the first step is to install the [Julia programming language](http
|
|||||||
|
|
||||||
```julia
|
```julia
|
||||||
using Pkg
|
using Pkg
|
||||||
Pkg.add(name="RELOG", version="0.7")
|
Pkg.add(name="RELOG", version="0.5")
|
||||||
|
```
|
||||||
|
|
||||||
|
After the package and all its dependencies have been installed, please run the RELOG test suite, as shown below, to make sure that the package has been correctly installed:
|
||||||
|
|
||||||
|
```julia
|
||||||
|
Pkg.test("RELOG")
|
||||||
```
|
```
|
||||||
|
|
||||||
## 2. Modeling the problem
|
## 2. Modeling the problem
|
||||||
@@ -15,21 +22,21 @@ The two main model components in RELOG are **products** and **plants**.
|
|||||||
|
|
||||||
A **product** is any material that needs to be recycled, any intermediary product produced during the recycling process, or any product recovered at the end of the process. For example, in a NiMH battery recycling study case, products could include (i) the original batteries to be recycled; (ii) the cathode and anode parts of the battery; (iii) rare-earth elements and (iv) scrap metals.
|
A **product** is any material that needs to be recycled, any intermediary product produced during the recycling process, or any product recovered at the end of the process. For example, in a NiMH battery recycling study case, products could include (i) the original batteries to be recycled; (ii) the cathode and anode parts of the battery; (iii) rare-earth elements and (iv) scrap metals.
|
||||||
|
|
||||||
- The model assumes that some products are initially available at user-specified locations (described by their latitude, longitude and the amount available), while other products only become available during the recycling process.
|
* The model assumes that some products are initially available at user-specified locations (described by their latitude, longitude and the amount available), while other products only become available during the recycling process.
|
||||||
|
|
||||||
- Products that are initially available must be sent to a plant for processing during the same time period they became available.
|
* Products that are initially available must be sent to a plant for processing during the same time period they became available.
|
||||||
|
|
||||||
- Transporting products from one location to another incurs a transportation cost (`$/km/tonne`), spends some amount of energy (`J/km/tonne`) and may generate multiple types of emissions (`tonne/tonne`). All these parameters are user-specified and may be product- and time-specific.
|
* Transporting products from one location to another incurs a transportation cost (`$/km/tonne`), spends some amount of energy (`J/km/tonne`) and may generate multiple types of emissions (`tonne/tonne`). All these parameters are user-specified and may be product- and time-specific.
|
||||||
|
|
||||||
A **plant** is a facility that converts one type of product to another. RELOG assumes that each plant receives a single type of product as input and converts this input into multiple types of products. Multiple types of plants, with different inputs, outputs and performance characteristics, may be specified. In the NiMH battery recycling study case, for example, one type of plant could be a _disassembly plant_, which converts _batteries_ into _cathode_ and _anode_. Another type of plant could be _anode recycling plant_, which converts _anode_ into _rare-earth elements_ and _scrap metals_.
|
A **plant** is a facility that converts one type of product to another. RELOG assumes that each plant receives a single type of product as input and converts this input into multiple types of products. Multiple types of plants, with different inputs, outputs and performance characteristics, may be specified. In the NiMH battery recycling study case, for example, one type of plant could be a *disassembly plant*, which converts *batteries* into *cathode* and *anode*. Another type of plant could be *anode recycling plant*, which converts *anode* into *rare-earth elements* and *scrap metals*.
|
||||||
|
|
||||||
- To process each tonne of input material, plants incur a variable operating cost (`$/tonne`), spend some amount of energy (`GJ/tonne`), and produce multiple types of emissions (`tonne/tonne`). Plants also incur a fixed operating cost (`$`) regardless of the amount of material they process. All these parameters are user-specified and may be region- and time-specific.
|
* To process each tonne of input material, plants incur a variable operating cost (`$/tonne`), spend some amount of energy (`GJ/tonne`), and produce multiple types of emissions (`tonne/tonne`). Plants also incur a fixed operating cost (`$`) regardless of the amount of material they process. All these parameters are user-specified and may be region- and time-specific.
|
||||||
|
|
||||||
- Plants can be built at user-specified potential locations. Opening a plant incurs a one-time opening cost (`$`) which may be region- and time-specific. Plants also have a limited capacity (in `tonne`), which indicates the maximum amount of input material they are able to process per year. When specifying potential locations for each type of plant, it is also possible to specify the minimum and maximum capacity of the plants that can be built at that particular location. Different plants sizes may have different opening costs and fixed operating costs. After a plant is built, it can be further expanded in the following years, up to its maximum capacity.
|
* Plants can be built at user-specified potential locations. Opening a plant incurs a one-time opening cost (`$`) which may be region- and time-specific. Plants also have a limited capacity (in `tonne`), which indicates the maximum amount of input material they are able to process per year. When specifying potential locations for each type of plant, it is also possible to specify the minimum and maximum capacity of the plants that can be built at that particular location. Different plants sizes may have different opening costs and fixed operating costs. After a plant is built, it can be further expanded in the following years, up to its maximum capacity.
|
||||||
|
|
||||||
- Products received by a plant can be either processed immediately or stored for later processing. Plants have a maximum storage capacity (`tonne`). Storage costs (`$/tonne`) can also be specified.
|
* Products received by a plant can be either processed immediately or stored for later processing. Plants have a maximum storage capacity (`tonne`). Storage costs (`$/tonne`) can also be specified.
|
||||||
|
|
||||||
- All products generated by a plant can either be sent to another plant for further processing, or disposed of locally for either a profit or a loss (`$/tonne`). To model environmental regulations, it is also possible to specify the maximum amount of each product that can be disposed of at each location.
|
* All products generated by a plant can either be sent to another plant for further processing, or disposed of locally for either a profit or a loss (`$/tonne`). To model environmental regulations, it is also possible to specify the maximum amount of each product that can be disposed of at each location.
|
||||||
|
|
||||||
All user parameters specified above must be provided to RELOG as a JSON file, which is fully described in the [data format page](format.md).
|
All user parameters specified above must be provided to RELOG as a JSON file, which is fully described in the [data format page](format.md).
|
||||||
|
|
||||||
@@ -89,11 +96,12 @@ To use the `resolve` method, the new input file should be very similar to the or
|
|||||||
- **Plant's storage:** Cost.
|
- **Plant's storage:** Cost.
|
||||||
- **Plant's capacity:** Opening cost, fixed operating cost and variable operating cost.
|
- **Plant's capacity:** Opening cost, fixed operating cost and variable operating cost.
|
||||||
|
|
||||||
|
|
||||||
## 5. Advanced options
|
## 5. Advanced options
|
||||||
|
|
||||||
### 5.1 Changing the solver
|
### 5.1 Changing the solver
|
||||||
|
|
||||||
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:
|
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:
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
using RELOG, Gurobi, JuMP
|
using RELOG, Gurobi, JuMP
|
||||||
|
|||||||
75
juliaw
Executable file
75
juliaw
Executable file
@@ -0,0 +1,75 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
||||||
|
# Copyright (C) 2020-2021, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
if [ ! -e Project.toml ]; then
|
||||||
|
echo "juliaw: Project.toml not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e Manifest.toml ]; then
|
||||||
|
julia --project=. -e 'using Pkg; Pkg.instantiate()' || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e build/sysimage.so -o Project.toml -nt build/sysimage.so ]; then
|
||||||
|
echo "juliaw: rebuilding system image..."
|
||||||
|
|
||||||
|
# Generate temporary project folder
|
||||||
|
rm -rf $HOME/.juliaw
|
||||||
|
mkdir -p $HOME/.juliaw/src
|
||||||
|
cp Project.toml Manifest.toml $HOME/.juliaw
|
||||||
|
NAME=$(julia -e 'using TOML; toml = TOML.parsefile("Project.toml"); "name" in keys(toml) && print(toml["name"])')
|
||||||
|
if [ ! -z $NAME ]; then
|
||||||
|
cat > $HOME/.juliaw/src/$NAME.jl << EOF
|
||||||
|
module $NAME
|
||||||
|
end
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add PackageCompiler dependencies to temporary project
|
||||||
|
julia --project=$HOME/.juliaw -e 'using Pkg; Pkg.add(["PackageCompiler", "TOML", "Logging"])'
|
||||||
|
|
||||||
|
# Generate system image scripts
|
||||||
|
cat > $HOME/.juliaw/sysimage.jl << EOF
|
||||||
|
using PackageCompiler
|
||||||
|
using TOML
|
||||||
|
using Logging
|
||||||
|
|
||||||
|
Logging.disable_logging(Logging.Info)
|
||||||
|
mkpath("$PWD/build")
|
||||||
|
|
||||||
|
println("juliaw: generating precompilation statements...")
|
||||||
|
run(\`julia --project="$PWD" --trace-compile="$PWD"/build/precompile.jl \$(ARGS)\`)
|
||||||
|
|
||||||
|
println("juliaw: finding dependencies...")
|
||||||
|
project = TOML.parsefile("Project.toml")
|
||||||
|
manifest = TOML.parsefile("Manifest.toml")
|
||||||
|
deps = Symbol[]
|
||||||
|
for dep in keys(project["deps"])
|
||||||
|
if dep in keys(manifest)
|
||||||
|
# Up to Julia 1.6
|
||||||
|
dep_entry = manifest[dep][1]
|
||||||
|
else
|
||||||
|
# Julia 1.7+
|
||||||
|
dep_entry = manifest["deps"][dep][1]
|
||||||
|
end
|
||||||
|
if "path" in keys(dep_entry)
|
||||||
|
println(" - \$(dep) [skip]")
|
||||||
|
else
|
||||||
|
println(" - \$(dep)")
|
||||||
|
push!(deps, Symbol(dep))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
println("juliaw: building system image...")
|
||||||
|
create_sysimage(
|
||||||
|
deps,
|
||||||
|
precompile_statements_file = "$PWD/build/precompile.jl",
|
||||||
|
sysimage_path = "$PWD/build/sysimage.so",
|
||||||
|
)
|
||||||
|
EOF
|
||||||
|
julia --project=$HOME/.juliaw $HOME/.juliaw/sysimage.jl $*
|
||||||
|
else
|
||||||
|
julia --project=. --sysimage build/sysimage.so $*
|
||||||
|
fi
|
||||||
23
mkdocs.yml
Normal file
23
mkdocs.yml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
site_name: RELOG
|
||||||
|
theme: cinder
|
||||||
|
copyright: "Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved."
|
||||||
|
repo_url: https://github.com/ANL-CEEESA/RELOG
|
||||||
|
edit_uri: edit/master/src/docs/
|
||||||
|
nav:
|
||||||
|
- Home: index.md
|
||||||
|
- Usage: usage.md
|
||||||
|
- Data Format: format.md
|
||||||
|
- Reports: reports.md
|
||||||
|
- Optimization Model: model.md
|
||||||
|
plugins:
|
||||||
|
- search
|
||||||
|
markdown_extensions:
|
||||||
|
- admonition
|
||||||
|
- mdx_math
|
||||||
|
extra_javascript:
|
||||||
|
- https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML
|
||||||
|
- js/mathjax.js
|
||||||
|
docs_dir: src/docs
|
||||||
|
site_dir: docs
|
||||||
|
extra_css:
|
||||||
|
- "css/custom.css"
|
||||||
33
src/RELOG.jl
33
src/RELOG.jl
@@ -1,14 +1,27 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
module RELOG
|
module RELOG
|
||||||
|
|
||||||
_round(x::Number) = round(x, digits = 5)
|
|
||||||
|
|
||||||
include("instance/structs.jl")
|
include("instance/structs.jl")
|
||||||
include("instance/parse.jl")
|
|
||||||
include("model/jumpext.jl")
|
|
||||||
include("model/dist.jl")
|
|
||||||
include("model/build.jl")
|
|
||||||
include("reports/plants.jl")
|
|
||||||
include("reports/transportation.jl")
|
|
||||||
include("reports/centers.jl")
|
|
||||||
|
|
||||||
end # module RELOG
|
include("graph/structs.jl")
|
||||||
|
|
||||||
|
include("graph/build.jl")
|
||||||
|
include("graph/csv.jl")
|
||||||
|
include("instance/compress.jl")
|
||||||
|
include("instance/geodb.jl")
|
||||||
|
include("instance/parse.jl")
|
||||||
|
include("instance/validate.jl")
|
||||||
|
include("model/build.jl")
|
||||||
|
include("model/getsol.jl")
|
||||||
|
include("model/solve.jl")
|
||||||
|
include("reports/plant_emissions.jl")
|
||||||
|
include("reports/plant_outputs.jl")
|
||||||
|
include("reports/plants.jl")
|
||||||
|
include("reports/products.jl")
|
||||||
|
include("reports/tr_emissions.jl")
|
||||||
|
include("reports/tr.jl")
|
||||||
|
include("reports/write.jl")
|
||||||
|
end
|
||||||
|
|||||||
103
src/graph/build.jl
Normal file
103
src/graph/build.jl
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
using Geodesy
|
||||||
|
|
||||||
|
function calculate_distance(source_lat, source_lon, dest_lat, dest_lon)::Float64
|
||||||
|
x = LLA(source_lat, source_lon, 0.0)
|
||||||
|
y = LLA(dest_lat, dest_lon, 0.0)
|
||||||
|
return round(euclidean_distance(x, y) / 1000.0, digits = 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
function build_graph(instance::Instance)::Graph
|
||||||
|
arcs = []
|
||||||
|
next_index = 0
|
||||||
|
process_nodes = ProcessNode[]
|
||||||
|
plant_shipping_nodes = ShippingNode[]
|
||||||
|
collection_shipping_nodes = ShippingNode[]
|
||||||
|
|
||||||
|
name_to_process_node_map = Dict{Tuple{AbstractString,AbstractString},ProcessNode}()
|
||||||
|
collection_center_to_node = Dict()
|
||||||
|
|
||||||
|
process_nodes_by_input_product =
|
||||||
|
Dict(product => ProcessNode[] for product in instance.products)
|
||||||
|
shipping_nodes_by_plant = Dict(plant => [] for plant in instance.plants)
|
||||||
|
|
||||||
|
# Build collection center shipping nodes
|
||||||
|
for center in instance.collection_centers
|
||||||
|
node = ShippingNode(next_index, center, center.product, [], [])
|
||||||
|
next_index += 1
|
||||||
|
collection_center_to_node[center] = node
|
||||||
|
push!(collection_shipping_nodes, node)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Build process and shipping nodes for plants
|
||||||
|
for plant in instance.plants
|
||||||
|
pn = ProcessNode(next_index, plant, [], [])
|
||||||
|
next_index += 1
|
||||||
|
push!(process_nodes, pn)
|
||||||
|
push!(process_nodes_by_input_product[plant.input], pn)
|
||||||
|
|
||||||
|
name_to_process_node_map[(plant.plant_name, plant.location_name)] = pn
|
||||||
|
|
||||||
|
for product in keys(plant.output)
|
||||||
|
sn = ShippingNode(next_index, plant, product, [], [])
|
||||||
|
next_index += 1
|
||||||
|
push!(plant_shipping_nodes, sn)
|
||||||
|
push!(shipping_nodes_by_plant[plant], sn)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Build arcs from collection centers to plants, and from one plant to another
|
||||||
|
for source in [collection_shipping_nodes; plant_shipping_nodes]
|
||||||
|
for dest in process_nodes_by_input_product[source.product]
|
||||||
|
distance = calculate_distance(
|
||||||
|
source.location.latitude,
|
||||||
|
source.location.longitude,
|
||||||
|
dest.location.latitude,
|
||||||
|
dest.location.longitude,
|
||||||
|
)
|
||||||
|
values = Dict("distance" => distance)
|
||||||
|
arc = Arc(length(arcs) + 1, source, dest, values)
|
||||||
|
push!(source.outgoing_arcs, arc)
|
||||||
|
push!(dest.incoming_arcs, arc)
|
||||||
|
push!(arcs, arc)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Build arcs from process nodes to shipping nodes within a plant
|
||||||
|
for source in process_nodes
|
||||||
|
plant = source.location
|
||||||
|
for dest in shipping_nodes_by_plant[plant]
|
||||||
|
weight = plant.output[dest.product]
|
||||||
|
values = Dict("weight" => weight)
|
||||||
|
arc = Arc(length(arcs) + 1, source, dest, values)
|
||||||
|
push!(source.outgoing_arcs, arc)
|
||||||
|
push!(dest.incoming_arcs, arc)
|
||||||
|
push!(arcs, arc)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return Graph(
|
||||||
|
process_nodes,
|
||||||
|
plant_shipping_nodes,
|
||||||
|
collection_shipping_nodes,
|
||||||
|
arcs,
|
||||||
|
name_to_process_node_map,
|
||||||
|
collection_center_to_node,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function print_graph_stats(instance::Instance, graph::Graph)::Nothing
|
||||||
|
@info @sprintf(" %12d time periods", instance.time)
|
||||||
|
@info @sprintf(" %12d process nodes", length(graph.process_nodes))
|
||||||
|
@info @sprintf(" %12d shipping nodes (plant)", length(graph.plant_shipping_nodes))
|
||||||
|
@info @sprintf(
|
||||||
|
" %12d shipping nodes (collection)",
|
||||||
|
length(graph.collection_shipping_nodes)
|
||||||
|
)
|
||||||
|
@info @sprintf(" %12d arcs", length(graph.arcs))
|
||||||
|
return
|
||||||
|
end
|
||||||
11
src/graph/csv.jl
Normal file
11
src/graph/csv.jl
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
function to_csv(graph::Graph)
|
||||||
|
result = ""
|
||||||
|
for a in graph.arcs
|
||||||
|
result *= "$(a.source.index),$(a.dest.index)\n"
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
46
src/graph/structs.jl
Normal file
46
src/graph/structs.jl
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
using Geodesy
|
||||||
|
|
||||||
|
abstract type Node end
|
||||||
|
|
||||||
|
mutable struct Arc
|
||||||
|
index::Int
|
||||||
|
source::Node
|
||||||
|
dest::Node
|
||||||
|
values::Dict{String,Float64}
|
||||||
|
end
|
||||||
|
|
||||||
|
mutable struct ProcessNode <: Node
|
||||||
|
index::Int
|
||||||
|
location::Plant
|
||||||
|
incoming_arcs::Vector{Arc}
|
||||||
|
outgoing_arcs::Vector{Arc}
|
||||||
|
end
|
||||||
|
|
||||||
|
mutable struct ShippingNode <: Node
|
||||||
|
index::Int
|
||||||
|
location::Union{Plant,CollectionCenter}
|
||||||
|
product::Product
|
||||||
|
incoming_arcs::Vector{Arc}
|
||||||
|
outgoing_arcs::Vector{Arc}
|
||||||
|
end
|
||||||
|
|
||||||
|
mutable struct Graph
|
||||||
|
process_nodes::Vector{ProcessNode}
|
||||||
|
plant_shipping_nodes::Vector{ShippingNode}
|
||||||
|
collection_shipping_nodes::Vector{ShippingNode}
|
||||||
|
arcs::Vector{Arc}
|
||||||
|
name_to_process_node_map::Dict{Tuple{AbstractString,AbstractString},ProcessNode}
|
||||||
|
collection_center_to_node::Dict{CollectionCenter,ShippingNode}
|
||||||
|
end
|
||||||
|
|
||||||
|
function Base.show(io::IO, instance::Graph)
|
||||||
|
print(io, "RELOG graph with ")
|
||||||
|
print(io, "$(length(instance.process_nodes)) process nodes, ")
|
||||||
|
print(io, "$(length(instance.plant_shipping_nodes)) plant shipping nodes, ")
|
||||||
|
print(io, "$(length(instance.collection_shipping_nodes)) collection shipping nodes, ")
|
||||||
|
print(io, "$(length(instance.arcs)) arcs")
|
||||||
|
end
|
||||||
101
src/instance/compress.jl
Normal file
101
src/instance/compress.jl
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
using DataStructures
|
||||||
|
using JSON
|
||||||
|
using JSONSchema
|
||||||
|
using Printf
|
||||||
|
using Statistics
|
||||||
|
|
||||||
|
"""
|
||||||
|
_compress(instance::Instance)
|
||||||
|
|
||||||
|
Create a single-period instance from a multi-period one. Specifically,
|
||||||
|
replaces every time-dependent attribute, such as initial_amounts,
|
||||||
|
by a list with a single element, which is either a sum, an average,
|
||||||
|
or something else that makes sense to that specific attribute.
|
||||||
|
"""
|
||||||
|
function _compress(instance::Instance)::Instance
|
||||||
|
T = instance.time
|
||||||
|
compressed = deepcopy(instance)
|
||||||
|
compressed.time = 1
|
||||||
|
compressed.building_period = [1]
|
||||||
|
|
||||||
|
# Compress products
|
||||||
|
for p in compressed.products
|
||||||
|
p.transportation_cost = [mean(p.transportation_cost)]
|
||||||
|
p.transportation_energy = [mean(p.transportation_energy)]
|
||||||
|
for (emission_name, emission_value) in p.transportation_emissions
|
||||||
|
p.transportation_emissions[emission_name] = [mean(emission_value)]
|
||||||
|
end
|
||||||
|
p.disposal_limit = [maximum(p.disposal_limit) * T]
|
||||||
|
p.disposal_cost = [mean(p.disposal_cost)]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Compress collection centers
|
||||||
|
for c in compressed.collection_centers
|
||||||
|
c.amount = [maximum(c.amount) * T]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Compress plants
|
||||||
|
for plant in compressed.plants
|
||||||
|
plant.energy = [mean(plant.energy)]
|
||||||
|
for (emission_name, emission_value) in plant.emissions
|
||||||
|
plant.emissions[emission_name] = [mean(emission_value)]
|
||||||
|
end
|
||||||
|
for s in plant.sizes
|
||||||
|
s.capacity *= T
|
||||||
|
s.variable_operating_cost = [mean(s.variable_operating_cost)]
|
||||||
|
s.opening_cost = [s.opening_cost[1]]
|
||||||
|
s.fixed_operating_cost = [sum(s.fixed_operating_cost)]
|
||||||
|
end
|
||||||
|
for (prod_name, disp_limit) in plant.disposal_limit
|
||||||
|
plant.disposal_limit[prod_name] = [sum(disp_limit)]
|
||||||
|
end
|
||||||
|
for (prod_name, disp_cost) in plant.disposal_cost
|
||||||
|
plant.disposal_cost[prod_name] = [mean(disp_cost)]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return compressed
|
||||||
|
end
|
||||||
|
|
||||||
|
function _slice(instance::Instance, T::UnitRange)::Instance
|
||||||
|
sliced = deepcopy(instance)
|
||||||
|
sliced.time = length(T)
|
||||||
|
|
||||||
|
for p in sliced.products
|
||||||
|
p.transportation_cost = p.transportation_cost[T]
|
||||||
|
p.transportation_energy = p.transportation_energy[T]
|
||||||
|
for (emission_name, emission_value) in p.transportation_emissions
|
||||||
|
p.transportation_emissions[emission_name] = emission_value[T]
|
||||||
|
end
|
||||||
|
p.disposal_limit = p.disposal_limit[T]
|
||||||
|
p.disposal_cost = p.disposal_cost[T]
|
||||||
|
end
|
||||||
|
|
||||||
|
for c in sliced.collection_centers
|
||||||
|
c.amount = c.amount[T]
|
||||||
|
end
|
||||||
|
|
||||||
|
for plant in sliced.plants
|
||||||
|
plant.energy = plant.energy[T]
|
||||||
|
for (emission_name, emission_value) in plant.emissions
|
||||||
|
plant.emissions[emission_name] = emission_value[T]
|
||||||
|
end
|
||||||
|
for s in plant.sizes
|
||||||
|
s.variable_operating_cost = s.variable_operating_cost[T]
|
||||||
|
s.opening_cost = s.opening_cost[T]
|
||||||
|
s.fixed_operating_cost = s.fixed_operating_cost[T]
|
||||||
|
end
|
||||||
|
for (prod_name, disp_limit) in plant.disposal_limit
|
||||||
|
plant.disposal_limit[prod_name] = disp_limit[T]
|
||||||
|
end
|
||||||
|
for (prod_name, disp_cost) in plant.disposal_cost
|
||||||
|
plant.disposal_cost[prod_name] = disp_cost[T]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return sliced
|
||||||
|
end
|
||||||
212
src/instance/geodb.jl
Normal file
212
src/instance/geodb.jl
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
using CRC
|
||||||
|
using CSV
|
||||||
|
using DataFrames
|
||||||
|
using Shapefile
|
||||||
|
using Statistics
|
||||||
|
using ZipFile
|
||||||
|
using ProgressBars
|
||||||
|
using OrderedCollections
|
||||||
|
|
||||||
|
import Downloads: download
|
||||||
|
import Base: parse
|
||||||
|
|
||||||
|
crc32 = crc(CRC_32)
|
||||||
|
|
||||||
|
struct GeoPoint
|
||||||
|
lat::Float64
|
||||||
|
lon::Float64
|
||||||
|
end
|
||||||
|
|
||||||
|
struct GeoRegion
|
||||||
|
centroid::GeoPoint
|
||||||
|
population::Int
|
||||||
|
GeoRegion(; centroid, population) = new(centroid, population)
|
||||||
|
end
|
||||||
|
|
||||||
|
DB_CACHE = Dict{String,Dict{String,GeoRegion}}()
|
||||||
|
|
||||||
|
function centroid(geom::Shapefile.Polygon)::GeoPoint
|
||||||
|
x_max, x_min, y_max, y_min = -Inf, Inf, -Inf, Inf
|
||||||
|
for p in geom.points
|
||||||
|
x_max = max(x_max, p.x)
|
||||||
|
x_min = min(x_min, p.x)
|
||||||
|
y_max = max(y_max, p.y)
|
||||||
|
y_min = min(y_min, p.y)
|
||||||
|
end
|
||||||
|
x_center = (x_max + x_min) / 2.0
|
||||||
|
y_center = (y_max + y_min) / 2.0
|
||||||
|
return GeoPoint(round(y_center, digits = 5), round(x_center, digits = 5))
|
||||||
|
end
|
||||||
|
|
||||||
|
function _download_file(url, output, expected_crc32)::Nothing
|
||||||
|
if isfile(output)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
mkpath(dirname(output))
|
||||||
|
@info "Downloading: $url"
|
||||||
|
fname = download(url)
|
||||||
|
actual_crc32 = open(crc32, fname)
|
||||||
|
expected_crc32 == actual_crc32 || error("CRC32 mismatch")
|
||||||
|
cp(fname, output)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
function _download_zip(url, outputdir, expected_output_file, expected_crc32)::Nothing
|
||||||
|
if isfile(expected_output_file)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
mkpath(outputdir)
|
||||||
|
@info "Downloading: $url"
|
||||||
|
zip_filename = download(url)
|
||||||
|
actual_crc32 = open(crc32, zip_filename)
|
||||||
|
expected_crc32 == actual_crc32 || error("CRC32 mismatch")
|
||||||
|
open(zip_filename) do zip_file
|
||||||
|
zr = ZipFile.Reader(zip_file)
|
||||||
|
for file in zr.files
|
||||||
|
open(joinpath(outputdir, file.name), "w") do output_file
|
||||||
|
write(output_file, read(file))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
function _geodb_load_gov_census(;
|
||||||
|
db_name,
|
||||||
|
extract_cols,
|
||||||
|
shp_crc32,
|
||||||
|
shp_filename,
|
||||||
|
shp_url,
|
||||||
|
population_url,
|
||||||
|
population_crc32,
|
||||||
|
population_col,
|
||||||
|
population_preprocess,
|
||||||
|
population_join,
|
||||||
|
)::Dict{String,GeoRegion}
|
||||||
|
basedir = joinpath(dirname(@__FILE__), "..", "..", "data", db_name)
|
||||||
|
csv_filename = "$basedir/locations.csv"
|
||||||
|
if !isfile(csv_filename)
|
||||||
|
# Download required files
|
||||||
|
_download_zip(shp_url, basedir, joinpath(basedir, shp_filename), shp_crc32)
|
||||||
|
_download_file(population_url, "$basedir/population.csv", population_crc32)
|
||||||
|
|
||||||
|
# Read shapefile
|
||||||
|
@info "Processing: $shp_filename"
|
||||||
|
table = Shapefile.Table(joinpath(basedir, shp_filename))
|
||||||
|
geoms = Shapefile.shapes(table)
|
||||||
|
|
||||||
|
# Build empty dataframe
|
||||||
|
df = DataFrame()
|
||||||
|
cols = extract_cols(table, 1)
|
||||||
|
for k in keys(cols)
|
||||||
|
df[!, k] = []
|
||||||
|
end
|
||||||
|
df[!, "latitude"] = Float64[]
|
||||||
|
df[!, "longitude"] = Float64[]
|
||||||
|
|
||||||
|
# Add regions to dataframe
|
||||||
|
for (i, geom) in tqdm(enumerate(geoms))
|
||||||
|
c = centroid(geom)
|
||||||
|
cols = extract_cols(table, i)
|
||||||
|
push!(df, [values(cols)..., c.lat, c.lon])
|
||||||
|
end
|
||||||
|
sort!(df)
|
||||||
|
|
||||||
|
# Join with population data
|
||||||
|
population = DataFrame(CSV.File("$basedir/population.csv"))
|
||||||
|
population_preprocess(population)
|
||||||
|
population = population[:, [population_join, population_col]]
|
||||||
|
rename!(population, population_col => "population")
|
||||||
|
df = leftjoin(df, population, on = population_join)
|
||||||
|
|
||||||
|
# Write output
|
||||||
|
CSV.write(csv_filename, df)
|
||||||
|
end
|
||||||
|
if db_name ∉ keys(DB_CACHE)
|
||||||
|
csv = CSV.File(csv_filename)
|
||||||
|
DB_CACHE[db_name] = Dict(
|
||||||
|
string(row.id) => GeoRegion(
|
||||||
|
centroid = GeoPoint(row.latitude, row.longitude),
|
||||||
|
population = (row.population === missing ? 0 : row.population),
|
||||||
|
) for row in csv
|
||||||
|
)
|
||||||
|
end
|
||||||
|
return DB_CACHE[db_name]
|
||||||
|
end
|
||||||
|
|
||||||
|
# 2018 US counties
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
function _extract_cols_2018_us_county(
|
||||||
|
table::Shapefile.Table,
|
||||||
|
i::Int,
|
||||||
|
)::OrderedDict{String,Any}
|
||||||
|
return OrderedDict(
|
||||||
|
"id" => table.STATEFP[i] * table.COUNTYFP[i],
|
||||||
|
"statefp" => table.STATEFP[i],
|
||||||
|
"countyfp" => table.COUNTYFP[i],
|
||||||
|
"name" => table.NAME[i],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
function _population_preprocess_2018_us_county(df)
|
||||||
|
df[!, "id"] = [@sprintf("%02d%03d", row.STATE, row.COUNTY) for row in eachrow(df)]
|
||||||
|
end
|
||||||
|
|
||||||
|
function _geodb_load_2018_us_county()::Dict{String,GeoRegion}
|
||||||
|
return _geodb_load_gov_census(
|
||||||
|
db_name = "2018-us-county",
|
||||||
|
extract_cols = _extract_cols_2018_us_county,
|
||||||
|
shp_crc32 = 0x83eaec6d,
|
||||||
|
shp_filename = "cb_2018_us_county_500k.shp",
|
||||||
|
shp_url = "https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_county_500k.zip",
|
||||||
|
population_url = "https://www2.census.gov/programs-surveys/popest/datasets/2010-2019/counties/totals/co-est2019-alldata.csv",
|
||||||
|
population_crc32 = 0xf85b0405,
|
||||||
|
population_col = "POPESTIMATE2019",
|
||||||
|
population_join = "id",
|
||||||
|
population_preprocess = _population_preprocess_2018_us_county,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# US States
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
function _extract_cols_us_state(table::Shapefile.Table, i::Int)::OrderedDict{String,Any}
|
||||||
|
return OrderedDict(
|
||||||
|
"id" => table.STUSPS[i],
|
||||||
|
"statefp" => parse(Int, table.STATEFP[i]),
|
||||||
|
"name" => table.NAME[i],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
function _population_preprocess_us_state(df)
|
||||||
|
rename!(df, "STATE" => "statefp")
|
||||||
|
end
|
||||||
|
|
||||||
|
function _geodb_load_us_state()::Dict{String,GeoRegion}
|
||||||
|
return _geodb_load_gov_census(
|
||||||
|
db_name = "us-state",
|
||||||
|
extract_cols = _extract_cols_us_state,
|
||||||
|
shp_crc32 = 0x9469e5ca,
|
||||||
|
shp_filename = "cb_2018_us_state_500k.shp",
|
||||||
|
shp_url = "https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_state_500k.zip",
|
||||||
|
population_url = "http://www2.census.gov/programs-surveys/popest/datasets/2010-2019/national/totals/nst-est2019-alldata.csv",
|
||||||
|
population_crc32 = 0x191cc64c,
|
||||||
|
population_col = "POPESTIMATE2019",
|
||||||
|
population_join = "statefp",
|
||||||
|
population_preprocess = _population_preprocess_us_state,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
function geodb_load(db_name::AbstractString)::Dict{String,GeoRegion}
|
||||||
|
db_name == "2018-us-county" && return _geodb_load_2018_us_county()
|
||||||
|
db_name == "us-state" && return _geodb_load_us_state()
|
||||||
|
error("Unknown database: $db_name")
|
||||||
|
end
|
||||||
|
|
||||||
|
function geodb_query(name)::GeoRegion
|
||||||
|
db_name, id = split(name, ":")
|
||||||
|
return geodb_load(db_name)[id]
|
||||||
|
end
|
||||||
@@ -1,142 +1,201 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
using DataStructures
|
||||||
using JSON
|
using JSON
|
||||||
using OrderedCollections
|
using JSONSchema
|
||||||
|
using Printf
|
||||||
|
using Statistics
|
||||||
|
|
||||||
function parsefile(path::String)::Instance
|
function parsefile(path::String)::Instance
|
||||||
return RELOG.parse(JSON.parsefile(path, dicttype = () -> OrderedDict()))
|
return RELOG.parse(JSON.parsefile(path))
|
||||||
end
|
end
|
||||||
|
|
||||||
function parse(json)::Instance
|
function parse(json)::Instance
|
||||||
# Read parameters
|
basedir = dirname(@__FILE__)
|
||||||
time_horizon = json["parameters"]["time horizon (years)"]
|
json_schema = JSON.parsefile("$basedir/../schemas/input.json")
|
||||||
building_period = json["parameters"]["building period (years)"]
|
validate(json, Schema(json_schema))
|
||||||
|
|
||||||
# Read distance metric
|
T = json["parameters"]["time horizon (years)"]
|
||||||
distance_metric_str = lowercase(json["parameters"]["distance metric"])
|
json_schema["definitions"]["TimeSeries"]["minItems"] = T
|
||||||
if distance_metric_str == "driving"
|
json_schema["definitions"]["TimeSeries"]["maxItems"] = T
|
||||||
distance_metric = KnnDrivingDistance()
|
validate(json, Schema(json_schema))
|
||||||
elseif distance_metric_str == "euclidean"
|
|
||||||
distance_metric = EuclideanDistance()
|
|
||||||
else
|
|
||||||
error("Invalid distance metric: $distance_metric_str")
|
|
||||||
end
|
|
||||||
|
|
||||||
timeseries(::Nothing; null_val = nothing) = repeat([null_val], time_horizon)
|
building_period = [1]
|
||||||
timeseries(x::Number; null_val = nothing) = repeat([x], time_horizon)
|
if "building period (years)" in keys(json)
|
||||||
timeseries(x::Array; null_val = nothing) = [xi === nothing ? null_val : xi for xi in x]
|
building_period = json["building period (years)"]
|
||||||
timeseries(d::OrderedDict; null_val = nothing) =
|
|
||||||
OrderedDict(k => timeseries(v; null_val) for (k, v) in d)
|
|
||||||
|
|
||||||
# Read products
|
|
||||||
products = Product[]
|
|
||||||
products_by_name = OrderedDict{String,Product}()
|
|
||||||
for (name, pdict) in json["products"]
|
|
||||||
tr_cost = timeseries(pdict["transportation cost (\$/km/tonne)"])
|
|
||||||
tr_energy = timeseries(pdict["transportation energy (J/km/tonne)"])
|
|
||||||
tr_emissions = timeseries(pdict["transportation emissions (tonne/km/tonne)"])
|
|
||||||
disposal_limit = timeseries(pdict["disposal limit (tonne)"], null_val = Inf)
|
|
||||||
prod = Product(; name, tr_cost, tr_energy, tr_emissions, disposal_limit)
|
|
||||||
push!(products, prod)
|
|
||||||
products_by_name[name] = prod
|
|
||||||
end
|
|
||||||
|
|
||||||
# Read centers
|
|
||||||
centers = Center[]
|
|
||||||
centers_by_name = OrderedDict{String,Center}()
|
|
||||||
for (name, cdict) in json["centers"]
|
|
||||||
latitude = cdict["latitude (deg)"]
|
|
||||||
longitude = cdict["longitude (deg)"]
|
|
||||||
input = nothing
|
|
||||||
revenue = [0.0 for t = 1:time_horizon]
|
|
||||||
if cdict["input"] !== nothing
|
|
||||||
input = products_by_name[cdict["input"]]
|
|
||||||
revenue = timeseries(cdict["revenue (\$/tonne)"])
|
|
||||||
end
|
|
||||||
outputs = [products_by_name[p] for p in cdict["outputs"]]
|
|
||||||
operating_cost = timeseries(cdict["operating cost (\$)"])
|
|
||||||
prod_dict(key, null_val) =
|
|
||||||
OrderedDict(p => timeseries(cdict[key][p.name]; null_val) for p in outputs)
|
|
||||||
fixed_output = prod_dict("fixed output (tonne)", 0.0)
|
|
||||||
var_output = prod_dict("variable output (tonne/tonne)", 0.0)
|
|
||||||
collection_cost = prod_dict("collection cost (\$/tonne)", 0.0)
|
|
||||||
disposal_limit = prod_dict("disposal limit (tonne)", Inf)
|
|
||||||
disposal_cost = prod_dict("disposal cost (\$/tonne)", 0.0)
|
|
||||||
|
|
||||||
center = Center(;
|
|
||||||
name,
|
|
||||||
latitude,
|
|
||||||
longitude,
|
|
||||||
input,
|
|
||||||
outputs,
|
|
||||||
revenue,
|
|
||||||
operating_cost,
|
|
||||||
fixed_output,
|
|
||||||
var_output,
|
|
||||||
collection_cost,
|
|
||||||
disposal_cost,
|
|
||||||
disposal_limit,
|
|
||||||
)
|
|
||||||
push!(centers, center)
|
|
||||||
centers_by_name[name] = center
|
|
||||||
end
|
end
|
||||||
|
|
||||||
plants = Plant[]
|
plants = Plant[]
|
||||||
plants_by_name = OrderedDict{String,Plant}()
|
products = Product[]
|
||||||
for (name, pdict) in json["plants"]
|
collection_centers = CollectionCenter[]
|
||||||
prod_dict(key; scale = 1.0, null_val = Inf) = OrderedDict{Product,Vector{Float64}}(
|
prod_name_to_product = Dict{String,Product}()
|
||||||
products_by_name[p] => [
|
|
||||||
v === nothing ? null_val : v * scale for v in timeseries(pdict[key][p])
|
|
||||||
] for p in keys(pdict[key])
|
|
||||||
)
|
|
||||||
|
|
||||||
latitude = pdict["latitude (deg)"]
|
# Create products
|
||||||
longitude = pdict["longitude (deg)"]
|
for (product_name, product_dict) in json["products"]
|
||||||
input_mix = prod_dict("input mix (%)", scale = 0.01)
|
cost = product_dict["transportation cost (\$/km/tonne)"]
|
||||||
output = prod_dict("output (tonne)")
|
energy = zeros(T)
|
||||||
emissions = timeseries(pdict["processing emissions (tonne)"])
|
emissions = Dict()
|
||||||
storage_cost = prod_dict("storage cost (\$/tonne)")
|
disposal_limit = zeros(T)
|
||||||
storage_limit = prod_dict("storage limit (tonne)")
|
disposal_cost = zeros(T)
|
||||||
disposal_cost = prod_dict("disposal cost (\$/tonne)")
|
|
||||||
disposal_limit = prod_dict("disposal limit (tonne)")
|
if "transportation energy (J/km/tonne)" in keys(product_dict)
|
||||||
initial_capacity = pdict["initial capacity (tonne)"]
|
energy = product_dict["transportation energy (J/km/tonne)"]
|
||||||
capacities = PlantCapacity[]
|
end
|
||||||
for cdict in pdict["capacities"]
|
|
||||||
size = cdict["size (tonne)"]
|
if "transportation emissions (tonne/km/tonne)" in keys(product_dict)
|
||||||
opening_cost = timeseries(cdict["opening cost (\$)"])
|
emissions = product_dict["transportation emissions (tonne/km/tonne)"]
|
||||||
fix_operating_cost = timeseries(cdict["fixed operating cost (\$)"])
|
end
|
||||||
var_operating_cost = timeseries(cdict["variable operating cost (\$/tonne)"])
|
|
||||||
push!(
|
if "disposal limit (tonne)" in keys(product_dict)
|
||||||
capacities,
|
disposal_limit = product_dict["disposal limit (tonne)"]
|
||||||
PlantCapacity(; size, opening_cost, fix_operating_cost, var_operating_cost),
|
end
|
||||||
|
|
||||||
|
if "disposal cost (\$/tonne)" in keys(product_dict)
|
||||||
|
disposal_cost = product_dict["disposal cost (\$/tonne)"]
|
||||||
|
end
|
||||||
|
|
||||||
|
prod_centers = []
|
||||||
|
|
||||||
|
product = Product(
|
||||||
|
product_name,
|
||||||
|
cost,
|
||||||
|
energy,
|
||||||
|
emissions,
|
||||||
|
disposal_limit,
|
||||||
|
disposal_cost,
|
||||||
|
prod_centers,
|
||||||
|
)
|
||||||
|
push!(products, product)
|
||||||
|
prod_name_to_product[product_name] = product
|
||||||
|
|
||||||
|
# Create collection centers
|
||||||
|
if "initial amounts" in keys(product_dict)
|
||||||
|
for (center_name, center_dict) in product_dict["initial amounts"]
|
||||||
|
if "location" in keys(center_dict)
|
||||||
|
region = geodb_query(center_dict["location"])
|
||||||
|
center_dict["latitude (deg)"] = region.centroid.lat
|
||||||
|
center_dict["longitude (deg)"] = region.centroid.lon
|
||||||
|
end
|
||||||
|
center = CollectionCenter(
|
||||||
|
length(collection_centers) + 1,
|
||||||
|
center_name,
|
||||||
|
center_dict["latitude (deg)"],
|
||||||
|
center_dict["longitude (deg)"],
|
||||||
|
product,
|
||||||
|
center_dict["amount (tonne)"],
|
||||||
|
)
|
||||||
|
push!(prod_centers, center)
|
||||||
|
push!(collection_centers, center)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Create plants
|
||||||
|
for (plant_name, plant_dict) in json["plants"]
|
||||||
|
input = prod_name_to_product[plant_dict["input"]]
|
||||||
|
output = Dict()
|
||||||
|
|
||||||
|
# Plant outputs
|
||||||
|
if "outputs (tonne/tonne)" in keys(plant_dict)
|
||||||
|
output = Dict(
|
||||||
|
prod_name_to_product[key] => value for
|
||||||
|
(key, value) in plant_dict["outputs (tonne/tonne)"] if value > 0
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
plant = Plant(;
|
energy = zeros(T)
|
||||||
name,
|
emissions = Dict()
|
||||||
latitude,
|
|
||||||
longitude,
|
if "energy (GJ/tonne)" in keys(plant_dict)
|
||||||
input_mix,
|
energy = plant_dict["energy (GJ/tonne)"]
|
||||||
output,
|
end
|
||||||
emissions,
|
|
||||||
storage_cost,
|
if "emissions (tonne/tonne)" in keys(plant_dict)
|
||||||
storage_limit,
|
emissions = plant_dict["emissions (tonne/tonne)"]
|
||||||
disposal_cost,
|
end
|
||||||
disposal_limit,
|
|
||||||
capacities,
|
for (location_name, location_dict) in plant_dict["locations"]
|
||||||
initial_capacity,
|
sizes = PlantSize[]
|
||||||
)
|
disposal_limit = Dict(p => [0.0 for t = 1:T] for p in keys(output))
|
||||||
push!(plants, plant)
|
disposal_cost = Dict(p => [0.0 for t = 1:T] for p in keys(output))
|
||||||
plants_by_name[name] = plant
|
|
||||||
|
# GeoDB
|
||||||
|
if "location" in keys(location_dict)
|
||||||
|
region = geodb_query(location_dict["location"])
|
||||||
|
location_dict["latitude (deg)"] = region.centroid.lat
|
||||||
|
location_dict["longitude (deg)"] = region.centroid.lon
|
||||||
|
end
|
||||||
|
|
||||||
|
# Disposal
|
||||||
|
if "disposal" in keys(location_dict)
|
||||||
|
for (product_name, disposal_dict) in location_dict["disposal"]
|
||||||
|
limit = [1e8 for t = 1:T]
|
||||||
|
if "limit (tonne)" in keys(disposal_dict)
|
||||||
|
limit = disposal_dict["limit (tonne)"]
|
||||||
|
end
|
||||||
|
disposal_limit[prod_name_to_product[product_name]] = limit
|
||||||
|
disposal_cost[prod_name_to_product[product_name]] =
|
||||||
|
disposal_dict["cost (\$/tonne)"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Capacities
|
||||||
|
for (capacity_name, capacity_dict) in location_dict["capacities (tonne)"]
|
||||||
|
push!(
|
||||||
|
sizes,
|
||||||
|
PlantSize(
|
||||||
|
Base.parse(Float64, capacity_name),
|
||||||
|
capacity_dict["variable operating cost (\$/tonne)"],
|
||||||
|
capacity_dict["fixed operating cost (\$)"],
|
||||||
|
capacity_dict["opening cost (\$)"],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
end
|
||||||
|
length(sizes) > 1 || push!(sizes, sizes[1])
|
||||||
|
sort!(sizes, by = x -> x.capacity)
|
||||||
|
|
||||||
|
# Storage
|
||||||
|
storage_limit = 0
|
||||||
|
storage_cost = zeros(T)
|
||||||
|
if "storage" in keys(location_dict)
|
||||||
|
storage_dict = location_dict["storage"]
|
||||||
|
storage_limit = storage_dict["limit (tonne)"]
|
||||||
|
storage_cost = storage_dict["cost (\$/tonne)"]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Validation: Capacities
|
||||||
|
if length(sizes) != 2
|
||||||
|
throw("At most two capacities are supported")
|
||||||
|
end
|
||||||
|
if sizes[1].variable_operating_cost != sizes[2].variable_operating_cost
|
||||||
|
throw("Variable operating costs must be the same for all capacities")
|
||||||
|
end
|
||||||
|
|
||||||
|
plant = Plant(
|
||||||
|
length(plants) + 1,
|
||||||
|
plant_name,
|
||||||
|
location_name,
|
||||||
|
input,
|
||||||
|
output,
|
||||||
|
location_dict["latitude (deg)"],
|
||||||
|
location_dict["longitude (deg)"],
|
||||||
|
disposal_limit,
|
||||||
|
disposal_cost,
|
||||||
|
sizes,
|
||||||
|
energy,
|
||||||
|
emissions,
|
||||||
|
storage_limit,
|
||||||
|
storage_cost,
|
||||||
|
)
|
||||||
|
|
||||||
|
push!(plants, plant)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return Instance(;
|
@info @sprintf("%12d collection centers", length(collection_centers))
|
||||||
time_horizon,
|
@info @sprintf("%12d candidate plant locations", length(plants))
|
||||||
building_period,
|
|
||||||
distance_metric,
|
return Instance(T, products, collection_centers, plants, building_period)
|
||||||
products,
|
|
||||||
products_by_name,
|
|
||||||
centers,
|
|
||||||
centers_by_name,
|
|
||||||
plants,
|
|
||||||
plants_by_name,
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,67 +1,60 @@
|
|||||||
using OrderedCollections
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
abstract type DistanceMetric end
|
using DataStructures
|
||||||
|
using JSON
|
||||||
|
using JSONSchema
|
||||||
|
using Printf
|
||||||
|
using Statistics
|
||||||
|
|
||||||
Base.@kwdef mutable struct KnnDrivingDistance <: DistanceMetric
|
mutable struct Product
|
||||||
tree = nothing
|
|
||||||
ratios = nothing
|
|
||||||
end
|
|
||||||
|
|
||||||
mutable struct EuclideanDistance <: DistanceMetric end
|
|
||||||
|
|
||||||
Base.@kwdef struct Product
|
|
||||||
name::String
|
name::String
|
||||||
tr_cost::Vector{Float64}
|
transportation_cost::Vector{Float64}
|
||||||
tr_energy::Vector{Float64}
|
transportation_energy::Vector{Float64}
|
||||||
tr_emissions::OrderedDict{String,Vector{Float64}}
|
transportation_emissions::Dict{String,Vector{Float64}}
|
||||||
disposal_limit::Vector{Float64}
|
disposal_limit::Vector{Float64}
|
||||||
|
disposal_cost::Vector{Float64}
|
||||||
|
collection_centers::Vector
|
||||||
end
|
end
|
||||||
|
|
||||||
Base.@kwdef struct Center
|
mutable struct CollectionCenter
|
||||||
|
index::Int64
|
||||||
name::String
|
name::String
|
||||||
latitude::Float64
|
latitude::Float64
|
||||||
longitude::Float64
|
longitude::Float64
|
||||||
input::Union{Product,Nothing}
|
product::Product
|
||||||
outputs::Vector{Product}
|
amount::Vector{Float64}
|
||||||
fixed_output::OrderedDict{Product,Vector{Float64}}
|
|
||||||
var_output::OrderedDict{Product,Vector{Float64}}
|
|
||||||
revenue::Vector{Float64}
|
|
||||||
collection_cost::OrderedDict{Product,Vector{Float64}}
|
|
||||||
operating_cost::Vector{Float64}
|
|
||||||
disposal_limit::OrderedDict{Product,Vector{Float64}}
|
|
||||||
disposal_cost::OrderedDict{Product,Vector{Float64}}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Base.@kwdef struct PlantCapacity
|
mutable struct PlantSize
|
||||||
size::Float64
|
capacity::Float64
|
||||||
|
variable_operating_cost::Vector{Float64}
|
||||||
|
fixed_operating_cost::Vector{Float64}
|
||||||
opening_cost::Vector{Float64}
|
opening_cost::Vector{Float64}
|
||||||
fix_operating_cost::Vector{Float64}
|
|
||||||
var_operating_cost::Vector{Float64}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Base.@kwdef struct Plant
|
mutable struct Plant
|
||||||
name::String
|
index::Int64
|
||||||
|
plant_name::String
|
||||||
|
location_name::String
|
||||||
|
input::Product
|
||||||
|
output::Dict{Product,Float64}
|
||||||
latitude::Float64
|
latitude::Float64
|
||||||
longitude::Float64
|
longitude::Float64
|
||||||
input_mix::OrderedDict{Product,Vector{Float64}}
|
disposal_limit::Dict{Product,Vector{Float64}}
|
||||||
output::OrderedDict{Product,Vector{Float64}}
|
disposal_cost::Dict{Product,Vector{Float64}}
|
||||||
emissions::OrderedDict{String,Vector{Float64}}
|
sizes::Vector{PlantSize}
|
||||||
storage_cost::OrderedDict{Product,Vector{Float64}}
|
energy::Vector{Float64}
|
||||||
storage_limit::OrderedDict{Product,Vector{Float64}}
|
emissions::Dict{String,Vector{Float64}}
|
||||||
disposal_cost::OrderedDict{Product,Vector{Float64}}
|
storage_limit::Float64
|
||||||
disposal_limit::OrderedDict{Product,Vector{Float64}}
|
storage_cost::Vector{Float64}
|
||||||
capacities::Vector{PlantCapacity}
|
|
||||||
initial_capacity::Float64
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Base.@kwdef struct Instance
|
mutable struct Instance
|
||||||
building_period::Vector{Int}
|
time::Int64
|
||||||
centers_by_name::OrderedDict{String,Center}
|
|
||||||
centers::Vector{Center}
|
|
||||||
distance_metric::DistanceMetric
|
|
||||||
products_by_name::OrderedDict{String,Product}
|
|
||||||
products::Vector{Product}
|
products::Vector{Product}
|
||||||
time_horizon::Int
|
collection_centers::Vector{CollectionCenter}
|
||||||
plants::Vector{Plant}
|
plants::Vector{Plant}
|
||||||
plants_by_name::OrderedDict{String,Plant}
|
building_period::Vector{Int64}
|
||||||
end
|
end
|
||||||
|
|||||||
21
src/instance/validate.jl
Normal file
21
src/instance/validate.jl
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
using DataStructures
|
||||||
|
using JSON
|
||||||
|
using JSONSchema
|
||||||
|
using Printf
|
||||||
|
using Statistics
|
||||||
|
|
||||||
|
function validate(json, schema)
|
||||||
|
result = JSONSchema.validate(json, schema)
|
||||||
|
if result !== nothing
|
||||||
|
if result isa JSONSchema.SingleIssue
|
||||||
|
msg = "$(result.reason) in $(result.path)"
|
||||||
|
else
|
||||||
|
msg = convert(String, result)
|
||||||
|
end
|
||||||
|
throw("Error parsing input file: $(msg)")
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,333 +1,364 @@
|
|||||||
using JuMP
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
function build_model(instance::Instance; optimizer, variable_names::Bool = false)
|
using JuMP, LinearAlgebra, Geodesy, ProgressBars, Printf, DataStructures, StochasticPrograms
|
||||||
model = JuMP.Model(optimizer)
|
|
||||||
centers = instance.centers
|
|
||||||
products = instance.products
|
|
||||||
plants = instance.plants
|
|
||||||
T = 1:instance.time_horizon
|
|
||||||
model.ext[:instance] = instance
|
|
||||||
|
|
||||||
# Transportation edges
|
function build_model(
|
||||||
# -------------------------------------------------------------------------
|
instance::Instance,
|
||||||
|
graph::Graph,
|
||||||
# Connectivity
|
optimizer,
|
||||||
model.ext[:E] = E = []
|
)
|
||||||
model.ext[:E_in] = E_in = Dict(src => [] for src in plants ∪ centers)
|
return build_model(
|
||||||
model.ext[:E_out] = E_out = Dict(src => [] for src in plants ∪ centers)
|
instance,
|
||||||
|
[graph],
|
||||||
function push_edge!(src, dst, m)
|
[1.0],
|
||||||
push!(E, (src, dst, m))
|
optimizer=optimizer,
|
||||||
push!(E_out[src], (dst, m))
|
method=:ef,
|
||||||
push!(E_in[dst], (src, m))
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
for m in products
|
function build_model(
|
||||||
for p1 in plants
|
instance::Instance,
|
||||||
m ∈ keys(p1.output) || continue
|
graphs::Vector{Graph},
|
||||||
|
probs::Vector{Float64};
|
||||||
# Plant to plant
|
optimizer,
|
||||||
for p2 in plants
|
method=:ef,
|
||||||
p1 != p2 || continue
|
tol=0.1,
|
||||||
m ∈ keys(p2.input_mix) || continue
|
)
|
||||||
push_edge!(p1, p2, m)
|
T = instance.time
|
||||||
end
|
|
||||||
|
@stochastic_model model begin
|
||||||
# Plant to center
|
# Stage 1: Build plants
|
||||||
for c in centers
|
# =====================================================================
|
||||||
m == c.input || continue
|
@stage 1 begin
|
||||||
push_edge!(p1, c, m)
|
pn = graphs[1].process_nodes
|
||||||
end
|
PN = length(pn)
|
||||||
end
|
|
||||||
|
# Var: open_plant
|
||||||
for c1 in centers
|
@decision(
|
||||||
m ∈ c1.outputs || continue
|
model,
|
||||||
|
open_plant[n in 1:PN, t in 1:T],
|
||||||
# Center to plant
|
binary = true,
|
||||||
for p in plants
|
)
|
||||||
m ∈ keys(p.input_mix) || continue
|
|
||||||
push_edge!(c1, p, m)
|
# Var: is_open
|
||||||
end
|
@decision(
|
||||||
|
model,
|
||||||
# Center to center
|
is_open[n in 1:PN, t in 1:T],
|
||||||
for c2 in centers
|
binary = true,
|
||||||
m == c2.input || continue
|
)
|
||||||
push_edge!(c1, c2, m)
|
|
||||||
end
|
# Objective function
|
||||||
end
|
@objective(
|
||||||
end
|
model,
|
||||||
|
Min,
|
||||||
# Distances
|
|
||||||
model.ext[:distances] = distances = Dict()
|
# Opening, fixed operating costs
|
||||||
for (p1, p2, m) in E
|
sum(
|
||||||
d = _calculate_distance(
|
pn[n].location.sizes[1].opening_cost[t] * open_plant[n, t] +
|
||||||
p1.latitude,
|
pn[n].location.sizes[1].fixed_operating_cost[t] * is_open[n, t]
|
||||||
p1.longitude,
|
for n in 1:PN
|
||||||
p2.latitude,
|
for t in 1:T
|
||||||
p2.longitude,
|
),
|
||||||
instance.distance_metric,
|
)
|
||||||
)
|
|
||||||
distances[p1, p2, m] = d
|
for t = 1:T, n in 1:PN
|
||||||
end
|
# Plant is currently open if it was already open in the previous time period or
|
||||||
|
# if it was built just now
|
||||||
# Decision variables
|
if t > 1
|
||||||
# -------------------------------------------------------------------------
|
@constraint(
|
||||||
|
model,
|
||||||
# Plant p is operational at time t
|
is_open[n, t] == is_open[n, t-1] + open_plant[n, t]
|
||||||
x = _init(model, :x)
|
)
|
||||||
for p in plants
|
else
|
||||||
x[p.name, 0] = p.initial_capacity > 0 ? 1 : 0
|
@constraint(model, is_open[n, t] == open_plant[n, t])
|
||||||
end
|
end
|
||||||
for p in plants, t in T
|
|
||||||
x[p.name, t] = @variable(model, binary = true)
|
# Plant can only be opened during building period
|
||||||
end
|
if t ∉ instance.building_period
|
||||||
|
@constraint(model, open_plant[n, t] == 0)
|
||||||
# Amount of product m sent from center/plant u to center/plant v at time T
|
end
|
||||||
y = _init(model, :y)
|
end
|
||||||
for (p1, p2, m) in E, t in T
|
end
|
||||||
y[p1.name, p2.name, m.name, t] = @variable(model, lower_bound = 0)
|
|
||||||
end
|
# Stage 2: Flows, disposal, capacity & storage
|
||||||
|
# =====================================================================
|
||||||
# Amount of product m produced by plant/center at time T
|
@stage 2 begin
|
||||||
z_prod = _init(model, :z_prod)
|
@uncertain graph
|
||||||
for p in plants, m in keys(p.output), t in T
|
pn = graph.process_nodes
|
||||||
z_prod[p.name, m.name, t] = @variable(model, lower_bound = 0)
|
psn = graph.plant_shipping_nodes
|
||||||
end
|
csn = graph.collection_shipping_nodes
|
||||||
|
arcs = graph.arcs
|
||||||
# Amount of product m disposed at plant/center p at time T
|
|
||||||
z_disp = _init(model, :z_disp)
|
A = length(arcs)
|
||||||
for p in plants, m in keys(p.output), t in T
|
PN = length(pn)
|
||||||
z_disp[p.name, m.name, t] = @variable(model, lower_bound = 0)
|
CSN = length(csn)
|
||||||
end
|
PSN = length(psn)
|
||||||
for c in centers, m in c.outputs, t in T
|
|
||||||
z_disp[c.name, m.name, t] = @variable(model, lower_bound = 0)
|
# Var: flow
|
||||||
end
|
@recourse(
|
||||||
|
model,
|
||||||
# Total plant/center input
|
flow[a in 1:A, t in 1:T],
|
||||||
z_input = _init(model, :z_input)
|
lower_bound = 0,
|
||||||
for p in plants, t in T
|
)
|
||||||
z_input[p.name, t] = @variable(model, lower_bound = 0)
|
|
||||||
end
|
# Var: plant_dispose
|
||||||
for c in centers, t in T
|
@recourse(
|
||||||
z_input[c.name, t] = @variable(model, lower_bound = 0)
|
model,
|
||||||
end
|
plant_dispose[n in 1:PSN, t in 1:T],
|
||||||
|
lower_bound = 0,
|
||||||
# Total amount collected by the center
|
upper_bound = psn[n].location.disposal_limit[psn[n].product][t],
|
||||||
z_collected = _init(model, :z_collected)
|
)
|
||||||
for c in centers, m in c.outputs, t in T
|
|
||||||
z_collected[c.name, m.name, t] = @variable(model, lower_bound = 0)
|
# Var: collection_dispose
|
||||||
end
|
@recourse(
|
||||||
|
model,
|
||||||
# Transportation emissions by greenhouse gas
|
collection_dispose[n in 1:CSN, t in 1:T],
|
||||||
z_tr_em = _init(model, :z_tr_em)
|
lower_bound = 0,
|
||||||
for (p1, p2, m) in E, t in T, g in keys(m.tr_emissions)
|
upper_bound = graph.collection_shipping_nodes[n].location.amount[t],
|
||||||
z_tr_em[g, p1.name, p2.name, m.name, t] = @variable(model, lower_bound = 0)
|
)
|
||||||
end
|
|
||||||
|
# Var: collection_shortfall
|
||||||
|
@recourse(
|
||||||
# Objective function
|
model,
|
||||||
# -------------------------------------------------------------------------
|
collection_shortfall[n in 1:CSN, t in 1:T],
|
||||||
obj = AffExpr()
|
lower_bound = 0,
|
||||||
|
)
|
||||||
# Transportation cost
|
|
||||||
for (p1, p2, m) in E, t in T
|
# Var: store
|
||||||
add_to_expression!(
|
@recourse(
|
||||||
obj,
|
model,
|
||||||
distances[p1, p2, m] * m.tr_cost[t],
|
store[
|
||||||
y[p1.name, p2.name, m.name, t],
|
n in 1:PN,
|
||||||
)
|
t in 1:T,
|
||||||
end
|
],
|
||||||
|
lower_bound = 0,
|
||||||
# Center: Revenue
|
upper_bound = pn[n].location.storage_limit,
|
||||||
for c in centers, (p, m) in E_in[c], t in T
|
)
|
||||||
add_to_expression!(obj, -c.revenue[t], y[p.name, c.name, m.name, t])
|
|
||||||
end
|
# Var: process
|
||||||
|
@recourse(
|
||||||
# Center: Collection cost
|
model,
|
||||||
for c in centers, (p, m) in E_out[c], t in T
|
process[
|
||||||
add_to_expression!(obj, c.collection_cost[m][t], y[c.name, p.name, m.name, t])
|
n in 1:PN,
|
||||||
end
|
t in 1:T,
|
||||||
|
],
|
||||||
# Center: Disposal cost
|
lower_bound = 0,
|
||||||
for c in centers, m in c.outputs, t in T
|
)
|
||||||
add_to_expression!(obj, c.disposal_cost[m][t], z_disp[c.name, m.name, t])
|
|
||||||
end
|
# Var: capacity
|
||||||
|
@recourse(
|
||||||
# Center: Operating cost
|
model,
|
||||||
for c in centers, t in T
|
capacity[
|
||||||
add_to_expression!(obj, c.operating_cost[t])
|
n in 1:PN,
|
||||||
end
|
t in 1:T,
|
||||||
|
],
|
||||||
# Plants: Disposal cost
|
lower_bound = 0,
|
||||||
for p in plants, m in keys(p.output), t in T
|
upper_bound = pn[n].location.sizes[2].capacity,
|
||||||
add_to_expression!(obj, p.disposal_cost[m][t], z_disp[p.name, m.name, t])
|
)
|
||||||
end
|
|
||||||
|
# Var: expansion
|
||||||
# Plants: Opening cost
|
@recourse(
|
||||||
for p in plants, t in T
|
model,
|
||||||
add_to_expression!(
|
expansion[
|
||||||
obj,
|
n in 1:PN,
|
||||||
p.capacities[1].opening_cost[t],
|
t in 1:T,
|
||||||
(x[p.name, t] - x[p.name, t-1]),
|
],
|
||||||
)
|
lower_bound = 0,
|
||||||
end
|
upper_bound = (
|
||||||
|
pn[n].location.sizes[2].capacity -
|
||||||
# Plants: Fixed operating cost
|
pn[n].location.sizes[1].capacity
|
||||||
for p in plants, t in T
|
),
|
||||||
add_to_expression!(obj, p.capacities[1].fix_operating_cost[t], x[p.name, t])
|
)
|
||||||
end
|
|
||||||
|
# Objective function
|
||||||
# Plants: Variable operating cost
|
@objective(
|
||||||
for p in plants, (src, m) in E_in[p], t in T
|
model,
|
||||||
add_to_expression!(
|
Min,
|
||||||
obj,
|
sum(
|
||||||
p.capacities[1].var_operating_cost[t],
|
# Transportation costs
|
||||||
y[src.name, p.name, m.name, t],
|
pn[n].location.input.transportation_cost[t] *
|
||||||
)
|
a.values["distance"] *
|
||||||
end
|
flow[a.index,t]
|
||||||
|
|
||||||
@objective(model, Min, obj)
|
for n in 1:PN
|
||||||
|
for a in pn[n].incoming_arcs
|
||||||
# Constraints
|
for t in 1:T
|
||||||
# -------------------------------------------------------------------------
|
) + sum(
|
||||||
|
# Fixed operating costs (expansion)
|
||||||
# Plants: Definition of total plant input
|
slope_fix_oper_cost(pn[n].location, t) * expansion[n, t] +
|
||||||
eq_z_input = _init(model, :eq_z_input)
|
|
||||||
for p in plants, t in T
|
# Processing costs
|
||||||
eq_z_input[p.name, t] = @constraint(
|
pn[n].location.sizes[1].variable_operating_cost[t] * process[n, t] +
|
||||||
model,
|
|
||||||
z_input[p.name, t] ==
|
# Storage costs
|
||||||
sum(y[src.name, p.name, m.name, t] for (src, m) in E_in[p])
|
pn[n].location.storage_cost[t] * store[n, t] +
|
||||||
)
|
|
||||||
end
|
# Expansion costs
|
||||||
|
(
|
||||||
# Plants: Must meet input mix
|
t < T ? (
|
||||||
eq_input_mix = _init(model, :eq_input_mix)
|
(
|
||||||
for p in plants, m in keys(p.input_mix), t in T
|
slope_open(pn[n].location, t) -
|
||||||
eq_input_mix[p.name, m.name, t] = @constraint(
|
slope_open(pn[n].location, t + 1)
|
||||||
model,
|
) * expansion[n, t]
|
||||||
sum(y[src.name, p.name, m.name, t] for (src, m2) in E_in[p] if m == m2) ==
|
) : slope_open(pn[n].location, t) * expansion[n, t]
|
||||||
z_input[p.name, t] * p.input_mix[m][t]
|
)
|
||||||
)
|
|
||||||
end
|
for n in 1:PN
|
||||||
|
for t in 1:T
|
||||||
# Plants: Calculate amount produced
|
) + sum(
|
||||||
eq_z_prod = _init(model, :eq_z_prod)
|
# Disposal costs (plants)
|
||||||
for p in plants, m in keys(p.output), t in T
|
psn[n].location.disposal_cost[psn[n].product][t] * plant_dispose[n, t]
|
||||||
eq_z_prod[p.name, m.name, t] = @constraint(
|
for n in 1:PSN
|
||||||
model,
|
for t in 1:T
|
||||||
z_prod[p.name, m.name, t] == z_input[p.name, t] * p.output[m][t]
|
) + sum(
|
||||||
)
|
# Disposal costs (collection centers)
|
||||||
end
|
csn[n].location.product.disposal_cost[t] * collection_dispose[n, t]
|
||||||
|
for n in 1:CSN
|
||||||
# Plants: Produced material must be sent or disposed
|
for t in 1:T
|
||||||
eq_balance = _init(model, :eq_balance)
|
) + sum(
|
||||||
for p in plants, m in keys(p.output), t in T
|
# Collection shortfall
|
||||||
eq_balance[p.name, m.name, t] = @constraint(
|
1e4 * collection_shortfall[n, t]
|
||||||
model,
|
for n in 1:CSN
|
||||||
z_prod[p.name, m.name, t] ==
|
for t in 1:T
|
||||||
sum(y[p.name, dst.name, m.name, t] for (dst, m2) in E_out[p] if m == m2) +
|
)
|
||||||
z_disp[p.name, m.name, t]
|
)
|
||||||
)
|
|
||||||
end
|
# Process node constraints
|
||||||
|
for t = 1:T, n in 1:PN
|
||||||
# Plants: Capacity limit
|
node = pn[n]
|
||||||
eq_capacity = _init(model, :eq_capacity)
|
|
||||||
for p in plants, t in T
|
# Output amount is implied by amount processed
|
||||||
eq_capacity[p.name, t] =
|
for arc in node.outgoing_arcs
|
||||||
@constraint(model, z_input[p.name, t] <= p.capacities[1].size * x[p.name, t])
|
@constraint(
|
||||||
end
|
model,
|
||||||
|
flow[arc.index, t] == arc.values["weight"] * process[n, t]
|
||||||
# Plants: Disposal limit
|
)
|
||||||
eq_disposal_limit = _init(model, :eq_disposal_limit)
|
end
|
||||||
for p in plants, m in keys(p.output), t in T
|
|
||||||
isfinite(p.disposal_limit[m][t]) || continue
|
# If plant is closed, capacity is zero
|
||||||
eq_disposal_limit[p.name, m.name, t] =
|
@constraint(
|
||||||
@constraint(model, z_disp[p.name, m.name, t] <= p.disposal_limit[m][t])
|
model,
|
||||||
end
|
capacity[n, t] <= node.location.sizes[2].capacity * is_open[n, t]
|
||||||
|
)
|
||||||
# Plants: Plant remains open
|
|
||||||
eq_keep_open = _init(model, :eq_keep_open)
|
# If plant is open, capacity is greater than base
|
||||||
for p in plants, t in T
|
@constraint(
|
||||||
eq_keep_open[p.name, t] = @constraint(model, x[p.name, t] >= x[p.name, t-1])
|
model,
|
||||||
end
|
capacity[n, t] >= node.location.sizes[1].capacity * is_open[n, t]
|
||||||
|
)
|
||||||
# Plants: Building period
|
|
||||||
eq_building_period = _init(model, :eq_building_period)
|
# Capacity is linked to expansion
|
||||||
for p in plants, t in T
|
@constraint(
|
||||||
if t ∉ instance.building_period
|
model,
|
||||||
eq_building_period[p.name, t] =
|
capacity[n, t] <=
|
||||||
@constraint(model, x[p.name, t] - x[p.name, t-1] <= 0)
|
node.location.sizes[1].capacity + expansion[n, t]
|
||||||
end
|
)
|
||||||
end
|
|
||||||
|
# Can only process up to capacity
|
||||||
# Centers: Definition of total center input
|
@constraint(model, process[n, t] <= capacity[n, t])
|
||||||
eq_z_input = _init(model, :eq_z_input)
|
|
||||||
for c in centers, t in T
|
if t > 1
|
||||||
eq_z_input[c.name, t] = @constraint(
|
# Plant capacity can only increase over time
|
||||||
model,
|
@constraint(model, capacity[n, t] >= capacity[n, t-1])
|
||||||
z_input[c.name, t] ==
|
@constraint(model, expansion[n, t] >= expansion[n, t-1])
|
||||||
sum(y[src.name, c.name, m.name, t] for (src, m) in E_in[c])
|
end
|
||||||
)
|
|
||||||
end
|
# Amount received equals amount processed plus stored
|
||||||
|
store_in = 0
|
||||||
# Centers: Calculate amount collected
|
if t > 1
|
||||||
eq_z_collected = _init(model, :eq_z_collected)
|
store_in = store[n, t-1]
|
||||||
for c in centers, m in c.outputs, t in T
|
end
|
||||||
M = length(c.var_output[m])
|
if t == T
|
||||||
eq_z_collected[c.name, m.name, t] = @constraint(
|
@constraint(model, store[n, t] == 0)
|
||||||
model,
|
end
|
||||||
z_collected[c.name, m.name, t] ==
|
@constraint(
|
||||||
sum(
|
model,
|
||||||
z_input[c.name, t-offset] * c.var_output[m][offset+1] for
|
sum(
|
||||||
offset = 0:min(M - 1, t - 1)
|
flow[arc.index, t]
|
||||||
) + c.fixed_output[m][t]
|
for arc in node.incoming_arcs
|
||||||
)
|
) + store_in == store[n, t] + process[n, t]
|
||||||
end
|
)
|
||||||
|
|
||||||
# Centers: Collected products must be disposed or sent
|
end
|
||||||
eq_balance = _init(model, :eq_balance)
|
|
||||||
for c in centers, m in c.outputs, t in T
|
# Material flow at collection shipping nodes
|
||||||
eq_balance[c.name, m.name, t] = @constraint(
|
@constraint(
|
||||||
model,
|
model,
|
||||||
z_collected[c.name, m.name, t] ==
|
eq_balance_centers[
|
||||||
sum(y[c.name, dst.name, m.name, t] for (dst, m2) in E_out[c] if m == m2) +
|
n in 1:CSN,
|
||||||
z_disp[c.name, m.name, t]
|
t in 1:T,
|
||||||
)
|
],
|
||||||
end
|
sum(
|
||||||
|
flow[arc.index, t]
|
||||||
# Centers: Disposal limit
|
for arc in csn[n].outgoing_arcs
|
||||||
eq_disposal_limit = _init(model, :eq_disposal_limit)
|
) == csn[n].location.amount[t] - collection_dispose[n, t] - collection_shortfall[n, t]
|
||||||
for c in centers, m in c.outputs, t in T
|
)
|
||||||
isfinite(c.disposal_limit[m][t]) || continue
|
|
||||||
eq_disposal_limit[c.name, m.name, t] =
|
# Material flow at plant shipping nodes
|
||||||
@constraint(model, z_disp[c.name, m.name, t] <= c.disposal_limit[m][t])
|
@constraint(
|
||||||
end
|
model,
|
||||||
|
eq_balance_plant[
|
||||||
# Global disposal limit
|
n in 1:PSN,
|
||||||
eq_disposal_limit = _init(model, :eq_disposal_limit)
|
t in 1:T,
|
||||||
for m in products, t in T
|
],
|
||||||
isfinite(m.disposal_limit[t]) || continue
|
sum(flow[a.index, t] for a in psn[n].incoming_arcs) ==
|
||||||
eq_disposal_limit[m.name, t] = @constraint(
|
sum(flow[a.index, t] for a in psn[n].outgoing_arcs) +
|
||||||
model,
|
plant_dispose[n, t]
|
||||||
sum(z_disp[p.name, m.name, t] for p in plants if m in keys(p.output)) +
|
)
|
||||||
sum(z_disp[c.name, m.name, t] for c in centers if m in c.outputs) <=
|
|
||||||
m.disposal_limit[t]
|
# Enforce product disposal limit at collection centers
|
||||||
)
|
for t in 1:T, prod in instance.products
|
||||||
end
|
if isempty(prod.collection_centers)
|
||||||
|
continue
|
||||||
# Transportation emissions
|
end
|
||||||
eq_tr_em = _init(model, :eq_tr_em)
|
@constraint(
|
||||||
for (p1, p2, m) in E, t in T, g in keys(m.tr_emissions)
|
model,
|
||||||
eq_tr_em[g, p1.name, p2.name, m.name, t] = @constraint(
|
sum(
|
||||||
model,
|
collection_dispose[n, t]
|
||||||
z_tr_em[g, p1.name, p2.name, m.name, t] ==
|
for n in 1:CSN
|
||||||
distances[p1, p2, m] * m.tr_emissions[g][t] * y[p1.name, p2.name, m.name, t]
|
if csn[n].product.name == prod.name
|
||||||
)
|
) <= prod.disposal_limit[t]
|
||||||
end
|
)
|
||||||
|
end
|
||||||
if variable_names
|
end
|
||||||
_set_names!(model)
|
end
|
||||||
end
|
|
||||||
return model
|
ξ = [
|
||||||
|
@scenario graph = graphs[i] probability = probs[i]
|
||||||
|
for i in 1:length(graphs)
|
||||||
|
]
|
||||||
|
|
||||||
|
if method == :ef
|
||||||
|
sp = instantiate(model, ξ; optimizer=optimizer)
|
||||||
|
elseif method == :lshaped
|
||||||
|
sp = instantiate(model, ξ; optimizer=LShaped.Optimizer)
|
||||||
|
set_optimizer_attribute(sp, MasterOptimizer(), optimizer)
|
||||||
|
set_optimizer_attribute(sp, SubProblemOptimizer(), optimizer)
|
||||||
|
set_optimizer_attribute(sp, RelativeTolerance(), tol)
|
||||||
|
else
|
||||||
|
error("unknown method: $method")
|
||||||
|
end
|
||||||
|
|
||||||
|
return sp
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function slope_open(plant, t)
|
||||||
|
if plant.sizes[2].capacity <= plant.sizes[1].capacity
|
||||||
|
0.0
|
||||||
|
else
|
||||||
|
(plant.sizes[2].opening_cost[t] - plant.sizes[1].opening_cost[t]) /
|
||||||
|
(plant.sizes[2].capacity - plant.sizes[1].capacity)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function slope_fix_oper_cost(plant, t)
|
||||||
|
if plant.sizes[2].capacity <= plant.sizes[1].capacity
|
||||||
|
0.0
|
||||||
|
else
|
||||||
|
(plant.sizes[2].fixed_operating_cost[t] - plant.sizes[1].fixed_operating_cost[t]) /
|
||||||
|
(plant.sizes[2].capacity - plant.sizes[1].capacity)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,110 +0,0 @@
|
|||||||
# RELOG: Reverse Logistics Optimization
|
|
||||||
# Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
# Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
|
|
||||||
using Geodesy
|
|
||||||
using NearestNeighbors
|
|
||||||
using DataFrames
|
|
||||||
using CRC
|
|
||||||
using ZipFile
|
|
||||||
using Statistics
|
|
||||||
using TimerOutputs
|
|
||||||
|
|
||||||
crc32 = crc(CRC_32)
|
|
||||||
|
|
||||||
function _calculate_distance(
|
|
||||||
source_lat,
|
|
||||||
source_lon,
|
|
||||||
dest_lat,
|
|
||||||
dest_lon,
|
|
||||||
::EuclideanDistance,
|
|
||||||
)::Float64
|
|
||||||
x = LLA(source_lat, source_lon, 0.0)
|
|
||||||
y = LLA(dest_lat, dest_lon, 0.0)
|
|
||||||
return round(euclidean_distance(x, y) / 1000.0, digits = 3)
|
|
||||||
end
|
|
||||||
|
|
||||||
function _download_file(url, output, expected_crc32)::Nothing
|
|
||||||
if isfile(output)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
mkpath(dirname(output))
|
|
||||||
@info "Downloading: $url"
|
|
||||||
fname = download(url)
|
|
||||||
actual_crc32 = open(crc32, fname)
|
|
||||||
expected_crc32 == actual_crc32 || error("CRC32 mismatch")
|
|
||||||
cp(fname, output)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
function _download_zip(url, outputdir, expected_output_file, expected_crc32)::Nothing
|
|
||||||
if isfile(expected_output_file)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
mkpath(outputdir)
|
|
||||||
@info "Downloading: $url"
|
|
||||||
zip_filename = download(url)
|
|
||||||
actual_crc32 = open(crc32, zip_filename)
|
|
||||||
expected_crc32 == actual_crc32 || error("CRC32 mismatch")
|
|
||||||
open(zip_filename) do zip_file
|
|
||||||
zr = ZipFile.Reader(zip_file)
|
|
||||||
for file in zr.files
|
|
||||||
open(joinpath(outputdir, file.name), "w") do output_file
|
|
||||||
write(output_file, read(file))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
function _calculate_distance(
|
|
||||||
source_lat,
|
|
||||||
source_lon,
|
|
||||||
dest_lat,
|
|
||||||
dest_lon,
|
|
||||||
metric::KnnDrivingDistance,
|
|
||||||
)::Float64
|
|
||||||
if metric.tree === nothing
|
|
||||||
basedir = joinpath(dirname(@__FILE__), "data")
|
|
||||||
csv_filename = joinpath(basedir, "dist_driving.csv")
|
|
||||||
|
|
||||||
# Download pre-computed driving data
|
|
||||||
@timeit "Download data" begin
|
|
||||||
if !isfile(csv_filename)
|
|
||||||
_download_zip(
|
|
||||||
"https://axavier.org/RELOG/0.6/data/dist_driving_0b9a6ad6.zip",
|
|
||||||
basedir,
|
|
||||||
csv_filename,
|
|
||||||
0x0b9a6ad6,
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@timeit "Fit KNN model" begin
|
|
||||||
df = DataFrame(CSV.File(csv_filename, missingstring = "NaN"))
|
|
||||||
dropmissing!(df)
|
|
||||||
coords = Matrix(df[!, [:source_lat, :source_lon, :dest_lat, :dest_lon]])'
|
|
||||||
metric.ratios = Matrix(df[!, [:ratio]])
|
|
||||||
metric.tree = KDTree(coords)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@timeit "Compute Euclidean distance" begin
|
|
||||||
dist_euclidean = _calculate_distance(
|
|
||||||
source_lat,
|
|
||||||
source_lon,
|
|
||||||
dest_lat,
|
|
||||||
dest_lon,
|
|
||||||
EuclideanDistance(),
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
@timeit "Predict driving distance" begin
|
|
||||||
idxs, _ = knn(metric.tree, [source_lat, source_lon, dest_lat, dest_lon], 5)
|
|
||||||
ratio_pred = mean(metric.ratios[idxs])
|
|
||||||
dist_pred = round(dist_euclidean * ratio_pred, digits = 3)
|
|
||||||
isfinite(dist_pred) || error("non-finite distance detected: $dist_pred")
|
|
||||||
end
|
|
||||||
|
|
||||||
return dist_pred
|
|
||||||
end
|
|
||||||
265
src/model/getsol.jl
Normal file
265
src/model/getsol.jl
Normal file
@@ -0,0 +1,265 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# 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, ProgressBars, Printf, DataStructures
|
||||||
|
|
||||||
|
function get_solution(
|
||||||
|
instance,
|
||||||
|
graph,
|
||||||
|
model,
|
||||||
|
scenario_index::Int=1;
|
||||||
|
marginal_costs=false,
|
||||||
|
)
|
||||||
|
value(x) = StochasticPrograms.value(x, scenario_index)
|
||||||
|
ivalue(x) = StochasticPrograms.value(x)
|
||||||
|
shadow_price(x) = StochasticPrograms.shadow_price(x, scenario_index)
|
||||||
|
|
||||||
|
T = instance.time
|
||||||
|
|
||||||
|
pn = graph.process_nodes
|
||||||
|
psn = graph.plant_shipping_nodes
|
||||||
|
csn = graph.collection_shipping_nodes
|
||||||
|
arcs = graph.arcs
|
||||||
|
|
||||||
|
A = length(arcs)
|
||||||
|
PN = length(pn)
|
||||||
|
CSN = length(csn)
|
||||||
|
PSN = length(psn)
|
||||||
|
|
||||||
|
flow = model[2, :flow]
|
||||||
|
|
||||||
|
output = OrderedDict(
|
||||||
|
"Plants" => OrderedDict(),
|
||||||
|
"Products" => OrderedDict(),
|
||||||
|
"Costs" => OrderedDict(
|
||||||
|
"Fixed operating (\$)" => zeros(T),
|
||||||
|
"Variable operating (\$)" => zeros(T),
|
||||||
|
"Opening (\$)" => zeros(T),
|
||||||
|
"Transportation (\$)" => zeros(T),
|
||||||
|
"Disposal (\$)" => zeros(T),
|
||||||
|
"Expansion (\$)" => zeros(T),
|
||||||
|
"Storage (\$)" => zeros(T),
|
||||||
|
"Total (\$)" => zeros(T),
|
||||||
|
),
|
||||||
|
"Energy" =>
|
||||||
|
OrderedDict("Plants (GJ)" => zeros(T), "Transportation (GJ)" => zeros(T)),
|
||||||
|
"Emissions" => OrderedDict(
|
||||||
|
"Plants (tonne)" => OrderedDict(),
|
||||||
|
"Transportation (tonne)" => OrderedDict(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
pn = graph.process_nodes
|
||||||
|
psn = graph.plant_shipping_nodes
|
||||||
|
|
||||||
|
plant_to_process_node_index = OrderedDict(
|
||||||
|
pn[n].location => n
|
||||||
|
for n in 1:length(pn)
|
||||||
|
)
|
||||||
|
|
||||||
|
plant_to_shipping_node_indices = OrderedDict(p => [] for p in instance.plants)
|
||||||
|
for n in 1:length(psn)
|
||||||
|
push!(plant_to_shipping_node_indices[psn[n].location], n)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Products
|
||||||
|
for n in 1:CSN
|
||||||
|
node = csn[n]
|
||||||
|
location_dict = OrderedDict{Any,Any}(
|
||||||
|
"Latitude (deg)" => node.location.latitude,
|
||||||
|
"Longitude (deg)" => node.location.longitude,
|
||||||
|
"Amount (tonne)" => node.location.amount,
|
||||||
|
"Dispose (tonne)" => [
|
||||||
|
value(model[2, :collection_dispose][n, t])
|
||||||
|
for t = 1:T
|
||||||
|
],
|
||||||
|
"Disposal cost (\$)" => [
|
||||||
|
value(model[2, :collection_dispose][n, t]) *
|
||||||
|
node.location.product.disposal_cost[t]
|
||||||
|
for t = 1:T
|
||||||
|
]
|
||||||
|
)
|
||||||
|
if marginal_costs
|
||||||
|
location_dict["Marginal cost (\$/tonne)"] = [
|
||||||
|
round(abs(shadow_price(model[2, :eq_balance_centers][n, t])), digits=2) for t = 1:T
|
||||||
|
]
|
||||||
|
end
|
||||||
|
if node.product.name ∉ keys(output["Products"])
|
||||||
|
output["Products"][node.product.name] = OrderedDict()
|
||||||
|
end
|
||||||
|
output["Products"][node.product.name][node.location.name] = location_dict
|
||||||
|
end
|
||||||
|
|
||||||
|
# Plants
|
||||||
|
for plant in instance.plants
|
||||||
|
skip_plant = true
|
||||||
|
n = plant_to_process_node_index[plant]
|
||||||
|
process_node = pn[n]
|
||||||
|
plant_dict = OrderedDict{Any,Any}(
|
||||||
|
"Input" => OrderedDict(),
|
||||||
|
"Output" =>
|
||||||
|
OrderedDict("Send" => OrderedDict(), "Dispose" => OrderedDict()),
|
||||||
|
"Input product" => plant.input.name,
|
||||||
|
"Total input (tonne)" => [0.0 for t = 1:T],
|
||||||
|
"Total output" => OrderedDict(),
|
||||||
|
"Latitude (deg)" => plant.latitude,
|
||||||
|
"Longitude (deg)" => plant.longitude,
|
||||||
|
"Capacity (tonne)" =>
|
||||||
|
[value(model[2, :capacity][n, t]) for t = 1:T],
|
||||||
|
"Opening cost (\$)" => [
|
||||||
|
ivalue(model[1, :open_plant][n, t]) *
|
||||||
|
plant.sizes[1].opening_cost[t] for t = 1:T
|
||||||
|
],
|
||||||
|
"Fixed operating cost (\$)" => [
|
||||||
|
ivalue(model[1, :is_open][n, t]) *
|
||||||
|
plant.sizes[1].fixed_operating_cost[t] +
|
||||||
|
value(model[2, :expansion][n, t]) *
|
||||||
|
slope_fix_oper_cost(plant, t) for t = 1:T
|
||||||
|
],
|
||||||
|
"Expansion cost (\$)" => [
|
||||||
|
(
|
||||||
|
if t == 1
|
||||||
|
slope_open(plant, t) * value(model[2, :expansion][n, t])
|
||||||
|
else
|
||||||
|
slope_open(plant, t) * (
|
||||||
|
value(model[2, :expansion][n, t]) -
|
||||||
|
value(model[2, :expansion][n, t-1])
|
||||||
|
)
|
||||||
|
end
|
||||||
|
) for t = 1:T
|
||||||
|
],
|
||||||
|
"Process (tonne)" =>
|
||||||
|
[value(model[2, :process][n, t]) for t = 1:T],
|
||||||
|
"Variable operating cost (\$)" => [
|
||||||
|
value(model[2, :process][n, t]) *
|
||||||
|
plant.sizes[1].variable_operating_cost[t] for t = 1:T
|
||||||
|
],
|
||||||
|
"Storage (tonne)" =>
|
||||||
|
[value(model[2, :store][n, t]) for t = 1:T],
|
||||||
|
"Storage cost (\$)" => [
|
||||||
|
value(model[2, :store][n, t]) * plant.storage_cost[t]
|
||||||
|
for t = 1:T
|
||||||
|
],
|
||||||
|
)
|
||||||
|
output["Costs"]["Fixed operating (\$)"] += plant_dict["Fixed operating cost (\$)"]
|
||||||
|
output["Costs"]["Variable operating (\$)"] +=
|
||||||
|
plant_dict["Variable operating cost (\$)"]
|
||||||
|
output["Costs"]["Opening (\$)"] += plant_dict["Opening cost (\$)"]
|
||||||
|
output["Costs"]["Expansion (\$)"] += plant_dict["Expansion cost (\$)"]
|
||||||
|
output["Costs"]["Storage (\$)"] += plant_dict["Storage cost (\$)"]
|
||||||
|
|
||||||
|
# Inputs
|
||||||
|
for a in process_node.incoming_arcs
|
||||||
|
vals = [value(flow[a.index, t]) for t = 1:T]
|
||||||
|
if sum(vals) <= 1e-3
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
skip_plant = false
|
||||||
|
dict = OrderedDict{Any,Any}(
|
||||||
|
"Amount (tonne)" => vals,
|
||||||
|
"Distance (km)" => a.values["distance"],
|
||||||
|
"Latitude (deg)" => a.source.location.latitude,
|
||||||
|
"Longitude (deg)" => a.source.location.longitude,
|
||||||
|
"Transportation cost (\$)" =>
|
||||||
|
a.source.product.transportation_cost .* vals .* a.values["distance"],
|
||||||
|
"Transportation energy (J)" =>
|
||||||
|
vals .* a.values["distance"] .* a.source.product.transportation_energy,
|
||||||
|
"Emissions (tonne)" => OrderedDict(),
|
||||||
|
)
|
||||||
|
emissions_dict = output["Emissions"]["Transportation (tonne)"]
|
||||||
|
for (em_name, em_values) in a.source.product.transportation_emissions
|
||||||
|
dict["Emissions (tonne)"][em_name] =
|
||||||
|
em_values .* dict["Amount (tonne)"] .* a.values["distance"]
|
||||||
|
if em_name ∉ keys(emissions_dict)
|
||||||
|
emissions_dict[em_name] = zeros(T)
|
||||||
|
end
|
||||||
|
emissions_dict[em_name] += dict["Emissions (tonne)"][em_name]
|
||||||
|
end
|
||||||
|
if a.source.location isa CollectionCenter
|
||||||
|
plant_name = "Origin"
|
||||||
|
location_name = a.source.location.name
|
||||||
|
else
|
||||||
|
plant_name = a.source.location.plant_name
|
||||||
|
location_name = a.source.location.location_name
|
||||||
|
end
|
||||||
|
|
||||||
|
if plant_name ∉ keys(plant_dict["Input"])
|
||||||
|
plant_dict["Input"][plant_name] = OrderedDict()
|
||||||
|
end
|
||||||
|
plant_dict["Input"][plant_name][location_name] = dict
|
||||||
|
plant_dict["Total input (tonne)"] += vals
|
||||||
|
output["Costs"]["Transportation (\$)"] += dict["Transportation cost (\$)"]
|
||||||
|
output["Energy"]["Transportation (GJ)"] +=
|
||||||
|
dict["Transportation energy (J)"] / 1e9
|
||||||
|
end
|
||||||
|
|
||||||
|
plant_dict["Energy (GJ)"] = plant_dict["Total input (tonne)"] .* plant.energy
|
||||||
|
output["Energy"]["Plants (GJ)"] += plant_dict["Energy (GJ)"]
|
||||||
|
|
||||||
|
plant_dict["Emissions (tonne)"] = OrderedDict()
|
||||||
|
emissions_dict = output["Emissions"]["Plants (tonne)"]
|
||||||
|
for (em_name, em_values) in plant.emissions
|
||||||
|
plant_dict["Emissions (tonne)"][em_name] =
|
||||||
|
em_values .* plant_dict["Total input (tonne)"]
|
||||||
|
if em_name ∉ keys(emissions_dict)
|
||||||
|
emissions_dict[em_name] = zeros(T)
|
||||||
|
end
|
||||||
|
emissions_dict[em_name] += plant_dict["Emissions (tonne)"][em_name]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Outputs
|
||||||
|
for n2 in plant_to_shipping_node_indices[plant]
|
||||||
|
shipping_node = psn[n2]
|
||||||
|
product_name = shipping_node.product.name
|
||||||
|
plant_dict["Total output"][product_name] = zeros(T)
|
||||||
|
plant_dict["Output"]["Send"][product_name] = product_dict = OrderedDict()
|
||||||
|
|
||||||
|
disposal_amount =
|
||||||
|
[value(model[2, :plant_dispose][n2, t]) for t = 1:T]
|
||||||
|
if sum(disposal_amount) > 1e-5
|
||||||
|
skip_plant = false
|
||||||
|
plant_dict["Output"]["Dispose"][product_name] =
|
||||||
|
disposal_dict = OrderedDict()
|
||||||
|
disposal_dict["Amount (tonne)"] =
|
||||||
|
[value(model[2, :plant_dispose][n2, t]) for t = 1:T]
|
||||||
|
disposal_dict["Cost (\$)"] = [
|
||||||
|
disposal_dict["Amount (tonne)"][t] *
|
||||||
|
plant.disposal_cost[shipping_node.product][t] for t = 1:T
|
||||||
|
]
|
||||||
|
plant_dict["Total output"][product_name] += disposal_amount
|
||||||
|
output["Costs"]["Disposal (\$)"] += disposal_dict["Cost (\$)"]
|
||||||
|
end
|
||||||
|
|
||||||
|
for a in shipping_node.outgoing_arcs
|
||||||
|
vals = [value(flow[a.index, t]) for t = 1:T]
|
||||||
|
if sum(vals) <= 1e-3
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
skip_plant = false
|
||||||
|
dict = OrderedDict(
|
||||||
|
"Amount (tonne)" => vals,
|
||||||
|
"Distance (km)" => a.values["distance"],
|
||||||
|
"Latitude (deg)" => a.dest.location.latitude,
|
||||||
|
"Longitude (deg)" => a.dest.location.longitude,
|
||||||
|
)
|
||||||
|
if a.dest.location.plant_name ∉ keys(product_dict)
|
||||||
|
product_dict[a.dest.location.plant_name] = OrderedDict()
|
||||||
|
end
|
||||||
|
product_dict[a.dest.location.plant_name][a.dest.location.location_name] =
|
||||||
|
dict
|
||||||
|
plant_dict["Total output"][product_name] += vals
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if !skip_plant
|
||||||
|
if plant.plant_name ∉ keys(output["Plants"])
|
||||||
|
output["Plants"][plant.plant_name] = OrderedDict()
|
||||||
|
end
|
||||||
|
output["Plants"][plant.plant_name][plant.location_name] = plant_dict
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
output["Costs"]["Total (\$)"] = sum(values(output["Costs"]))
|
||||||
|
return output
|
||||||
|
end
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
# This file extends some JuMP functions so that decision variables can be safely
|
|
||||||
# replaced by (constant) floating point numbers.
|
|
||||||
|
|
||||||
using Printf
|
|
||||||
using JuMP
|
|
||||||
|
|
||||||
import JuMP: value, fix, set_name
|
|
||||||
|
|
||||||
function value(x::Float64)
|
|
||||||
return x
|
|
||||||
end
|
|
||||||
|
|
||||||
function fix(x::Float64, v::Float64; force)
|
|
||||||
return abs(x - v) < 1e-6 || error("Value mismatch: $x != $v")
|
|
||||||
end
|
|
||||||
|
|
||||||
function set_name(x::Number, n::String)
|
|
||||||
# nop
|
|
||||||
end
|
|
||||||
|
|
||||||
function _init(model::JuMP.Model, key::Symbol)::OrderedDict
|
|
||||||
if !(key in keys(object_dictionary(model)))
|
|
||||||
model[key] = OrderedDict()
|
|
||||||
end
|
|
||||||
return model[key]
|
|
||||||
end
|
|
||||||
|
|
||||||
function _set_names!(model::JuMP.Model)
|
|
||||||
@info "Setting variable and constraint names..."
|
|
||||||
time_varnames = @elapsed begin
|
|
||||||
_set_names!(object_dictionary(model))
|
|
||||||
end
|
|
||||||
@info @sprintf("Set names in %.2f seconds", time_varnames)
|
|
||||||
end
|
|
||||||
|
|
||||||
function _set_names!(dict::Dict)
|
|
||||||
for name in keys(dict)
|
|
||||||
dict[name] isa AbstractDict || continue
|
|
||||||
for idx in keys(dict[name])
|
|
||||||
if dict[name][idx] isa AffExpr
|
|
||||||
continue
|
|
||||||
end
|
|
||||||
idx_str = join(map(string, idx), ",")
|
|
||||||
set_name(dict[name][idx], "$name[$idx_str]")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
137
src/model/solve.jl
Normal file
137
src/model/solve.jl
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# 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, HiGHS, ProgressBars, Printf, DataStructures
|
||||||
|
|
||||||
|
function _get_default_milp_optimizer()
|
||||||
|
return optimizer_with_attributes(HiGHS.Optimizer)
|
||||||
|
end
|
||||||
|
|
||||||
|
function _get_default_lp_optimizer()
|
||||||
|
return optimizer_with_attributes(HiGHS.Optimizer)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function _print_graph_stats(instance::Instance, graph::Graph)::Nothing
|
||||||
|
@info @sprintf(" %12d time periods", instance.time)
|
||||||
|
@info @sprintf(" %12d process nodes", length(graph.process_nodes))
|
||||||
|
@info @sprintf(" %12d shipping nodes (plant)", length(graph.plant_shipping_nodes))
|
||||||
|
@info @sprintf(
|
||||||
|
" %12d shipping nodes (collection)",
|
||||||
|
length(graph.collection_shipping_nodes)
|
||||||
|
)
|
||||||
|
@info @sprintf(" %12d arcs", length(graph.arcs))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
function solve_stochastic(;
|
||||||
|
scenarios::Vector{String},
|
||||||
|
probs::Vector{Float64},
|
||||||
|
optimizer,
|
||||||
|
method=:ef,
|
||||||
|
tol=0.1,
|
||||||
|
)
|
||||||
|
@info "Reading instance files..."
|
||||||
|
instances = [parsefile(sc) for sc in scenarios]
|
||||||
|
|
||||||
|
@info "Building graphs..."
|
||||||
|
graphs = [build_graph(inst) for inst in instances]
|
||||||
|
|
||||||
|
@info "Building stochastic model..."
|
||||||
|
sp = RELOG.build_model(instances[1], graphs, probs; optimizer, method, tol)
|
||||||
|
|
||||||
|
@info "Optimizing stochastic model..."
|
||||||
|
optimize!(sp)
|
||||||
|
|
||||||
|
@info "Extracting solution..."
|
||||||
|
solutions = [
|
||||||
|
get_solution(instances[i], graphs[i], sp, i)
|
||||||
|
for i in 1:length(instances)
|
||||||
|
]
|
||||||
|
|
||||||
|
return solutions
|
||||||
|
end
|
||||||
|
|
||||||
|
function solve(
|
||||||
|
instance::Instance;
|
||||||
|
optimizer=HiGHS.Optimizer,
|
||||||
|
marginal_costs=true,
|
||||||
|
return_model=false
|
||||||
|
)
|
||||||
|
@info "Building graph..."
|
||||||
|
graph = RELOG.build_graph(instance)
|
||||||
|
_print_graph_stats(instance, graph)
|
||||||
|
|
||||||
|
@info "Building model..."
|
||||||
|
model = RELOG.build_model(instance, [graph], [1.0]; optimizer)
|
||||||
|
|
||||||
|
@info "Optimizing model..."
|
||||||
|
optimize!(model)
|
||||||
|
if !has_values(model)
|
||||||
|
error("No solution available")
|
||||||
|
end
|
||||||
|
|
||||||
|
@info "Extracting solution..."
|
||||||
|
solution = get_solution(instance, graph, model, 1)
|
||||||
|
|
||||||
|
if marginal_costs
|
||||||
|
@info "Re-optimizing with integer variables fixed..."
|
||||||
|
open_plant_vals = value.(model[1, :open_plant])
|
||||||
|
is_open_vals = value.(model[1, :is_open])
|
||||||
|
|
||||||
|
for n in 1:length(graph.process_nodes), t in 1:instance.time
|
||||||
|
unset_binary(model[1, :open_plant][n, t])
|
||||||
|
unset_binary(model[1, :is_open][n, t])
|
||||||
|
fix(
|
||||||
|
model[1, :open_plant][n, t],
|
||||||
|
open_plant_vals[n, t]
|
||||||
|
)
|
||||||
|
fix(
|
||||||
|
model[1, :is_open][n, t],
|
||||||
|
is_open_vals[n, t]
|
||||||
|
)
|
||||||
|
|
||||||
|
end
|
||||||
|
optimize!(model)
|
||||||
|
if has_values(model)
|
||||||
|
@info "Extracting solution..."
|
||||||
|
solution = get_solution(instance, graph, model, 1, marginal_costs=true)
|
||||||
|
else
|
||||||
|
@warn "Error computing marginal costs. Ignoring."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if return_model
|
||||||
|
return solution, model
|
||||||
|
else
|
||||||
|
return solution
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function solve(filename::AbstractString; heuristic=false, kwargs...)
|
||||||
|
@info "Reading $filename..."
|
||||||
|
instance = RELOG.parsefile(filename)
|
||||||
|
if heuristic && instance.time > 1
|
||||||
|
@info "Solving single-period version..."
|
||||||
|
compressed = _compress(instance)
|
||||||
|
csol, model = solve(compressed; marginal_costs=false, return_model=true, kwargs...)
|
||||||
|
@info "Filtering candidate locations..."
|
||||||
|
selected_pairs = []
|
||||||
|
for (plant_name, plant_dict) in csol["Plants"]
|
||||||
|
for (location_name, location_dict) in plant_dict
|
||||||
|
push!(selected_pairs, (plant_name, location_name))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
filtered_plants = []
|
||||||
|
for p in instance.plants
|
||||||
|
if (p.plant_name, p.location_name) in selected_pairs
|
||||||
|
push!(filtered_plants, p)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
instance.plants = filtered_plants
|
||||||
|
@info "Solving original version..."
|
||||||
|
end
|
||||||
|
sol = solve(instance; kwargs...)
|
||||||
|
return sol
|
||||||
|
end
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
# RELOG: Reverse Logistics Optimization
|
|
||||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
# Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
|
|
||||||
using DataFrames
|
|
||||||
using CSV
|
|
||||||
|
|
||||||
function centers_report(model)::DataFrame
|
|
||||||
df = DataFrame()
|
|
||||||
df."center" = String[]
|
|
||||||
df."latitude" = Float64[]
|
|
||||||
df."longitude" = Float64[]
|
|
||||||
df."year" = Int[]
|
|
||||||
df."input product" = String[]
|
|
||||||
df."input amount (tonne)" = Float64[]
|
|
||||||
df."revenue (\$)" = Float64[]
|
|
||||||
df."operating cost (\$)" = Float64[]
|
|
||||||
|
|
||||||
centers = model.ext[:instance].centers
|
|
||||||
T = 1:model.ext[:instance].time_horizon
|
|
||||||
E_in = model.ext[:E_in]
|
|
||||||
|
|
||||||
for c in centers, t in T
|
|
||||||
input_name = (c.input === nothing) ? "" : c.input.name
|
|
||||||
input = value(model[:z_input][c.name, t])
|
|
||||||
if isempty(E_in[c])
|
|
||||||
revenue = 0
|
|
||||||
else
|
|
||||||
revenue = sum(
|
|
||||||
c.revenue[t] * value(model[:y][p.name, c.name, m.name, t]) for
|
|
||||||
(p, m) in E_in[c]
|
|
||||||
)
|
|
||||||
end
|
|
||||||
push!(
|
|
||||||
df,
|
|
||||||
Dict(
|
|
||||||
"center" => c.name,
|
|
||||||
"latitude" => c.latitude,
|
|
||||||
"longitude" => c.longitude,
|
|
||||||
"year" => t,
|
|
||||||
"input product" => input_name,
|
|
||||||
"input amount (tonne)" => _round(input),
|
|
||||||
"revenue (\$)" => _round(revenue),
|
|
||||||
"operating cost (\$)" => _round(c.operating_cost[t]),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
end
|
|
||||||
return df
|
|
||||||
end
|
|
||||||
|
|
||||||
function center_outputs_report(model)::DataFrame
|
|
||||||
df = DataFrame()
|
|
||||||
df."center" = String[]
|
|
||||||
df."latitude" = Float64[]
|
|
||||||
df."longitude" = Float64[]
|
|
||||||
df."output product" = String[]
|
|
||||||
df."year" = Int[]
|
|
||||||
df."amount collected (tonne)" = Float64[]
|
|
||||||
df."amount disposed (tonne)" = Float64[]
|
|
||||||
df."disposal limit (tonne)" = Float64[]
|
|
||||||
df."collection cost (\$)" = Float64[]
|
|
||||||
df."disposal cost (\$)" = Float64[]
|
|
||||||
|
|
||||||
centers = model.ext[:instance].centers
|
|
||||||
T = 1:model.ext[:instance].time_horizon
|
|
||||||
E_out = model.ext[:E_out]
|
|
||||||
|
|
||||||
for c in centers, m in c.outputs, t in T
|
|
||||||
collected = value(model[:z_collected][c.name, m.name, t])
|
|
||||||
disposed = value(model[:z_disp][c.name, m.name, t])
|
|
||||||
disposal_cost = c.disposal_cost[m][t] * disposed
|
|
||||||
if isempty(E_out[c])
|
|
||||||
collection_cost = 0
|
|
||||||
else
|
|
||||||
collection_cost = sum(
|
|
||||||
c.collection_cost[m][t] * value(model[:y][c.name, p.name, m.name, t])
|
|
||||||
for (p, m) in E_out[c]
|
|
||||||
)
|
|
||||||
end
|
|
||||||
push!(
|
|
||||||
df,
|
|
||||||
Dict(
|
|
||||||
"center" => c.name,
|
|
||||||
"latitude" => c.latitude,
|
|
||||||
"longitude" => c.longitude,
|
|
||||||
"output product" => m.name,
|
|
||||||
"year" => t,
|
|
||||||
"amount collected (tonne)" => _round(collected),
|
|
||||||
"amount disposed (tonne)" => _round(disposed),
|
|
||||||
"disposal limit (tonne)" => _round(c.disposal_limit[m][t]),
|
|
||||||
"collection cost (\$)" => _round(collection_cost),
|
|
||||||
"disposal cost (\$)" => _round(disposal_cost),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
end
|
|
||||||
return df
|
|
||||||
end
|
|
||||||
|
|
||||||
write_centers_report(solution, filename) = CSV.write(filename, centers_report(solution))
|
|
||||||
write_center_outputs_report(solution, filename) =
|
|
||||||
CSV.write(filename, center_outputs_report(solution))
|
|
||||||
38
src/reports/plant_emissions.jl
Normal file
38
src/reports/plant_emissions.jl
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
using DataFrames
|
||||||
|
using CSV
|
||||||
|
|
||||||
|
function plant_emissions_report(solution)::DataFrame
|
||||||
|
df = DataFrame()
|
||||||
|
df."plant type" = String[]
|
||||||
|
df."location name" = String[]
|
||||||
|
df."year" = Int[]
|
||||||
|
df."emission type" = String[]
|
||||||
|
df."emission amount (tonne)" = Float64[]
|
||||||
|
T = length(solution["Energy"]["Plants (GJ)"])
|
||||||
|
for (plant_name, plant_dict) in solution["Plants"]
|
||||||
|
for (location_name, location_dict) in plant_dict
|
||||||
|
for (emission_name, emission_amount) in location_dict["Emissions (tonne)"]
|
||||||
|
for year = 1:T
|
||||||
|
push!(
|
||||||
|
df,
|
||||||
|
[
|
||||||
|
plant_name,
|
||||||
|
location_name,
|
||||||
|
year,
|
||||||
|
emission_name,
|
||||||
|
round(emission_amount[year], digits = 2),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return df
|
||||||
|
end
|
||||||
|
|
||||||
|
write_plant_emissions_report(solution, filename) =
|
||||||
|
CSV.write(filename, plant_emissions_report(solution))
|
||||||
66
src/reports/plant_outputs.jl
Normal file
66
src/reports/plant_outputs.jl
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
using DataFrames
|
||||||
|
using CSV
|
||||||
|
|
||||||
|
function plant_outputs_report(solution)::DataFrame
|
||||||
|
df = DataFrame()
|
||||||
|
df."plant type" = String[]
|
||||||
|
df."location name" = String[]
|
||||||
|
df."year" = Int[]
|
||||||
|
df."product name" = String[]
|
||||||
|
df."amount produced (tonne)" = Float64[]
|
||||||
|
df."amount sent (tonne)" = Float64[]
|
||||||
|
df."amount disposed (tonne)" = Float64[]
|
||||||
|
df."disposal cost (\$)" = Float64[]
|
||||||
|
T = length(solution["Energy"]["Plants (GJ)"])
|
||||||
|
for (plant_name, plant_dict) in solution["Plants"]
|
||||||
|
for (location_name, location_dict) in plant_dict
|
||||||
|
for (product_name, amount_produced) in location_dict["Total output"]
|
||||||
|
send_dict = location_dict["Output"]["Send"]
|
||||||
|
disposal_dict = location_dict["Output"]["Dispose"]
|
||||||
|
|
||||||
|
sent = zeros(T)
|
||||||
|
if product_name in keys(send_dict)
|
||||||
|
for (dst_plant_name, dst_plant_dict) in send_dict[product_name]
|
||||||
|
for (dst_location_name, dst_location_dict) in dst_plant_dict
|
||||||
|
sent += dst_location_dict["Amount (tonne)"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
sent = round.(sent, digits = 2)
|
||||||
|
|
||||||
|
disposal_amount = zeros(T)
|
||||||
|
disposal_cost = zeros(T)
|
||||||
|
if product_name in keys(disposal_dict)
|
||||||
|
disposal_amount += disposal_dict[product_name]["Amount (tonne)"]
|
||||||
|
disposal_cost += disposal_dict[product_name]["Cost (\$)"]
|
||||||
|
end
|
||||||
|
disposal_amount = round.(disposal_amount, digits = 2)
|
||||||
|
disposal_cost = round.(disposal_cost, digits = 2)
|
||||||
|
|
||||||
|
for year = 1:T
|
||||||
|
push!(
|
||||||
|
df,
|
||||||
|
[
|
||||||
|
plant_name,
|
||||||
|
location_name,
|
||||||
|
year,
|
||||||
|
product_name,
|
||||||
|
round(amount_produced[year], digits = 2),
|
||||||
|
sent[year],
|
||||||
|
disposal_amount[year],
|
||||||
|
disposal_cost[year],
|
||||||
|
],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return df
|
||||||
|
end
|
||||||
|
|
||||||
|
write_plant_outputs_report(solution, filename) =
|
||||||
|
CSV.write(filename, plant_outputs_report(solution))
|
||||||
@@ -5,98 +5,75 @@
|
|||||||
using DataFrames
|
using DataFrames
|
||||||
using CSV
|
using CSV
|
||||||
|
|
||||||
function plants_report(model)::DataFrame
|
function plants_report(solution)::DataFrame
|
||||||
df = DataFrame()
|
df = DataFrame()
|
||||||
df."plant" = String[]
|
df."plant type" = String[]
|
||||||
df."latitude" = Float64[]
|
df."location name" = String[]
|
||||||
df."longitude" = Float64[]
|
|
||||||
df."initial capacity" = Float64[]
|
|
||||||
df."current capacity" = Float64[]
|
|
||||||
df."year" = Int[]
|
df."year" = Int[]
|
||||||
df."operational?" = Bool[]
|
df."latitude (deg)" = Float64[]
|
||||||
df."input amount (tonne)" = Float64[]
|
df."longitude (deg)" = Float64[]
|
||||||
|
df."capacity (tonne)" = Float64[]
|
||||||
|
df."amount processed (tonne)" = Float64[]
|
||||||
|
df."amount received (tonne)" = Float64[]
|
||||||
|
df."amount in storage (tonne)" = Float64[]
|
||||||
|
df."utilization factor (%)" = Float64[]
|
||||||
|
df."energy (GJ)" = Float64[]
|
||||||
df."opening cost (\$)" = Float64[]
|
df."opening cost (\$)" = Float64[]
|
||||||
|
df."expansion cost (\$)" = Float64[]
|
||||||
df."fixed operating cost (\$)" = Float64[]
|
df."fixed operating cost (\$)" = Float64[]
|
||||||
df."variable operating cost (\$)" = Float64[]
|
df."variable operating cost (\$)" = Float64[]
|
||||||
|
df."storage cost (\$)" = Float64[]
|
||||||
plants = model.ext[:instance].plants
|
df."total cost (\$)" = Float64[]
|
||||||
T = 1:model.ext[:instance].time_horizon
|
T = length(solution["Energy"]["Plants (GJ)"])
|
||||||
|
for (plant_name, plant_dict) in solution["Plants"]
|
||||||
for p in plants, t in T
|
for (location_name, location_dict) in plant_dict
|
||||||
operational = JuMP.value(model[:x][p.name, t]) > 0.5
|
for year = 1:T
|
||||||
input = value(model[:z_input][p.name, t])
|
capacity = round(location_dict["Capacity (tonne)"][year], digits = 2)
|
||||||
|
received = round(location_dict["Total input (tonne)"][year], digits = 2)
|
||||||
# Opening cost
|
processed = round(location_dict["Process (tonne)"][year], digits = 2)
|
||||||
opening_cost = 0
|
in_storage = round(location_dict["Storage (tonne)"][year], digits = 2)
|
||||||
if value(model[:x][p.name, t]) > 0.5 && value(model[:x][p.name, t-1]) < 0.5
|
utilization_factor = round(processed / capacity * 100.0, digits = 2)
|
||||||
opening_cost = p.capacities[1].opening_cost[t]
|
energy = round(location_dict["Energy (GJ)"][year], digits = 2)
|
||||||
|
latitude = round(location_dict["Latitude (deg)"], digits = 6)
|
||||||
|
longitude = round(location_dict["Longitude (deg)"], digits = 6)
|
||||||
|
opening_cost = round(location_dict["Opening cost (\$)"][year], digits = 2)
|
||||||
|
expansion_cost =
|
||||||
|
round(location_dict["Expansion cost (\$)"][year], digits = 2)
|
||||||
|
fixed_cost =
|
||||||
|
round(location_dict["Fixed operating cost (\$)"][year], digits = 2)
|
||||||
|
var_cost =
|
||||||
|
round(location_dict["Variable operating cost (\$)"][year], digits = 2)
|
||||||
|
storage_cost = round(location_dict["Storage cost (\$)"][year], digits = 2)
|
||||||
|
total_cost = round(
|
||||||
|
opening_cost + expansion_cost + fixed_cost + var_cost + storage_cost,
|
||||||
|
digits = 2,
|
||||||
|
)
|
||||||
|
push!(
|
||||||
|
df,
|
||||||
|
[
|
||||||
|
plant_name,
|
||||||
|
location_name,
|
||||||
|
year,
|
||||||
|
latitude,
|
||||||
|
longitude,
|
||||||
|
capacity,
|
||||||
|
processed,
|
||||||
|
received,
|
||||||
|
in_storage,
|
||||||
|
utilization_factor,
|
||||||
|
energy,
|
||||||
|
opening_cost,
|
||||||
|
expansion_cost,
|
||||||
|
fixed_cost,
|
||||||
|
var_cost,
|
||||||
|
storage_cost,
|
||||||
|
total_cost,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Plant size
|
|
||||||
curr_capacity = 0
|
|
||||||
if operational
|
|
||||||
curr_capacity = p.capacities[1].size
|
|
||||||
end
|
|
||||||
|
|
||||||
fix_operating_cost = (operational ? p.capacities[1].fix_operating_cost[t] : 0)
|
|
||||||
var_operating_cost = input * p.capacities[1].var_operating_cost[t]
|
|
||||||
push!(
|
|
||||||
df,
|
|
||||||
Dict(
|
|
||||||
"plant" => p.name,
|
|
||||||
"latitude" => p.latitude,
|
|
||||||
"longitude" => p.longitude,
|
|
||||||
"initial capacity" => p.initial_capacity,
|
|
||||||
"current capacity" => curr_capacity,
|
|
||||||
"year" => t,
|
|
||||||
"operational?" => operational,
|
|
||||||
"input amount (tonne)" => _round(input),
|
|
||||||
"opening cost (\$)" => _round(opening_cost),
|
|
||||||
"fixed operating cost (\$)" => _round(fix_operating_cost),
|
|
||||||
"variable operating cost (\$)" => _round(var_operating_cost),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
end
|
|
||||||
return df
|
|
||||||
end
|
|
||||||
|
|
||||||
function plant_outputs_report(model)::DataFrame
|
|
||||||
df = DataFrame()
|
|
||||||
df."plant" = String[]
|
|
||||||
df."latitude" = Float64[]
|
|
||||||
df."longitude" = Float64[]
|
|
||||||
df."output product" = String[]
|
|
||||||
df."year" = Int[]
|
|
||||||
df."amount produced (tonne)" = Float64[]
|
|
||||||
df."amount disposed (tonne)" = Float64[]
|
|
||||||
df."disposal limit (tonne)" = Float64[]
|
|
||||||
df."disposal cost (\$)" = Float64[]
|
|
||||||
|
|
||||||
plants = model.ext[:instance].plants
|
|
||||||
T = 1:model.ext[:instance].time_horizon
|
|
||||||
|
|
||||||
for p in plants, m in keys(p.output), t in T
|
|
||||||
produced = JuMP.value(model[:z_prod][p.name, m.name, t])
|
|
||||||
disposed = JuMP.value(model[:z_disp][p.name, m.name, t])
|
|
||||||
disposal_cost = p.disposal_cost[m][t] * disposed
|
|
||||||
push!(
|
|
||||||
df,
|
|
||||||
Dict(
|
|
||||||
"plant" => p.name,
|
|
||||||
"latitude" => p.latitude,
|
|
||||||
"longitude" => p.longitude,
|
|
||||||
"output product" => m.name,
|
|
||||||
"year" => t,
|
|
||||||
"amount produced (tonne)" => _round(produced),
|
|
||||||
"amount disposed (tonne)" => _round(disposed),
|
|
||||||
"disposal limit (tonne)" => _round(p.disposal_limit[m][t]),
|
|
||||||
"disposal cost (\$)" => _round(disposal_cost),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
return df
|
return df
|
||||||
end
|
end
|
||||||
|
|
||||||
write_plants_report(solution, filename) = CSV.write(filename, plants_report(solution))
|
write_plants_report(solution, filename) = CSV.write(filename, plants_report(solution))
|
||||||
write_plant_outputs_report(solution, filename) =
|
|
||||||
CSV.write(filename, plant_outputs_report(solution))
|
|
||||||
|
|||||||
52
src/reports/products.jl
Normal file
52
src/reports/products.jl
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
using DataFrames
|
||||||
|
using CSV
|
||||||
|
|
||||||
|
function products_report(solution)::DataFrame
|
||||||
|
df = DataFrame()
|
||||||
|
df."product name" = String[]
|
||||||
|
df."location name" = String[]
|
||||||
|
df."latitude (deg)" = Float64[]
|
||||||
|
df."longitude (deg)" = Float64[]
|
||||||
|
df."year" = Int[]
|
||||||
|
df."amount (tonne)" = Float64[]
|
||||||
|
df."marginal cost (\$/tonne)" = Float64[]
|
||||||
|
df."amount disposed (tonne)" = Float64[]
|
||||||
|
df."disposal cost (\$)" = Float64[]
|
||||||
|
T = length(solution["Energy"]["Plants (GJ)"])
|
||||||
|
for (prod_name, prod_dict) in solution["Products"]
|
||||||
|
for (location_name, location_dict) in prod_dict
|
||||||
|
for year = 1:T
|
||||||
|
marginal_cost = NaN
|
||||||
|
if "Marginal cost (\$/tonne)" in keys(location_dict)
|
||||||
|
marginal_cost = location_dict["Marginal cost (\$/tonne)"][year]
|
||||||
|
end
|
||||||
|
latitude = round(location_dict["Latitude (deg)"], digits = 6)
|
||||||
|
longitude = round(location_dict["Longitude (deg)"], digits = 6)
|
||||||
|
amount = location_dict["Amount (tonne)"][year]
|
||||||
|
amount_disposed = location_dict["Dispose (tonne)"][year]
|
||||||
|
disposal_cost = location_dict["Disposal cost (\$)"][year]
|
||||||
|
push!(
|
||||||
|
df,
|
||||||
|
[
|
||||||
|
prod_name,
|
||||||
|
location_name,
|
||||||
|
latitude,
|
||||||
|
longitude,
|
||||||
|
year,
|
||||||
|
amount,
|
||||||
|
marginal_cost,
|
||||||
|
amount_disposed,
|
||||||
|
disposal_cost,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return df
|
||||||
|
end
|
||||||
|
|
||||||
|
write_products_report(solution, filename) = CSV.write(filename, products_report(solution))
|
||||||
75
src/reports/tr.jl
Normal file
75
src/reports/tr.jl
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
using DataFrames
|
||||||
|
using CSV
|
||||||
|
|
||||||
|
function transportation_report(solution)::DataFrame
|
||||||
|
df = DataFrame()
|
||||||
|
df."source type" = String[]
|
||||||
|
df."source location name" = String[]
|
||||||
|
df."source latitude (deg)" = Float64[]
|
||||||
|
df."source longitude (deg)" = Float64[]
|
||||||
|
df."destination type" = String[]
|
||||||
|
df."destination location name" = String[]
|
||||||
|
df."destination latitude (deg)" = Float64[]
|
||||||
|
df."destination longitude (deg)" = Float64[]
|
||||||
|
df."product" = String[]
|
||||||
|
df."year" = Int[]
|
||||||
|
df."distance (km)" = Float64[]
|
||||||
|
df."amount (tonne)" = Float64[]
|
||||||
|
df."amount-distance (tonne-km)" = Float64[]
|
||||||
|
df."transportation cost (\$)" = Float64[]
|
||||||
|
df."transportation energy (GJ)" = Float64[]
|
||||||
|
|
||||||
|
T = length(solution["Energy"]["Plants (GJ)"])
|
||||||
|
for (dst_plant_name, dst_plant_dict) in solution["Plants"]
|
||||||
|
for (dst_location_name, dst_location_dict) in dst_plant_dict
|
||||||
|
for (src_plant_name, src_plant_dict) in dst_location_dict["Input"]
|
||||||
|
for (src_location_name, src_location_dict) in src_plant_dict
|
||||||
|
for year = 1:T
|
||||||
|
push!(
|
||||||
|
df,
|
||||||
|
[
|
||||||
|
src_plant_name,
|
||||||
|
src_location_name,
|
||||||
|
round(src_location_dict["Latitude (deg)"], digits = 6),
|
||||||
|
round(src_location_dict["Longitude (deg)"], digits = 6),
|
||||||
|
dst_plant_name,
|
||||||
|
dst_location_name,
|
||||||
|
round(dst_location_dict["Latitude (deg)"], digits = 6),
|
||||||
|
round(dst_location_dict["Longitude (deg)"], digits = 6),
|
||||||
|
dst_location_dict["Input product"],
|
||||||
|
year,
|
||||||
|
round(src_location_dict["Distance (km)"], digits = 2),
|
||||||
|
round(
|
||||||
|
src_location_dict["Amount (tonne)"][year],
|
||||||
|
digits = 2,
|
||||||
|
),
|
||||||
|
round(
|
||||||
|
src_location_dict["Amount (tonne)"][year] *
|
||||||
|
src_location_dict["Distance (km)"],
|
||||||
|
digits = 2,
|
||||||
|
),
|
||||||
|
round(
|
||||||
|
src_location_dict["Transportation cost (\$)"][year],
|
||||||
|
digits = 2,
|
||||||
|
),
|
||||||
|
round(
|
||||||
|
src_location_dict["Transportation energy (J)"][year] /
|
||||||
|
1e9,
|
||||||
|
digits = 2,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return df
|
||||||
|
end
|
||||||
|
|
||||||
|
write_transportation_report(solution, filename) =
|
||||||
|
CSV.write(filename, transportation_report(solution))
|
||||||
71
src/reports/tr_emissions.jl
Normal file
71
src/reports/tr_emissions.jl
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
using DataFrames
|
||||||
|
using CSV
|
||||||
|
|
||||||
|
function transportation_emissions_report(solution)::DataFrame
|
||||||
|
df = DataFrame()
|
||||||
|
df."source type" = String[]
|
||||||
|
df."source location name" = String[]
|
||||||
|
df."source latitude (deg)" = Float64[]
|
||||||
|
df."source longitude (deg)" = Float64[]
|
||||||
|
df."destination type" = String[]
|
||||||
|
df."destination location name" = String[]
|
||||||
|
df."destination latitude (deg)" = Float64[]
|
||||||
|
df."destination longitude (deg)" = Float64[]
|
||||||
|
df."product" = String[]
|
||||||
|
df."year" = Int[]
|
||||||
|
df."distance (km)" = Float64[]
|
||||||
|
df."shipped amount (tonne)" = Float64[]
|
||||||
|
df."shipped amount-distance (tonne-km)" = Float64[]
|
||||||
|
df."emission type" = String[]
|
||||||
|
df."emission amount (tonne)" = Float64[]
|
||||||
|
|
||||||
|
T = length(solution["Energy"]["Plants (GJ)"])
|
||||||
|
for (dst_plant_name, dst_plant_dict) in solution["Plants"]
|
||||||
|
for (dst_location_name, dst_location_dict) in dst_plant_dict
|
||||||
|
for (src_plant_name, src_plant_dict) in dst_location_dict["Input"]
|
||||||
|
for (src_location_name, src_location_dict) in src_plant_dict
|
||||||
|
for (emission_name, emission_amount) in
|
||||||
|
src_location_dict["Emissions (tonne)"]
|
||||||
|
for year = 1:T
|
||||||
|
push!(
|
||||||
|
df,
|
||||||
|
[
|
||||||
|
src_plant_name,
|
||||||
|
src_location_name,
|
||||||
|
round(src_location_dict["Latitude (deg)"], digits = 6),
|
||||||
|
round(src_location_dict["Longitude (deg)"], digits = 6),
|
||||||
|
dst_plant_name,
|
||||||
|
dst_location_name,
|
||||||
|
round(dst_location_dict["Latitude (deg)"], digits = 6),
|
||||||
|
round(dst_location_dict["Longitude (deg)"], digits = 6),
|
||||||
|
dst_location_dict["Input product"],
|
||||||
|
year,
|
||||||
|
round(src_location_dict["Distance (km)"], digits = 2),
|
||||||
|
round(
|
||||||
|
src_location_dict["Amount (tonne)"][year],
|
||||||
|
digits = 2,
|
||||||
|
),
|
||||||
|
round(
|
||||||
|
src_location_dict["Amount (tonne)"][year] *
|
||||||
|
src_location_dict["Distance (km)"],
|
||||||
|
digits = 2,
|
||||||
|
),
|
||||||
|
emission_name,
|
||||||
|
round(emission_amount[year], digits = 2),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return df
|
||||||
|
end
|
||||||
|
|
||||||
|
write_transportation_emissions_report(solution, filename) =
|
||||||
|
CSV.write(filename, transportation_emissions_report(solution))
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
# RELOG: Reverse Logistics Optimization
|
|
||||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
# Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
|
|
||||||
using DataFrames
|
|
||||||
using CSV
|
|
||||||
|
|
||||||
function transportation_report(model)::DataFrame
|
|
||||||
df = DataFrame()
|
|
||||||
df."source" = String[]
|
|
||||||
df."destination" = String[]
|
|
||||||
df."product" = String[]
|
|
||||||
df."year" = Int[]
|
|
||||||
df."amount sent (tonne)" = Float64[]
|
|
||||||
df."distance (km)" = Float64[]
|
|
||||||
df."transportation cost (\$)" = Float64[]
|
|
||||||
df."center revenue (\$)" = Float64[]
|
|
||||||
df."center collection cost (\$)" = Float64[]
|
|
||||||
|
|
||||||
E = model.ext[:E]
|
|
||||||
distances = model.ext[:distances]
|
|
||||||
T = 1:model.ext[:instance].time_horizon
|
|
||||||
|
|
||||||
for (p1, p2, m) in E, t in T
|
|
||||||
amount = value(model[:y][p1.name, p2.name, m.name, t])
|
|
||||||
amount > 1e-3 || continue
|
|
||||||
distance = distances[p1, p2, m]
|
|
||||||
tr_cost = distance * amount * m.tr_cost[t]
|
|
||||||
revenue = 0
|
|
||||||
if isa(p2, Center)
|
|
||||||
revenue = p2.revenue[t] * amount
|
|
||||||
end
|
|
||||||
collection_cost = 0
|
|
||||||
if isa(p1, Center)
|
|
||||||
collection_cost = p1.collection_cost[m][t] * amount
|
|
||||||
end
|
|
||||||
push!(
|
|
||||||
df,
|
|
||||||
Dict(
|
|
||||||
"source" => p1.name,
|
|
||||||
"destination" => p2.name,
|
|
||||||
"product" => m.name,
|
|
||||||
"year" => t,
|
|
||||||
"amount sent (tonne)" => _round(amount),
|
|
||||||
"distance (km)" => _round(distance),
|
|
||||||
"transportation cost (\$)" => _round(tr_cost),
|
|
||||||
"center revenue (\$)" => _round(revenue),
|
|
||||||
"center collection cost (\$)" => _round(collection_cost),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
end
|
|
||||||
return df
|
|
||||||
end
|
|
||||||
|
|
||||||
function transportation_emissions_report(model)::DataFrame
|
|
||||||
df = DataFrame()
|
|
||||||
df."source" = String[]
|
|
||||||
df."destination" = String[]
|
|
||||||
df."product" = String[]
|
|
||||||
df."emission" = String[]
|
|
||||||
df."year" = Int[]
|
|
||||||
df."amount sent (tonne)" = Float64[]
|
|
||||||
df."distance (km)" = Float64[]
|
|
||||||
df."emission factor (tonne/km/tonne)" = Float64[]
|
|
||||||
df."emission amount (tonne)" = Float64[]
|
|
||||||
|
|
||||||
E = model.ext[:E]
|
|
||||||
distances = model.ext[:distances]
|
|
||||||
T = 1:model.ext[:instance].time_horizon
|
|
||||||
|
|
||||||
for (p1, p2, m) in E, t in T, g in keys(m.tr_emissions)
|
|
||||||
amount = value(model[:y][p1.name, p2.name, m.name, t])
|
|
||||||
amount > 1e-3 || continue
|
|
||||||
distance = distances[p1, p2, m]
|
|
||||||
emission_factor = m.tr_emissions[g][t]
|
|
||||||
emissions = value(model[:z_tr_em][g, p1.name, p2.name, m.name, t])
|
|
||||||
push!(
|
|
||||||
df,
|
|
||||||
Dict(
|
|
||||||
"source" => p1.name,
|
|
||||||
"destination" => p2.name,
|
|
||||||
"product" => m.name,
|
|
||||||
"emission" => g,
|
|
||||||
"year" => t,
|
|
||||||
"amount sent (tonne)" => _round(amount),
|
|
||||||
"distance (km)" => _round(distance),
|
|
||||||
"emission factor (tonne/km/tonne)" => _round(emission_factor),
|
|
||||||
"emission amount (tonne)" => _round(emissions),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
end
|
|
||||||
return df
|
|
||||||
end
|
|
||||||
|
|
||||||
write_transportation_report(solution, filename) =
|
|
||||||
CSV.write(filename, transportation_report(solution))
|
|
||||||
|
|
||||||
write_transportation_emissions_report(solution, filename) =
|
|
||||||
CSV.write(filename, transportation_emissions_report(solution))
|
|
||||||
14
src/reports/write.jl
Normal file
14
src/reports/write.jl
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
using DataFrames
|
||||||
|
using CSV
|
||||||
|
import Base: write
|
||||||
|
|
||||||
|
function write(solution::AbstractDict, filename::AbstractString)
|
||||||
|
@info "Writing solution: $filename"
|
||||||
|
open(filename, "w") do file
|
||||||
|
JSON.print(file, solution, 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
203
src/schemas/input.json
Normal file
203
src/schemas/input.json
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||||
|
"$id": "https://anl-ceeesa.github.io/RELOG/input",
|
||||||
|
"title": "Schema for RELOG Input File",
|
||||||
|
"definitions": {
|
||||||
|
"TimeSeries": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Parameters": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"time horizon (years)": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"time horizon (years)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Plant": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"input": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"outputs (tonne/tonne)": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"energy (GJ/tonne)": {
|
||||||
|
"$ref": "#/definitions/TimeSeries"
|
||||||
|
},
|
||||||
|
"emissions (tonne/tonne)": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/definitions/TimeSeries"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"locations": {
|
||||||
|
"$ref": "#/definitions/PlantLocation"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"input",
|
||||||
|
"locations"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"PlantLocation": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"location": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"latitude (deg)": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"longitude (deg)": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"disposal": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"cost ($/tonne)": {
|
||||||
|
"$ref": "#/definitions/TimeSeries"
|
||||||
|
},
|
||||||
|
"limit (tonne)": {
|
||||||
|
"$ref": "#/definitions/TimeSeries"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"cost ($/tonne)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"storage": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"cost ($/tonne)": {
|
||||||
|
"$ref": "#/definitions/TimeSeries"
|
||||||
|
},
|
||||||
|
"limit (tonne)": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"cost ($/tonne)",
|
||||||
|
"limit (tonne)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"variable operating cost ($/tonne)": {
|
||||||
|
"$ref": "#/definitions/TimeSeries"
|
||||||
|
},
|
||||||
|
"fixed operating cost ($)": {
|
||||||
|
"$ref": "#/definitions/TimeSeries"
|
||||||
|
},
|
||||||
|
"opening cost ($)": {
|
||||||
|
"$ref": "#/definitions/TimeSeries"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"variable operating cost ($/tonne)",
|
||||||
|
"fixed operating cost ($)",
|
||||||
|
"opening cost ($)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"capacities (tonne)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"InitialAmount": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"location": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"latitude (deg)": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"longitude (deg)": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"amount (tonne)": {
|
||||||
|
"$ref": "#/definitions/TimeSeries"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"amount (tonne)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Product": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"transportation cost ($/km/tonne)": {
|
||||||
|
"$ref": "#/definitions/TimeSeries"
|
||||||
|
},
|
||||||
|
"transportation energy (J/km/tonne)": {
|
||||||
|
"$ref": "#/definitions/TimeSeries"
|
||||||
|
},
|
||||||
|
"transportation emissions (tonne/km/tonne)": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/definitions/TimeSeries"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"initial amounts": {
|
||||||
|
"$ref": "#/definitions/InitialAmount"
|
||||||
|
},
|
||||||
|
"disposal limit (tonne)": {
|
||||||
|
"$ref": "#/definitions/TimeSeries"
|
||||||
|
},
|
||||||
|
"disposal cost ($/tonne)": {
|
||||||
|
"$ref": "#/definitions/TimeSeries"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"transportation cost ($/km/tonne)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"parameters": {
|
||||||
|
"$ref": "#/definitions/Parameters"
|
||||||
|
},
|
||||||
|
"plants": {
|
||||||
|
"$ref": "#/definitions/Plant"
|
||||||
|
},
|
||||||
|
"products": {
|
||||||
|
"$ref": "#/definitions/Product"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"parameters",
|
||||||
|
"plants",
|
||||||
|
"products"
|
||||||
|
]
|
||||||
|
}
|
||||||
30
src/sysimage.jl
Normal file
30
src/sysimage.jl
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using PackageCompiler
|
||||||
|
using TOML
|
||||||
|
using Logging
|
||||||
|
|
||||||
|
Logging.disable_logging(Logging.Info)
|
||||||
|
|
||||||
|
mkpath("build")
|
||||||
|
|
||||||
|
printstyled("Generating precompilation statements...\n", color = :light_green)
|
||||||
|
run(`julia --project=. --trace-compile=build/precompile.jl $ARGS`)
|
||||||
|
|
||||||
|
printstyled("Finding dependencies...\n", color = :light_green)
|
||||||
|
project = TOML.parsefile("Project.toml")
|
||||||
|
manifest = TOML.parsefile("Manifest.toml")
|
||||||
|
deps = Symbol[]
|
||||||
|
for dep in keys(project["deps"])
|
||||||
|
if "path" in keys(manifest[dep][1])
|
||||||
|
printstyled(" skip $(dep)\n", color = :light_black)
|
||||||
|
else
|
||||||
|
println(" add $(dep)")
|
||||||
|
push!(deps, Symbol(dep))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
printstyled("Building system image...\n", color = :light_green)
|
||||||
|
create_sysimage(
|
||||||
|
deps,
|
||||||
|
precompile_statements_file = "build/precompile.jl",
|
||||||
|
sysimage_path = "build/sysimage.so",
|
||||||
|
)
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
name = "RELOGT"
|
|
||||||
uuid = "d5238ab2-e29b-4856-ba0f-d2b80f40b47d"
|
|
||||||
authors = ["Alinson S. Xavier <git@axavier.org>"]
|
|
||||||
version = "0.1.0"
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
|
|
||||||
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
|
|
||||||
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
|
|
||||||
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
|
|
||||||
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
|
|
||||||
RELOG = "7cafaa7a-b311-45f0-b313-80bf15b5e5e5"
|
|
||||||
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
|
|
||||||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
|
|
||||||
186
test/fixtures/boat_example.jl
vendored
186
test/fixtures/boat_example.jl
vendored
@@ -1,186 +0,0 @@
|
|||||||
using OrderedCollections
|
|
||||||
using JSON
|
|
||||||
using RELOG
|
|
||||||
dict = OrderedDict
|
|
||||||
|
|
||||||
function run_boat_example()
|
|
||||||
cities_a = dict(
|
|
||||||
"Chicago" => [41.881832, -87.623177],
|
|
||||||
"New York City" => [40.712776, -74.005974],
|
|
||||||
"Los Angeles" => [34.052235, -118.243683],
|
|
||||||
"Houston" => [29.760427, -95.369804],
|
|
||||||
"Phoenix" => [33.448376, -112.074036],
|
|
||||||
"Philadelphia" => [39.952583, -75.165222],
|
|
||||||
"San Antonio" => [29.424122, -98.493629],
|
|
||||||
"San Diego" => [32.715736, -117.161087],
|
|
||||||
"Dallas" => [32.776664, -96.796988],
|
|
||||||
"San Jose" => [37.338208, -121.886329],
|
|
||||||
)
|
|
||||||
|
|
||||||
cities_b = dict(
|
|
||||||
"Chicago" => [41.881832, -87.623177],
|
|
||||||
"Phoenix" => [33.448376, -112.074036],
|
|
||||||
"Dallas" => [32.776664, -96.796988],
|
|
||||||
)
|
|
||||||
|
|
||||||
parameters = dict(
|
|
||||||
"time horizon (years)" => 5,
|
|
||||||
"building period (years)" => [1],
|
|
||||||
"distance metric" => "Euclidean",
|
|
||||||
)
|
|
||||||
|
|
||||||
nail_factory = dict(
|
|
||||||
"input" => nothing,
|
|
||||||
"outputs" => ["Nail"],
|
|
||||||
"fixed output (tonne)" => dict("Nail" => 1),
|
|
||||||
"variable output (tonne/tonne)" => dict("Nail" => 0),
|
|
||||||
"revenue (\$/tonne)" => nothing,
|
|
||||||
"collection cost (\$/tonne)" => dict("Nail" => 1000),
|
|
||||||
"operating cost (\$)" => 0,
|
|
||||||
"disposal limit (tonne)" => dict("Nail" => nothing),
|
|
||||||
"disposal cost (\$/tonne)" => dict("Nail" => 0),
|
|
||||||
)
|
|
||||||
|
|
||||||
forest = dict(
|
|
||||||
"input" => nothing,
|
|
||||||
"outputs" => ["Wood"],
|
|
||||||
"fixed output (tonne)" => dict("Wood" => 100),
|
|
||||||
"variable output (tonne/tonne)" => dict("Wood" => 0),
|
|
||||||
"revenue (\$/tonne)" => nothing,
|
|
||||||
"collection cost (\$/tonne)" => dict("Wood" => 250),
|
|
||||||
"operating cost (\$)" => 0,
|
|
||||||
"disposal limit (tonne)" => dict("Wood" => nothing),
|
|
||||||
"disposal cost (\$/tonne)" => dict("Wood" => 0),
|
|
||||||
)
|
|
||||||
|
|
||||||
retail = dict(
|
|
||||||
"input" => "NewBoat",
|
|
||||||
"outputs" => ["UsedBoat"],
|
|
||||||
"fixed output (tonne)" => dict("UsedBoat" => 0),
|
|
||||||
"variable output (tonne/tonne)" => dict("UsedBoat" => [0.10, 0.25, 0.10]),
|
|
||||||
"revenue (\$/tonne)" => 12_000,
|
|
||||||
"collection cost (\$/tonne)" => dict("UsedBoat" => 100),
|
|
||||||
"operating cost (\$)" => 125_000,
|
|
||||||
"disposal limit (tonne)" => dict("UsedBoat" => 0),
|
|
||||||
"disposal cost (\$/tonne)" => dict("UsedBoat" => 0),
|
|
||||||
)
|
|
||||||
|
|
||||||
prod = dict(
|
|
||||||
"transportation cost (\$/km/tonne)" => 0.30,
|
|
||||||
"transportation energy (J/km/tonne)" => 7_500,
|
|
||||||
"transportation emissions (tonne/km/tonne)" =>
|
|
||||||
dict("CO2" => 2.68, "NH4" => 1.02),
|
|
||||||
"disposal limit (tonne)" => nothing,
|
|
||||||
)
|
|
||||||
|
|
||||||
boat_factory = dict(
|
|
||||||
"input mix (%)" => dict("Wood" => 95, "Nail" => 5),
|
|
||||||
"output (tonne)" => dict("NewBoat" => 1.0),
|
|
||||||
"processing emissions (tonne)" => dict("CO2" => 5),
|
|
||||||
"storage cost (\$/tonne)" => dict("Wood" => 500, "Nail" => 200),
|
|
||||||
"storage limit (tonne)" => dict("Wood" => 5, "Nail" => 1),
|
|
||||||
"disposal cost (\$/tonne)" => dict("NewBoat" => 0),
|
|
||||||
"disposal limit (tonne)" => dict("NewBoat" => 0),
|
|
||||||
"capacities" => [
|
|
||||||
dict(
|
|
||||||
"size (tonne)" => 500,
|
|
||||||
"opening cost (\$)" => 1_00_000,
|
|
||||||
"fixed operating cost (\$)" => 250_000,
|
|
||||||
"variable operating cost (\$/tonne)" => 5,
|
|
||||||
),
|
|
||||||
dict(
|
|
||||||
"size (tonne)" => 1000,
|
|
||||||
"opening cost (\$)" => 2_000_000,
|
|
||||||
"fixed operating cost (\$)" => 500_000,
|
|
||||||
"variable operating cost (\$/tonne)" => 5,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
"initial capacity (tonne)" => 0,
|
|
||||||
)
|
|
||||||
|
|
||||||
recycling_plant = dict(
|
|
||||||
"input mix (%)" => dict("UsedBoat" => 100),
|
|
||||||
"output (tonne)" => dict("Nail" => 0.025, "Wood" => 0.475),
|
|
||||||
"processing emissions (tonne)" => dict("CO2" => 5),
|
|
||||||
"storage cost (\$/tonne)" => dict("UsedBoat" => 0),
|
|
||||||
"storage limit (tonne)" => dict("UsedBoat" => 0),
|
|
||||||
"disposal cost (\$/tonne)" => dict("Nail" => 0, "Wood" => 0),
|
|
||||||
"disposal limit (tonne)" => dict("Nail" => 0, "Wood" => 0),
|
|
||||||
"capacities" => [
|
|
||||||
dict(
|
|
||||||
"size (tonne)" => 500,
|
|
||||||
"opening cost (\$)" => 500_000,
|
|
||||||
"fixed operating cost (\$)" => 125_000,
|
|
||||||
"variable operating cost (\$/tonne)" => 2.5,
|
|
||||||
),
|
|
||||||
dict(
|
|
||||||
"size (tonne)" => 1000,
|
|
||||||
"opening cost (\$)" => 1_000_000,
|
|
||||||
"fixed operating cost (\$)" => 250_000,
|
|
||||||
"variable operating cost (\$/tonne)" => 2.5,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
"initial capacity (tonne)" => 0,
|
|
||||||
)
|
|
||||||
|
|
||||||
lat_lon_dict(city_location) =
|
|
||||||
dict("latitude (deg)" => city_location[1], "longitude (deg)" => city_location[2])
|
|
||||||
|
|
||||||
data = dict(
|
|
||||||
"parameters" => parameters,
|
|
||||||
"products" =>
|
|
||||||
dict("Nail" => prod, "Wood" => prod, "NewBoat" => prod, "UsedBoat" => prod),
|
|
||||||
"centers" => merge(
|
|
||||||
dict(
|
|
||||||
"NailFactory ($city_name)" =>
|
|
||||||
merge(nail_factory, lat_lon_dict(city_location)) for
|
|
||||||
(city_name, city_location) in cities_b
|
|
||||||
),
|
|
||||||
dict(
|
|
||||||
"Forest ($city_name)" => merge(forest, lat_lon_dict(city_location))
|
|
||||||
for (city_name, city_location) in cities_b
|
|
||||||
),
|
|
||||||
dict(
|
|
||||||
"Retail ($city_name)" => merge(retail, lat_lon_dict(city_location))
|
|
||||||
for (city_name, city_location) in cities_a
|
|
||||||
),
|
|
||||||
),
|
|
||||||
"plants" => merge(
|
|
||||||
dict(
|
|
||||||
"BoatFactory ($city_name)" =>
|
|
||||||
merge(boat_factory, lat_lon_dict(city_location)) for
|
|
||||||
(city_name, city_location) in cities_a
|
|
||||||
),
|
|
||||||
dict(
|
|
||||||
"RecyclingPlant ($city_name)" =>
|
|
||||||
merge(recycling_plant, lat_lon_dict(city_location)) for
|
|
||||||
(city_name, city_location) in cities_a
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
# Generate instance file
|
|
||||||
open(fixture("boat_example.json"), "w") do file
|
|
||||||
JSON.print(file, data, 2)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Load and solve example
|
|
||||||
instance = RELOG.parsefile(fixture("boat_example.json"))
|
|
||||||
model = RELOG.build_model(instance, optimizer = HiGHS.Optimizer, variable_names = true)
|
|
||||||
optimize!(model)
|
|
||||||
|
|
||||||
# Write reports
|
|
||||||
mkpath(fixture("boat_example"))
|
|
||||||
write_to_file(model, fixture("boat_example/model.lp"))
|
|
||||||
RELOG.write_plants_report(model, fixture("boat_example/plants.csv"))
|
|
||||||
RELOG.write_plant_outputs_report(model, fixture("boat_example/plant_outputs.csv"))
|
|
||||||
RELOG.write_centers_report(model, fixture("boat_example/centers.csv"))
|
|
||||||
RELOG.write_center_outputs_report(model, fixture("boat_example/center_outputs.csv"))
|
|
||||||
RELOG.write_transportation_report(model, fixture("boat_example/transportation.csv"))
|
|
||||||
RELOG.write_transportation_emissions_report(
|
|
||||||
model,
|
|
||||||
fixture("boat_example/tr_emissions.csv"),
|
|
||||||
)
|
|
||||||
|
|
||||||
return
|
|
||||||
end
|
|
||||||
1351
test/fixtures/boat_example.json
vendored
1351
test/fixtures/boat_example.json
vendored
File diff suppressed because it is too large
Load Diff
81
test/fixtures/boat_example/center_outputs.csv
vendored
81
test/fixtures/boat_example/center_outputs.csv
vendored
@@ -1,81 +0,0 @@
|
|||||||
center,latitude,longitude,output product,year,amount collected (tonne),amount disposed (tonne),disposal limit (tonne),collection cost ($),disposal cost ($)
|
|
||||||
NailFactory (Chicago),41.881832,-87.623177,Nail,1,1.0,0.0,Inf,1000.0,0.0
|
|
||||||
NailFactory (Chicago),41.881832,-87.623177,Nail,2,1.0,0.0,Inf,1000.0,0.0
|
|
||||||
NailFactory (Chicago),41.881832,-87.623177,Nail,3,1.0,0.0,Inf,1000.0,0.0
|
|
||||||
NailFactory (Chicago),41.881832,-87.623177,Nail,4,1.0,0.0,Inf,1000.0,0.0
|
|
||||||
NailFactory (Chicago),41.881832,-87.623177,Nail,5,1.0,0.0,Inf,1000.0,0.0
|
|
||||||
NailFactory (Phoenix),33.448376,-112.074036,Nail,1,1.0,0.0,Inf,1000.0,0.0
|
|
||||||
NailFactory (Phoenix),33.448376,-112.074036,Nail,2,1.0,0.0,Inf,1000.0,0.0
|
|
||||||
NailFactory (Phoenix),33.448376,-112.074036,Nail,3,1.0,0.0,Inf,1000.0,0.0
|
|
||||||
NailFactory (Phoenix),33.448376,-112.074036,Nail,4,1.0,0.0,Inf,1000.0,0.0
|
|
||||||
NailFactory (Phoenix),33.448376,-112.074036,Nail,5,1.0,0.0,Inf,1000.0,0.0
|
|
||||||
NailFactory (Dallas),32.776664,-96.796988,Nail,1,1.0,0.0,Inf,1000.0,0.0
|
|
||||||
NailFactory (Dallas),32.776664,-96.796988,Nail,2,1.0,-0.0,Inf,1000.0,-0.0
|
|
||||||
NailFactory (Dallas),32.776664,-96.796988,Nail,3,1.0,0.0,Inf,1000.0,0.0
|
|
||||||
NailFactory (Dallas),32.776664,-96.796988,Nail,4,1.0,-0.0,Inf,1000.0,-0.0
|
|
||||||
NailFactory (Dallas),32.776664,-96.796988,Nail,5,1.0,-0.0,Inf,1000.0,-0.0
|
|
||||||
Forest (Chicago),41.881832,-87.623177,Wood,1,100.0,100.0,Inf,0.0,0.0
|
|
||||||
Forest (Chicago),41.881832,-87.623177,Wood,2,100.0,100.0,Inf,0.0,0.0
|
|
||||||
Forest (Chicago),41.881832,-87.623177,Wood,3,100.0,100.0,Inf,0.0,0.0
|
|
||||||
Forest (Chicago),41.881832,-87.623177,Wood,4,100.0,100.0,Inf,0.0,0.0
|
|
||||||
Forest (Chicago),41.881832,-87.623177,Wood,5,100.0,100.0,Inf,0.0,0.0
|
|
||||||
Forest (Phoenix),33.448376,-112.074036,Wood,1,100.0,100.0,Inf,0.0,0.0
|
|
||||||
Forest (Phoenix),33.448376,-112.074036,Wood,2,100.0,100.0,Inf,0.0,0.0
|
|
||||||
Forest (Phoenix),33.448376,-112.074036,Wood,3,100.0,100.0,Inf,0.0,0.0
|
|
||||||
Forest (Phoenix),33.448376,-112.074036,Wood,4,100.0,100.0,Inf,0.0,0.0
|
|
||||||
Forest (Phoenix),33.448376,-112.074036,Wood,5,100.0,100.0,Inf,0.0,0.0
|
|
||||||
Forest (Dallas),32.776664,-96.796988,Wood,1,100.0,43.0,Inf,14250.0,0.0
|
|
||||||
Forest (Dallas),32.776664,-96.796988,Wood,2,100.0,43.0,Inf,14250.0,0.0
|
|
||||||
Forest (Dallas),32.776664,-96.796988,Wood,3,100.0,43.0,Inf,14250.0,0.0
|
|
||||||
Forest (Dallas),32.776664,-96.796988,Wood,4,100.0,43.0,Inf,14250.0,0.0
|
|
||||||
Forest (Dallas),32.776664,-96.796988,Wood,5,100.0,43.0,Inf,14250.0,0.0
|
|
||||||
Retail (Chicago),41.881832,-87.623177,UsedBoat,1,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Chicago),41.881832,-87.623177,UsedBoat,2,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Chicago),41.881832,-87.623177,UsedBoat,3,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Chicago),41.881832,-87.623177,UsedBoat,4,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Chicago),41.881832,-87.623177,UsedBoat,5,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (New York City),40.712776,-74.005974,UsedBoat,1,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (New York City),40.712776,-74.005974,UsedBoat,2,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (New York City),40.712776,-74.005974,UsedBoat,3,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (New York City),40.712776,-74.005974,UsedBoat,4,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (New York City),40.712776,-74.005974,UsedBoat,5,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Los Angeles),34.052235,-118.243683,UsedBoat,1,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Los Angeles),34.052235,-118.243683,UsedBoat,2,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Los Angeles),34.052235,-118.243683,UsedBoat,3,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Los Angeles),34.052235,-118.243683,UsedBoat,4,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Los Angeles),34.052235,-118.243683,UsedBoat,5,-0.0,0.0,0.0,-0.0,0.0
|
|
||||||
Retail (Houston),29.760427,-95.369804,UsedBoat,1,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Houston),29.760427,-95.369804,UsedBoat,2,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Houston),29.760427,-95.369804,UsedBoat,3,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Houston),29.760427,-95.369804,UsedBoat,4,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Houston),29.760427,-95.369804,UsedBoat,5,-0.0,0.0,0.0,-0.0,0.0
|
|
||||||
Retail (Phoenix),33.448376,-112.074036,UsedBoat,1,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Phoenix),33.448376,-112.074036,UsedBoat,2,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Phoenix),33.448376,-112.074036,UsedBoat,3,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Phoenix),33.448376,-112.074036,UsedBoat,4,-0.0,0.0,0.0,-0.0,0.0
|
|
||||||
Retail (Phoenix),33.448376,-112.074036,UsedBoat,5,-0.0,0.0,0.0,-0.0,0.0
|
|
||||||
Retail (Philadelphia),39.952583,-75.165222,UsedBoat,1,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Philadelphia),39.952583,-75.165222,UsedBoat,2,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Philadelphia),39.952583,-75.165222,UsedBoat,3,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Philadelphia),39.952583,-75.165222,UsedBoat,4,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Philadelphia),39.952583,-75.165222,UsedBoat,5,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (San Antonio),29.424122,-98.493629,UsedBoat,1,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (San Antonio),29.424122,-98.493629,UsedBoat,2,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (San Antonio),29.424122,-98.493629,UsedBoat,3,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (San Antonio),29.424122,-98.493629,UsedBoat,4,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (San Antonio),29.424122,-98.493629,UsedBoat,5,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (San Diego),32.715736,-117.161087,UsedBoat,1,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (San Diego),32.715736,-117.161087,UsedBoat,2,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (San Diego),32.715736,-117.161087,UsedBoat,3,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (San Diego),32.715736,-117.161087,UsedBoat,4,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (San Diego),32.715736,-117.161087,UsedBoat,5,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (Dallas),32.776664,-96.796988,UsedBoat,1,6.31579,0.0,0.0,631.57895,0.0
|
|
||||||
Retail (Dallas),32.776664,-96.796988,UsedBoat,2,22.93629,0.0,0.0,2293.62881,0.0
|
|
||||||
Retail (Dallas),32.776664,-96.796988,UsedBoat,3,31.7714,0.0,0.0,3177.13952,0.0
|
|
||||||
Retail (Dallas),32.776664,-96.796988,UsedBoat,4,33.80867,0.0,0.0,3380.86724,0.0
|
|
||||||
Retail (Dallas),32.776664,-96.796988,UsedBoat,5,34.54174,0.0,0.0,3454.17409,0.0
|
|
||||||
Retail (San Jose),37.338208,-121.886329,UsedBoat,1,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (San Jose),37.338208,-121.886329,UsedBoat,2,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (San Jose),37.338208,-121.886329,UsedBoat,3,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (San Jose),37.338208,-121.886329,UsedBoat,4,0.0,0.0,0.0,0.0,0.0
|
|
||||||
Retail (San Jose),37.338208,-121.886329,UsedBoat,5,0.0,0.0,0.0,0.0,0.0
|
|
||||||
|
81
test/fixtures/boat_example/centers.csv
vendored
81
test/fixtures/boat_example/centers.csv
vendored
@@ -1,81 +0,0 @@
|
|||||||
center,latitude,longitude,year,input product,input amount (tonne),revenue ($),operating cost ($)
|
|
||||||
NailFactory (Chicago),41.881832,-87.623177,1,,0.0,0.0,0.0
|
|
||||||
NailFactory (Chicago),41.881832,-87.623177,2,,0.0,0.0,0.0
|
|
||||||
NailFactory (Chicago),41.881832,-87.623177,3,,0.0,0.0,0.0
|
|
||||||
NailFactory (Chicago),41.881832,-87.623177,4,,0.0,0.0,0.0
|
|
||||||
NailFactory (Chicago),41.881832,-87.623177,5,,0.0,0.0,0.0
|
|
||||||
NailFactory (Phoenix),33.448376,-112.074036,1,,0.0,0.0,0.0
|
|
||||||
NailFactory (Phoenix),33.448376,-112.074036,2,,0.0,0.0,0.0
|
|
||||||
NailFactory (Phoenix),33.448376,-112.074036,3,,0.0,0.0,0.0
|
|
||||||
NailFactory (Phoenix),33.448376,-112.074036,4,,0.0,0.0,0.0
|
|
||||||
NailFactory (Phoenix),33.448376,-112.074036,5,,0.0,0.0,0.0
|
|
||||||
NailFactory (Dallas),32.776664,-96.796988,1,,0.0,0.0,0.0
|
|
||||||
NailFactory (Dallas),32.776664,-96.796988,2,,0.0,0.0,0.0
|
|
||||||
NailFactory (Dallas),32.776664,-96.796988,3,,0.0,0.0,0.0
|
|
||||||
NailFactory (Dallas),32.776664,-96.796988,4,,0.0,0.0,0.0
|
|
||||||
NailFactory (Dallas),32.776664,-96.796988,5,,0.0,0.0,0.0
|
|
||||||
Forest (Chicago),41.881832,-87.623177,1,,0.0,0.0,0.0
|
|
||||||
Forest (Chicago),41.881832,-87.623177,2,,0.0,0.0,0.0
|
|
||||||
Forest (Chicago),41.881832,-87.623177,3,,0.0,0.0,0.0
|
|
||||||
Forest (Chicago),41.881832,-87.623177,4,,0.0,0.0,0.0
|
|
||||||
Forest (Chicago),41.881832,-87.623177,5,,0.0,0.0,0.0
|
|
||||||
Forest (Phoenix),33.448376,-112.074036,1,,0.0,0.0,0.0
|
|
||||||
Forest (Phoenix),33.448376,-112.074036,2,,0.0,0.0,0.0
|
|
||||||
Forest (Phoenix),33.448376,-112.074036,3,,0.0,0.0,0.0
|
|
||||||
Forest (Phoenix),33.448376,-112.074036,4,,0.0,0.0,0.0
|
|
||||||
Forest (Phoenix),33.448376,-112.074036,5,,0.0,0.0,0.0
|
|
||||||
Forest (Dallas),32.776664,-96.796988,1,,0.0,0.0,0.0
|
|
||||||
Forest (Dallas),32.776664,-96.796988,2,,0.0,0.0,0.0
|
|
||||||
Forest (Dallas),32.776664,-96.796988,3,,0.0,0.0,0.0
|
|
||||||
Forest (Dallas),32.776664,-96.796988,4,,0.0,0.0,0.0
|
|
||||||
Forest (Dallas),32.776664,-96.796988,5,,0.0,0.0,0.0
|
|
||||||
Retail (Chicago),41.881832,-87.623177,1,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Chicago),41.881832,-87.623177,2,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Chicago),41.881832,-87.623177,3,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Chicago),41.881832,-87.623177,4,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Chicago),41.881832,-87.623177,5,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (New York City),40.712776,-74.005974,1,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (New York City),40.712776,-74.005974,2,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (New York City),40.712776,-74.005974,3,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (New York City),40.712776,-74.005974,4,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (New York City),40.712776,-74.005974,5,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Los Angeles),34.052235,-118.243683,1,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Los Angeles),34.052235,-118.243683,2,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Los Angeles),34.052235,-118.243683,3,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Los Angeles),34.052235,-118.243683,4,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Los Angeles),34.052235,-118.243683,5,NewBoat,-0.0,0.0,125000.0
|
|
||||||
Retail (Houston),29.760427,-95.369804,1,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Houston),29.760427,-95.369804,2,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Houston),29.760427,-95.369804,3,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Houston),29.760427,-95.369804,4,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Houston),29.760427,-95.369804,5,NewBoat,-0.0,0.0,125000.0
|
|
||||||
Retail (Phoenix),33.448376,-112.074036,1,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Phoenix),33.448376,-112.074036,2,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Phoenix),33.448376,-112.074036,3,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Phoenix),33.448376,-112.074036,4,NewBoat,-0.0,-0.0,125000.0
|
|
||||||
Retail (Phoenix),33.448376,-112.074036,5,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Philadelphia),39.952583,-75.165222,1,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Philadelphia),39.952583,-75.165222,2,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Philadelphia),39.952583,-75.165222,3,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Philadelphia),39.952583,-75.165222,4,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Philadelphia),39.952583,-75.165222,5,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (San Antonio),29.424122,-98.493629,1,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (San Antonio),29.424122,-98.493629,2,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (San Antonio),29.424122,-98.493629,3,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (San Antonio),29.424122,-98.493629,4,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (San Antonio),29.424122,-98.493629,5,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (San Diego),32.715736,-117.161087,1,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (San Diego),32.715736,-117.161087,2,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (San Diego),32.715736,-117.161087,3,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (San Diego),32.715736,-117.161087,4,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (San Diego),32.715736,-117.161087,5,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (Dallas),32.776664,-96.796988,1,NewBoat,63.15789,757894.73684,125000.0
|
|
||||||
Retail (Dallas),32.776664,-96.796988,2,NewBoat,71.46814,857617.72853,125000.0
|
|
||||||
Retail (Dallas),32.776664,-96.796988,3,NewBoat,75.8857,910628.37148,125000.0
|
|
||||||
Retail (Dallas),32.776664,-96.796988,4,NewBoat,76.90434,922852.03459,125000.0
|
|
||||||
Retail (Dallas),32.776664,-96.796988,5,NewBoat,77.27087,927250.44516,125000.0
|
|
||||||
Retail (San Jose),37.338208,-121.886329,1,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (San Jose),37.338208,-121.886329,2,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (San Jose),37.338208,-121.886329,3,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (San Jose),37.338208,-121.886329,4,NewBoat,0.0,0.0,125000.0
|
|
||||||
Retail (San Jose),37.338208,-121.886329,5,NewBoat,0.0,0.0,125000.0
|
|
||||||
|
151
test/fixtures/boat_example/plant_outputs.csv
vendored
151
test/fixtures/boat_example/plant_outputs.csv
vendored
@@ -1,151 +0,0 @@
|
|||||||
plant,latitude,longitude,output product,year,amount produced (tonne),amount disposed (tonne),disposal limit (tonne),disposal cost ($)
|
|
||||||
BoatFactory (Chicago),41.881832,-87.623177,NewBoat,1,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Chicago),41.881832,-87.623177,NewBoat,2,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Chicago),41.881832,-87.623177,NewBoat,3,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Chicago),41.881832,-87.623177,NewBoat,4,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Chicago),41.881832,-87.623177,NewBoat,5,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (New York City),40.712776,-74.005974,NewBoat,1,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (New York City),40.712776,-74.005974,NewBoat,2,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (New York City),40.712776,-74.005974,NewBoat,3,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (New York City),40.712776,-74.005974,NewBoat,4,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (New York City),40.712776,-74.005974,NewBoat,5,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Los Angeles),34.052235,-118.243683,NewBoat,1,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Los Angeles),34.052235,-118.243683,NewBoat,2,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Los Angeles),34.052235,-118.243683,NewBoat,3,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Los Angeles),34.052235,-118.243683,NewBoat,4,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Los Angeles),34.052235,-118.243683,NewBoat,5,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Houston),29.760427,-95.369804,NewBoat,1,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Houston),29.760427,-95.369804,NewBoat,2,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Houston),29.760427,-95.369804,NewBoat,3,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Houston),29.760427,-95.369804,NewBoat,4,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Houston),29.760427,-95.369804,NewBoat,5,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Phoenix),33.448376,-112.074036,NewBoat,1,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Phoenix),33.448376,-112.074036,NewBoat,2,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Phoenix),33.448376,-112.074036,NewBoat,3,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Phoenix),33.448376,-112.074036,NewBoat,4,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Phoenix),33.448376,-112.074036,NewBoat,5,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Philadelphia),39.952583,-75.165222,NewBoat,1,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Philadelphia),39.952583,-75.165222,NewBoat,2,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Philadelphia),39.952583,-75.165222,NewBoat,3,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Philadelphia),39.952583,-75.165222,NewBoat,4,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Philadelphia),39.952583,-75.165222,NewBoat,5,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Antonio),29.424122,-98.493629,NewBoat,1,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Antonio),29.424122,-98.493629,NewBoat,2,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Antonio),29.424122,-98.493629,NewBoat,3,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Antonio),29.424122,-98.493629,NewBoat,4,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Antonio),29.424122,-98.493629,NewBoat,5,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Diego),32.715736,-117.161087,NewBoat,1,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Diego),32.715736,-117.161087,NewBoat,2,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Diego),32.715736,-117.161087,NewBoat,3,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Diego),32.715736,-117.161087,NewBoat,4,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Diego),32.715736,-117.161087,NewBoat,5,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Dallas),32.776664,-96.796988,NewBoat,1,63.15789,0.0,0.0,0.0
|
|
||||||
BoatFactory (Dallas),32.776664,-96.796988,NewBoat,2,71.46814,0.0,0.0,0.0
|
|
||||||
BoatFactory (Dallas),32.776664,-96.796988,NewBoat,3,75.8857,0.0,0.0,0.0
|
|
||||||
BoatFactory (Dallas),32.776664,-96.796988,NewBoat,4,76.90434,0.0,0.0,0.0
|
|
||||||
BoatFactory (Dallas),32.776664,-96.796988,NewBoat,5,77.27087,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Jose),37.338208,-121.886329,NewBoat,1,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Jose),37.338208,-121.886329,NewBoat,2,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Jose),37.338208,-121.886329,NewBoat,3,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Jose),37.338208,-121.886329,NewBoat,4,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Jose),37.338208,-121.886329,NewBoat,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Chicago),41.881832,-87.623177,Nail,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Chicago),41.881832,-87.623177,Nail,2,-0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Chicago),41.881832,-87.623177,Nail,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Chicago),41.881832,-87.623177,Nail,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Chicago),41.881832,-87.623177,Nail,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Chicago),41.881832,-87.623177,Wood,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Chicago),41.881832,-87.623177,Wood,2,-0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Chicago),41.881832,-87.623177,Wood,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Chicago),41.881832,-87.623177,Wood,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Chicago),41.881832,-87.623177,Wood,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (New York City),40.712776,-74.005974,Nail,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (New York City),40.712776,-74.005974,Nail,2,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (New York City),40.712776,-74.005974,Nail,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (New York City),40.712776,-74.005974,Nail,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (New York City),40.712776,-74.005974,Nail,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (New York City),40.712776,-74.005974,Wood,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (New York City),40.712776,-74.005974,Wood,2,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (New York City),40.712776,-74.005974,Wood,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (New York City),40.712776,-74.005974,Wood,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (New York City),40.712776,-74.005974,Wood,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Los Angeles),34.052235,-118.243683,Nail,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Los Angeles),34.052235,-118.243683,Nail,2,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Los Angeles),34.052235,-118.243683,Nail,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Los Angeles),34.052235,-118.243683,Nail,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Los Angeles),34.052235,-118.243683,Nail,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Los Angeles),34.052235,-118.243683,Wood,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Los Angeles),34.052235,-118.243683,Wood,2,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Los Angeles),34.052235,-118.243683,Wood,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Los Angeles),34.052235,-118.243683,Wood,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Los Angeles),34.052235,-118.243683,Wood,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Houston),29.760427,-95.369804,Nail,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Houston),29.760427,-95.369804,Nail,2,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Houston),29.760427,-95.369804,Nail,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Houston),29.760427,-95.369804,Nail,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Houston),29.760427,-95.369804,Nail,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Houston),29.760427,-95.369804,Wood,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Houston),29.760427,-95.369804,Wood,2,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Houston),29.760427,-95.369804,Wood,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Houston),29.760427,-95.369804,Wood,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Houston),29.760427,-95.369804,Wood,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Phoenix),33.448376,-112.074036,Nail,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Phoenix),33.448376,-112.074036,Nail,2,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Phoenix),33.448376,-112.074036,Nail,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Phoenix),33.448376,-112.074036,Nail,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Phoenix),33.448376,-112.074036,Nail,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Phoenix),33.448376,-112.074036,Wood,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Phoenix),33.448376,-112.074036,Wood,2,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Phoenix),33.448376,-112.074036,Wood,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Phoenix),33.448376,-112.074036,Wood,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Phoenix),33.448376,-112.074036,Wood,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Philadelphia),39.952583,-75.165222,Nail,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Philadelphia),39.952583,-75.165222,Nail,2,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Philadelphia),39.952583,-75.165222,Nail,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Philadelphia),39.952583,-75.165222,Nail,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Philadelphia),39.952583,-75.165222,Nail,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Philadelphia),39.952583,-75.165222,Wood,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Philadelphia),39.952583,-75.165222,Wood,2,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Philadelphia),39.952583,-75.165222,Wood,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Philadelphia),39.952583,-75.165222,Wood,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Philadelphia),39.952583,-75.165222,Wood,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Antonio),29.424122,-98.493629,Nail,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Antonio),29.424122,-98.493629,Nail,2,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Antonio),29.424122,-98.493629,Nail,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Antonio),29.424122,-98.493629,Nail,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Antonio),29.424122,-98.493629,Nail,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Antonio),29.424122,-98.493629,Wood,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Antonio),29.424122,-98.493629,Wood,2,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Antonio),29.424122,-98.493629,Wood,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Antonio),29.424122,-98.493629,Wood,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Antonio),29.424122,-98.493629,Wood,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Diego),32.715736,-117.161087,Nail,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Diego),32.715736,-117.161087,Nail,2,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Diego),32.715736,-117.161087,Nail,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Diego),32.715736,-117.161087,Nail,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Diego),32.715736,-117.161087,Nail,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Diego),32.715736,-117.161087,Wood,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Diego),32.715736,-117.161087,Wood,2,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Diego),32.715736,-117.161087,Wood,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Diego),32.715736,-117.161087,Wood,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Diego),32.715736,-117.161087,Wood,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),32.776664,-96.796988,Nail,1,0.15789,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),32.776664,-96.796988,Nail,2,0.57341,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),32.776664,-96.796988,Nail,3,0.79428,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),32.776664,-96.796988,Nail,4,0.84522,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),32.776664,-96.796988,Nail,5,0.86354,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),32.776664,-96.796988,Wood,1,3.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),32.776664,-96.796988,Wood,2,10.89474,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),32.776664,-96.796988,Wood,3,15.09141,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),32.776664,-96.796988,Wood,4,16.05912,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),32.776664,-96.796988,Wood,5,16.40733,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Jose),37.338208,-121.886329,Nail,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Jose),37.338208,-121.886329,Nail,2,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Jose),37.338208,-121.886329,Nail,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Jose),37.338208,-121.886329,Nail,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Jose),37.338208,-121.886329,Nail,5,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Jose),37.338208,-121.886329,Wood,1,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Jose),37.338208,-121.886329,Wood,2,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Jose),37.338208,-121.886329,Wood,3,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Jose),37.338208,-121.886329,Wood,4,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Jose),37.338208,-121.886329,Wood,5,0.0,0.0,0.0,0.0
|
|
||||||
|
101
test/fixtures/boat_example/plants.csv
vendored
101
test/fixtures/boat_example/plants.csv
vendored
@@ -1,101 +0,0 @@
|
|||||||
plant,latitude,longitude,initial capacity,current capacity,year,operational?,input amount (tonne),opening cost ($),fixed operating cost ($),variable operating cost ($)
|
|
||||||
BoatFactory (Chicago),41.881832,-87.623177,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Chicago),41.881832,-87.623177,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Chicago),41.881832,-87.623177,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Chicago),41.881832,-87.623177,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Chicago),41.881832,-87.623177,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (New York City),40.712776,-74.005974,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (New York City),40.712776,-74.005974,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (New York City),40.712776,-74.005974,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (New York City),40.712776,-74.005974,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (New York City),40.712776,-74.005974,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Los Angeles),34.052235,-118.243683,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Los Angeles),34.052235,-118.243683,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Los Angeles),34.052235,-118.243683,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Los Angeles),34.052235,-118.243683,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Los Angeles),34.052235,-118.243683,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Houston),29.760427,-95.369804,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Houston),29.760427,-95.369804,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Houston),29.760427,-95.369804,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Houston),29.760427,-95.369804,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Houston),29.760427,-95.369804,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Phoenix),33.448376,-112.074036,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Phoenix),33.448376,-112.074036,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Phoenix),33.448376,-112.074036,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Phoenix),33.448376,-112.074036,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Phoenix),33.448376,-112.074036,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Philadelphia),39.952583,-75.165222,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Philadelphia),39.952583,-75.165222,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Philadelphia),39.952583,-75.165222,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Philadelphia),39.952583,-75.165222,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Philadelphia),39.952583,-75.165222,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Antonio),29.424122,-98.493629,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Antonio),29.424122,-98.493629,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Antonio),29.424122,-98.493629,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Antonio),29.424122,-98.493629,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Antonio),29.424122,-98.493629,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Diego),32.715736,-117.161087,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Diego),32.715736,-117.161087,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Diego),32.715736,-117.161087,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Diego),32.715736,-117.161087,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Diego),32.715736,-117.161087,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (Dallas),32.776664,-96.796988,0.0,500.0,1,true,63.15789,100000.0,250000.0,315.78947
|
|
||||||
BoatFactory (Dallas),32.776664,-96.796988,0.0,500.0,2,true,71.46814,0.0,250000.0,357.34072
|
|
||||||
BoatFactory (Dallas),32.776664,-96.796988,0.0,500.0,3,true,75.8857,0.0,250000.0,379.42849
|
|
||||||
BoatFactory (Dallas),32.776664,-96.796988,0.0,500.0,4,true,76.90434,0.0,250000.0,384.52168
|
|
||||||
BoatFactory (Dallas),32.776664,-96.796988,0.0,500.0,5,true,77.27087,0.0,250000.0,386.35435
|
|
||||||
BoatFactory (San Jose),37.338208,-121.886329,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Jose),37.338208,-121.886329,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Jose),37.338208,-121.886329,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Jose),37.338208,-121.886329,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
BoatFactory (San Jose),37.338208,-121.886329,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Chicago),41.881832,-87.623177,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Chicago),41.881832,-87.623177,0.0,0.0,2,false,-0.0,0.0,0.0,-0.0
|
|
||||||
RecyclingPlant (Chicago),41.881832,-87.623177,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Chicago),41.881832,-87.623177,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Chicago),41.881832,-87.623177,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (New York City),40.712776,-74.005974,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (New York City),40.712776,-74.005974,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (New York City),40.712776,-74.005974,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (New York City),40.712776,-74.005974,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (New York City),40.712776,-74.005974,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Los Angeles),34.052235,-118.243683,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Los Angeles),34.052235,-118.243683,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Los Angeles),34.052235,-118.243683,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Los Angeles),34.052235,-118.243683,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Los Angeles),34.052235,-118.243683,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Houston),29.760427,-95.369804,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Houston),29.760427,-95.369804,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Houston),29.760427,-95.369804,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Houston),29.760427,-95.369804,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Houston),29.760427,-95.369804,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Phoenix),33.448376,-112.074036,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Phoenix),33.448376,-112.074036,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Phoenix),33.448376,-112.074036,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Phoenix),33.448376,-112.074036,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Phoenix),33.448376,-112.074036,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Philadelphia),39.952583,-75.165222,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Philadelphia),39.952583,-75.165222,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Philadelphia),39.952583,-75.165222,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Philadelphia),39.952583,-75.165222,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Philadelphia),39.952583,-75.165222,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Antonio),29.424122,-98.493629,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Antonio),29.424122,-98.493629,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Antonio),29.424122,-98.493629,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Antonio),29.424122,-98.493629,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Antonio),29.424122,-98.493629,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Diego),32.715736,-117.161087,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Diego),32.715736,-117.161087,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Diego),32.715736,-117.161087,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Diego),32.715736,-117.161087,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Diego),32.715736,-117.161087,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),32.776664,-96.796988,0.0,500.0,1,true,6.31579,500000.0,125000.0,15.78947
|
|
||||||
RecyclingPlant (Dallas),32.776664,-96.796988,0.0,500.0,2,true,22.93629,0.0,125000.0,57.34072
|
|
||||||
RecyclingPlant (Dallas),32.776664,-96.796988,0.0,500.0,3,true,31.7714,0.0,125000.0,79.42849
|
|
||||||
RecyclingPlant (Dallas),32.776664,-96.796988,0.0,500.0,4,true,33.80867,0.0,125000.0,84.52168
|
|
||||||
RecyclingPlant (Dallas),32.776664,-96.796988,0.0,500.0,5,true,34.54174,0.0,125000.0,86.35435
|
|
||||||
RecyclingPlant (San Jose),37.338208,-121.886329,0.0,0.0,1,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Jose),37.338208,-121.886329,0.0,0.0,2,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Jose),37.338208,-121.886329,0.0,0.0,3,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Jose),37.338208,-121.886329,0.0,0.0,4,false,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (San Jose),37.338208,-121.886329,0.0,0.0,5,false,0.0,0.0,0.0,0.0
|
|
||||||
|
81
test/fixtures/boat_example/tr_emissions.csv
vendored
81
test/fixtures/boat_example/tr_emissions.csv
vendored
@@ -1,81 +0,0 @@
|
|||||||
source,destination,product,emission,year,amount sent (tonne),distance (km),emission factor (tonne/km/tonne),emission amount (tonne)
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,CO2,1,0.15789,0.0,2.68,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,NH4,1,0.15789,0.0,1.02,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,CO2,2,0.57341,0.0,2.68,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,NH4,2,0.57341,0.0,1.02,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,CO2,3,0.79428,0.0,2.68,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,NH4,3,0.79428,0.0,1.02,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,CO2,4,0.84522,0.0,2.68,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,NH4,4,0.84522,0.0,1.02,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,CO2,5,0.86354,0.0,2.68,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,NH4,5,0.86354,0.0,1.02,0.0
|
|
||||||
NailFactory (Chicago),BoatFactory (Dallas),Nail,CO2,1,1.0,1293.093,2.68,3465.48924
|
|
||||||
NailFactory (Chicago),BoatFactory (Dallas),Nail,NH4,1,1.0,1293.093,1.02,1318.95486
|
|
||||||
NailFactory (Chicago),BoatFactory (Dallas),Nail,CO2,2,1.0,1293.093,2.68,3465.48924
|
|
||||||
NailFactory (Chicago),BoatFactory (Dallas),Nail,NH4,2,1.0,1293.093,1.02,1318.95486
|
|
||||||
NailFactory (Chicago),BoatFactory (Dallas),Nail,CO2,3,1.0,1293.093,2.68,3465.48924
|
|
||||||
NailFactory (Chicago),BoatFactory (Dallas),Nail,NH4,3,1.0,1293.093,1.02,1318.95486
|
|
||||||
NailFactory (Chicago),BoatFactory (Dallas),Nail,CO2,4,1.0,1293.093,2.68,3465.48924
|
|
||||||
NailFactory (Chicago),BoatFactory (Dallas),Nail,NH4,4,1.0,1293.093,1.02,1318.95486
|
|
||||||
NailFactory (Chicago),BoatFactory (Dallas),Nail,CO2,5,1.0,1293.093,2.68,3465.48924
|
|
||||||
NailFactory (Chicago),BoatFactory (Dallas),Nail,NH4,5,1.0,1293.093,1.02,1318.95486
|
|
||||||
NailFactory (Phoenix),BoatFactory (Dallas),Nail,CO2,1,1.0,1423.57,2.68,3815.1676
|
|
||||||
NailFactory (Phoenix),BoatFactory (Dallas),Nail,NH4,1,1.0,1423.57,1.02,1452.0414
|
|
||||||
NailFactory (Phoenix),BoatFactory (Dallas),Nail,CO2,2,1.0,1423.57,2.68,3815.1676
|
|
||||||
NailFactory (Phoenix),BoatFactory (Dallas),Nail,NH4,2,1.0,1423.57,1.02,1452.0414
|
|
||||||
NailFactory (Phoenix),BoatFactory (Dallas),Nail,CO2,3,1.0,1423.57,2.68,3815.1676
|
|
||||||
NailFactory (Phoenix),BoatFactory (Dallas),Nail,NH4,3,1.0,1423.57,1.02,1452.0414
|
|
||||||
NailFactory (Phoenix),BoatFactory (Dallas),Nail,CO2,4,1.0,1423.57,2.68,3815.1676
|
|
||||||
NailFactory (Phoenix),BoatFactory (Dallas),Nail,NH4,4,1.0,1423.57,1.02,1452.0414
|
|
||||||
NailFactory (Phoenix),BoatFactory (Dallas),Nail,CO2,5,1.0,1423.57,2.68,3815.1676
|
|
||||||
NailFactory (Phoenix),BoatFactory (Dallas),Nail,NH4,5,1.0,1423.57,1.02,1452.0414
|
|
||||||
NailFactory (Dallas),BoatFactory (Dallas),Nail,CO2,1,1.0,0.0,2.68,0.0
|
|
||||||
NailFactory (Dallas),BoatFactory (Dallas),Nail,NH4,1,1.0,0.0,1.02,0.0
|
|
||||||
NailFactory (Dallas),BoatFactory (Dallas),Nail,CO2,2,1.0,0.0,2.68,0.0
|
|
||||||
NailFactory (Dallas),BoatFactory (Dallas),Nail,NH4,2,1.0,0.0,1.02,0.0
|
|
||||||
NailFactory (Dallas),BoatFactory (Dallas),Nail,CO2,3,1.0,0.0,2.68,0.0
|
|
||||||
NailFactory (Dallas),BoatFactory (Dallas),Nail,NH4,3,1.0,0.0,1.02,0.0
|
|
||||||
NailFactory (Dallas),BoatFactory (Dallas),Nail,CO2,4,1.0,0.0,2.68,0.0
|
|
||||||
NailFactory (Dallas),BoatFactory (Dallas),Nail,NH4,4,1.0,0.0,1.02,0.0
|
|
||||||
NailFactory (Dallas),BoatFactory (Dallas),Nail,CO2,5,1.0,0.0,2.68,0.0
|
|
||||||
NailFactory (Dallas),BoatFactory (Dallas),Nail,NH4,5,1.0,0.0,1.02,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,CO2,1,3.0,0.0,2.68,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,NH4,1,3.0,0.0,1.02,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,CO2,2,10.89474,0.0,2.68,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,NH4,2,10.89474,0.0,1.02,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,CO2,3,15.09141,0.0,2.68,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,NH4,3,15.09141,0.0,1.02,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,CO2,4,16.05912,0.0,2.68,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,NH4,4,16.05912,0.0,1.02,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,CO2,5,16.40733,0.0,2.68,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,NH4,5,16.40733,0.0,1.02,0.0
|
|
||||||
Forest (Dallas),BoatFactory (Dallas),Wood,CO2,1,57.0,0.0,2.68,0.0
|
|
||||||
Forest (Dallas),BoatFactory (Dallas),Wood,NH4,1,57.0,0.0,1.02,0.0
|
|
||||||
Forest (Dallas),BoatFactory (Dallas),Wood,CO2,2,57.0,0.0,2.68,0.0
|
|
||||||
Forest (Dallas),BoatFactory (Dallas),Wood,NH4,2,57.0,0.0,1.02,0.0
|
|
||||||
Forest (Dallas),BoatFactory (Dallas),Wood,CO2,3,57.0,0.0,2.68,0.0
|
|
||||||
Forest (Dallas),BoatFactory (Dallas),Wood,NH4,3,57.0,0.0,1.02,0.0
|
|
||||||
Forest (Dallas),BoatFactory (Dallas),Wood,CO2,4,57.0,0.0,2.68,0.0
|
|
||||||
Forest (Dallas),BoatFactory (Dallas),Wood,NH4,4,57.0,0.0,1.02,0.0
|
|
||||||
Forest (Dallas),BoatFactory (Dallas),Wood,CO2,5,57.0,0.0,2.68,0.0
|
|
||||||
Forest (Dallas),BoatFactory (Dallas),Wood,NH4,5,57.0,0.0,1.02,0.0
|
|
||||||
BoatFactory (Dallas),Retail (Dallas),NewBoat,CO2,1,63.15789,0.0,2.68,0.0
|
|
||||||
BoatFactory (Dallas),Retail (Dallas),NewBoat,NH4,1,63.15789,0.0,1.02,0.0
|
|
||||||
BoatFactory (Dallas),Retail (Dallas),NewBoat,CO2,2,71.46814,0.0,2.68,0.0
|
|
||||||
BoatFactory (Dallas),Retail (Dallas),NewBoat,NH4,2,71.46814,0.0,1.02,0.0
|
|
||||||
BoatFactory (Dallas),Retail (Dallas),NewBoat,CO2,3,75.8857,0.0,2.68,0.0
|
|
||||||
BoatFactory (Dallas),Retail (Dallas),NewBoat,NH4,3,75.8857,0.0,1.02,0.0
|
|
||||||
BoatFactory (Dallas),Retail (Dallas),NewBoat,CO2,4,76.90434,0.0,2.68,0.0
|
|
||||||
BoatFactory (Dallas),Retail (Dallas),NewBoat,NH4,4,76.90434,0.0,1.02,0.0
|
|
||||||
BoatFactory (Dallas),Retail (Dallas),NewBoat,CO2,5,77.27087,0.0,2.68,0.0
|
|
||||||
BoatFactory (Dallas),Retail (Dallas),NewBoat,NH4,5,77.27087,0.0,1.02,0.0
|
|
||||||
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,CO2,1,6.31579,0.0,2.68,0.0
|
|
||||||
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,NH4,1,6.31579,0.0,1.02,0.0
|
|
||||||
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,CO2,2,22.93629,0.0,2.68,0.0
|
|
||||||
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,NH4,2,22.93629,0.0,1.02,0.0
|
|
||||||
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,CO2,3,31.7714,0.0,2.68,0.0
|
|
||||||
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,NH4,3,31.7714,0.0,1.02,0.0
|
|
||||||
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,CO2,4,33.80867,0.0,2.68,0.0
|
|
||||||
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,NH4,4,33.80867,0.0,1.02,0.0
|
|
||||||
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,CO2,5,34.54174,0.0,2.68,0.0
|
|
||||||
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,NH4,5,34.54174,0.0,1.02,0.0
|
|
||||||
|
41
test/fixtures/boat_example/transportation.csv
vendored
41
test/fixtures/boat_example/transportation.csv
vendored
@@ -1,41 +0,0 @@
|
|||||||
source,destination,product,year,amount sent (tonne),distance (km),transportation cost ($),center revenue ($),center collection cost ($)
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,1,0.15789,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,2,0.57341,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,3,0.79428,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,4,0.84522,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,5,0.86354,0.0,0.0,0.0,0.0
|
|
||||||
NailFactory (Chicago),BoatFactory (Dallas),Nail,1,1.0,1293.093,387.9279,0.0,1000.0
|
|
||||||
NailFactory (Chicago),BoatFactory (Dallas),Nail,2,1.0,1293.093,387.9279,0.0,1000.0
|
|
||||||
NailFactory (Chicago),BoatFactory (Dallas),Nail,3,1.0,1293.093,387.9279,0.0,1000.0
|
|
||||||
NailFactory (Chicago),BoatFactory (Dallas),Nail,4,1.0,1293.093,387.9279,0.0,1000.0
|
|
||||||
NailFactory (Chicago),BoatFactory (Dallas),Nail,5,1.0,1293.093,387.9279,0.0,1000.0
|
|
||||||
NailFactory (Phoenix),BoatFactory (Dallas),Nail,1,1.0,1423.57,427.071,0.0,1000.0
|
|
||||||
NailFactory (Phoenix),BoatFactory (Dallas),Nail,2,1.0,1423.57,427.071,0.0,1000.0
|
|
||||||
NailFactory (Phoenix),BoatFactory (Dallas),Nail,3,1.0,1423.57,427.071,0.0,1000.0
|
|
||||||
NailFactory (Phoenix),BoatFactory (Dallas),Nail,4,1.0,1423.57,427.071,0.0,1000.0
|
|
||||||
NailFactory (Phoenix),BoatFactory (Dallas),Nail,5,1.0,1423.57,427.071,0.0,1000.0
|
|
||||||
NailFactory (Dallas),BoatFactory (Dallas),Nail,1,1.0,0.0,0.0,0.0,1000.0
|
|
||||||
NailFactory (Dallas),BoatFactory (Dallas),Nail,2,1.0,0.0,0.0,0.0,1000.0
|
|
||||||
NailFactory (Dallas),BoatFactory (Dallas),Nail,3,1.0,0.0,0.0,0.0,1000.0
|
|
||||||
NailFactory (Dallas),BoatFactory (Dallas),Nail,4,1.0,0.0,0.0,0.0,1000.0
|
|
||||||
NailFactory (Dallas),BoatFactory (Dallas),Nail,5,1.0,0.0,0.0,0.0,1000.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,1,3.0,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,2,10.89474,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,3,15.09141,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,4,16.05912,0.0,0.0,0.0,0.0
|
|
||||||
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,5,16.40733,0.0,0.0,0.0,0.0
|
|
||||||
Forest (Dallas),BoatFactory (Dallas),Wood,1,57.0,0.0,0.0,0.0,14250.0
|
|
||||||
Forest (Dallas),BoatFactory (Dallas),Wood,2,57.0,0.0,0.0,0.0,14250.0
|
|
||||||
Forest (Dallas),BoatFactory (Dallas),Wood,3,57.0,0.0,0.0,0.0,14250.0
|
|
||||||
Forest (Dallas),BoatFactory (Dallas),Wood,4,57.0,0.0,0.0,0.0,14250.0
|
|
||||||
Forest (Dallas),BoatFactory (Dallas),Wood,5,57.0,0.0,0.0,0.0,14250.0
|
|
||||||
BoatFactory (Dallas),Retail (Dallas),NewBoat,1,63.15789,0.0,0.0,757894.73684,0.0
|
|
||||||
BoatFactory (Dallas),Retail (Dallas),NewBoat,2,71.46814,0.0,0.0,857617.72853,0.0
|
|
||||||
BoatFactory (Dallas),Retail (Dallas),NewBoat,3,75.8857,0.0,0.0,910628.37148,0.0
|
|
||||||
BoatFactory (Dallas),Retail (Dallas),NewBoat,4,76.90434,0.0,0.0,922852.03459,0.0
|
|
||||||
BoatFactory (Dallas),Retail (Dallas),NewBoat,5,77.27087,0.0,0.0,927250.44516,0.0
|
|
||||||
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,1,6.31579,0.0,0.0,0.0,631.57895
|
|
||||||
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,2,22.93629,0.0,0.0,0.0,2293.62881
|
|
||||||
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,3,31.7714,0.0,0.0,0.0,3177.13952
|
|
||||||
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,4,33.80867,0.0,0.0,0.0,3380.86724
|
|
||||||
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,5,34.54174,0.0,0.0,0.0,3454.17409
|
|
||||||
|
4406
test/fixtures/instances/case3_p010_s1.00.json
vendored
Normal file
4406
test/fixtures/instances/case3_p010_s1.00.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4406
test/fixtures/instances/case3_p010_s1.25.json
vendored
Normal file
4406
test/fixtures/instances/case3_p010_s1.25.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
357
test/fixtures/instances/s1.json
vendored
Normal file
357
test/fixtures/instances/s1.json
vendored
Normal file
@@ -0,0 +1,357 @@
|
|||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"time horizon (years)": 2
|
||||||
|
},
|
||||||
|
"products": {
|
||||||
|
"P1": {
|
||||||
|
"transportation cost ($/km/tonne)": [
|
||||||
|
0.015,
|
||||||
|
0.015
|
||||||
|
],
|
||||||
|
"transportation energy (J/km/tonne)": [
|
||||||
|
0.12,
|
||||||
|
0.11
|
||||||
|
],
|
||||||
|
"transportation emissions (tonne/km/tonne)": {
|
||||||
|
"CO2": [
|
||||||
|
0.052,
|
||||||
|
0.050
|
||||||
|
],
|
||||||
|
"CH4": [
|
||||||
|
0.003,
|
||||||
|
0.002
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"initial amounts": {
|
||||||
|
"C1": {
|
||||||
|
"latitude (deg)": 7.0,
|
||||||
|
"longitude (deg)": 7.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
934.56,
|
||||||
|
934.56
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C2": {
|
||||||
|
"latitude (deg)": 7.0,
|
||||||
|
"longitude (deg)": 19.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
198.95,
|
||||||
|
198.95
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C3": {
|
||||||
|
"latitude (deg)": 84.0,
|
||||||
|
"longitude (deg)": 76.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
212.97,
|
||||||
|
212.97
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C4": {
|
||||||
|
"latitude (deg)": 21.0,
|
||||||
|
"longitude (deg)": 16.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
352.19,
|
||||||
|
352.19
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C5": {
|
||||||
|
"latitude (deg)": 32.0,
|
||||||
|
"longitude (deg)": 92.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
510.33,
|
||||||
|
510.33
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C6": {
|
||||||
|
"latitude (deg)": 14.0,
|
||||||
|
"longitude (deg)": 62.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
471.66,
|
||||||
|
471.66
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C7": {
|
||||||
|
"latitude (deg)": 30.0,
|
||||||
|
"longitude (deg)": 83.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
785.21,
|
||||||
|
785.21
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C8": {
|
||||||
|
"latitude (deg)": 35.0,
|
||||||
|
"longitude (deg)": 40.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
706.17,
|
||||||
|
706.17
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C9": {
|
||||||
|
"latitude (deg)": 74.0,
|
||||||
|
"longitude (deg)": 52.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
30.08,
|
||||||
|
30.08
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C10": {
|
||||||
|
"latitude (deg)": 22.0,
|
||||||
|
"longitude (deg)": 54.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
536.52,
|
||||||
|
536.52
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"disposal limit (tonne)": [
|
||||||
|
1.0,
|
||||||
|
1.0
|
||||||
|
],
|
||||||
|
"disposal cost ($/tonne)": [
|
||||||
|
-1000,
|
||||||
|
-1000
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"P2": {
|
||||||
|
"transportation cost ($/km/tonne)": [
|
||||||
|
0.02,
|
||||||
|
0.02
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"P3": {
|
||||||
|
"transportation cost ($/km/tonne)": [
|
||||||
|
0.0125,
|
||||||
|
0.0125
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"P4": {
|
||||||
|
"transportation cost ($/km/tonne)": [
|
||||||
|
0.0175,
|
||||||
|
0.0175
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"plants": {
|
||||||
|
"F1": {
|
||||||
|
"input": "P1",
|
||||||
|
"outputs (tonne/tonne)": {
|
||||||
|
"P2": 0.2,
|
||||||
|
"P3": 0.5
|
||||||
|
},
|
||||||
|
"energy (GJ/tonne)": [
|
||||||
|
0.12,
|
||||||
|
0.11
|
||||||
|
],
|
||||||
|
"emissions (tonne/tonne)": {
|
||||||
|
"CO2": [
|
||||||
|
0.052,
|
||||||
|
0.050
|
||||||
|
],
|
||||||
|
"CH4": [
|
||||||
|
0.003,
|
||||||
|
0.002
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locations": {
|
||||||
|
"L1": {
|
||||||
|
"latitude (deg)": 0.0,
|
||||||
|
"longitude (deg)": 0.0,
|
||||||
|
"disposal": {
|
||||||
|
"P2": {
|
||||||
|
"cost ($/tonne)": [
|
||||||
|
-10.0,
|
||||||
|
-10.0
|
||||||
|
],
|
||||||
|
"limit (tonne)": [
|
||||||
|
1.0,
|
||||||
|
1.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"P3": {
|
||||||
|
"cost ($/tonne)": [
|
||||||
|
-10.0,
|
||||||
|
-10.0
|
||||||
|
],
|
||||||
|
"limit (tonne)": [
|
||||||
|
1.0,
|
||||||
|
1.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"250.0": {
|
||||||
|
"opening cost ($)": [
|
||||||
|
500.0,
|
||||||
|
500.0
|
||||||
|
],
|
||||||
|
"fixed operating cost ($)": [
|
||||||
|
30.0,
|
||||||
|
30.0
|
||||||
|
],
|
||||||
|
"variable operating cost ($/tonne)": [
|
||||||
|
30.0,
|
||||||
|
30.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"1000.0": {
|
||||||
|
"opening cost ($)": [
|
||||||
|
1250.0,
|
||||||
|
1250.0
|
||||||
|
],
|
||||||
|
"fixed operating cost ($)": [
|
||||||
|
30.0,
|
||||||
|
30.0
|
||||||
|
],
|
||||||
|
"variable operating cost ($/tonne)": [
|
||||||
|
30.0,
|
||||||
|
30.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"L2": {
|
||||||
|
"latitude (deg)": 0.5,
|
||||||
|
"longitude (deg)": 0.5,
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"0.0": {
|
||||||
|
"opening cost ($)": [
|
||||||
|
1000,
|
||||||
|
1000
|
||||||
|
],
|
||||||
|
"fixed operating cost ($)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
],
|
||||||
|
"variable operating cost ($/tonne)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"10000.0": {
|
||||||
|
"opening cost ($)": [
|
||||||
|
10000,
|
||||||
|
10000
|
||||||
|
],
|
||||||
|
"fixed operating cost ($)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
],
|
||||||
|
"variable operating cost ($/tonne)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"F2": {
|
||||||
|
"input": "P2",
|
||||||
|
"outputs (tonne/tonne)": {
|
||||||
|
"P3": 0.05,
|
||||||
|
"P4": 0.80
|
||||||
|
},
|
||||||
|
"locations": {
|
||||||
|
"L3": {
|
||||||
|
"latitude (deg)": 25.0,
|
||||||
|
"longitude (deg)": 65.0,
|
||||||
|
"disposal": {
|
||||||
|
"P3": {
|
||||||
|
"cost ($/tonne)": [
|
||||||
|
100.0,
|
||||||
|
100.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"1000.0": {
|
||||||
|
"opening cost ($)": [
|
||||||
|
3000,
|
||||||
|
3000
|
||||||
|
],
|
||||||
|
"fixed operating cost ($)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
],
|
||||||
|
"variable operating cost ($/tonne)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"L4": {
|
||||||
|
"latitude (deg)": 0.75,
|
||||||
|
"longitude (deg)": 0.20,
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"10000": {
|
||||||
|
"opening cost ($)": [
|
||||||
|
3000,
|
||||||
|
3000
|
||||||
|
],
|
||||||
|
"fixed operating cost ($)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
],
|
||||||
|
"variable operating cost ($/tonne)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"F3": {
|
||||||
|
"input": "P4",
|
||||||
|
"locations": {
|
||||||
|
"L5": {
|
||||||
|
"latitude (deg)": 100.0,
|
||||||
|
"longitude (deg)": 100.0,
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"15000": {
|
||||||
|
"opening cost ($)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"fixed operating cost ($)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"variable operating cost ($/tonne)": [
|
||||||
|
-15.0,
|
||||||
|
-15.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"F4": {
|
||||||
|
"input": "P3",
|
||||||
|
"locations": {
|
||||||
|
"L6": {
|
||||||
|
"latitude (deg)": 50.0,
|
||||||
|
"longitude (deg)": 50.0,
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"10000": {
|
||||||
|
"opening cost ($)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"fixed operating cost ($)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"variable operating cost ($/tonne)": [
|
||||||
|
-15.0,
|
||||||
|
-15.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
347
test/fixtures/instances/s2.json
vendored
Normal file
347
test/fixtures/instances/s2.json
vendored
Normal file
@@ -0,0 +1,347 @@
|
|||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"time horizon (years)": 2
|
||||||
|
},
|
||||||
|
"products": {
|
||||||
|
"P1": {
|
||||||
|
"transportation cost ($/km/tonne)": [
|
||||||
|
0.015,
|
||||||
|
0.015
|
||||||
|
],
|
||||||
|
"transportation energy (J/km/tonne)": [
|
||||||
|
0.12,
|
||||||
|
0.11
|
||||||
|
],
|
||||||
|
"transportation emissions (tonne/km/tonne)": {
|
||||||
|
"CO2": [
|
||||||
|
0.052,
|
||||||
|
0.050
|
||||||
|
],
|
||||||
|
"CH4": [
|
||||||
|
0.003,
|
||||||
|
0.002
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"initial amounts": {
|
||||||
|
"C1": {
|
||||||
|
"location": "2018-us-county:17043",
|
||||||
|
"amount (tonne)": [
|
||||||
|
934.56,
|
||||||
|
934.56
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C2": {
|
||||||
|
"latitude (deg)": 7.0,
|
||||||
|
"longitude (deg)": 19.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
198.95,
|
||||||
|
198.95
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C3": {
|
||||||
|
"latitude (deg)": 84.0,
|
||||||
|
"longitude (deg)": 76.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
212.97,
|
||||||
|
212.97
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C4": {
|
||||||
|
"latitude (deg)": 21.0,
|
||||||
|
"longitude (deg)": 16.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
352.19,
|
||||||
|
352.19
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C5": {
|
||||||
|
"latitude (deg)": 32.0,
|
||||||
|
"longitude (deg)": 92.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
510.33,
|
||||||
|
510.33
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C6": {
|
||||||
|
"latitude (deg)": 14.0,
|
||||||
|
"longitude (deg)": 62.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
471.66,
|
||||||
|
471.66
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C7": {
|
||||||
|
"latitude (deg)": 30.0,
|
||||||
|
"longitude (deg)": 83.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
785.21,
|
||||||
|
785.21
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C8": {
|
||||||
|
"latitude (deg)": 35.0,
|
||||||
|
"longitude (deg)": 40.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
706.17,
|
||||||
|
706.17
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C9": {
|
||||||
|
"latitude (deg)": 74.0,
|
||||||
|
"longitude (deg)": 52.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
30.08,
|
||||||
|
30.08
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C10": {
|
||||||
|
"latitude (deg)": 22.0,
|
||||||
|
"longitude (deg)": 54.0,
|
||||||
|
"amount (tonne)": [
|
||||||
|
536.52,
|
||||||
|
536.52
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"P2": {
|
||||||
|
"transportation cost ($/km/tonne)": [
|
||||||
|
0.02,
|
||||||
|
0.02
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"P3": {
|
||||||
|
"transportation cost ($/km/tonne)": [
|
||||||
|
0.0125,
|
||||||
|
0.0125
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"P4": {
|
||||||
|
"transportation cost ($/km/tonne)": [
|
||||||
|
0.0175,
|
||||||
|
0.0175
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"plants": {
|
||||||
|
"F1": {
|
||||||
|
"input": "P1",
|
||||||
|
"outputs (tonne/tonne)": {
|
||||||
|
"P2": 0.2,
|
||||||
|
"P3": 0.5
|
||||||
|
},
|
||||||
|
"energy (GJ/tonne)": [
|
||||||
|
0.12,
|
||||||
|
0.11
|
||||||
|
],
|
||||||
|
"emissions (tonne/tonne)": {
|
||||||
|
"CO2": [
|
||||||
|
0.052,
|
||||||
|
0.050
|
||||||
|
],
|
||||||
|
"CH4": [
|
||||||
|
0.003,
|
||||||
|
0.002
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locations": {
|
||||||
|
"L1": {
|
||||||
|
"latitude (deg)": 0.0,
|
||||||
|
"longitude (deg)": 0.0,
|
||||||
|
"disposal": {
|
||||||
|
"P2": {
|
||||||
|
"cost ($/tonne)": [
|
||||||
|
-10.0,
|
||||||
|
-10.0
|
||||||
|
],
|
||||||
|
"limit (tonne)": [
|
||||||
|
1.0,
|
||||||
|
1.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"P3": {
|
||||||
|
"cost ($/tonne)": [
|
||||||
|
-10.0,
|
||||||
|
-10.0
|
||||||
|
],
|
||||||
|
"limit (tonne)": [
|
||||||
|
1.0,
|
||||||
|
1.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"250.0": {
|
||||||
|
"opening cost ($)": [
|
||||||
|
500.0,
|
||||||
|
500.0
|
||||||
|
],
|
||||||
|
"fixed operating cost ($)": [
|
||||||
|
30.0,
|
||||||
|
30.0
|
||||||
|
],
|
||||||
|
"variable operating cost ($/tonne)": [
|
||||||
|
30.0,
|
||||||
|
30.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"1000.0": {
|
||||||
|
"opening cost ($)": [
|
||||||
|
1250.0,
|
||||||
|
1250.0
|
||||||
|
],
|
||||||
|
"fixed operating cost ($)": [
|
||||||
|
30.0,
|
||||||
|
30.0
|
||||||
|
],
|
||||||
|
"variable operating cost ($/tonne)": [
|
||||||
|
30.0,
|
||||||
|
30.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"L2": {
|
||||||
|
"location": "2018-us-county:17043",
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"0.0": {
|
||||||
|
"opening cost ($)": [
|
||||||
|
1000,
|
||||||
|
1000
|
||||||
|
],
|
||||||
|
"fixed operating cost ($)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
],
|
||||||
|
"variable operating cost ($/tonne)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"10000.0": {
|
||||||
|
"opening cost ($)": [
|
||||||
|
10000,
|
||||||
|
10000
|
||||||
|
],
|
||||||
|
"fixed operating cost ($)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
],
|
||||||
|
"variable operating cost ($/tonne)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"F2": {
|
||||||
|
"input": "P2",
|
||||||
|
"outputs (tonne/tonne)": {
|
||||||
|
"P3": 0.05,
|
||||||
|
"P4": 0.80
|
||||||
|
},
|
||||||
|
"locations": {
|
||||||
|
"L3": {
|
||||||
|
"latitude (deg)": 25.0,
|
||||||
|
"longitude (deg)": 65.0,
|
||||||
|
"disposal": {
|
||||||
|
"P3": {
|
||||||
|
"cost ($/tonne)": [
|
||||||
|
100.0,
|
||||||
|
100.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"1000.0": {
|
||||||
|
"opening cost ($)": [
|
||||||
|
3000,
|
||||||
|
3000
|
||||||
|
],
|
||||||
|
"fixed operating cost ($)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
],
|
||||||
|
"variable operating cost ($/tonne)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"L4": {
|
||||||
|
"latitude (deg)": 0.75,
|
||||||
|
"longitude (deg)": 0.20,
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"10000": {
|
||||||
|
"opening cost ($)": [
|
||||||
|
3000,
|
||||||
|
3000
|
||||||
|
],
|
||||||
|
"fixed operating cost ($)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
],
|
||||||
|
"variable operating cost ($/tonne)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"F3": {
|
||||||
|
"input": "P4",
|
||||||
|
"locations": {
|
||||||
|
"L5": {
|
||||||
|
"latitude (deg)": 100.0,
|
||||||
|
"longitude (deg)": 100.0,
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"15000": {
|
||||||
|
"opening cost ($)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"fixed operating cost ($)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"variable operating cost ($/tonne)": [
|
||||||
|
-15.0,
|
||||||
|
-15.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"F4": {
|
||||||
|
"input": "P3",
|
||||||
|
"locations": {
|
||||||
|
"L6": {
|
||||||
|
"latitude (deg)": 50.0,
|
||||||
|
"longitude (deg)": 50.0,
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"10000": {
|
||||||
|
"opening cost ($)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"fixed operating cost ($)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"variable operating cost ($/tonne)": [
|
||||||
|
-15.0,
|
||||||
|
-15.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
950
test/fixtures/instances/solutions/s1.json
vendored
Normal file
950
test/fixtures/instances/solutions/s1.json
vendored
Normal file
@@ -0,0 +1,950 @@
|
|||||||
|
{
|
||||||
|
"Energy": {
|
||||||
|
"Plants (GJ)": [
|
||||||
|
568.6368,
|
||||||
|
521.2504
|
||||||
|
],
|
||||||
|
"Transportation (GJ)": [
|
||||||
|
3.120910400232,
|
||||||
|
2.860834533546
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Costs": {
|
||||||
|
"Variable operating ($)": [
|
||||||
|
216672.818,
|
||||||
|
216672.818
|
||||||
|
],
|
||||||
|
"Transportation ($)": [
|
||||||
|
714499.27483131,
|
||||||
|
714499.27483131
|
||||||
|
],
|
||||||
|
"Disposal ($)": [
|
||||||
|
-20.0,
|
||||||
|
-20.0
|
||||||
|
],
|
||||||
|
"Total ($)": [
|
||||||
|
939896.86883131,
|
||||||
|
931282.09283131
|
||||||
|
],
|
||||||
|
"Fixed operating ($)": [
|
||||||
|
130.0,
|
||||||
|
130.0
|
||||||
|
],
|
||||||
|
"Opening ($)": [
|
||||||
|
4500.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Expansion ($)": [
|
||||||
|
4114.776,
|
||||||
|
0.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Plants": {
|
||||||
|
"F3": {
|
||||||
|
"L5": {
|
||||||
|
"Opening cost ($)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Emissions (tonne)": {},
|
||||||
|
"Expansion cost ($)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 100.0,
|
||||||
|
"Energy (GJ)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Total output": {},
|
||||||
|
"Capacity (tonne)": [
|
||||||
|
15000.0,
|
||||||
|
15000.0
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 100.0,
|
||||||
|
"Output": {
|
||||||
|
"Send": {},
|
||||||
|
"Dispose": {}
|
||||||
|
},
|
||||||
|
"Total input (tonne)": [
|
||||||
|
757.3824000000001,
|
||||||
|
757.3824000000001
|
||||||
|
],
|
||||||
|
"Fixed operating cost ($)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Input": {
|
||||||
|
"F2": {
|
||||||
|
"L4": {
|
||||||
|
"Distance (km)": 8811.73,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
757.3824000000001,
|
||||||
|
757.3824000000001
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
116792.36127216002,
|
||||||
|
116792.36127216002
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 0.2,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
-11360.736,
|
||||||
|
-11360.736
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 0.75,
|
||||||
|
"Emissions (tonne)": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"F1": {
|
||||||
|
"L1": {
|
||||||
|
"Opening cost ($)": [
|
||||||
|
500.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Emissions (tonne)": {
|
||||||
|
"CH4": [
|
||||||
|
3.0,
|
||||||
|
2.0
|
||||||
|
],
|
||||||
|
"CO2": [
|
||||||
|
52.0,
|
||||||
|
50.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Expansion cost ($)": [
|
||||||
|
750.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 0.0,
|
||||||
|
"Energy (GJ)": [
|
||||||
|
120.0,
|
||||||
|
110.0
|
||||||
|
],
|
||||||
|
"Total output": {
|
||||||
|
"P2": [
|
||||||
|
200.0,
|
||||||
|
200.0
|
||||||
|
],
|
||||||
|
"P3": [
|
||||||
|
500.0,
|
||||||
|
500.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Capacity (tonne)": [
|
||||||
|
1000.0,
|
||||||
|
1000.0
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 0.0,
|
||||||
|
"Output": {
|
||||||
|
"Send": {
|
||||||
|
"P2": {
|
||||||
|
"F2": {
|
||||||
|
"L4": {
|
||||||
|
"Distance (km)": 85.87,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
199.0,
|
||||||
|
199.0
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 0.2,
|
||||||
|
"Latitude (deg)": 0.75
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"P3": {
|
||||||
|
"F4": {
|
||||||
|
"L6": {
|
||||||
|
"Distance (km)": 6893.41,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
499.0,
|
||||||
|
499.0
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 50.0,
|
||||||
|
"Latitude (deg)": 50.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Dispose": {
|
||||||
|
"P2": {
|
||||||
|
"Amount (tonne)": [
|
||||||
|
1.0,
|
||||||
|
1.0
|
||||||
|
],
|
||||||
|
"Cost ($)": [
|
||||||
|
-10.0,
|
||||||
|
-10.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"P3": {
|
||||||
|
"Amount (tonne)": [
|
||||||
|
1.0,
|
||||||
|
1.0
|
||||||
|
],
|
||||||
|
"Cost ($)": [
|
||||||
|
-10.0,
|
||||||
|
-10.0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Total input (tonne)": [
|
||||||
|
1000.0,
|
||||||
|
1000.0
|
||||||
|
],
|
||||||
|
"Fixed operating cost ($)": [
|
||||||
|
30.0,
|
||||||
|
30.0
|
||||||
|
],
|
||||||
|
"Input": {
|
||||||
|
"Origin": {
|
||||||
|
"C3": {
|
||||||
|
"Distance (km)": 8889.75,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
212.97000000000003,
|
||||||
|
212.97000000000003
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
227190.00690000004,
|
||||||
|
208257.50632500005
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
28398.750862500005,
|
||||||
|
28398.750862500005
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 76.0,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
6389.1,
|
||||||
|
6389.1
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 84.0,
|
||||||
|
"Emissions (tonne)": {
|
||||||
|
"CH4": [
|
||||||
|
0.6389100000000001,
|
||||||
|
0.42594000000000004
|
||||||
|
],
|
||||||
|
"CO2": [
|
||||||
|
11.074440000000001,
|
||||||
|
10.648500000000002
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"C7": {
|
||||||
|
"Distance (km)": 8526.39,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
246.62,
|
||||||
|
246.62
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
252333.396216,
|
||||||
|
231305.613198
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
31541.674527,
|
||||||
|
31541.674527
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 83.0,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
7398.6,
|
||||||
|
7398.6
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 30.0,
|
||||||
|
"Emissions (tonne)": {
|
||||||
|
"CH4": [
|
||||||
|
0.7398600000000001,
|
||||||
|
0.49324
|
||||||
|
],
|
||||||
|
"CO2": [
|
||||||
|
12.82424,
|
||||||
|
12.331000000000001
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"C5": {
|
||||||
|
"Distance (km)": 9148.52,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
510.3299999999999,
|
||||||
|
510.3299999999999
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
560251.7053919999,
|
||||||
|
513564.0632759999
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
70031.46317399999,
|
||||||
|
70031.46317399999
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 92.0,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
15309.899999999998,
|
||||||
|
15309.899999999998
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 32.0,
|
||||||
|
"Emissions (tonne)": {
|
||||||
|
"CH4": [
|
||||||
|
1.5309899999999999,
|
||||||
|
1.02066
|
||||||
|
],
|
||||||
|
"CO2": [
|
||||||
|
26.537159999999997,
|
||||||
|
25.516499999999997
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"C9": {
|
||||||
|
"Distance (km)": 8201.21,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
30.08,
|
||||||
|
30.08
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
29603.087615999993,
|
||||||
|
27136.163647999994
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
3700.385951999999,
|
||||||
|
3700.385951999999
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 52.0,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
902.4,
|
||||||
|
902.4
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 74.0,
|
||||||
|
"Emissions (tonne)": {
|
||||||
|
"CH4": [
|
||||||
|
0.09024,
|
||||||
|
0.06016
|
||||||
|
],
|
||||||
|
"CO2": [
|
||||||
|
1.5641599999999998,
|
||||||
|
1.504
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"L2": {
|
||||||
|
"Opening cost ($)": [
|
||||||
|
999.9999999999999,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Emissions (tonne)": {
|
||||||
|
"CH4": [
|
||||||
|
11.21592,
|
||||||
|
7.4772799999999995
|
||||||
|
],
|
||||||
|
"CO2": [
|
||||||
|
194.40928,
|
||||||
|
186.93200000000002
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Expansion cost ($)": [
|
||||||
|
3364.7759999999994,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 0.5,
|
||||||
|
"Energy (GJ)": [
|
||||||
|
448.6368,
|
||||||
|
411.2504
|
||||||
|
],
|
||||||
|
"Total output": {
|
||||||
|
"P2": [
|
||||||
|
747.728,
|
||||||
|
747.728
|
||||||
|
],
|
||||||
|
"P3": [
|
||||||
|
1869.32,
|
||||||
|
1869.32
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Capacity (tonne)": [
|
||||||
|
3738.6399999999994,
|
||||||
|
3738.6399999999994
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 0.5,
|
||||||
|
"Output": {
|
||||||
|
"Send": {
|
||||||
|
"P2": {
|
||||||
|
"F2": {
|
||||||
|
"L4": {
|
||||||
|
"Distance (km)": 43.35,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
747.728,
|
||||||
|
747.728
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 0.2,
|
||||||
|
"Latitude (deg)": 0.75
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"P3": {
|
||||||
|
"F4": {
|
||||||
|
"L6": {
|
||||||
|
"Distance (km)": 6828.89,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
1869.32,
|
||||||
|
1869.32
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 50.0,
|
||||||
|
"Latitude (deg)": 50.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Dispose": {}
|
||||||
|
},
|
||||||
|
"Total input (tonne)": [
|
||||||
|
3738.64,
|
||||||
|
3738.64
|
||||||
|
],
|
||||||
|
"Fixed operating cost ($)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
],
|
||||||
|
"Input": {
|
||||||
|
"Origin": {
|
||||||
|
"C1": {
|
||||||
|
"Distance (km)": 1017.44,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
934.56,
|
||||||
|
934.56
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
114103.047168,
|
||||||
|
104594.459904
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
14262.880895999999,
|
||||||
|
14262.880895999999
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 7.0,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
46728.0,
|
||||||
|
46728.0
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 7.0,
|
||||||
|
"Emissions (tonne)": {
|
||||||
|
"CH4": [
|
||||||
|
2.80368,
|
||||||
|
1.86912
|
||||||
|
],
|
||||||
|
"CO2": [
|
||||||
|
48.59712,
|
||||||
|
46.728
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"C2": {
|
||||||
|
"Distance (km)": 2165.47,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
198.95,
|
||||||
|
198.95
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
51698.430779999995,
|
||||||
|
47390.228214999996
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
6462.303847499999,
|
||||||
|
6462.303847499999
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 19.0,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
9947.5,
|
||||||
|
9947.5
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 7.0,
|
||||||
|
"Emissions (tonne)": {
|
||||||
|
"CH4": [
|
||||||
|
0.59685,
|
||||||
|
0.3979
|
||||||
|
],
|
||||||
|
"CO2": [
|
||||||
|
10.3454,
|
||||||
|
9.9475
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"C8": {
|
||||||
|
"Distance (km)": 5421.1,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
706.17,
|
||||||
|
706.17
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
459386.18243999995,
|
||||||
|
421104.00057
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
57423.272805,
|
||||||
|
57423.272805
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 40.0,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
35308.5,
|
||||||
|
35308.5
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 35.0,
|
||||||
|
"Emissions (tonne)": {
|
||||||
|
"CH4": [
|
||||||
|
2.11851,
|
||||||
|
1.41234
|
||||||
|
],
|
||||||
|
"CO2": [
|
||||||
|
36.720839999999995,
|
||||||
|
35.3085
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"C6": {
|
||||||
|
"Distance (km)": 6595.52,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
471.66,
|
||||||
|
471.66
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
373301.15558400005,
|
||||||
|
342192.72595200007
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
46662.64444800001,
|
||||||
|
46662.64444800001
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 62.0,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
23583.0,
|
||||||
|
23583.0
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 14.0,
|
||||||
|
"Emissions (tonne)": {
|
||||||
|
"CH4": [
|
||||||
|
1.4149800000000001,
|
||||||
|
0.94332
|
||||||
|
],
|
||||||
|
"CO2": [
|
||||||
|
24.526320000000002,
|
||||||
|
23.583000000000002
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"C10": {
|
||||||
|
"Distance (km)": 6014.13,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
536.52,
|
||||||
|
536.52
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
387204.123312,
|
||||||
|
354937.113036
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
48400.515413999994,
|
||||||
|
48400.515413999994
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 54.0,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
26826.0,
|
||||||
|
26826.0
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 22.0,
|
||||||
|
"Emissions (tonne)": {
|
||||||
|
"CH4": [
|
||||||
|
1.6095599999999999,
|
||||||
|
1.07304
|
||||||
|
],
|
||||||
|
"CO2": [
|
||||||
|
27.89904,
|
||||||
|
26.826
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"C4": {
|
||||||
|
"Distance (km)": 2802.12,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
352.19,
|
||||||
|
352.19
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
118425.43713599998,
|
||||||
|
108556.65070799999
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
14803.179642,
|
||||||
|
14803.179642
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 16.0,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
17609.5,
|
||||||
|
17609.5
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 21.0,
|
||||||
|
"Emissions (tonne)": {
|
||||||
|
"CH4": [
|
||||||
|
1.05657,
|
||||||
|
0.70438
|
||||||
|
],
|
||||||
|
"CO2": [
|
||||||
|
18.313879999999997,
|
||||||
|
17.6095
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"C7": {
|
||||||
|
"Distance (km)": 8469.86,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
538.59,
|
||||||
|
538.59
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
547413.827688,
|
||||||
|
501796.008714
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
68426.728461,
|
||||||
|
68426.728461
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 83.0,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
26929.5,
|
||||||
|
26929.5
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 30.0,
|
||||||
|
"Emissions (tonne)": {
|
||||||
|
"CH4": [
|
||||||
|
1.6157700000000002,
|
||||||
|
1.07718
|
||||||
|
],
|
||||||
|
"CO2": [
|
||||||
|
28.00668,
|
||||||
|
26.929500000000004
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"F2": {
|
||||||
|
"L4": {
|
||||||
|
"Opening cost ($)": [
|
||||||
|
2999.9999999999995,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Emissions (tonne)": {},
|
||||||
|
"Expansion cost ($)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 0.2,
|
||||||
|
"Energy (GJ)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Total output": {
|
||||||
|
"P4": [
|
||||||
|
757.3824000000001,
|
||||||
|
757.3824000000001
|
||||||
|
],
|
||||||
|
"P3": [
|
||||||
|
47.336400000000005,
|
||||||
|
47.336400000000005
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Capacity (tonne)": [
|
||||||
|
10000.0,
|
||||||
|
10000.0
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 0.75,
|
||||||
|
"Output": {
|
||||||
|
"Send": {
|
||||||
|
"P4": {
|
||||||
|
"F3": {
|
||||||
|
"L5": {
|
||||||
|
"Distance (km)": 8811.73,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
757.3824000000001,
|
||||||
|
757.3824000000001
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 100.0,
|
||||||
|
"Latitude (deg)": 100.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"P3": {
|
||||||
|
"F4": {
|
||||||
|
"L6": {
|
||||||
|
"Distance (km)": 6824.63,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
47.336400000000005,
|
||||||
|
47.336400000000005
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 50.0,
|
||||||
|
"Latitude (deg)": 50.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Dispose": {}
|
||||||
|
},
|
||||||
|
"Total input (tonne)": [
|
||||||
|
946.728,
|
||||||
|
946.728
|
||||||
|
],
|
||||||
|
"Fixed operating cost ($)": [
|
||||||
|
50.0,
|
||||||
|
50.0
|
||||||
|
],
|
||||||
|
"Input": {
|
||||||
|
"F1": {
|
||||||
|
"L1": {
|
||||||
|
"Distance (km)": 85.87,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
199.0,
|
||||||
|
199.0
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
341.7626,
|
||||||
|
341.7626
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 0.0,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
9950.0,
|
||||||
|
9950.0
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 0.0,
|
||||||
|
"Emissions (tonne)": {}
|
||||||
|
},
|
||||||
|
"L2": {
|
||||||
|
"Distance (km)": 43.35,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
747.728,
|
||||||
|
747.728
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
648.280176,
|
||||||
|
648.280176
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 0.5,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
37386.399999999994,
|
||||||
|
37386.399999999994
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 0.5,
|
||||||
|
"Emissions (tonne)": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"F4": {
|
||||||
|
"L6": {
|
||||||
|
"Opening cost ($)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Emissions (tonne)": {},
|
||||||
|
"Expansion cost ($)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 50.0,
|
||||||
|
"Energy (GJ)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Total output": {},
|
||||||
|
"Capacity (tonne)": [
|
||||||
|
10000.0,
|
||||||
|
10000.0
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 50.0,
|
||||||
|
"Output": {
|
||||||
|
"Send": {},
|
||||||
|
"Dispose": {}
|
||||||
|
},
|
||||||
|
"Total input (tonne)": [
|
||||||
|
2415.6564,
|
||||||
|
2415.6564
|
||||||
|
],
|
||||||
|
"Fixed operating cost ($)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Input": {
|
||||||
|
"F1": {
|
||||||
|
"L1": {
|
||||||
|
"Distance (km)": 6893.41,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
499.0,
|
||||||
|
499.0
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
42997.644875000005,
|
||||||
|
42997.644875000005
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 0.0,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
-7485.0,
|
||||||
|
-7485.0
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 0.0,
|
||||||
|
"Emissions (tonne)": {}
|
||||||
|
},
|
||||||
|
"L2": {
|
||||||
|
"Distance (km)": 6828.89,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
1869.32,
|
||||||
|
1869.32
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
159567.258185,
|
||||||
|
159567.258185
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 0.5,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
-28039.8,
|
||||||
|
-28039.8
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 0.5,
|
||||||
|
"Emissions (tonne)": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"F2": {
|
||||||
|
"L4": {
|
||||||
|
"Distance (km)": 6824.63,
|
||||||
|
"Amount (tonne)": [
|
||||||
|
47.336400000000005,
|
||||||
|
47.336400000000005
|
||||||
|
],
|
||||||
|
"Transportation energy (J)": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"Transportation cost ($)": [
|
||||||
|
4038.1676941500004,
|
||||||
|
4038.1676941500004
|
||||||
|
],
|
||||||
|
"Longitude (deg)": 0.2,
|
||||||
|
"Variable operating cost ($)": [
|
||||||
|
-710.046,
|
||||||
|
-710.046
|
||||||
|
],
|
||||||
|
"Latitude (deg)": 0.75,
|
||||||
|
"Emissions (tonne)": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Emissions": {
|
||||||
|
"Transportation (tonne)": {
|
||||||
|
"CH4": [
|
||||||
|
14.21592,
|
||||||
|
9.477279999999999
|
||||||
|
],
|
||||||
|
"CO2": [
|
||||||
|
246.40927999999994,
|
||||||
|
236.93200000000002
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Plants (tonne)": {
|
||||||
|
"CH4": [
|
||||||
|
14.21592,
|
||||||
|
9.47728
|
||||||
|
],
|
||||||
|
"CO2": [
|
||||||
|
246.40928,
|
||||||
|
236.93200000000002
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Products": {
|
||||||
|
"P1": {
|
||||||
|
"C1": {
|
||||||
|
"Marginal cost ($/tonne)": [
|
||||||
|
133.59,
|
||||||
|
134.49
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C2": {
|
||||||
|
"Marginal cost ($/tonne)": [
|
||||||
|
150.81,
|
||||||
|
151.71
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C3": {
|
||||||
|
"Marginal cost ($/tonne)": [
|
||||||
|
250.83,
|
||||||
|
251.73
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C8": {
|
||||||
|
"Marginal cost ($/tonne)": [
|
||||||
|
199.65,
|
||||||
|
200.55
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C6": {
|
||||||
|
"Marginal cost ($/tonne)": [
|
||||||
|
217.26,
|
||||||
|
218.16
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C10": {
|
||||||
|
"Marginal cost ($/tonne)": [
|
||||||
|
208.54,
|
||||||
|
209.44
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C4": {
|
||||||
|
"Marginal cost ($/tonne)": [
|
||||||
|
160.36,
|
||||||
|
161.26
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C5": {
|
||||||
|
"Marginal cost ($/tonne)": [
|
||||||
|
254.71,
|
||||||
|
255.61
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C7": {
|
||||||
|
"Marginal cost ($/tonne)": [
|
||||||
|
245.38,
|
||||||
|
246.28
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"C9": {
|
||||||
|
"Marginal cost ($/tonne)": [
|
||||||
|
240.5,
|
||||||
|
241.4
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
202
test/fixtures/s1-wrong-length.json
vendored
Normal file
202
test/fixtures/s1-wrong-length.json
vendored
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"time horizon (years)": 2
|
||||||
|
},
|
||||||
|
"products": {
|
||||||
|
"P1": {
|
||||||
|
"transportation cost ($/km/tonne)": [0.015, 0.015],
|
||||||
|
"transportation energy (J/km/tonne)": [0.12, 0.11],
|
||||||
|
"transportation emissions (tonne/km/tonne)": {
|
||||||
|
"CO2": [0.052],
|
||||||
|
"CH4": [0.003, 0.002]
|
||||||
|
},
|
||||||
|
"initial amounts": {
|
||||||
|
"C1": {
|
||||||
|
"latitude (deg)": 7.0,
|
||||||
|
"longitude (deg)": 7.0,
|
||||||
|
"amount (tonne)": [934.56, 934.56]
|
||||||
|
},
|
||||||
|
"C2": {
|
||||||
|
"latitude (deg)": 7.0,
|
||||||
|
"longitude (deg)": 19.0,
|
||||||
|
"amount (tonne)": [198.95, 198.95]
|
||||||
|
},
|
||||||
|
"C3": {
|
||||||
|
"latitude (deg)": 84.0,
|
||||||
|
"longitude (deg)": 76.0,
|
||||||
|
"amount (tonne)": [212.97, 212.97]
|
||||||
|
},
|
||||||
|
"C4": {
|
||||||
|
"latitude (deg)": 21.0,
|
||||||
|
"longitude (deg)": 16.0,
|
||||||
|
"amount (tonne)": [352.19, 352.19]
|
||||||
|
},
|
||||||
|
"C5": {
|
||||||
|
"latitude (deg)": 32.0,
|
||||||
|
"longitude (deg)": 92.0,
|
||||||
|
"amount (tonne)": [510.33, 510.33]
|
||||||
|
},
|
||||||
|
"C6": {
|
||||||
|
"latitude (deg)": 14.0,
|
||||||
|
"longitude (deg)": 62.0,
|
||||||
|
"amount (tonne)": [471.66, 471.66]
|
||||||
|
},
|
||||||
|
"C7": {
|
||||||
|
"latitude (deg)": 30.0,
|
||||||
|
"longitude (deg)": 83.0,
|
||||||
|
"amount (tonne)": [785.21, 785.21]
|
||||||
|
},
|
||||||
|
"C8": {
|
||||||
|
"latitude (deg)": 35.0,
|
||||||
|
"longitude (deg)": 40.0,
|
||||||
|
"amount (tonne)": [706.17, 706.17]
|
||||||
|
},
|
||||||
|
"C9": {
|
||||||
|
"latitude (deg)": 74.0,
|
||||||
|
"longitude (deg)": 52.0,
|
||||||
|
"amount (tonne)": [30.08, 30.08]
|
||||||
|
},
|
||||||
|
"C10": {
|
||||||
|
"latitude (deg)": 22.0,
|
||||||
|
"longitude (deg)": 54.0,
|
||||||
|
"amount (tonne)": [536.52, 536.52]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"P2": {
|
||||||
|
"transportation cost ($/km/tonne)": [0.02, 0.02]
|
||||||
|
},
|
||||||
|
"P3": {
|
||||||
|
"transportation cost ($/km/tonne)": [0.0125, 0.0125]
|
||||||
|
},
|
||||||
|
"P4": {
|
||||||
|
"transportation cost ($/km/tonne)": [0.0175, 0.0175]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"plants": {
|
||||||
|
"F1": {
|
||||||
|
"input": "P1",
|
||||||
|
"outputs (tonne/tonne)": {
|
||||||
|
"P2": 0.2,
|
||||||
|
"P3": 0.5
|
||||||
|
},
|
||||||
|
"energy (GJ/tonne)": [0.12, 0.11],
|
||||||
|
"emissions (tonne/tonne)": {
|
||||||
|
"CO2": [0.052, 0.050],
|
||||||
|
"CH4": [0.003, 0.002]
|
||||||
|
},
|
||||||
|
"locations": {
|
||||||
|
"L1": {
|
||||||
|
"latitude (deg)": 0.0,
|
||||||
|
"longitude (deg)": 0.0,
|
||||||
|
"disposal": {
|
||||||
|
"P2": {
|
||||||
|
"cost ($/tonne)": [-10.0, -10.0],
|
||||||
|
"limit (tonne)": [1.0, 1.0]
|
||||||
|
},
|
||||||
|
"P3": {
|
||||||
|
"cost ($/tonne)": [-10.0, -10.0],
|
||||||
|
"limit (tonne)": [1.0, 1.0]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"250.0": {
|
||||||
|
"opening cost ($)": [500.0, 500.0],
|
||||||
|
"fixed operating cost ($)": [30.0, 30.0],
|
||||||
|
"variable operating cost ($/tonne)": [30.0, 30.0]
|
||||||
|
},
|
||||||
|
"1000.0": {
|
||||||
|
"opening cost ($)": [1250.0, 1250.0],
|
||||||
|
"fixed operating cost ($)": [30.0, 30.0],
|
||||||
|
"variable operating cost ($/tonne)": [30.0, 30.0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"L2": {
|
||||||
|
"latitude (deg)": 0.5,
|
||||||
|
"longitude (deg)": 0.5,
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"0.0": {
|
||||||
|
"opening cost ($)": [1000, 1000],
|
||||||
|
"fixed operating cost ($)": [50.0, 50.0],
|
||||||
|
"variable operating cost ($/tonne)": [50.0, 50.0]
|
||||||
|
},
|
||||||
|
"10000.0": {
|
||||||
|
"opening cost ($)": [10000, 10000],
|
||||||
|
"fixed operating cost ($)": [50.0, 50.0],
|
||||||
|
"variable operating cost ($/tonne)": [50.0, 50.0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"F2": {
|
||||||
|
"input": "P2",
|
||||||
|
"outputs (tonne/tonne)": {
|
||||||
|
"P3": 0.05,
|
||||||
|
"P4": 0.80
|
||||||
|
},
|
||||||
|
"locations": {
|
||||||
|
"L3": {
|
||||||
|
"latitude (deg)": 25.0,
|
||||||
|
"longitude (deg)": 65.0,
|
||||||
|
"disposal": {
|
||||||
|
"P3": {
|
||||||
|
"cost ($/tonne)": [100.0, 100.0]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"1000.0": {
|
||||||
|
"opening cost ($)": [3000, 3000],
|
||||||
|
"fixed operating cost ($)": [50.0, 50.0],
|
||||||
|
"variable operating cost ($/tonne)": [50.0, 50.0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"L4": {
|
||||||
|
"latitude (deg)": 0.75,
|
||||||
|
"longitude (deg)": 0.20,
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"10000": {
|
||||||
|
"opening cost ($)": [3000, 3000],
|
||||||
|
"fixed operating cost ($)": [50.0, 50.0],
|
||||||
|
"variable operating cost ($/tonne)": [50.0, 50.0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"F3": {
|
||||||
|
"input": "P4",
|
||||||
|
"locations": {
|
||||||
|
"L5": {
|
||||||
|
"latitude (deg)": 100.0,
|
||||||
|
"longitude (deg)": 100.0,
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"15000": {
|
||||||
|
"opening cost ($)": [0.0, 0.0],
|
||||||
|
"fixed operating cost ($)": [0.0, 0.0],
|
||||||
|
"variable operating cost ($/tonne)": [-15.0, -15.0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"F4": {
|
||||||
|
"input": "P3",
|
||||||
|
"locations": {
|
||||||
|
"L6": {
|
||||||
|
"latitude (deg)": 50.0,
|
||||||
|
"longitude (deg)": 50.0,
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"10000": {
|
||||||
|
"opening cost ($)": [0.0, 0.0],
|
||||||
|
"fixed operating cost ($)": [0.0, 0.0],
|
||||||
|
"variable operating cost ($/tonne)": [-15.0, -15.0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
159
test/fixtures/simple.json
vendored
159
test/fixtures/simple.json
vendored
@@ -1,159 +0,0 @@
|
|||||||
{
|
|
||||||
"parameters": {
|
|
||||||
"time horizon (years)": 4,
|
|
||||||
"building period (years)": [1],
|
|
||||||
"distance metric": "euclidean"
|
|
||||||
},
|
|
||||||
"products": {
|
|
||||||
"P1": {
|
|
||||||
"transportation cost ($/km/tonne)": 0.015,
|
|
||||||
"transportation energy (J/km/tonne)": 0.12,
|
|
||||||
"transportation emissions (tonne/km/tonne)": {
|
|
||||||
"CO2": 0.052,
|
|
||||||
"CH4": [0.003, 0.003, 0.003, 0.003]
|
|
||||||
},
|
|
||||||
"disposal limit (tonne)": 1.0
|
|
||||||
},
|
|
||||||
"P2": {
|
|
||||||
"transportation cost ($/km/tonne)": [0.015, 0.015, 0.015, 0.015],
|
|
||||||
"transportation energy (J/km/tonne)": [0.12, 0.12, 0.12, 0.12],
|
|
||||||
"transportation emissions (tonne/km/tonne)": {
|
|
||||||
"CO2": [0.052, 0.052, 0.052, 0.052],
|
|
||||||
"CH4": [0.003, 0.003, 0.003, 0.003]
|
|
||||||
},
|
|
||||||
"disposal limit (tonne)": 2.0
|
|
||||||
},
|
|
||||||
"P3": {
|
|
||||||
"transportation cost ($/km/tonne)": [0.015, 0.015, 0.015, 0.015],
|
|
||||||
"transportation energy (J/km/tonne)": [0.12, 0.12, 0.12, 0.12],
|
|
||||||
"transportation emissions (tonne/km/tonne)": {
|
|
||||||
"CO2": [0.052, 0.052, 0.052, 0.052],
|
|
||||||
"CH4": [0.003, 0.003, 0.003, 0.003]
|
|
||||||
},
|
|
||||||
"disposal limit (tonne)": 5.0
|
|
||||||
},
|
|
||||||
"P4": {
|
|
||||||
"transportation cost ($/km/tonne)": [0.015, 0.015, 0.015, 0.015],
|
|
||||||
"transportation energy (J/km/tonne)": [0.12, 0.12, 0.12, 0.12],
|
|
||||||
"transportation emissions (tonne/km/tonne)": {
|
|
||||||
"CO2": [0.052, 0.052, 0.052, 0.052],
|
|
||||||
"CH4": [0.003, 0.003, 0.003, 0.003]
|
|
||||||
},
|
|
||||||
"disposal limit (tonne)": null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"centers": {
|
|
||||||
"C1": {
|
|
||||||
"latitude (deg)": 41.881,
|
|
||||||
"longitude (deg)": -87.623,
|
|
||||||
"input": "P1",
|
|
||||||
"outputs": ["P2", "P3"],
|
|
||||||
"fixed output (tonne)": {
|
|
||||||
"P2": [100, 50, 0, 0],
|
|
||||||
"P3": [20, 10, 0, 0]
|
|
||||||
},
|
|
||||||
"variable output (tonne/tonne)": {
|
|
||||||
"P2": [0.20, 0.25, 0.12],
|
|
||||||
"P3": [0.25, 0.25, 0.25]
|
|
||||||
},
|
|
||||||
"revenue ($/tonne)": 12.0,
|
|
||||||
"collection cost ($/tonne)": {
|
|
||||||
"P2": [0.25, 0.25, 0.25, 0.25],
|
|
||||||
"P3": [0.37, 0.37, 0.37, 0.37]
|
|
||||||
},
|
|
||||||
"operating cost ($)": [150.0, 150.0, 150.0, 150.0],
|
|
||||||
"disposal limit (tonne)": {
|
|
||||||
"P2": [0, 0, 0, 0],
|
|
||||||
"P3": [null, null, null, null]
|
|
||||||
},
|
|
||||||
"disposal cost ($/tonne)": {
|
|
||||||
"P2": [0.23, 0.23, 0.23, 0.23],
|
|
||||||
"P3": [1.0, 1.0, 1.0, 1.0]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"C2": {
|
|
||||||
"latitude (deg)": 42.881,
|
|
||||||
"longitude (deg)": -87.623,
|
|
||||||
"input": null,
|
|
||||||
"outputs": ["P1"],
|
|
||||||
"variable output (tonne/tonne)": {
|
|
||||||
"P1": 0
|
|
||||||
},
|
|
||||||
"fixed output (tonne)": {
|
|
||||||
"P1": [50, 60, 70, 80]
|
|
||||||
},
|
|
||||||
"revenue ($/tonne)": null,
|
|
||||||
"collection cost ($/tonne)": {
|
|
||||||
"P1": 0.25
|
|
||||||
},
|
|
||||||
"operating cost ($)": [150.0, 150.0, 150.0, 150.0],
|
|
||||||
"disposal limit (tonne)": {
|
|
||||||
"P1": null
|
|
||||||
},
|
|
||||||
"disposal cost ($/tonne)": {
|
|
||||||
"P1": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"C3": {
|
|
||||||
"latitude (deg)": 43.881,
|
|
||||||
"longitude (deg)": -87.623,
|
|
||||||
"input": "P4",
|
|
||||||
"outputs": [],
|
|
||||||
"variable output (tonne/tonne)": {},
|
|
||||||
"constant output (tonne)": {},
|
|
||||||
"revenue ($/tonne)": [12.0, 12.0, 12.0, 12.0],
|
|
||||||
"collection cost ($/tonne)": {},
|
|
||||||
"operating cost ($)": 150.0,
|
|
||||||
"disposal limit (tonne)": {},
|
|
||||||
"disposal cost ($/tonne)": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"plants": {
|
|
||||||
"L1": {
|
|
||||||
"latitude (deg)": 44.881,
|
|
||||||
"longitude (deg)": -87.623,
|
|
||||||
"input mix (%)": {
|
|
||||||
"P1": 95.3,
|
|
||||||
"P2": 4.7
|
|
||||||
},
|
|
||||||
"output (tonne)": {
|
|
||||||
"P3": 0.25,
|
|
||||||
"P4": 0.12
|
|
||||||
},
|
|
||||||
"processing emissions (tonne)": {
|
|
||||||
"CO2": 0.1
|
|
||||||
},
|
|
||||||
"storage cost ($/tonne)": {
|
|
||||||
"P1": 0.1,
|
|
||||||
"P2": 0.1
|
|
||||||
},
|
|
||||||
"storage limit (tonne)": {
|
|
||||||
"P1": 100,
|
|
||||||
"P2": null
|
|
||||||
},
|
|
||||||
"disposal cost ($/tonne)": {
|
|
||||||
"P3": 0,
|
|
||||||
"P4": 0.86
|
|
||||||
},
|
|
||||||
"disposal limit (tonne)": {
|
|
||||||
"P3": null,
|
|
||||||
"P4": 1000.0
|
|
||||||
},
|
|
||||||
"capacities": [
|
|
||||||
{
|
|
||||||
"size (tonne)": 100,
|
|
||||||
"opening cost ($)": [300, 400, 450, 475],
|
|
||||||
"fixed operating cost ($)": 300,
|
|
||||||
"variable operating cost ($/tonne)": 5.0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"size (tonne)": 500,
|
|
||||||
"opening cost ($)": 1000.0,
|
|
||||||
"fixed operating cost ($)": 400.0,
|
|
||||||
"variable operating cost ($/tonne)": 5.0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"initial capacity (tonne)": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
39
test/fixtures/storage.json
vendored
Normal file
39
test/fixtures/storage.json
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"time horizon (years)": 3
|
||||||
|
},
|
||||||
|
"products": {
|
||||||
|
"battery": {
|
||||||
|
"initial amounts": {
|
||||||
|
"Chicago": {
|
||||||
|
"latitude (deg)": 0.0,
|
||||||
|
"longitude (deg)": 0.0,
|
||||||
|
"amount (tonne)": [100.0, 0.0, 0.0]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"transportation cost ($/km/tonne)": [0.01, 0.01, 0.01]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"plants": {
|
||||||
|
"mega plant": {
|
||||||
|
"input": "battery",
|
||||||
|
"locations": {
|
||||||
|
"Chicago": {
|
||||||
|
"latitude (deg)": 0.0,
|
||||||
|
"longitude (deg)": 0.0,
|
||||||
|
"storage": {
|
||||||
|
"cost ($/tonne)": [2.0, 1.5, 1.0],
|
||||||
|
"limit (tonne)": 50.0
|
||||||
|
},
|
||||||
|
"capacities (tonne)": {
|
||||||
|
"100": {
|
||||||
|
"opening cost ($)": [0.0, 0.0, 0],
|
||||||
|
"fixed operating cost ($)": [0.0, 0.0, 0.0],
|
||||||
|
"variable operating cost ($/tonne)": [10.0, 5.0, 2.0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
test/graph/build_test.jl
Normal file
40
test/graph/build_test.jl
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# Copyright (C) 2020 Argonne National Laboratory
|
||||||
|
# Written by Alinson Santos Xavier <axavier@anl.gov>
|
||||||
|
|
||||||
|
using RELOG
|
||||||
|
|
||||||
|
function graph_build_test()
|
||||||
|
@testset "build_graph" begin
|
||||||
|
instance = RELOG.parsefile(fixture("instances/s1.json"))
|
||||||
|
graph = RELOG.build_graph(instance)
|
||||||
|
process_node_by_location_name =
|
||||||
|
Dict(n.location.location_name => n for n in graph.process_nodes)
|
||||||
|
|
||||||
|
@test length(graph.plant_shipping_nodes) == 8
|
||||||
|
@test length(graph.collection_shipping_nodes) == 10
|
||||||
|
@test length(graph.process_nodes) == 6
|
||||||
|
|
||||||
|
node = graph.collection_shipping_nodes[1]
|
||||||
|
@test node.location.name == "C1"
|
||||||
|
@test length(node.incoming_arcs) == 0
|
||||||
|
@test length(node.outgoing_arcs) == 2
|
||||||
|
@test node.outgoing_arcs[1].source.location.name == "C1"
|
||||||
|
@test node.outgoing_arcs[1].dest.location.plant_name == "F1"
|
||||||
|
@test node.outgoing_arcs[1].dest.location.location_name == "L1"
|
||||||
|
@test node.outgoing_arcs[1].values["distance"] == 1095.62
|
||||||
|
|
||||||
|
node = process_node_by_location_name["L1"]
|
||||||
|
@test node.location.plant_name == "F1"
|
||||||
|
@test node.location.location_name == "L1"
|
||||||
|
@test length(node.incoming_arcs) == 10
|
||||||
|
@test length(node.outgoing_arcs) == 2
|
||||||
|
|
||||||
|
node = process_node_by_location_name["L3"]
|
||||||
|
@test node.location.plant_name == "F2"
|
||||||
|
@test node.location.location_name == "L3"
|
||||||
|
@test length(node.incoming_arcs) == 2
|
||||||
|
@test length(node.outgoing_arcs) == 2
|
||||||
|
|
||||||
|
@test length(graph.arcs) == 38
|
||||||
|
end
|
||||||
|
end
|
||||||
54
test/instance/compress_test.jl
Normal file
54
test/instance/compress_test.jl
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# Copyright (C) 2020 Argonne National Laboratory
|
||||||
|
# Written by Alinson Santos Xavier <axavier@anl.gov>
|
||||||
|
|
||||||
|
using RELOG
|
||||||
|
|
||||||
|
function compress_test()
|
||||||
|
@testset "compress" begin
|
||||||
|
instance = RELOG.parsefile(fixture("instances/s1.json"))
|
||||||
|
compressed = RELOG._compress(instance)
|
||||||
|
|
||||||
|
product_name_to_product = Dict(p.name => p for p in compressed.products)
|
||||||
|
location_name_to_facility = Dict()
|
||||||
|
for p in compressed.plants
|
||||||
|
location_name_to_facility[p.location_name] = p
|
||||||
|
end
|
||||||
|
for c in compressed.collection_centers
|
||||||
|
location_name_to_facility[c.name] = c
|
||||||
|
end
|
||||||
|
|
||||||
|
p1 = product_name_to_product["P1"]
|
||||||
|
p2 = product_name_to_product["P2"]
|
||||||
|
p3 = product_name_to_product["P3"]
|
||||||
|
c1 = location_name_to_facility["C1"]
|
||||||
|
l1 = location_name_to_facility["L1"]
|
||||||
|
|
||||||
|
@test compressed.time == 1
|
||||||
|
@test compressed.building_period == [1]
|
||||||
|
|
||||||
|
@test p1.name == "P1"
|
||||||
|
@test p1.transportation_cost ≈ [0.015]
|
||||||
|
@test p1.transportation_energy ≈ [0.115]
|
||||||
|
@test p1.transportation_emissions["CO2"] ≈ [0.051]
|
||||||
|
@test p1.transportation_emissions["CH4"] ≈ [0.0025]
|
||||||
|
|
||||||
|
@test c1.name == "C1"
|
||||||
|
@test c1.amount ≈ [1869.12]
|
||||||
|
|
||||||
|
@test l1.plant_name == "F1"
|
||||||
|
@test l1.location_name == "L1"
|
||||||
|
@test l1.energy ≈ [0.115]
|
||||||
|
@test l1.emissions["CO2"] ≈ [0.051]
|
||||||
|
@test l1.emissions["CH4"] ≈ [0.0025]
|
||||||
|
@test l1.sizes[1].opening_cost ≈ [500]
|
||||||
|
@test l1.sizes[2].opening_cost ≈ [1250]
|
||||||
|
@test l1.sizes[1].fixed_operating_cost ≈ [60]
|
||||||
|
@test l1.sizes[2].fixed_operating_cost ≈ [60]
|
||||||
|
@test l1.sizes[1].variable_operating_cost ≈ [30]
|
||||||
|
@test l1.sizes[2].variable_operating_cost ≈ [30]
|
||||||
|
@test l1.disposal_limit[p2] ≈ [2.0]
|
||||||
|
@test l1.disposal_limit[p3] ≈ [2.0]
|
||||||
|
@test l1.disposal_cost[p2] ≈ [-10.0]
|
||||||
|
@test l1.disposal_cost[p3] ≈ [-10.0]
|
||||||
|
end
|
||||||
|
end
|
||||||
27
test/instance/geodb_test.jl
Normal file
27
test/instance/geodb_test.jl
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
using RELOG
|
||||||
|
|
||||||
|
function geodb_test()
|
||||||
|
@testset "geodb_query (2018-us-county)" begin
|
||||||
|
region = RELOG.geodb_query("2018-us-county:17043")
|
||||||
|
@test region.centroid.lat == 41.83956
|
||||||
|
@test region.centroid.lon == -88.08857
|
||||||
|
@test region.population == 922_921
|
||||||
|
end
|
||||||
|
|
||||||
|
# @testset "geodb_query (2018-us-zcta)" begin
|
||||||
|
# region = RELOG.geodb_query("2018-us-zcta:60439")
|
||||||
|
# @test region.centroid.lat == 41.68241
|
||||||
|
# @test region.centroid.lon == -87.98954
|
||||||
|
# end
|
||||||
|
|
||||||
|
@testset "geodb_query (us-state)" begin
|
||||||
|
region = RELOG.geodb_query("us-state:IL")
|
||||||
|
@test region.centroid.lat == 39.73939
|
||||||
|
@test region.centroid.lon == -89.50414
|
||||||
|
@test region.population == 12_671_821
|
||||||
|
end
|
||||||
|
end
|
||||||
92
test/instance/parse_test.jl
Normal file
92
test/instance/parse_test.jl
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
# Copyright (C) 2020 Argonne National Laboratory
|
||||||
|
# Written by Alinson Santos Xavier <axavier@anl.gov>
|
||||||
|
|
||||||
|
using RELOG
|
||||||
|
|
||||||
|
function parse_test()
|
||||||
|
@testset "parse" begin
|
||||||
|
instance = RELOG.parsefile(fixture("instances/s1.json"))
|
||||||
|
|
||||||
|
centers = instance.collection_centers
|
||||||
|
plants = instance.plants
|
||||||
|
products = instance.products
|
||||||
|
location_name_to_plant = Dict(p.location_name => p for p in plants)
|
||||||
|
product_name_to_product = Dict(p.name => p for p in products)
|
||||||
|
|
||||||
|
@test length(centers) == 10
|
||||||
|
@test centers[1].name == "C1"
|
||||||
|
@test centers[1].latitude == 7
|
||||||
|
@test centers[1].latitude == 7
|
||||||
|
@test centers[1].longitude == 7
|
||||||
|
@test centers[1].amount == [934.56, 934.56]
|
||||||
|
@test centers[1].product.name == "P1"
|
||||||
|
|
||||||
|
@test length(plants) == 6
|
||||||
|
|
||||||
|
plant = location_name_to_plant["L1"]
|
||||||
|
@test plant.plant_name == "F1"
|
||||||
|
@test plant.location_name == "L1"
|
||||||
|
@test plant.input.name == "P1"
|
||||||
|
@test plant.latitude == 0
|
||||||
|
@test plant.longitude == 0
|
||||||
|
|
||||||
|
@test length(plant.sizes) == 2
|
||||||
|
@test plant.sizes[1].capacity == 250
|
||||||
|
@test plant.sizes[1].opening_cost == [500, 500]
|
||||||
|
@test plant.sizes[1].fixed_operating_cost == [30, 30]
|
||||||
|
@test plant.sizes[1].variable_operating_cost == [30, 30]
|
||||||
|
@test plant.sizes[2].capacity == 1000
|
||||||
|
@test plant.sizes[2].opening_cost == [1250, 1250]
|
||||||
|
@test plant.sizes[2].fixed_operating_cost == [30, 30]
|
||||||
|
@test plant.sizes[2].variable_operating_cost == [30, 30]
|
||||||
|
|
||||||
|
p1 = product_name_to_product["P1"]
|
||||||
|
@test p1.disposal_limit == [1.0, 1.0]
|
||||||
|
@test p1.disposal_cost == [-1000.0, -1000.0]
|
||||||
|
|
||||||
|
p2 = product_name_to_product["P2"]
|
||||||
|
@test p2.disposal_limit == [0.0, 0.0]
|
||||||
|
@test p2.disposal_cost == [0.0, 0.0]
|
||||||
|
|
||||||
|
p3 = product_name_to_product["P3"]
|
||||||
|
@test length(plant.output) == 2
|
||||||
|
@test plant.output[p2] == 0.2
|
||||||
|
@test plant.output[p3] == 0.5
|
||||||
|
@test plant.disposal_limit[p2] == [1, 1]
|
||||||
|
@test plant.disposal_limit[p3] == [1, 1]
|
||||||
|
@test plant.disposal_cost[p2] == [-10, -10]
|
||||||
|
@test plant.disposal_cost[p3] == [-10, -10]
|
||||||
|
|
||||||
|
plant = location_name_to_plant["L3"]
|
||||||
|
@test plant.location_name == "L3"
|
||||||
|
@test plant.input.name == "P2"
|
||||||
|
@test plant.latitude == 25
|
||||||
|
@test plant.longitude == 65
|
||||||
|
|
||||||
|
@test length(plant.sizes) == 2
|
||||||
|
@test plant.sizes[1].capacity == 1000.0
|
||||||
|
@test plant.sizes[1].opening_cost == [3000, 3000]
|
||||||
|
@test plant.sizes[1].fixed_operating_cost == [50, 50]
|
||||||
|
@test plant.sizes[1].variable_operating_cost == [50, 50]
|
||||||
|
@test plant.sizes[1] == plant.sizes[2]
|
||||||
|
|
||||||
|
p4 = product_name_to_product["P4"]
|
||||||
|
@test plant.output[p3] == 0.05
|
||||||
|
@test plant.output[p4] == 0.8
|
||||||
|
@test plant.disposal_limit[p3] == [1e8, 1e8]
|
||||||
|
@test plant.disposal_limit[p4] == [0, 0]
|
||||||
|
end
|
||||||
|
|
||||||
|
@testset "parse (geodb)" begin
|
||||||
|
instance = RELOG.parsefile(fixture("instances/s2.json"))
|
||||||
|
|
||||||
|
centers = instance.collection_centers
|
||||||
|
@test centers[1].name == "C1"
|
||||||
|
@test centers[1].latitude == 41.83956
|
||||||
|
@test centers[1].longitude == -88.08857
|
||||||
|
end
|
||||||
|
|
||||||
|
# @testset "parse (invalid)" begin
|
||||||
|
# @test_throws ErrorException RELOG.parsefile(fixture("s1-wrong-length.json"))
|
||||||
|
# end
|
||||||
|
end
|
||||||
38
test/model/build_test.jl
Normal file
38
test/model/build_test.jl
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# Copyright (C) 2020 Argonne National Laboratory
|
||||||
|
# Written by Alinson Santos Xavier <axavier@anl.gov>
|
||||||
|
|
||||||
|
using RELOG, HiGHS, JuMP, Printf, JSON, MathOptInterface.FileFormats
|
||||||
|
|
||||||
|
function model_build_test()
|
||||||
|
@testset "build" begin
|
||||||
|
instance = RELOG.parsefile(fixture("instances/s1.json"))
|
||||||
|
graph = RELOG.build_graph(instance)
|
||||||
|
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)
|
||||||
|
|
||||||
|
shipping_node_by_loc_and_prod_names = Dict(
|
||||||
|
(n.location.location_name, n.product.name) => n for n in graph.plant_shipping_nodes
|
||||||
|
)
|
||||||
|
|
||||||
|
@test length(model[1, :open_plant]) == 12
|
||||||
|
@test length(model[2, :flow]) == 76
|
||||||
|
@test length(model[2, :plant_dispose]) == 16
|
||||||
|
@test length(model[2, :capacity]) == 12
|
||||||
|
@test length(model[2, :expansion]) == 12
|
||||||
|
|
||||||
|
# l1 = process_node_by_location_name["L1"]
|
||||||
|
# v = model[2, :capacity][l1.index, 1]
|
||||||
|
# @test lower_bound(v) == 0.0
|
||||||
|
# @test upper_bound(v) == 1000.0
|
||||||
|
|
||||||
|
# v = model[2, :expansion][l1.index, 1]
|
||||||
|
# @test lower_bound(v) == 0.0
|
||||||
|
# @test upper_bound(v) == 750.0
|
||||||
|
|
||||||
|
# v = model[2, :plant_dispose][shipping_node_by_loc_and_prod_names["L1", "P2"].index, 1]
|
||||||
|
# @test lower_bound(v) == 0.0
|
||||||
|
# @test upper_bound(v) == 1.0
|
||||||
|
end
|
||||||
|
end
|
||||||
85
test/model/solve_test.jl
Normal file
85
test/model/solve_test.jl
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
# Copyright (C) 2020 Argonne National Laboratory
|
||||||
|
# Written by Alinson Santos Xavier <axavier@anl.gov>
|
||||||
|
|
||||||
|
using RELOG, JuMP, Printf, JSON, MathOptInterface.FileFormats
|
||||||
|
|
||||||
|
basedir = dirname(@__FILE__)
|
||||||
|
|
||||||
|
function model_solve_test()
|
||||||
|
@testset "solve (exact)" begin
|
||||||
|
solution = RELOG.solve(fixture("instances/s1.json"))
|
||||||
|
|
||||||
|
solution_filename = tempname()
|
||||||
|
RELOG.write(solution, solution_filename)
|
||||||
|
@test isfile(solution_filename)
|
||||||
|
|
||||||
|
@test "Costs" in keys(solution)
|
||||||
|
@test "Fixed operating (\$)" in keys(solution["Costs"])
|
||||||
|
@test "Transportation (\$)" in keys(solution["Costs"])
|
||||||
|
@test "Variable operating (\$)" in keys(solution["Costs"])
|
||||||
|
@test "Total (\$)" in keys(solution["Costs"])
|
||||||
|
|
||||||
|
@test "Plants" in keys(solution)
|
||||||
|
@test "F1" in keys(solution["Plants"])
|
||||||
|
@test "F2" in keys(solution["Plants"])
|
||||||
|
@test "F3" in keys(solution["Plants"])
|
||||||
|
@test "F4" in keys(solution["Plants"])
|
||||||
|
|
||||||
|
@test "Products" in keys(solution)
|
||||||
|
@test "P1" in keys(solution["Products"])
|
||||||
|
@test "C1" in keys(solution["Products"]["P1"])
|
||||||
|
@test "Dispose (tonne)" in keys(solution["Products"]["P1"]["C1"])
|
||||||
|
|
||||||
|
total_disposal =
|
||||||
|
sum([loc["Dispose (tonne)"] for loc in values(solution["Products"]["P1"])])
|
||||||
|
@test total_disposal == [1.0, 1.0]
|
||||||
|
end
|
||||||
|
|
||||||
|
@testset "solve (heuristic)" begin
|
||||||
|
# Should not crash
|
||||||
|
solution = RELOG.solve(fixture("instances/s1.json"), heuristic = true)
|
||||||
|
end
|
||||||
|
|
||||||
|
# @testset "solve (infeasible)" begin
|
||||||
|
# json = JSON.parsefile(fixture("instances/s1.json"))
|
||||||
|
# for (location_name, location_dict) in json["products"]["P1"]["initial amounts"]
|
||||||
|
# location_dict["amount (tonne)"] *= 1000
|
||||||
|
# end
|
||||||
|
# @test_throws ErrorException("No solution available") RELOG.solve(RELOG.parse(json))
|
||||||
|
# end
|
||||||
|
|
||||||
|
@testset "solve (with storage)" begin
|
||||||
|
basedir = dirname(@__FILE__)
|
||||||
|
filename = "$basedir/../fixtures/storage.json"
|
||||||
|
instance = RELOG.parsefile(filename)
|
||||||
|
@test instance.plants[1].storage_limit == 50.0
|
||||||
|
@test instance.plants[1].storage_cost == [2.0, 1.5, 1.0]
|
||||||
|
|
||||||
|
solution = RELOG.solve(filename)
|
||||||
|
plant_dict = solution["Plants"]["mega plant"]["Chicago"]
|
||||||
|
@test plant_dict["Variable operating cost (\$)"] == [500.0, 0.0, 100.0]
|
||||||
|
@test plant_dict["Process (tonne)"] == [50.0, 0.0, 50.0]
|
||||||
|
@test plant_dict["Storage (tonne)"] == [50.0, 50.0, 0.0]
|
||||||
|
@test plant_dict["Storage cost (\$)"] == [100.0, 75.0, 0.0]
|
||||||
|
|
||||||
|
@test solution["Costs"]["Variable operating (\$)"] == [500.0, 0.0, 100.0]
|
||||||
|
@test solution["Costs"]["Storage (\$)"] == [100.0, 75.0, 0.0]
|
||||||
|
@test solution["Costs"]["Total (\$)"] == [600.0, 75.0, 100.0]
|
||||||
|
end
|
||||||
|
|
||||||
|
@testset "solve (stochastic)" begin
|
||||||
|
# Should not crash
|
||||||
|
solutions = RELOG.solve_stochastic(
|
||||||
|
scenarios=[
|
||||||
|
fixture("instances/case3_p010_s1.00.json"),
|
||||||
|
fixture("instances/case3_p010_s1.25.json"),
|
||||||
|
],
|
||||||
|
probs=[0.5, 0.5],
|
||||||
|
optimizer=optimizer_with_attributes(
|
||||||
|
HiGHS.Optimizer,
|
||||||
|
"log_to_console" => false,
|
||||||
|
),
|
||||||
|
method=:lshaped,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
23
test/reports_test.jl
Normal file
23
test/reports_test.jl
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# RELOG: Reverse Logistics Optimization
|
||||||
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||||
|
# Released under the modified BSD license. See COPYING.md for more details.
|
||||||
|
|
||||||
|
using RELOG, JSON, GZip
|
||||||
|
|
||||||
|
basedir = @__DIR__
|
||||||
|
|
||||||
|
function reports_test()
|
||||||
|
@testset "Reports" begin
|
||||||
|
@testset "from solve" begin
|
||||||
|
solution = RELOG.solve(fixture("instances/s1.json"))
|
||||||
|
tmp_filename = tempname()
|
||||||
|
# The following should not crash
|
||||||
|
RELOG.write_plant_emissions_report(solution, tmp_filename)
|
||||||
|
RELOG.write_plant_outputs_report(solution, tmp_filename)
|
||||||
|
RELOG.write_plants_report(solution, tmp_filename)
|
||||||
|
RELOG.write_products_report(solution, tmp_filename)
|
||||||
|
RELOG.write_transportation_emissions_report(solution, tmp_filename)
|
||||||
|
RELOG.write_transportation_report(solution, tmp_filename)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
47
test/runtests.jl
Normal file
47
test/runtests.jl
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# Copyright (C) 2020 Argonne National Laboratory
|
||||||
|
# Written by Alinson Santos Xavier <axavier@anl.gov>
|
||||||
|
|
||||||
|
using Test
|
||||||
|
using RELOG
|
||||||
|
using Revise
|
||||||
|
|
||||||
|
includet("instance/compress_test.jl")
|
||||||
|
includet("instance/geodb_test.jl")
|
||||||
|
includet("instance/parse_test.jl")
|
||||||
|
includet("graph/build_test.jl")
|
||||||
|
includet("model/build_test.jl")
|
||||||
|
includet("model/solve_test.jl")
|
||||||
|
includet("reports_test.jl")
|
||||||
|
|
||||||
|
function fixture(path)
|
||||||
|
for candidate in [
|
||||||
|
"fixtures/$path",
|
||||||
|
"test/fixtures/$path"
|
||||||
|
]
|
||||||
|
if isfile(candidate)
|
||||||
|
return candidate
|
||||||
|
end
|
||||||
|
end
|
||||||
|
error("Fixture not found: $path")
|
||||||
|
end
|
||||||
|
|
||||||
|
function runtests()
|
||||||
|
@testset "RELOG" begin
|
||||||
|
@testset "Instance" begin
|
||||||
|
compress_test()
|
||||||
|
geodb_test()
|
||||||
|
parse_test()
|
||||||
|
end
|
||||||
|
@testset "Graph" begin
|
||||||
|
graph_build_test()
|
||||||
|
end
|
||||||
|
@testset "Model" begin
|
||||||
|
model_build_test()
|
||||||
|
model_solve_test()
|
||||||
|
end
|
||||||
|
reports_test()
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
runtests()
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
module RELOGT
|
|
||||||
|
|
||||||
using Test
|
|
||||||
using RELOG
|
|
||||||
using JuliaFormatter
|
|
||||||
|
|
||||||
include("instance/parse_test.jl")
|
|
||||||
include("model/build_test.jl")
|
|
||||||
include("model/dist_test.jl")
|
|
||||||
include("reports_test.jl")
|
|
||||||
include("../fixtures/boat_example.jl")
|
|
||||||
|
|
||||||
basedir = dirname(@__FILE__)
|
|
||||||
|
|
||||||
function fixture(path::String)::String
|
|
||||||
return "$basedir/../fixtures/$path"
|
|
||||||
end
|
|
||||||
|
|
||||||
function runtests()
|
|
||||||
@testset "RELOG" begin
|
|
||||||
instance_parse_test_1()
|
|
||||||
instance_parse_test_2()
|
|
||||||
model_build_test()
|
|
||||||
model_dist_test()
|
|
||||||
report_tests()
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
function format()
|
|
||||||
JuliaFormatter.format(basedir, verbose = true)
|
|
||||||
JuliaFormatter.format("$basedir/../../src", verbose = true)
|
|
||||||
JuliaFormatter.format("$basedir/../fixtures", verbose = true)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end # module RELOGT
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
using RELOG
|
|
||||||
using Test
|
|
||||||
using OrderedCollections
|
|
||||||
|
|
||||||
function instance_parse_test_1()
|
|
||||||
instance = RELOG.parsefile(fixture("simple.json"))
|
|
||||||
|
|
||||||
# Parameters
|
|
||||||
@test instance.time_horizon == 4
|
|
||||||
@test instance.building_period == [1]
|
|
||||||
@test instance.distance_metric isa RELOG.EuclideanDistance
|
|
||||||
|
|
||||||
# Products
|
|
||||||
@test length(instance.products) == 4
|
|
||||||
p1 = instance.products[1]
|
|
||||||
@test p1.name == "P1"
|
|
||||||
@test p1.tr_cost == [0.015, 0.015, 0.015, 0.015]
|
|
||||||
@test p1.tr_energy == [0.12, 0.12, 0.12, 0.12]
|
|
||||||
@test p1.tr_emissions ==
|
|
||||||
Dict("CO2" => [0.052, 0.052, 0.052, 0.052], "CH4" => [0.003, 0.003, 0.003, 0.003])
|
|
||||||
@test p1.disposal_limit == [1.0, 1.0, 1.0, 1.0]
|
|
||||||
@test instance.products_by_name["P1"] === p1
|
|
||||||
p2 = instance.products[2]
|
|
||||||
p3 = instance.products[3]
|
|
||||||
p4 = instance.products[4]
|
|
||||||
|
|
||||||
# Centers
|
|
||||||
@test length(instance.centers) == 3
|
|
||||||
c1 = instance.centers[1]
|
|
||||||
@test c1.latitude == 41.881
|
|
||||||
@test c1.longitude == -87.623
|
|
||||||
@test c1.input === p1
|
|
||||||
@test c1.outputs == [p2, p3]
|
|
||||||
@test c1.fixed_output == Dict(p2 => [100, 50, 0, 0], p3 => [20, 10, 0, 0])
|
|
||||||
@test c1.var_output == Dict(p2 => [0.2, 0.25, 0.12], p3 => [0.25, 0.25, 0.25])
|
|
||||||
@test c1.revenue == [12.0, 12.0, 12.0, 12.0]
|
|
||||||
@test c1.operating_cost == [150.0, 150.0, 150.0, 150.0]
|
|
||||||
@test c1.disposal_limit == Dict(p2 => [0, 0, 0, 0], p3 => [Inf, Inf, Inf, Inf])
|
|
||||||
@test c1.disposal_cost ==
|
|
||||||
Dict(p2 => [0.23, 0.23, 0.23, 0.23], p3 => [1.0, 1.0, 1.0, 1.0])
|
|
||||||
c2 = instance.centers[2]
|
|
||||||
@test c2.input === nothing
|
|
||||||
@test c2.revenue == [0, 0, 0, 0]
|
|
||||||
|
|
||||||
# Plants
|
|
||||||
@test length(instance.plants) == 1
|
|
||||||
l1 = instance.plants[1]
|
|
||||||
@test l1.latitude == 44.881
|
|
||||||
@test l1.longitude == -87.623
|
|
||||||
@test l1.input_mix ==
|
|
||||||
Dict(p1 => [0.953, 0.953, 0.953, 0.953], p2 => [0.047, 0.047, 0.047, 0.047])
|
|
||||||
@test l1.output == Dict(p3 => [0.25, 0.25, 0.25, 0.25], p4 => [0.12, 0.12, 0.12, 0.12])
|
|
||||||
@test l1.emissions == Dict("CO2" => [0.1, 0.1, 0.1, 0.1])
|
|
||||||
@test l1.storage_cost == Dict(p1 => [0.1, 0.1, 0.1, 0.1], p2 => [0.1, 0.1, 0.1, 0.1])
|
|
||||||
@test l1.storage_limit == Dict(p1 => [100, 100, 100, 100], p2 => [Inf, Inf, Inf, Inf])
|
|
||||||
@test l1.disposal_cost == Dict(p3 => [0, 0, 0, 0], p4 => [0.86, 0.86, 0.86, 0.86])
|
|
||||||
@test l1.disposal_limit ==
|
|
||||||
Dict(p3 => [Inf, Inf, Inf, Inf], p4 => [1000.0, 1000.0, 1000.0, 1000.0])
|
|
||||||
@test l1.initial_capacity == 0
|
|
||||||
@test length(l1.capacities) == 2
|
|
||||||
c1 = l1.capacities[1]
|
|
||||||
@test c1.size == 100
|
|
||||||
@test c1.opening_cost == [300, 400, 450, 475]
|
|
||||||
@test c1.fix_operating_cost == [300, 300, 300, 300]
|
|
||||||
@test c1.var_operating_cost == [5, 5, 5, 5]
|
|
||||||
c2 = l1.capacities[2]
|
|
||||||
@test c2.size == 500
|
|
||||||
@test c2.opening_cost == [1000, 1000, 1000, 1000]
|
|
||||||
@test c2.fix_operating_cost == [400, 400, 400, 400]
|
|
||||||
@test c2.var_operating_cost == [5, 5, 5, 5]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function instance_parse_test_2()
|
|
||||||
# Should not crash
|
|
||||||
RELOG.parsefile(fixture("boat_example.json"))
|
|
||||||
end
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
using RELOG
|
|
||||||
using Test
|
|
||||||
using HiGHS
|
|
||||||
using JuMP
|
|
||||||
|
|
||||||
function model_build_test()
|
|
||||||
instance = RELOG.parsefile(fixture("simple.json"))
|
|
||||||
model = RELOG.build_model(instance, optimizer = HiGHS.Optimizer, variable_names = true)
|
|
||||||
y = model[:y]
|
|
||||||
z_disp = model[:z_disp]
|
|
||||||
z_input = model[:z_input]
|
|
||||||
z_tr_em = model[:z_tr_em]
|
|
||||||
x = model[:x]
|
|
||||||
obj = objective_function(model)
|
|
||||||
# print(model)
|
|
||||||
|
|
||||||
@test obj.terms[y["L1", "C3", "P4", 1]] == (
|
|
||||||
111.118 * 0.015 # transportation
|
|
||||||
- 12.0 # revenue
|
|
||||||
)
|
|
||||||
@test obj.terms[y["C1", "L1", "P2", 4]] == (
|
|
||||||
333.262 * 0.015 + # transportation
|
|
||||||
0.25 + # center collection cost
|
|
||||||
5.0 # plant operating cost
|
|
||||||
)
|
|
||||||
@test obj.terms[z_disp["C1", "P2", 1]] == 0.23
|
|
||||||
@test obj.constant == (
|
|
||||||
150 * 4 * 3 # center operating cost
|
|
||||||
)
|
|
||||||
@test obj.terms[z_disp["L1", "P4", 2]] == 0.86
|
|
||||||
@test obj.terms[x["L1", 1]] == (
|
|
||||||
-100.0 + # opening cost
|
|
||||||
300 # fixed operating cost
|
|
||||||
)
|
|
||||||
@test obj.terms[x["L1", 2]] == (
|
|
||||||
-50.0 + # opening cost
|
|
||||||
300 # fixed operating cost
|
|
||||||
)
|
|
||||||
@test obj.terms[x["L1", 3]] == (
|
|
||||||
-25.0 + # opening cost
|
|
||||||
300 # fixed operating cost
|
|
||||||
)
|
|
||||||
@test obj.terms[x["L1", 4]] == (
|
|
||||||
475.0 + # opening cost
|
|
||||||
300 # fixed operating cost
|
|
||||||
)
|
|
||||||
|
|
||||||
# Variables: Transportation emissions
|
|
||||||
@test haskey(z_tr_em, ("CO2", "L1", "C3", "P4", 1))
|
|
||||||
@test haskey(z_tr_em, ("CH4", "L1", "C3", "P4", 1))
|
|
||||||
@test haskey(z_tr_em, ("CO2", "C2", "L1", "P1", 1))
|
|
||||||
@test haskey(z_tr_em, ("CH4", "C2", "L1", "P1", 1))
|
|
||||||
|
|
||||||
# Plants: Definition of total plant input
|
|
||||||
@test repr(model[:eq_z_input]["L1", 1]) ==
|
|
||||||
"eq_z_input[L1,1] : -y[C2,L1,P1,1] - y[C1,L1,P2,1] + z_input[L1,1] = 0"
|
|
||||||
|
|
||||||
# Plants: Must meet input mix
|
|
||||||
@test repr(model[:eq_input_mix]["L1", "P1", 1]) ==
|
|
||||||
"eq_input_mix[L1,P1,1] : y[C2,L1,P1,1] - 0.953 z_input[L1,1] = 0"
|
|
||||||
@test repr(model[:eq_input_mix]["L1", "P2", 1]) ==
|
|
||||||
"eq_input_mix[L1,P2,1] : y[C1,L1,P2,1] - 0.047 z_input[L1,1] = 0"
|
|
||||||
|
|
||||||
# Plants: Calculate amount produced
|
|
||||||
@test repr(model[:eq_z_prod]["L1", "P3", 1]) ==
|
|
||||||
"eq_z_prod[L1,P3,1] : z_prod[L1,P3,1] - 0.25 z_input[L1,1] = 0"
|
|
||||||
@test repr(model[:eq_z_prod]["L1", "P4", 1]) ==
|
|
||||||
"eq_z_prod[L1,P4,1] : z_prod[L1,P4,1] - 0.12 z_input[L1,1] = 0"
|
|
||||||
|
|
||||||
# Plants: Produced material must be sent or disposed
|
|
||||||
@test repr(model[:eq_balance]["L1", "P3", 1]) ==
|
|
||||||
"eq_balance[L1,P3,1] : z_prod[L1,P3,1] - z_disp[L1,P3,1] = 0"
|
|
||||||
@test repr(model[:eq_balance]["L1", "P4", 1]) ==
|
|
||||||
"eq_balance[L1,P4,1] : -y[L1,C3,P4,1] + z_prod[L1,P4,1] - z_disp[L1,P4,1] = 0"
|
|
||||||
|
|
||||||
# Plants: Capacity limit
|
|
||||||
@test repr(model[:eq_capacity]["L1", 1]) ==
|
|
||||||
"eq_capacity[L1,1] : -100 x[L1,1] + z_input[L1,1] ≤ 0"
|
|
||||||
|
|
||||||
# Plants: Disposal limit
|
|
||||||
@test repr(model[:eq_disposal_limit]["L1", "P4", 1]) ==
|
|
||||||
"eq_disposal_limit[L1,P4,1] : z_disp[L1,P4,1] ≤ 1000"
|
|
||||||
@test ("L1", "P3", 1) ∉ keys(model[:eq_disposal_limit])
|
|
||||||
|
|
||||||
# Plants: Plant remains open
|
|
||||||
@test repr(model[:eq_keep_open]["L1", 4]) ==
|
|
||||||
"eq_keep_open[L1,4] : -x[L1,3] + x[L1,4] ≥ 0"
|
|
||||||
@test repr(model[:eq_keep_open]["L1", 1]) == "eq_keep_open[L1,1] : x[L1,1] ≥ 0"
|
|
||||||
|
|
||||||
# Plants: Building period
|
|
||||||
@test ("L1", 1) ∉ keys(model[:eq_building_period])
|
|
||||||
@test repr(model[:eq_building_period]["L1", 2]) ==
|
|
||||||
"eq_building_period[L1,2] : -x[L1,1] + x[L1,2] ≤ 0"
|
|
||||||
|
|
||||||
# Centers: Definition of total center input
|
|
||||||
@test repr(model[:eq_z_input]["C1", 1]) ==
|
|
||||||
"eq_z_input[C1,1] : -y[C2,C1,P1,1] + z_input[C1,1] = 0"
|
|
||||||
|
|
||||||
# Centers: Calculate amount collected
|
|
||||||
@test repr(model[:eq_z_collected]["C1", "P2", 1]) ==
|
|
||||||
"eq_z_collected[C1,P2,1] : -0.2 z_input[C1,1] + z_collected[C1,P2,1] = 100"
|
|
||||||
@test repr(model[:eq_z_collected]["C1", "P2", 2]) ==
|
|
||||||
"eq_z_collected[C1,P2,2] : -0.25 z_input[C1,1] - 0.2 z_input[C1,2] + z_collected[C1,P2,2] = 50"
|
|
||||||
@test repr(model[:eq_z_collected]["C1", "P2", 3]) ==
|
|
||||||
"eq_z_collected[C1,P2,3] : -0.12 z_input[C1,1] - 0.25 z_input[C1,2] - 0.2 z_input[C1,3] + z_collected[C1,P2,3] = 0"
|
|
||||||
@test repr(model[:eq_z_collected]["C1", "P2", 4]) ==
|
|
||||||
"eq_z_collected[C1,P2,4] : -0.12 z_input[C1,2] - 0.25 z_input[C1,3] - 0.2 z_input[C1,4] + z_collected[C1,P2,4] = 0"
|
|
||||||
|
|
||||||
# Centers: Collected products must be disposed or sent
|
|
||||||
@test repr(model[:eq_balance]["C1", "P2", 1]) ==
|
|
||||||
"eq_balance[C1,P2,1] : -y[C1,L1,P2,1] - z_disp[C1,P2,1] + z_collected[C1,P2,1] = 0"
|
|
||||||
@test repr(model[:eq_balance]["C1", "P3", 1]) ==
|
|
||||||
"eq_balance[C1,P3,1] : -z_disp[C1,P3,1] + z_collected[C1,P3,1] = 0"
|
|
||||||
|
|
||||||
# Centers: Disposal limit
|
|
||||||
@test repr(model[:eq_disposal_limit]["C1", "P2", 1]) ==
|
|
||||||
"eq_disposal_limit[C1,P2,1] : z_disp[C1,P2,1] ≤ 0"
|
|
||||||
@test ("C1", "P3", 1) ∉ keys(model[:eq_disposal_limit])
|
|
||||||
|
|
||||||
# Global disposal limit
|
|
||||||
@test repr(model[:eq_disposal_limit]["P1", 1]) ==
|
|
||||||
"eq_disposal_limit[P1,1] : z_disp[C2,P1,1] ≤ 1"
|
|
||||||
@test repr(model[:eq_disposal_limit]["P2", 1]) ==
|
|
||||||
"eq_disposal_limit[P2,1] : z_disp[C1,P2,1] ≤ 2"
|
|
||||||
@test repr(model[:eq_disposal_limit]["P3", 1]) ==
|
|
||||||
"eq_disposal_limit[P3,1] : z_disp[L1,P3,1] + z_disp[C1,P3,1] ≤ 5"
|
|
||||||
@test ("P4", 1) ∉ keys(model[:eq_disposal_limit])
|
|
||||||
|
|
||||||
# Products: Transportation emissions
|
|
||||||
@test repr(model[:eq_tr_em]["CH4", "L1", "C3", "P4", 1]) ==
|
|
||||||
"eq_tr_em[CH4,L1,C3,P4,1] : -0.333354 y[L1,C3,P4,1] + z_tr_em[CH4,L1,C3,P4,1] = 0"
|
|
||||||
end
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
# RELOG: Reverse Logistics Optimization
|
|
||||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
# Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
|
|
||||||
using RELOG
|
|
||||||
|
|
||||||
function model_dist_test()
|
|
||||||
# Euclidean distance between Chicago and Indianapolis
|
|
||||||
@test RELOG._calculate_distance(
|
|
||||||
41.866,
|
|
||||||
-87.656,
|
|
||||||
39.764,
|
|
||||||
-86.148,
|
|
||||||
RELOG.EuclideanDistance(),
|
|
||||||
) == 265.818
|
|
||||||
|
|
||||||
# Driving distance between Chicago and Indianapolis
|
|
||||||
@test RELOG._calculate_distance(
|
|
||||||
41.866,
|
|
||||||
-87.656,
|
|
||||||
39.764,
|
|
||||||
-86.148,
|
|
||||||
RELOG.KnnDrivingDistance(),
|
|
||||||
) == 316.43
|
|
||||||
end
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
function report_tests()
|
|
||||||
# Load and solve the boat example
|
|
||||||
instance = RELOG.parsefile(fixture("boat_example.json"))
|
|
||||||
model = RELOG.build_model(instance, optimizer = HiGHS.Optimizer, variable_names = true)
|
|
||||||
optimize!(model)
|
|
||||||
mkpath("tmp")
|
|
||||||
write_to_file(model, "tmp/model.lp")
|
|
||||||
RELOG.write_plants_report(model, "tmp/plants.csv")
|
|
||||||
RELOG.write_plant_outputs_report(model, "tmp/plant_outputs.csv")
|
|
||||||
RELOG.write_centers_report(model, "tmp/centers.csv")
|
|
||||||
RELOG.write_center_outputs_report(model, "tmp/center_outputs.csv")
|
|
||||||
RELOG.write_transportation_report(model, "tmp/transportation.csv")
|
|
||||||
end
|
|
||||||
25
web/.gitignore
vendored
25
web/.gitignore
vendored
@@ -1,25 +0,0 @@
|
|||||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
/node_modules
|
|
||||||
/.pnp
|
|
||||||
.pnp.js
|
|
||||||
|
|
||||||
# testing
|
|
||||||
/coverage
|
|
||||||
|
|
||||||
# production
|
|
||||||
/build
|
|
||||||
|
|
||||||
# misc
|
|
||||||
.DS_Store
|
|
||||||
.env.local
|
|
||||||
.env.development.local
|
|
||||||
.env.test.local
|
|
||||||
.env.production.local
|
|
||||||
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
|
|
||||||
assets
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
17746
web/package-lock.json
generated
17746
web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,65 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "web",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"private": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
|
||||||
"@fortawesome/free-regular-svg-icons": "^6.7.2",
|
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.7.2",
|
|
||||||
"@fortawesome/react-fontawesome": "^0.2.2",
|
|
||||||
"@testing-library/dom": "^10.4.0",
|
|
||||||
"@testing-library/jest-dom": "^6.6.3",
|
|
||||||
"@testing-library/react": "^16.3.0",
|
|
||||||
"@testing-library/user-event": "^13.5.0",
|
|
||||||
"@types/jest": "^27.5.2",
|
|
||||||
"@types/node": "^16.18.126",
|
|
||||||
"@types/pako": "^2.0.3",
|
|
||||||
"@types/papaparse": "^5.3.16",
|
|
||||||
"@types/react": "^19.1.3",
|
|
||||||
"@types/react-dom": "^19.1.3",
|
|
||||||
"ajv": "^8.17.1",
|
|
||||||
"eslint": "^8.57.1",
|
|
||||||
"pako": "^2.1.0",
|
|
||||||
"papaparse": "^5.5.2",
|
|
||||||
"react": "^19.1.0",
|
|
||||||
"react-dom": "^19.1.0",
|
|
||||||
"react-scripts": "^5.0.1",
|
|
||||||
"tabulator-tables": "^6.3.1",
|
|
||||||
"typescript": "^4.9.5",
|
|
||||||
"web-vitals": "^2.1.4"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"start": "react-scripts start",
|
|
||||||
"build": "react-scripts build",
|
|
||||||
"test": "react-scripts test",
|
|
||||||
"eject": "react-scripts eject"
|
|
||||||
},
|
|
||||||
"eslintConfig": {
|
|
||||||
"extends": [
|
|
||||||
"react-app",
|
|
||||||
"react-app/jest"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"semi": [
|
|
||||||
"error",
|
|
||||||
"always"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"browserslist": {
|
|
||||||
"production": [
|
|
||||||
">0.2%",
|
|
||||||
"not dead",
|
|
||||||
"not op_mini all"
|
|
||||||
],
|
|
||||||
"development": [
|
|
||||||
"last 1 chrome version",
|
|
||||||
"last 1 firefox version",
|
|
||||||
"last 1 safari version"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/tabulator-tables": "^6.2.6",
|
|
||||||
"prettier": "3.5.3"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB |
@@ -1,49 +0,0 @@
|
|||||||
<!--
|
|
||||||
~ RELOG: Supply Chain Analysis and Optimization
|
|
||||||
~ Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
~ Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<meta name="theme-color" content="#000000" />
|
|
||||||
<meta name="description" content="RELOG Case Builder" />
|
|
||||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
|
||||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
||||||
<title>Case Builder - RELOG</title>
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--site-max-width: 1500px;
|
|
||||||
--site-min-width: 900px;
|
|
||||||
--box-border: 1px solid rgba(0, 0, 0, 0.2);
|
|
||||||
--box-shadow: 0px 2px 4px -3px rgba(0, 0, 0, 0.2);
|
|
||||||
--border-radius: 4px;
|
|
||||||
--primary: #0d6efd;
|
|
||||||
--contrast-100: #202020;
|
|
||||||
--contrast-80: #606060;
|
|
||||||
--contrast-60: #909090;
|
|
||||||
--contrast-20: #d6d6d6;
|
|
||||||
--contrast-10: #f6f6f6;
|
|
||||||
--contrast-0: #fefefe;
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
font-family: Arial, sans-serif;
|
|
||||||
background-color: #333;
|
|
||||||
}
|
|
||||||
.content {
|
|
||||||
background-color: var(--contrast-10);
|
|
||||||
padding-bottom: 36px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
||||||
<div id="root"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 9.4 KiB |
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"short_name": "React App",
|
|
||||||
"name": "Create React App Sample",
|
|
||||||
"icons": [
|
|
||||||
{
|
|
||||||
"src": "favicon.ico",
|
|
||||||
"sizes": "64x64 32x32 24x24 16x16",
|
|
||||||
"type": "image/x-icon"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "logo192.png",
|
|
||||||
"type": "image/png",
|
|
||||||
"sizes": "192x192"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "logo512.png",
|
|
||||||
"type": "image/png",
|
|
||||||
"sizes": "512x512"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"start_url": ".",
|
|
||||||
"display": "standalone",
|
|
||||||
"theme_color": "#000000",
|
|
||||||
"background_color": "#ffffff"
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# https://www.robotstxt.org/robotstxt.html
|
|
||||||
User-agent: *
|
|
||||||
Disallow:
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
* RELOG: Supply Chain Analysis and Optimization
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import Header from "./Header";
|
|
||||||
|
|
||||||
import "tabulator-tables/dist/css/tabulator.min.css";
|
|
||||||
import "../Common/Forms/Tables.css";
|
|
||||||
import Footer from "./Footer";
|
|
||||||
|
|
||||||
const CaseBuilder = () => {
|
|
||||||
const onClear = () => {};
|
|
||||||
const onSave = () => {};
|
|
||||||
const onLoad = () => {};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<Header onClear={onClear} onSave={onSave} onLoad={onLoad} />
|
|
||||||
<div className="content"></div>
|
|
||||||
<Footer />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CaseBuilder;
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
/*
|
|
||||||
* RELOG: Supply Chain Analysis and Optimization
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
.Footer {
|
|
||||||
background-color: #333;
|
|
||||||
text-align: center;
|
|
||||||
color: #aaa;
|
|
||||||
font-size: 14px;
|
|
||||||
padding: 16px;
|
|
||||||
line-height: 24px;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
* RELOG: Supply Chain Analysis and Optimization
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import styles from "./Footer.module.css";
|
|
||||||
|
|
||||||
function Footer() {
|
|
||||||
return (
|
|
||||||
<div className={styles.Footer}>
|
|
||||||
RELOG: Supply Chain Analysis and Optimization <br />
|
|
||||||
Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Footer;
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
/*
|
|
||||||
* RELOG: Supply Chain Analysis and Optimization
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
.HeaderBox {
|
|
||||||
background-color: var(--contrast-0);
|
|
||||||
border-bottom: var(--box-border);
|
|
||||||
box-shadow: var(--box-shadow);
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.HeaderContent {
|
|
||||||
margin: 0 auto;
|
|
||||||
max-width: var(--site-max-width);
|
|
||||||
min-width: var(--site-min-width);
|
|
||||||
}
|
|
||||||
|
|
||||||
.HeaderContent h1,
|
|
||||||
h2 {
|
|
||||||
color: var(--contrast-100);
|
|
||||||
display: inline-block;
|
|
||||||
line-height: 48px;
|
|
||||||
font-size: 28px;
|
|
||||||
margin: 0;
|
|
||||||
padding: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.HeaderContent h2 {
|
|
||||||
display: inline-block;
|
|
||||||
font-size: 22px;
|
|
||||||
color: var(--contrast-80);
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
.buttonContainer {
|
|
||||||
float: right;
|
|
||||||
padding: 16px 12px;
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* RELOG: Supply Chain Analysis and Optimization
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import styles from "./Header.module.css";
|
|
||||||
import SiteHeaderButton from "../Common/Buttons/SiteHeaderButton";
|
|
||||||
import { useRef } from "react";
|
|
||||||
import FileUploadElement from "../Common/Buttons/FileUploadElement";
|
|
||||||
|
|
||||||
interface HeaderProps {
|
|
||||||
onClear: () => void;
|
|
||||||
onSave: () => void;
|
|
||||||
onLoad: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Header(props: HeaderProps) {
|
|
||||||
const fileElem = useRef<FileUploadElement>(null);
|
|
||||||
|
|
||||||
function onLoad() {}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={styles.HeaderBox}>
|
|
||||||
<div className={styles.HeaderContent}>
|
|
||||||
<h1>RELOG</h1>
|
|
||||||
<h2>Case Builder</h2>
|
|
||||||
<div className={styles.buttonContainer}>
|
|
||||||
<SiteHeaderButton title="Clear" onClick={props.onClear} />
|
|
||||||
<SiteHeaderButton title="Load" onClick={onLoad} />
|
|
||||||
<SiteHeaderButton title="Save" onClick={props.onSave} />
|
|
||||||
</div>
|
|
||||||
<FileUploadElement ref={fileElem} accept=".json,.json.gz" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Header;
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* RELOG: Supply Chain Analysis and Optimization
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import pako from "pako";
|
|
||||||
import React, { Component } from "react";
|
|
||||||
|
|
||||||
class FileUploadElement extends Component<any> {
|
|
||||||
private inputRef = React.createRef<HTMLInputElement>();
|
|
||||||
private callback: (data: any) => void = () => {};
|
|
||||||
|
|
||||||
showFilePicker = (callback: (data: any) => void) => {
|
|
||||||
this.callback = callback;
|
|
||||||
this.inputRef.current?.click();
|
|
||||||
};
|
|
||||||
|
|
||||||
onFileSelected = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
||||||
const file = event.target.files![0]!;
|
|
||||||
let isCompressed = file.name.endsWith(".gz");
|
|
||||||
if (file) {
|
|
||||||
const reader = new FileReader();
|
|
||||||
reader.onload = async (e) => {
|
|
||||||
let content = e.target?.result;
|
|
||||||
|
|
||||||
if (isCompressed) {
|
|
||||||
const compressed = new Uint8Array(content as ArrayBuffer);
|
|
||||||
const decompressed = pako.inflate(compressed);
|
|
||||||
content = new TextDecoder().decode(decompressed);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.callback(content as string);
|
|
||||||
this.callback = () => {};
|
|
||||||
};
|
|
||||||
if (isCompressed) {
|
|
||||||
reader.readAsArrayBuffer(file);
|
|
||||||
} else {
|
|
||||||
reader.readAsText(file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.target.value = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
override render() {
|
|
||||||
return (
|
|
||||||
<input
|
|
||||||
ref={this.inputRef}
|
|
||||||
type="file"
|
|
||||||
accept={this.props.accept}
|
|
||||||
style={{ display: "none" }}
|
|
||||||
onChange={this.onFileSelected}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default FileUploadElement;
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* RELOG: Supply Chain Analysis and Optimization
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
.tooltip {
|
|
||||||
visibility: hidden;
|
|
||||||
background-color: var(--contrast-80);
|
|
||||||
color: var(--contrast-10);
|
|
||||||
opacity: 0;
|
|
||||||
width: 250px;
|
|
||||||
margin-top: 36px;
|
|
||||||
margin-left: -250px;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 100;
|
|
||||||
font-size: 14px;
|
|
||||||
border-radius: var(--border-radius);
|
|
||||||
box-shadow: var(--box-shadow);
|
|
||||||
line-height: 20px;
|
|
||||||
transition: opacity 0.5s;
|
|
||||||
font-weight: normal;
|
|
||||||
text-align: left;
|
|
||||||
padding: 6px 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
color: var(--contrast-60);
|
|
||||||
font-size: 16px;
|
|
||||||
padding: 8px 8px 8px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.HelpButton {
|
|
||||||
border: 0;
|
|
||||||
background-color: transparent;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.HelpButton:hover .tooltip {
|
|
||||||
visibility: visible;
|
|
||||||
opacity: 100%;
|
|
||||||
transition: opacity 0.5s;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
* RELOG: Supply Chain Analysis and Optimization
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import styles from "./HelpButton.module.css";
|
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
||||||
import { faCircleQuestion } from "@fortawesome/free-regular-svg-icons";
|
|
||||||
|
|
||||||
function HelpButton({ text }: { text: String }) {
|
|
||||||
return (
|
|
||||||
<button className={styles.HelpButton}>
|
|
||||||
<span className={styles.tooltip}>{text}</span>
|
|
||||||
<span className={styles.icon}>
|
|
||||||
<FontAwesomeIcon icon={faCircleQuestion} />
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default HelpButton;
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* RELOG: Supply Chain Analysis and Optimization
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
.SectionButton {
|
|
||||||
height: 48px;
|
|
||||||
width: 48px;
|
|
||||||
font-size: 16px;
|
|
||||||
border: 0;
|
|
||||||
background-color: transparent;
|
|
||||||
margin: 8px 0 8px 0px;
|
|
||||||
cursor: pointer;
|
|
||||||
color: var(--contrast-60);
|
|
||||||
}
|
|
||||||
|
|
||||||
.SectionButton:hover {
|
|
||||||
color: var(--contrast-100);
|
|
||||||
background-color: var(--contrast-20);
|
|
||||||
border-radius: var(--border-radius);
|
|
||||||
}
|
|
||||||
|
|
||||||
.SectionButton:active {
|
|
||||||
background-color: var(--contrast-60);
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
* RELOG: Supply Chain Analysis and Optimization
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
||||||
import styles from "./SectionButton.module.css";
|
|
||||||
|
|
||||||
interface SectionButtonProps {
|
|
||||||
icon: IconDefinition;
|
|
||||||
tooltip: string;
|
|
||||||
onClick?: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
function SectionButton(props: SectionButtonProps) {
|
|
||||||
return (
|
|
||||||
<button
|
|
||||||
className={styles.SectionButton}
|
|
||||||
title={props.tooltip}
|
|
||||||
onClick={props.onClick}
|
|
||||||
>
|
|
||||||
<FontAwesomeIcon icon={props.icon} />
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default SectionButton;
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* RELOG: Supply Chain Analysis and Optimization
|
|
||||||
* Copyright (C) 2020-2025, UChicago Argonne, LLC. All rights reserved.
|
|
||||||
* Released under the modified BSD license. See COPYING.md for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
.SiteHeaderButton {
|
|
||||||
padding: 6px 36px;
|
|
||||||
margin: 0 0 0 8px;
|
|
||||||
line-height: 24px;
|
|
||||||
border: var(--box-border);
|
|
||||||
box-shadow: var(--box-shadow);
|
|
||||||
border-radius: var(--border-radius);
|
|
||||||
cursor: pointer;
|
|
||||||
color: var(--contrast-80);
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 12px;
|
|
||||||
background: linear-gradient(var(--contrast-0) 25%, var(--contrast-10) 100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.SiteHeaderButton:hover {
|
|
||||||
background: rgb(245, 245, 245);
|
|
||||||
}
|
|
||||||
|
|
||||||
.SiteHeaderButton:active {
|
|
||||||
background: rgba(220, 220, 220);
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user