52 Commits

Author SHA1 Message Date
7dbc3cf90b model: Capacity cannot decrease over time 2025-11-14 10:24:58 -06:00
b7d16fee3e model: Fix division by zero 2025-11-14 10:14:20 -06:00
eedf023b47 Fix RELOG.parsefile 2025-11-14 10:13:59 -06:00
5eee29547c Reformat source code 2025-09-19 14:25:48 -05:00
897717677f Implement plant storage 2025-09-19 14:14:50 -05:00
480547933b Implement plant expansion 2025-09-19 13:05:36 -05:00
744b043461 Implement _add_pwl_constraints 2025-09-18 12:08:58 -05:00
f4e97ff7f2 docs: Minor fix 2025-09-17 15:05:26 -05:00
f35c84abe9 Add emission limits and penalties 2025-09-17 15:03:51 -05:00
003922ac70 Implement plant emissions 2025-09-17 13:57:44 -05:00
4ce52b7420 Merge branch 'circular' 2025-09-17 12:16:20 -05:00
157cd500ef Implement transportation emissions 2025-09-17 12:11:52 -05:00
ca06db2870 Add more fields to CSV reports 2025-09-16 12:17:00 -05:00
5ac9ae2b62 Reports: use dicts instead of lists 2025-09-16 12:01:29 -05:00
e4d4ee1cc8 Implement global disposal limits 2025-09-16 11:53:32 -05:00
67b1e5fd40 Reformat source code 2025-09-16 11:14:15 -05:00
5ea3e10139 web: Update copyright 2025-06-10 09:58:39 -05:00
3f9d2f22f5 web: Add scaffold 2025-06-10 09:56:06 -05:00
3d36caa507 Circular: Implement driving distances 2025-03-28 13:46:45 -05:00
17a870967b Fix typos 2025-03-28 12:17:13 -05:00
29999d006e Bump version to 0.8.0 2025-03-28 12:06:49 -05:00
db7f1c8af5 Simplify title 2025-03-28 12:06:16 -05:00
f940489693 Add README.md 2025-03-28 12:04:16 -05:00
40947190ad Update docs 2025-03-28 11:39:16 -05:00
f82a1d121d Make boat example easier to run; add output 2023-12-08 10:06:21 -06:00
6dae3a825f Convert boat example to Julia 2023-12-08 10:01:53 -06:00
ada89b7878 Debug model; improve reports 2023-12-06 16:16:13 -06:00
319e5f1ed3 Implement basic reports; fix boat example 2023-12-06 14:39:28 -06:00
06642c631f Conclude model implementation 2023-12-06 13:06:42 -06:00
d41ff30326 Model: Objective function and plant constraints 2023-12-06 11:50:03 -06:00
0da66b571a Start implementation of circular model 2023-12-06 09:27:37 -06:00
4947ad1a8a Finish implementing parser 2023-11-30 12:05:32 -06:00
76b085e105 Parser: Allow scalars in timeseries fields 2023-11-30 11:06:31 -06:00
6055eafcd6 Add larger example 2023-11-30 10:49:22 -06:00
74759bd602 Start implementation of circular model 2023-11-28 10:26:07 -06:00
9e0f8c5796 solve: Allow custom graph 2023-07-27 10:38:53 -05:00
5693ef2aa2 Reformat source code 2023-07-26 10:25:11 -05:00
bc05b49222 Make resolve compatible with solve(heuristic=true) 2023-07-26 10:17:37 -05:00
3e54e767c4 Fix failing test 2023-07-26 10:00:07 -05:00
84bd25b04d Fix: Remove disposal when deleting product 2023-07-07 10:22:57 -05:00
c86dda12cd Make marginal costs optional in write_reports 2023-07-07 10:20:25 -05:00
f3a2d1d616 Fix bug in _compress when plants have fixed size
Capacity was being incorrectly multiplied by T twice. This
happened because there were two references to the same struct
in the plant sizes array. This fix replaces the second reference
by an actual copy of the struct.
2023-07-07 10:05:31 -05:00
029a47a64b compress: Update disposal/acquisition limits/costs 2023-05-16 15:29:08 -05:00
de27a6202d Bump version to 0.7.2 2023-03-10 16:27:32 -06:00
7d4a763910 Fix issue with collection disposal; increase precision in CSV reports 2023-03-10 14:20:21 -06:00
8432c49050 Add .zenodo.json 2023-03-08 10:17:18 -06:00
2d860326fe Bump version to 0.7.1 2023-03-08 10:01:45 -06:00
be37934b87 Web: Do not use heuristics 2023-03-08 09:44:44 -06:00
3c354ec3e4 Add write_reports function 2023-03-08 09:44:27 -06:00
f5a92358d7 Formulation: If plant is closed, storage cannot be used 2023-03-08 09:44:08 -06:00
69f205be77 Formulation: Prevent plants from sending products to themselves 2023-03-08 09:42:53 -06:00
3b3ecbde27 Web: Fix parsing of disposal limit 2023-03-08 09:42:02 -06:00
154 changed files with 23573 additions and 38229 deletions

1
.gitignore vendored
View File

@@ -16,3 +16,4 @@ run.jl
relog-web-legacy
.vscode
jobs
tmp

28
.zenodo.json Normal file
View File

@@ -0,0 +1,28 @@
{
"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."
}

View File

@@ -1,94 +0,0 @@
# 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
## [0.7.0] -- 2023-02-23
### Added
- Core: Allow disposal at collection centers
- Core: Allow products to have acquisition costs
- Core: Allow modeling of existing plants
- Web UI: Allow CSV variables and expressions
- Web UI: Allow specifying distance metric
### Changed
- Switch from Cbc/Clp to HiGHS
## [0.6.0] -- 2022-12-15
### Added
- Allow RELOG to calculate approximate driving distances, instead of just straight-line distances between points.
### Fixed
- Fix bug that caused building period parameter to be ignored
## [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)"

View File

@@ -1,25 +0,0 @@
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.
********************************************************************************

View File

@@ -1,29 +0,0 @@
FROM julia:1.7-buster
ENV RELOG_TIME_LIMIT_SEC=3600
# Install Node.js & zip
RUN apt-get update -yq && \
apt-get -yq install curl gnupg ca-certificates && \
curl -L https://deb.nodesource.com/setup_18.x | bash && \
apt-get update -yq && \
apt-get install -yq nodejs zip
# Install Julia dependencies
ADD Project.toml /app/
ADD src/RELOG.jl /app/src/
RUN julia --project=/app -e 'using Pkg; Pkg.update()'
# Install JS dependencies
ADD relog-web/package*.json /app/relog-web/
RUN cd /app/relog-web && npm install
# Copy source code
ADD . /app
RUN julia --project=/app -e 'using Pkg; Pkg.precompile()'
# Build JS app
RUN cd /app/relog-web && npm run build
WORKDIR /app
CMD julia --project=/app -e 'import RELOG; RELOG.web("0.0.0.0")'

View File

@@ -1,30 +0,0 @@
VERSION := 0.7
PKG := ghcr.io/anl-ceeesa/relog-web
clean:
rm -rfv build Manifest.toml test/Manifest.toml deps/formatter/build deps/formatter/Manifest.toml
docs:
rsync -avP --delete-after docs/build/ ../docs/$(VERSION)/
docker-build:
docker build --tag $(PKG):$(VERSION) .
docker build --tag $(PKG):latest .
docker-push:
docker push $(PKG):$(VERSION)
docker push $(PKG):latest
docker-run:
docker run -it --rm --name relog --volume $(PWD)/jobs:/app/jobs --publish 8000:8080 $(PKG):$(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

View File

@@ -1,51 +1,18 @@
name = "RELOG"
uuid = "a2afcdf7-cf04-4913-85f9-c0d81ddf2008"
authors = ["Alinson S Xavier <axavier@anl.gov>"]
version = "0.7.0"
uuid = "7cafaa7a-b311-45f0-b313-80bf15b5e5e5"
authors = ["Alinson S. Xavier <git@axavier.org>"]
version = "0.8.0"
[deps]
CRC = "44b605c4-b955-5f2b-9b6d-d2bd01d3d205"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
GZip = "92fee26a-97fe-5a0c-ad85-20a5f3185b63"
Geodesy = "0ef565a4-170c-5f04-8de2-149903a85f3d"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
JSONSchema = "7d188eb4-7ad8-530c-ae41-71a32a6d4692"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
ProgressBars = "49802e3a-d2f1-5c88-81d8-b72133a6f568"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Shapefile = "8e980c4a-a4fe-5da2-b3a7-4b4b0353a2f4"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea"
[compat]
CRC = "4"
CSV = "0.10"
DataFrames = "1"
DataStructures = "0.18"
GZip = "0.5"
Geodesy = "1"
HTTP = "0.9"
HiGHS = "1"
JSON = "0.21"
JSONSchema = "1"
JuMP = "1"
MathOptInterface = "1"
NearestNeighbors = "0.4"
OrderedCollections = "1"
ProgressBars = "1"
Shapefile = "0.8"
ZipFile = "0.10"
julia = "1"

View File

@@ -1,8 +1,5 @@
<h1 align="center">RELOG: Reverse Logistics Optimization</h1>
<h1 align="center">RELOG: Supply Chain Analysis and Optimization</h1>
<p align="center">
<a href="https://github.com/ANL-CEEESA/RELOG/actions">
<img src="https://github.com/ANL-CEEESA/RELOG/workflows/Build%20&%20Test/badge.svg">
</a>
<a href="https://doi.org/10.5281/zenodo.4302341">
<img src="https://zenodo.org/badge/DOI/10.5281/zenodo.4302341.svg">
</a>
@@ -11,30 +8,44 @@
</a>
</p>
**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.
**RELOG** is an open-source package designed to optimize supply chains for
forward, reverse and circular manufacturing. Using mixed-integer linear
optimization, RELOG helps users determine strategic decisions such as:
<img src="https://anl-ceeesa.github.io/RELOG/0.7/assets/ex_transportation.png" width="1000px"/>
- 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
### Documentation
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.
- [Usage](https://anl-ceeesa.github.io/RELOG/0.7/usage)
- [Input and Output Data Formats](https://anl-ceeesa.github.io/RELOG/0.7/format)
- [Simplified Solution Reports](https://anl-ceeesa.github.io/RELOG/0.7/reports)
- [Optimization Model](https://anl-ceeesa.github.io/RELOG/0.7/model)
## Screenshots
### Authors
<img src="https://raw.githubusercontent.com/ANL-CEEESA/RELOG/refs/heads/circular/docs/src/assets/relog.png" width="1000px"/>
- **Alinson S. Xavier** <<axavier@anl.gov>>
- **Nwike Iloeje** <<ciloeje@anl.gov>>
- **John Atkins**
- **Kyle Sun**
- **Audrey Gallier**
## Documentation
### License
See official documentation at: https://anl-ceeesa.github.io/RELOG/
## Authors
- **Alinson S. Xavier,** Argonne National Laboratory <axavier@anl.gov>
- **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
RELOG: Reverse Logistics Optimization
Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.
Copyright © 2020-2025, UChicago Argonne, LLC. All Rights Reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:

View File

@@ -1,4 +1,5 @@
[deps]
BetterFileWatching = "c9fd44ac-77b5-486c-9482-9798bd063cc6"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
RELOG = "a2afcdf7-cf04-4913-85f9-c0d81ddf2008"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"

View File

@@ -1,17 +1,26 @@
using Documenter, RELOG
using Documenter
using RELOG
using BetterFileWatching
function make()
makedocs(
sitename="RELOG",
pages=[
"Home" => "index.md",
"usage.md",
"format.md",
"reports.md",
"model.md",
"User guide" => [
"problem.md",
"format.md",
]
],
format = Documenter.HTML(
assets=["assets/custom.css"],
)
)
end
function watch()
make()
watch_folder("src") do event
make()
end
end

BIN
docs/src/assets/relog.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

View File

@@ -1,14 +1,10 @@
# Input and Output Data Formats
# Input data format
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.
RELOG accepts as input a JSON file with five sections: `parameters`, `products`,
`centers`, `plants` and `emissions`. Below, we describe each section in more
detail.
## Input Data Format (JSON)
RELOG accepts as input a JSON file with three sections: `parameters`, `products` and `plants`. Below, we describe each section in more detail.
### Parameters
The **parameters** section describes details about the simulation itself.
## Parameters
| Key | Description |
| :------------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -21,34 +17,21 @@ The **parameters** section describes details about the simulation itself.
```json
{
"parameters": {
"time horizon (years)": 2,
"time horizon (years)": 4,
"building period (years)": [1],
"distance metric": "driving"
}
}
```
### Products
## 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. |
| `acquisition cost ($/tonne)` | Cost of acquiring one tonne of this product at a collection center. If omitted, defaults to zero. |
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. |
| 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. |
| `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. |
#### Example
@@ -56,184 +39,211 @@ Each product may have some amount available at the beginning of each time period
{
"products": {
"P1": {
"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]
}
},
"transportation cost ($/km/tonne)": [0.015, 0.015],
"transportation energy (J/km/tonne)": [0.12, 0.11],
"transportation cost ($/km/tonne)": 0.015,
"transportation energy (J/km/tonne)": 0.12,
"transportation emissions (tonne/km/tonne)": {
"CO2": [0.052, 0.05],
"CH4": [0.003, 0.002]
"CO2": 0.052,
"CH4": 0.003
},
"disposal cost ($/tonne)": [-10.0, -12.0],
"disposal limit (tonne)": [1.0, 1.0],
"acquisition cost ($/tonne)": [1.0, 1.0]
},
"P2": {
"transportation cost ($/km/tonne)": [0.022, 0.02]
},
"P3": {
"transportation cost ($/km/tonne)": [0.0125, 0.0125]
},
"P4": {
"transportation cost ($/km/tonne)": [0.0175, 0.0175]
"disposal limit (tonne)": 100.0
}
}
}
```
### Processing plants
## Centers
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 |
| :------------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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. |
| 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). |
```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)": {}
}
}
}
```
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:
## Plants
| 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. |
| `initial capacity (tonne)` | Capacity already available at this location. Optional. |
| 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. |
| `initial capacity (tonne)` | Capacity already available. If the plant has not been built yet, this should be `0`. |
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:
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. |
| `fixed operating cost ($)` | The cost to keep the plant open, even if the plant doesn't process anything. |
| `variable operating cost ($/tonne)` | The cost that the plant incurs to process each tonne of input. Must be the same for all capacities. |
```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
},
{
"size": 500,
"opening cost ($)": 1000.0,
"fixed operating cost ($)": 400.0,
"variable operating cost ($/tonne)": 5.0.
}
],
"initial capacity (tonne)": 0,
}
}
}
```
## Emissions
| Key | Description |
| :------------------ | :------------------------------------------------------------------------------------------------------------------------------------- |
| `limit (tonne)` | Maximum amount of this greenhouse gas allowed to be emitted per year across the entire supply chain. Entry may be `null` if unlimited. |
| `penalty ($/tonne)` | Penalty cost per tonne of this greenhouse gas emitted. |
#### 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.05],
"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]
}
}
}
}
"emissions": {
"CO2": {
"limit (tonne)": 1000.0,
"penalty ($/tonne)": 50.0
},
"CH4": {
"limit (tonne)": null,
"penalty ($/tonne)": 1200.0
},
"N2O": {
"limit (tonne)": 10.0,
"penalty ($/tonne)": 15000.0
}
}
}
```
### 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.
- Accurate driving distances are only available for the continental United States.
## Output Data Format (JSON)
To be documented.

View File

@@ -1,37 +1,42 @@
# RELOG: Reverse Logistics Optimization
# RELOG -- Supply Chain Analysis and Optimization
**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.
**RELOG** is an open-source package designed to optimize supply chains for
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
<center>
<img src="assets/ex_transportation.png" width="1000px"/>
<img src="assets/relog.png" width="1000px"/>
</center>
```
### Table of Contents
```@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
## Authors
- **Alinson S. Xavier,** Argonne National Laboratory <axavier@anl.gov>
- **Nwike Iloeje,** Argonne National Laboratory <ciloeje@anl.gov>
- **John Atkins**
- **Kyle Sun**
- **Audrey Gallier**
- **Kavitha G. Menon,** Argonne National Laboratory
- **John Atkins,** Argonne National Laboratory
- **Kyle Sun,** Argonne National Laboratory
- **Audrey Gallier,** Argonne National Laboratory
### License
## License
```text
RELOG: Reverse Logistics Optimization
Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.
Copyright © 2020-2025, UChicago Argonne, LLC. All Rights Reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:

View File

@@ -1,225 +0,0 @@
# 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 collection centers holding the primary 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{exp}_{pt}$ | Cost of adding one tonne of capacity to plant $p$ at time $t$ | \$/tonne |
| $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{open}_{pt}$ | Cost of opening plant $p$ at time $t$, at minimum capacity | $ |
| $c^\text{p-disp}_{pmt}$ | Cost of disposing recovered material $m$ at plant $p$ during time $t$ | \$/tonne/km |
| $c^\text{store}_{pt}$ | Cost of storing primary material at plant $p$ at time $t$ | \$/tonne |
| $c^\text{proc}_{pt}$ | Variable cost of processing primary material at plant $p$ at time $t$ | \$/tonne |
| $m^\text{max}_p$ | Maximum capacity of plant $p$ | tonne |
| $m^\text{min}_p$ | Minimum capacity of plant $p$ | tonne |
| $m^\text{init}_p$ | Initial capacity of plant $p$ | tonne |
| $m^\text{p-disp}_{pmt}$ | Maximum amount of recovered material $m$ that plant $p$ can dispose of during time $t$ | tonne |
| $m^\text{store}_p$ | Maximum amount of primary 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 primary material | tonne/tonne |
| $c^\text{acq}_{lt}$ | Cost of acquiring primary material at collection center $l$ during time $t$ | \$/tonne |
| $c^\text{c-disp}_{lt}$ | Cost of disposing primary material at collection center $l$ during time $t$ | \$/tonne |
| $m^\text{c-disp}_{t}$ | Maximum amount of primary material that can be disposed of across all collection centers during time $t$ | tonne |
| $m^\text{initial}_{lt}$ | Amount of primary material available to be recycled at collection center $l$ during time $t$ | tonne |
#### Transportation
| Symbol | Description | Unit |
| :---------------- | :--------------------------------------------------- | :---------- |
| $c^\text{tr}_{t}$ | Cost to transport primary material during time $t$ | \$/tonne/km |
| $d_{lp}$ | Distance between plant $p$ and collection center $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 primary material sent from collection center $l$ to plant $p$ during time $t$ | tonne |
| $z^{\text{p-disp}}_{mpt}$ | Amount of recovered material $m$ disposed of by plant $p$ during time $t$ | tonne |
| $z^{\text{c-disp}}_{lt}$ | Amount of primary material disposed of at collection center $l$ during time $t$ | tonne |
| $z^{\text{store}}_{pt}$ | Amount of primary material in storage at plant $p$ by the end of time period $t$ | tonne |
| $z^{\text{proc}}_{mpt}$ | Amount of primary 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} +
c^\text{f-exp}_{pt} \left( \sum_{i=0}^t w_{pi} \right) +
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{p-disp}}_{pmt} z_{pmt} +
\\
&
\sum_{t \in T} \sum_{l \in L} c^\text{acq}_{lt} \left(
m^\text{initial}_{lt} - z^{\text{c-disp}}_{lt}
\right) + c^\text{c-disp}_{lt} z^{\text{c-disp}}_{lt}
\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 disposal costs at the plants.
In the fifth line, we have acquisition and disposal cost at the collection centers.
### Constraints
- All primary material must either be sent to a plant for processing or disposed of at the collection center:
```math
\begin{align*}
& \sum_{p \in P} y_{lpt} + z^{\text{c-disp}}_{lt} = m^\text{initial}_{lt}
& \forall l \in L, t \in T
\end{align*}
```
- There is a limit on how much primary material can be disposed of at the collection centers:
```math
\begin{align*}
& \sum_{l \in L} z^{\text{c-disp}}_{lt} \leq m^\text{c-disp}_{t}
& t \in T
\end{align*}
```
- Amount received equals amount processed plus stored. Furthermore, all primary 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=0}^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=0}^t w_p \leq \left( m^\text{max}_p - m^\text{min}_p \right) 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^{\text{p-disp}}_{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 \\
\end{align*}
```
- Boundary constants:
```math
\begin{align*}
& x_{p,0} = \begin{cases}
0 & \text{ if } m^\text{init}_p = 0 \\
1 & \text{ otherwise }
\end{cases} \\
& w_{p,0} = \max\left\{0, m^\text{init}_p - m^\text{min}_p \right\}
\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{c-disp}}_{lt} \geq 0
& l \in L, t \in T \\
& z^{\text{store}}_{pt} \geq 0
& p \in P, t \in T \\
& z^{\text{p-disp}}_{mpt}, z^{\text{proc}}_{mpt} \geq 0
& \forall m \in M, p \in P, t \in T
\end{align*}
```

415
docs/src/problem.md Normal file
View File

@@ -0,0 +1,415 @@
# 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 includes 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-init}_p$ | Initial capacity of plant $p$ | tonne |
| $K^\text{cap-max}_p$ | Maximum capacity of plant $p$ | tonne |
| $K^\text{cap-min}_p$ | Minimum capacity of plant $p$ | 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{em-limit}_{gt}$ | Maximum amount of greenhouse gas $g$ allowed to be emitted (globally) at time $t$ | tonne |
| $K^\text{em-plant}_{gpt}$ | Amount of greenhouse gas $g$ released by plant $p$ at time $t$ for each tonne of input material processed | tonne/tonne |
| $K^\text{em-tr}_{gmt}$ | Amount of greenhouse gas $g$ released by transporting 1 tonne of material $m$ over one km at time $t$ | tonne/km-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{out-fix}_{cmt}$ | Fixed amount of material $m$ collected at center $c$ at time $t$ | tonne |
| $K^\text{out-var-len}_{cm}$ | Length of the $K^\text{out-var}_{c,m,*}$ vector. | -- |
| $K^\text{out-var}_{cmi}$ | Factor used to calculate variable amount of material $m$ collected at center $c$. See `eq_z_collected` for more details. | -- |
| $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{storage-limit}_{pm}$ | Maximum amount of material $m$ that can be stored at plant $p$ at any time | 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{em}_{gt}$ | Penalty cost per tonne of greenhouse gas $g$ emitted at time $t$ | \$/tonne |
| $R^\text{expand}_{pt}$ | Cost to increase capacity of plant $p$ at time $t$ | \$/tonne |
| $R^\text{fix-exp}_{pt}$ | Increase in fixed operational cost for plant $p$ at time $t$ for every additional tonne of capacity | \$/tonne |
| $R^\text{fix-min}_{pt}$ | Fixed operating cost for plant $p$ at time $t$ at minimum capacity | \$ |
| $R^\text{fix}_{ct}$ | Fixed operating cost for center $c$ at time $t$ | \$ |
| $R^\text{open}_{pt}$ | Cost to open plant $p$ at time $t$, at minimum capacity | \$ |
| $R^\text{rev}_{ct}$ | Revenue for selling the input product of center $c$ at this center at time $t$ | \$/tonne |
| $R^\text{storage}_{pmt}$ | Cost to store one tonne of material $m$ at plant $p$ at time $t$ for one year | \$/tonne |
| $R^\text{tr}_{mt}$ | Cost to send material $m$ at time $t$ | \$/km-tonne |
| $R^\text{var}_{pt}$ | Cost to process one tonne of input material at plant $p$ at time $t$ | \$/tonne |
## 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{exp}}_{pt}$ | `z_exp[p.name, t]` | Extra capacity installed at plant $p$ at time $t$ above the minimum capacity | 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{em-plant}}_{gpt}$ | `z_em_plant[g.name, p.name, t]` | Amount of greenhouse gas $g$ released by plant $p$ at time $t$ | tonne |
| $z^{\text{em-tr}}_{guvmt}$ | `z_em_tr[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 |
| $z^{\text{input}}_{ut}$ | `z_input[u.name, t]` | Total amount received by plant/center $u$ 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{storage}}_{pmt}$ | `z_storage[p.name, m.name, t]` | Amount of input material $m$ stored at plant $p$ at the end of time $t$ | tonne |
| $z^{\text{process}}_{pt}$ | `z_process[p.name, t]` | Total amount of input material processed by plant $p$ at time $t$ | tonne |
## Objective function
The goal 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, incurred when the plant goes from non-operational at time
$t-1$ to operational at time $t$. Never incurred if the plant is initially
open:
```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. Depends on the
size of the plant:
```math
\sum_{p \in P} \sum_{t \in T} \left(
R^\text{fix-min}_{pt} x_{pt} +
R^\text{fix-exp}_{pt} z^\text{exp}_{pt}
\right)
```
- Plant expansion cost, incurred whenever plant capacity increases:
```math
\sum_{p \in P} \sum_{t \in T} R^\text{expand}_{pt} \left(z^\text{exp}_{pt} - z^\text{exp}_{p,t-1} \right)
```
- 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}
```
- Plant storage cost, incurred for each tonne of material stored at the plant:
```math
\sum_{p \in P} \sum_{m \in M^-_p} \sum_{t \in T} R^\text{storage}_{pmt} z^{\text{storage}}_{pmt}
```
- Emissions penalty cost, incurred for each tonne of greenhouse gas emitted:
```math
\sum_{g \in G} \sum_{t \in T} R^\text{em}_{gt} \left(
\sum_{p \in P} z^{\text{em-plant}}_{gpt} + \sum_{(u,v,m) \in E} z^{\text{em-tr}}_{guvmt}
\right)
```
## 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*}
```
- Definition of plant processing (`eq_z_process[p.name, t]`):
```math
\begin{align*}
& z^{\text{process}}_{pt} = z^{\text{input}}_{pt} + \sum_{m \in M^-_p} \left(z^{\text{storage}}_{p,m,t-1} - z^{\text{storage}}_{pmt}\right)
& \forall p \in P, t \in T
\end{align*}
```
- Plant processing mix must have correct proportion
(`eq_process_mix[p.name, m.name, t]`):
```math
\begin{align*}
& \sum_{u : (u,m) \in E^-(p)} y_{upmt} + z^{\text{storage}}_{p,m,t-1} - z^{\text{storage}}_{pmt}
= K^\text{mix}_{pmt} z^{\text{process}}_{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{process}}_{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*}
```
- Plant can only be expanded if the plant is open, and up to a certain amount
(`eq_exp_ub[p.name, t]`):
```math
\begin{align*}
& z^\text{exp}_{pt} \leq \left(K^\text{cap-max}_p - K^\text{cap-min}_p) x_{pt}
& \forall p \in P, t \in T
\end{align*}
```
- Plant capacity cannot decrease over time (`eq_capacity_nondecreasing[p.name, t]`):
```math
\begin{align*}
& z^\text{exp}_{pt} \geq z^\text{exp}_{p,t-1}
& \forall p \in P, t \in T
\end{align*}
```
- Plant is initially open if initial capacity is positive:
```math
\begin{align*}
& x_{p,0} = \begin{cases}
0 & \text{ if } K^\text{cap-init}_p = 0 \\
1 & \text{otherwise}
\end{cases}
& \forall p \in P
\end{align*}
```
- Calculation of initial plant expansion:
```math
\begin{align*}
& z^\text{exp}_{p,0} = K^\text{cap-init}_p - K^\text{cap-min}_p
& \forall p \in P
\end{align*}
```
- Plants cannot process more than their current capacity
(`eq_process_limit[p.name,t]`)
```math
\begin{align*}
& z^\text{process}_{pt} \leq K^\text{cap-min}_p x_{pt} + z^\text{exp}_{pt}
& \forall p \in P, t \in T
\end{align*}
```
- Storage limit at the plants (`eq_storage_limit[p.name, m.name, t]`):
```math
\begin{align*}
& z^{\text{storage}}_{pmt} \leq K^\text{storage-limit}_{pm}
& \forall p \in P, m \in M^-_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_emission_tr[g.name, u.name, v.name, m.name, t]`):
```math
\begin{align*}
& z^{\text{em-tr}}_{guvmt} = K^{\text{dist}}_{uv} K^\text{em-tr}_{gmt} y_{uvmt}
& \forall g \in G, (u, v, m) \in E, t \in T
\end{align*}
```
- Computation of plant emissions (`eq_emission_plant[g.name, p.name, t]`):
```math
\begin{align*}
& z^{\text{em-plant}}_{gpt} = K^\text{em-plant}_{gpt} z^{\text{process}}_{pt}
& \forall g \in G, p \in P, t \in T
\end{align*}
```
- Global emissions limit (`eq_emission_limit[g.name, t]`):
```math
\begin{align*}
& \sum_{p \in P} z^{\text{em-plant}}_{gpt} + \sum_{(u,v,m) \in E} z^{\text{em-tr}}_{guvmt} \leq K^\text{em-limit}_{gt}
& \forall g \in G, t \in T
\end{align*}
```
- All stored materials must be processed by the end of the time horizon
(`eq_storage_final[p.name, m.name]`):
```math
\begin{align*}
& z^{\text{storage}}_{p,m,t^{max}} = 0
& \forall p \in P, m \in M^-_p
\end{align*}
```
- Initial storage is zero (`eq_storage_initial[p.name, m.name]`):
```math
\begin{align*}
& z^{\text{storage}}_{p,m,0} = 0
& \forall p \in P, m \in M^-_p
\end{align*}
```

View File

@@ -1,4 +1,4 @@
# Simplified Solution Reports
# 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).

View File

@@ -1,70 +0,0 @@
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
The page will reload when you make changes.\
You may also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `npm run build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

29124
relog-web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,53 +0,0 @@
{
"name": "relog-web",
"version": "0.1.0",
"private": true,
"homepage": "/",
"jest": {
"moduleNameMapper": {
"d3": "<rootDir>/node_modules/d3/dist/d3.min.js"
}
},
"dependencies": {
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.4",
"@testing-library/user-event": "^13.5.0",
"ajv": "^8.11.0",
"d3": "^5.16.0",
"d3-array": "^2.12.1",
"dagre": "^0.8.5",
"idb": "^6.1.5",
"jsep": "^1.3.8",
"leaflet": "^1.8.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-flow-renderer": "^9.7.4",
"react-router-dom": "^5.3.3",
"react-scripts": "5.0.0",
"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"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

View File

@@ -1,13 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>RELOG</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>

View File

@@ -1,422 +0,0 @@
import { openDB } from "idb";
import React, { useEffect, useRef, useState } from "react";
import Button from "../common/Button";
import Footer from "../common/Footer";
import Header from "../common/Header";
import "../index.css";
import { generateFile } from "./csv";
import { defaultData, defaultPlant, defaultProduct } from "./defaults";
import { exportData, importData } from "./export";
import ParametersBlock from "./ParametersBlock";
import PipelineBlock, { randomPosition } from "./PipelineBlock";
import PlantBlock from "./PlantBlock";
import ProductBlock from "./ProductBlock";
import { validate } from "./validate";
import { useHistory } from "react-router-dom";
import { SERVER_URL } from "..";
const setDefaults = (actualDict, defaultDict) => {
for (const [key, defaultValue] of Object.entries(defaultDict)) {
if (!(key in actualDict)) {
if (typeof defaultValue === "object") {
actualDict[key] = { ...defaultValue };
} else {
actualDict[key] = defaultValue;
}
}
}
};
const cleanDict = (dict, defaultDict) => {
for (const key of Object.keys(dict)) {
if (!(key in defaultDict)) {
delete dict[key];
}
}
};
const fixLists = (dict, blacklist, stringify) => {
for (const [key, val] of Object.entries(dict)) {
if (blacklist.includes(key)) continue;
if (Array.isArray(val)) {
// Replace constant lists by a single number
let isConstant = true;
for (let i = 1; i < val.length; i++) {
if (val[i - 1] !== val[i]) {
isConstant = false;
break;
}
}
if (isConstant) dict[key] = val[0];
// Convert lists to JSON strings
if (stringify) dict[key] = JSON.stringify(dict[key]);
}
if (typeof val === "object") {
fixLists(val, blacklist, stringify);
}
}
};
const openRelogDB = async () => {
const dbPromise = await openDB("RELOG", 1, {
upgrade(db) {
db.createObjectStore("casebuilder");
},
});
return dbPromise;
};
const InputPage = () => {
const fileElem = useRef();
let [data, setData] = useState(defaultData);
let [messages, setMessages] = useState([]);
let [processing, setProcessing] = useState(false);
const save = async (data) => {
const db = await openRelogDB();
await db.put("casebuilder", data, "data");
};
useEffect(async () => {
const db = await openRelogDB();
const data = await db.get("casebuilder", "data");
if (data) setData(data);
}, []);
const history = useHistory();
const promptName = (prevData) => {
const name = prompt("Name");
if (!name || name.length === 0) return;
if (name in prevData.products || name in prevData.plants) return;
return name;
};
const onAddPlant = () => {
setData((prevData) => {
const name = promptName(prevData);
if (name === undefined) return prevData;
const newData = { ...prevData };
const [x, y] = randomPosition();
newData.plants[name] = {
...defaultPlant,
x: x,
y: y,
};
save(newData);
return newData;
});
};
const onAddProduct = () => {
setData((prevData) => {
const name = promptName(prevData);
if (name === undefined) return prevData;
const newData = { ...prevData };
const [x, y] = randomPosition();
console.log(x, y);
newData.products[name] = {
...defaultProduct,
x: x,
y: y,
};
save(newData);
return newData;
});
};
const onRenamePlant = (prevName, newName) => {
setData((prevData) => {
const newData = { ...prevData };
newData.plants[newName] = newData.plants[prevName];
delete newData.plants[prevName];
save(newData);
return newData;
});
};
const onRenameProduct = (prevName, newName) => {
setData((prevData) => {
const newData = { ...prevData };
newData.products[newName] = newData.products[prevName];
delete newData.products[prevName];
for (const [, plant] of Object.entries(newData.plants)) {
if (plant.input === prevName) {
plant.input = newName;
}
let outputFound = false;
for (const [outputName] of Object.entries(
plant["outputs (tonne/tonne)"]
)) {
if (outputName === prevName) outputFound = true;
}
if (outputFound) {
plant["outputs (tonne/tonne)"][newName] =
plant["outputs (tonne/tonne)"][prevName];
delete plant["outputs (tonne/tonne)"][prevName];
}
}
save(newData);
return newData;
});
};
const onMovePlant = (plantName, x, y) => {
setData((prevData) => {
const newData = { ...prevData };
newData.plants[plantName].x = x;
newData.plants[plantName].y = y;
save(newData);
return newData;
});
};
const onMoveProduct = (productName, x, y) => {
setData((prevData) => {
const newData = { ...prevData };
newData.products[productName].x = x;
newData.products[productName].y = y;
save(newData);
return newData;
});
};
const onRemovePlant = (plantName) => {
setData((prevData) => {
const newData = { ...prevData };
delete newData.plants[plantName];
save(newData);
return newData;
});
};
const onRemoveProduct = (productName) => {
setData((prevData) => {
const newData = { ...prevData };
delete newData.products[productName];
for (const [, plant] of Object.entries(newData.plants)) {
if (plant.input === productName) {
delete plant.input;
}
let outputFound = false;
for (const [outputName] of Object.entries(
plant["outputs (tonne/tonne)"]
)) {
if (outputName === productName) outputFound = true;
}
if (outputFound) {
delete plant["outputs (tonne/tonne)"][productName];
}
}
save(newData);
return newData;
});
};
const onSetPlantInput = (plantName, productName) => {
setData((prevData) => {
const newData = { ...prevData };
newData.plants[plantName].input = productName;
save(newData);
return newData;
});
};
const onAddPlantOutput = (plantName, productName) => {
setData((prevData) => {
if (productName in prevData.plants[plantName]["outputs (tonne/tonne)"]) {
return prevData;
}
const newData = { ...prevData };
[
"outputs (tonne/tonne)",
"disposal cost ($/tonne)",
"disposal limit (tonne)",
].forEach((key) => {
newData.plants[plantName][key] = { ...newData.plants[plantName][key] };
newData.plants[plantName][key][productName] = 0;
});
save(newData);
return newData;
});
};
const onSave = () => {
const exported = exportData(data);
const valid = validate(exported);
console.log(exported);
console.log(validate.errors);
if (valid) {
generateFile("case.json", JSON.stringify(exported, null, 2));
} else {
setMessages([
...messages,
"Data has validation errors and could not be saved.",
]);
}
};
const onClear = () => {
const newData = JSON.parse(JSON.stringify(defaultData));
setData(newData);
save(newData);
};
const onLoad = (contents) => {
const parsed = JSON.parse(contents);
const valid = validate(parsed);
if (valid) {
let newData = null;
if (parsed["case builder"]) {
newData = parsed["case builder"];
} else {
newData = importData(parsed);
}
setData(newData);
save(newData);
} else {
console.log(validate.errors);
setMessages([...messages, "File is corrupted and could not be loaded."]);
}
};
const onDismissMessage = (idx) => {
setMessages([...messages.slice(0, idx), ...messages.slice(idx + 1)]);
};
const onChange = (val, field1, field2) => {
setData((prevData) => {
const newData = { ...prevData };
if (field2 !== undefined) {
newData[field1][field2] = val;
} else {
newData[field1] = val;
}
save(newData);
return newData;
});
};
let productComps = [];
for (const [prodName, prod] of Object.entries(data.products)) {
productComps.push(
<ProductBlock
key={prodName}
name={prodName}
value={prod}
onChange={(v) => onChange(v, "products", prodName, v)}
/>
);
}
const onSubmit = async () => {
const exported = exportData(data);
const valid = validate(exported);
if (valid) {
setProcessing(true);
try {
const response = await fetch(`${SERVER_URL}/submit`, {
method: "POST",
body: JSON.stringify(exported),
});
if (response.ok) {
const data = await response.json();
history.push(`solver/${data.job_id}`);
} else {
throw "Error";
}
} catch {
setMessages([
...messages,
"Failed to submit job. Please try again later.",
]);
} finally {
setProcessing(false);
}
}
};
let plantComps = [];
for (const [plantName, plant] of Object.entries(data.plants)) {
plantComps.push(
<PlantBlock
key={plantName}
name={plantName}
value={plant}
onChange={(v) => onChange(v, "plants", plantName)}
/>
);
}
let messageComps = [];
for (let i = 0; i < messages.length; i++) {
messageComps.push(
<div className="message error" key={i}>
<p>{messages[i]}</p>
<Button label="Dismiss" onClick={() => onDismissMessage(i)} />
</div>
);
}
const onFileSelected = () => {
const file = fileElem.current.files[0];
if (file) {
const reader = new FileReader();
reader.addEventListener("load", () => {
onLoad(reader.result);
});
reader.readAsText(file);
}
fileElem.current.value = "";
};
return (
<>
<Header title="Case Builder">
<Button label="Clear" disabled={processing} onClick={onClear} />
<Button
label="Load"
disabled={processing}
onClick={(e) => fileElem.current.click()}
/>
<Button label="Save" disabled={processing} onClick={onSave} />
<Button label="Submit" disabled={processing} onClick={onSubmit} />
<input
type="file"
ref={fileElem}
accept=".json"
style={{ display: "none" }}
onChange={onFileSelected}
/>
</Header>
<div id="contentBackground">
<div id="content">
<PipelineBlock
onAddPlant={onAddPlant}
onAddPlantOutput={onAddPlantOutput}
onAddProduct={onAddProduct}
onMovePlant={onMovePlant}
onMoveProduct={onMoveProduct}
onRenamePlant={onRenamePlant}
onRenameProduct={onRenameProduct}
onSetPlantInput={onSetPlantInput}
onRemovePlant={onRemovePlant}
onRemoveProduct={onRemoveProduct}
plants={data.plants}
products={data.products}
/>
<ParametersBlock
value={data.parameters}
onChange={(v) => onChange(v, "parameters")}
/>
{productComps}
{plantComps}
</div>
</div>
<div id="messageTray">{messageComps}</div>
<Footer />
</>
);
};
export default InputPage;

View File

@@ -1,53 +0,0 @@
import Section from "../common/Section";
import Card from "../common/Card";
import Form from "../common/Form";
import TextInputRow from "../common/TextInputRow";
const ParametersBlock = (props) => {
const onChangeField = (field, val) => {
props.value[field] = val;
props.onChange(props.value);
};
return (
<>
<Section title="Parameters" />
<Card>
<Form>
<TextInputRow
label="Time horizon"
unit="years"
tooltip="Number of years in the simulation."
value={props.value["time horizon (years)"]}
onChange={(v) => onChangeField("time horizon (years)", v)}
validate="int"
/>
<TextInputRow
label="Building period"
unit="years"
tooltip="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."
value={props.value["building period (years)"]}
onChange={(v) => onChangeField("building period (years)", v)}
validate="intList"
/>
<TextInputRow
label="Inflation rate"
unit="%"
tooltip="Rate at which costs change from one time period to the next. This is applied uniformly to all costs."
value={props.value["inflation rate (%)"]}
onChange={(v) => onChangeField("inflation rate (%)", v)}
validate="float"
/>
<TextInputRow
label="Distance metric"
tooltip="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."
value={props.value["distance metric"]}
onChange={(v) => onChangeField("distance metric", v)}
default="Euclidean"
/>
</Form>
</Card>
</>
);
};
export default ParametersBlock;

View File

@@ -1,200 +0,0 @@
import React, { useEffect } from "react";
import ReactFlow, { Background, isNode, Controls } from "react-flow-renderer";
import Section from "../common/Section";
import Card from "../common/Card";
import Button from "../common/Button";
import styles from "./PipelineBlock.module.css";
import dagre from "dagre";
window.nextX = 15;
window.nextY = 15;
export const randomPosition = () => {
window.nextY += 60;
if (window.nextY >= 500) {
window.nextY = 15;
window.nextX += 150;
}
return [window.nextX, window.nextY];
};
const getLayoutedElements = (elements) => {
const nodeWidth = 125;
const nodeHeight = 45;
const dagreGraph = new dagre.graphlib.Graph();
dagreGraph.setDefaultEdgeLabel(() => ({}));
dagreGraph.setGraph({ rankdir: "LR" });
elements.forEach((el) => {
if (isNode(el)) {
dagreGraph.setNode(el.id, { width: nodeWidth, height: nodeHeight });
} else {
dagreGraph.setEdge(el.source, el.target);
}
});
dagre.layout(dagreGraph);
return elements.map((el) => {
if (isNode(el)) {
const n = dagreGraph.node(el.id);
el.position = {
x: 15 + n.x - nodeWidth / 2,
y: 15 + n.y - nodeHeight / 2,
};
}
return el;
});
};
const PipelineBlock = (props) => {
let elements = [];
let mapNameToType = {};
let hasNullPositions = false;
for (const [productName, product] of Object.entries(props.products)) {
if (!product.x || !product.y) hasNullPositions = true;
mapNameToType[productName] = "product";
elements.push({
id: productName,
data: { label: productName, type: "product" },
position: { x: product.x, y: product.y },
sourcePosition: "right",
targetPosition: "left",
className: styles.ProductNode,
});
}
for (const [plantName, plant] of Object.entries(props.plants)) {
if (!plant.x || !plant.y) hasNullPositions = true;
mapNameToType[plantName] = "plant";
elements.push({
id: plantName,
data: { label: plantName, type: "plant" },
position: { x: plant.x, y: plant.y },
sourcePosition: "right",
targetPosition: "left",
className: styles.PlantNode,
});
if (plant.input !== undefined) {
elements.push({
id: `${plant.input}-${plantName}`,
source: plant.input,
target: plantName,
animated: true,
style: { stroke: "black" },
selectable: false,
});
}
for (const [productName] of Object.entries(
plant["outputs (tonne/tonne)"]
)) {
elements.push({
id: `${plantName}-${productName}`,
source: plantName,
target: productName,
animated: true,
style: { stroke: "black" },
selectable: false,
});
}
}
const onNodeDoubleClick = (ev, node) => {
const oldName = node.data.label;
const newName = window.prompt("Enter new name", oldName);
if (newName === undefined || newName.length === 0) return;
if (newName in mapNameToType) return;
if (node.data.type === "plant") {
props.onRenamePlant(oldName, newName);
} else {
props.onRenameProduct(oldName, newName);
}
};
const onElementsRemove = (elements) => {
elements.forEach((el) => {
if (!(el.id in mapNameToType)) return;
if (el.data.type === "plant") {
props.onRemovePlant(el.data.label);
} else {
props.onRemoveProduct(el.data.label);
}
});
};
const onNodeDragStop = (ev, node) => {
if (node.data.type === "plant") {
props.onMovePlant(node.data.label, node.position.x, node.position.y);
} else {
props.onMoveProduct(node.data.label, node.position.x, node.position.y);
}
};
const onConnect = (args) => {
const sourceType = mapNameToType[args.source];
const targetType = mapNameToType[args.target];
if (sourceType === "product" && targetType === "plant") {
props.onSetPlantInput(args.target, args.source);
} else if (sourceType === "plant" && targetType === "product") {
props.onAddPlantOutput(args.source, args.target);
}
};
const onLayout = () => {
const layoutedElements = getLayoutedElements(elements);
layoutedElements.forEach((el) => {
if (isNode(el)) {
if (el.data.type === "plant") {
props.onMovePlant(el.data.label, el.position.x, el.position.y);
} else {
props.onMoveProduct(el.data.label, el.position.x, el.position.y);
}
}
});
};
useEffect(() => {
if (hasNullPositions) onLayout();
}, [hasNullPositions]);
return (
<>
<Section title="Pipeline" />
<Card>
<div className={styles.PipelineBlock}>
<ReactFlow
elements={elements}
onNodeDoubleClick={onNodeDoubleClick}
onNodeDragStop={onNodeDragStop}
onConnect={onConnect}
onElementsRemove={onElementsRemove}
deleteKeyCode={46}
maxZoom={1.25}
minZoom={0.5}
snapToGrid={true}
preventScrolling={false}
>
<Background />
<Controls showInteractive={false} />
</ReactFlow>
</div>
<div style={{ textAlign: "center" }}>
<Button
label="Add product"
kind="inline"
onClick={props.onAddProduct}
/>
<Button label="Add plant" kind="inline" onClick={props.onAddPlant} />
<Button label="Auto Layout" kind="inline" onClick={onLayout} />
<Button
label="?"
kind="inline"
tooltip="Drag from one connector to another to create links between products and plants. Double click to rename an element. Click an element to select and move it. Press the [Delete] key to remove it."
/>
</div>
</Card>
</>
);
};
export default PipelineBlock;

View File

@@ -1,25 +0,0 @@
.PipelineBlock {
height: 800px !important;
border: 1px solid rgba(0, 0, 0, 0.1) !important;
border-radius: var(--border-radius) !important;
margin-bottom: 12px !important;
}
.PlantNode,
.ProductNode {
border-color: rgba(0, 0, 0, 0.8) !important;
color: black !important;
font-size: 13px !important;
border-width: 1px !important;
border-radius: 6px !important;
box-shadow: 0px 2px 4px -3px black !important;
width: 100px !important;
}
.PlantNode {
background-color: #8d8 !important;
}
.ProductNode {
background-color: #e6e6e6 !important;
}

View File

@@ -1,257 +0,0 @@
import Section from "../common/Section";
import Card from "../common/Card";
import Form from "../common/Form";
import TextInputRow from "../common/TextInputRow";
import FileInputRow from "../common/FileInputRow";
import DictInputRow from "../common/DictInputRow";
import { csvFormat, csvParse, generateFile } from "./csv";
const PlantBlock = (props) => {
const onChange = (val, field1, field2, field3) => {
const newPlant = { ...props.value };
if (field3 !== undefined) {
newPlant[field1][field2][field3] = val;
} else if (field2 !== undefined) {
newPlant[field1][field2] = val;
} else {
newPlant[field1] = val;
}
props.onChange(newPlant);
};
const onCandidateLocationsTemplate = () => {
generateFile(
"Candidate locations - Template.csv",
csvFormat([
{
name: "Washakie County",
"latitude (deg)": "43.8356",
"longitude (deg)": "-107.6602",
"initial capacity (tonne)": "0",
"area cost factor": "0.88",
},
{
name: "Platte County",
"latitude (deg)": "42.1314",
"longitude (deg)": "-104.9676",
"initial capacity (tonne)": "0",
"area cost factor": "1.29",
},
{
name: "Park County",
"latitude (deg)": "44.4063",
"longitude (deg)": "-109.4153",
"initial capacity (tonne)": "0",
"area cost factor": "0.99",
},
{
name: "Goshen County",
"latitude (deg)": "42.0853",
"longitude (deg)": "-104.3534",
"initial capacity (tonne)": "0",
"area cost factor": "1",
},
])
);
};
const onCandidateLocationsFile = (contents) => {
const data = csvParse({
contents: contents,
requiredCols: [
"name",
"latitude (deg)",
"longitude (deg)",
"area cost factor",
"initial capacity (tonne)",
],
});
const result = {};
data.forEach((el) => {
let { name, ...props } = el;
result[name] = props;
});
onChange(result, "locations");
};
const onCandidateLocationsDownload = () => {
const result = [];
for (const [locationName, locationDict] of Object.entries(
props.value["locations"]
)) {
result.push({
name: locationName,
...locationDict,
});
}
generateFile(`Candidate locations - ${props.name}.csv`, csvFormat(result));
};
const onCandidateLocationsClear = () => {
onChange({}, "locations");
};
let description = "No locations set";
const nCenters = Object.keys(props.value["locations"]).length;
if (nCenters > 0) description = `${nCenters} locations`;
const shouldDisableMaxCap =
props.value["minimum capacity (tonne)"] ===
props.value["maximum capacity (tonne)"];
return (
<>
<Section title={props.name} />
<Card>
<Form>
<h1>General information</h1>
<FileInputRow
label="Candidate locations"
tooltip="A table describing potential locations where plants can be built and their characteristics."
onTemplate={onCandidateLocationsTemplate}
onFile={onCandidateLocationsFile}
onDownload={onCandidateLocationsDownload}
onClear={onCandidateLocationsClear}
value={description}
/>
<h1>Inputs & Outputs</h1>
<TextInputRow
label="Input"
tooltip="The name of the product that this plant takes as input."
disabled="disabled"
value={props.value["input"]}
/>
<DictInputRow
label="Outputs"
unit="tonne/tonne"
tooltip="A dictionary specifying how many tonnes of each product is produced for each tonne of input."
value={props.value["outputs (tonne/tonne)"]}
onChange={(v) => onChange(v, "outputs (tonne/tonne)")}
disableKeys={true}
/>
<h1>Capacity & Costs</h1>
<TextInputRow
label="Minimum capacity"
unit="tonne"
tooltip="The minimum size of the plant."
value={props.value["minimum capacity (tonne)"]}
onChange={(v) => onChange(v, "minimum capacity (tonne)")}
/>
<TextInputRow
label="Opening cost (min capacity)"
unit="$"
tooltip="The cost to open the plant at minimum capacity."
value={props.value["opening cost (min capacity) ($)"]}
onChange={(v) => onChange(v, "opening cost (min capacity) ($)")}
/>
<TextInputRow
label="Fixed operating cost (min capacity)"
unit="$"
tooltip="The cost to keep the plant open, even if the plant doesn't process anything."
value={props.value["fixed operating cost (min capacity) ($)"]}
onChange={(v) =>
onChange(v, "fixed operating cost (min capacity) ($)")
}
/>
<TextInputRow
label="Maximum capacity"
unit="tonne"
tooltip="The maximum size of the plant."
value={props.value["maximum capacity (tonne)"]}
onChange={(v) => onChange(v, "maximum capacity (tonne)")}
/>
<TextInputRow
label="Opening cost (max capacity)"
unit="$"
tooltip="The cost to open a plant of this size."
value={
shouldDisableMaxCap
? ""
: props.value["opening cost (max capacity) ($)"]
}
onChange={(v) => onChange(v, "opening cost (max capacity) ($)")}
disabled={shouldDisableMaxCap}
/>
<TextInputRow
label="Fixed operating cost (max capacity)"
unit="$"
tooltip="The cost to keep the plant open, even if the plant doesn't process anything."
value={
shouldDisableMaxCap
? ""
: props.value["fixed operating cost (max capacity) ($)"]
}
onChange={(v) =>
onChange(v, "fixed operating cost (max capacity) ($)")
}
disabled={shouldDisableMaxCap}
/>
<TextInputRow
label="Variable operating cost"
unit="$/tonne"
tooltip="The cost that the plant incurs to process each tonne of input."
value={props.value["variable operating cost ($/tonne)"]}
onChange={(v) => onChange(v, "variable operating cost ($/tonne)")}
/>
<TextInputRow
label="Energy expenditure"
unit="GJ/tonne"
tooltip="The energy required to process one tonne of the input."
value={props.value["energy (GJ/tonne)"]}
onChange={(v) => onChange(v, "energy (GJ/tonne)")}
/>
<h1>Storage</h1>
<TextInputRow
label="Storage cost"
unit="$/tonne"
tooltip="The cost to store a tonne of input product for one time period."
value={props.value["storage"]["cost ($/tonne)"]}
onChange={(v) => onChange(v, "storage", "cost ($/tonne)")}
/>
<TextInputRow
label="Storage limit"
unit="tonne"
tooltip="The maximum amount of input product this plant can have in storage at any given time."
value={props.value["storage"]["limit (tonne)"]}
onChange={(v) => onChange(v, "storage", "limit (tonne)")}
/>
<h1>Disposal</h1>
<DictInputRow
label="Disposal cost"
unit="$/tonne"
tooltip="The cost to dispose of the product."
value={props.value["disposal cost ($/tonne)"]}
onChange={(v) => onChange(v, "disposal cost ($/tonne)")}
disableKeys={true}
/>
<DictInputRow
label="Disposal limit"
unit="tonne"
tooltip="The maximum amount that can be disposed of. If an unlimited amount can be disposed, leave blank."
value={props.value["disposal limit (tonne)"]}
onChange={(v) => onChange(v, "disposal limit (tonne)")}
disableKeys={true}
valuePlaceholder="Unlimited"
/>
<h1>Emissions</h1>
<DictInputRow
label="Emissions"
unit="tonne/tonne"
tooltip="A dictionary mapping the name of each greenhouse gas, produced to process each tonne of input, to the amount of gas produced (in tonne)."
value={props.value["emissions (tonne/tonne)"]}
onChange={(v) => onChange(v, "emissions (tonne/tonne)")}
keyPlaceholder="Emission name"
valuePlaceholder="0"
/>
</Form>
</Card>
</>
);
};
export default PlantBlock;

View File

@@ -1,195 +0,0 @@
import Section from "../common/Section";
import Card from "../common/Card";
import Form from "../common/Form";
import TextInputRow from "../common/TextInputRow";
import FileInputRow from "../common/FileInputRow";
import DictInputRow from "../common/DictInputRow";
import { csvParse, extractNumericColumns, generateFile } from "./csv";
import { csvFormat } from "d3";
const ProductBlock = (props) => {
const onChange = (field, val) => {
const newProduct = { ...props.value };
newProduct[field] = val;
props.onChange(newProduct);
};
const onInitialAmountsFile = (contents) => {
const data = csvParse({
contents: contents,
requiredCols: ["latitude (deg)", "longitude (deg)", "name"],
});
const result = {};
data.forEach((el) => {
result[el["name"]] = {
"latitude (deg)": el["latitude (deg)"],
"longitude (deg)": el["longitude (deg)"],
"amount (tonne)": extractNumericColumns(el, "amount"),
};
});
onChange("initial amounts", result);
};
const onInitialAmountsClear = () => {
onChange("initial amounts", {});
};
const onInitialAmountsTemplate = () => {
generateFile(
"Initial amounts - Template.csv",
csvFormat([
{
name: "Washakie County",
"latitude (deg)": "43.8356",
"longitude (deg)": "-107.6602",
"amount 1": "21902",
"amount 2": "6160",
"amount 3": "2721",
"amount 4": "12917",
"amount 5": "18048",
},
{
name: "Platte County",
"latitude (deg)": "42.1314",
"longitude (deg)": "-104.9676",
"amount 1": "16723",
"amount 2": "8709",
"amount 3": "22584",
"amount 4": "12278",
"amount 5": "7196",
},
{
name: "Park County",
"latitude (deg)": "44.4063",
"longitude (deg)": "-109.4153",
"amount 1": "14731",
"amount 2": "11729",
"amount 3": "15562",
"amount 4": "7703",
"amount 5": "23349",
},
])
);
};
const onInitialAmountsDownload = () => {
const results = [];
for (const [locationName, locationDict] of Object.entries(
props.value["initial amounts"]
)) {
const row = {
name: locationName,
"latitude (deg)": locationDict["latitude (deg)"],
"longitude (deg)": locationDict["longitude (deg)"],
};
locationDict["amount (tonne)"].forEach((el, idx) => {
row[`amount ${idx + 1}`] = el;
});
results.push(row);
}
generateFile(`Initial amounts - ${props.name}.csv`, csvFormat(results));
};
let description = "Not initially available";
let notInitiallyAvailable = true;
const nCenters = Object.keys(props.value["initial amounts"]).length;
if (nCenters > 0) {
description = `${nCenters} collection centers`;
notInitiallyAvailable = false;
}
return (
<>
<Section title={props.name} />
<Card>
<Form>
<h1>General Information</h1>
<FileInputRow
value={description}
label="Initial amounts"
tooltip="A table indicating the amount of this product initially available at each collection center."
accept=".csv"
onFile={onInitialAmountsFile}
onDownload={onInitialAmountsDownload}
onClear={onInitialAmountsClear}
onTemplate={onInitialAmountsTemplate}
disableDownload={notInitiallyAvailable}
disableClear={notInitiallyAvailable}
/>
<h1 style={{ display: nCenters == 0 ? "none" : "block" }}>
Acquisition & disposal
</h1>
<div style={{ display: nCenters == 0 ? "none" : "block" }}>
<TextInputRow
label="Acquisition cost"
unit="$/tonne"
tooltip="Cost of acquiring one tonne of this product at a collection center."
value={props.value["acquisition cost ($/tonne)"]}
onChange={(v) => onChange("acquisition cost ($/tonne)", v)}
validate="floatList"
/>
<TextInputRow
label="Disposal cost"
unit="$/tonne"
tooltip="The cost to dispose of one tonne of this product at a collection center, without further processing."
value={props.value["disposal cost ($/tonne)"]}
onChange={(v) => onChange("disposal cost ($/tonne)", v)}
validate="floatList"
/>
<TextInputRow
label="Disposal limit"
unit="tonne"
tooltip="The maximum amount (in tonnes) of this product that can be disposed of across all collection centers, without further processing."
value={props.value["disposal limit (tonne)"]}
onChange={(v) => onChange("disposal limit (tonne)", v)}
validate="floatList"
disabled={String(props.value["disposal limit (%)"]).length > 0}
/>
<TextInputRow
label="Disposal limit"
unit="%"
tooltip="The maximum amount of this product that can be disposed of across all collection centers, without further processing, as a percentage of the total amount available."
value={props.value["disposal limit (%)"]}
onChange={(v) => onChange("disposal limit (%)", v)}
validate="floatList"
disabled={props.value["disposal limit (tonne)"].length > 0}
/>
</div>
<h1>Transportation</h1>
<TextInputRow
label="Transportation cost"
unit="$/km/tonne"
tooltip="The cost to transport this product."
value={props.value["transportation cost ($/km/tonne)"]}
onChange={(v) => onChange("transportation cost ($/km/tonne)", v)}
validate="floatList"
/>
<TextInputRow
label="Transportation energy"
unit="J/km/tonne"
tooltip="The energy required to transport this product."
value={props.value["transportation energy (J/km/tonne)"]}
onChange={(v) => onChange("transportation energy (J/km/tonne)", v)}
validate="floatList"
/>
<DictInputRow
label="Transportation emissions"
unit="tonne/km/tonne"
tooltip="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."
keyPlaceholder="Emission name"
value={props.value["transportation emissions (tonne/km/tonne)"]}
onChange={(v) =>
onChange("transportation emissions (tonne/km/tonne)", v)
}
validate="floatList"
/>
</Form>
</Card>
</>
);
};
export default ProductBlock;

View File

@@ -1,50 +0,0 @@
import * as d3 from "d3";
export const csvParse = ({ contents, requiredCols }) => {
const data = d3.csvParse(contents, d3.autoType);
requiredCols.forEach((col) => {
if (!(col in data[0])) {
throw Error(`Column "${col}" not found in CSV file.`);
}
});
return data;
};
export const parseCsv = (contents, requiredCols = []) => {
const data = d3.csvParse(contents);
const T = data.columns.length - requiredCols.length;
let isValid = true;
for (let t = 0; t < T; t++) {
requiredCols.push(t + 1);
}
requiredCols.forEach((col) => {
if (!(col in data[0])) {
console.log(`Column "${col}" not found in CSV file.`);
isValid = false;
}
});
if (!isValid) return [undefined, undefined];
return [data, T];
};
export const extractNumericColumns = (obj, prefix) => {
const result = [];
for (let i = 1; `${prefix} ${i}` in obj; i++) {
result.push(obj[`${prefix} ${i}`]);
}
return result;
};
export const csvFormat = (data) => {
return d3.csvFormat(data);
};
export const generateFile = (filename, contents) => {
var link = document.createElement("a");
link.setAttribute("href", URL.createObjectURL(new Blob([contents])));
link.setAttribute("download", filename);
link.style.visibility = "hidden";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};

View File

@@ -1,53 +0,0 @@
import { csvParse, extractNumericColumns, csvFormat } from "./csv";
import { exportValue } from "./export";
test("parse CSV", () => {
const contents = "name,location,1,2,3\ntest,illinois,100,200,300";
const actual = csvParse({
contents: contents,
requiredCols: ["name", "location"],
});
expect(actual.length).toEqual(1);
expect(actual[0]).toEqual({
name: "test",
location: "illinois",
1: 100,
2: 200,
3: 300,
});
});
test("parse CSV with missing columns", () => {
const contents = "name,location,1,2,3\ntest,illinois,100,200,300";
expect(() =>
csvParse({
contents: contents,
requiredCols: ["name", "location", "latitude"],
})
).toThrow('Column "latitude" not found in CSV file.');
});
test("extract numeric columns from object", () => {
const obj1 = {
"amount 1": "hello",
"amount 2": "world",
"amount 4": "ignored",
};
const obj2 = { hello: "world" };
expect(extractNumericColumns(obj1, "amount")).toEqual(["hello", "world"]);
expect(extractNumericColumns(obj2, "amount")).toEqual([]);
});
test("generate CSV", () => {
const data = [
{ name: "alice", age: 20 },
{ name: "bob", age: null },
];
expect(csvFormat(data)).toEqual("name,age\nalice,20\nbob,");
});
test("export value", () => {
expect(exportValue("1")).toEqual(1);
expect(exportValue("[1,2,3]")).toEqual([1, 2, 3]);
// expect(exportValue("qwe")).toEqual("qwe");
});

View File

@@ -1,52 +0,0 @@
export const defaultProduct = {
"initial amounts": {},
"acquisition cost ($/tonne)": "0",
"disposal cost ($/tonne)": "0",
"disposal limit (tonne)": "0",
"disposal limit (%)": "",
"transportation cost ($/km/tonne)": "0",
"transportation energy (J/km/tonne)": "0",
"transportation emissions (tonne/km/tonne)": {},
x: 0,
y: 0,
};
export const defaultPlantLocation = {
"area cost factor": 1.0,
"initial capacity (tonne)": 0,
"latitude (deg)": 0,
"longitude (deg)": 0,
};
export const defaultPlant = {
locations: {},
"outputs (tonne/tonne)": {},
"disposal cost ($/tonne)": {},
"disposal limit (tonne)": {},
"emissions (tonne/tonne)": {},
storage: {
"cost ($/tonne)": "0",
"limit (tonne)": "0",
},
"maximum capacity (tonne)": "0",
"minimum capacity (tonne)": "0",
"opening cost (max capacity) ($)": "0",
"opening cost (min capacity) ($)": "0",
"fixed operating cost (max capacity) ($)": "0",
"fixed operating cost (min capacity) ($)": "0",
"variable operating cost ($/tonne)": "0",
"energy (GJ/tonne)": "0",
x: 0,
y: 0,
};
export const defaultData = {
parameters: {
"time horizon (years)": "1",
"building period (years)": "[1]",
"inflation rate (%)": "0",
"distance metric": "Euclidean",
},
products: {},
plants: {},
};

View File

@@ -1,625 +0,0 @@
import { evaluateExpr } from "./expr";
const isNumeric = (val) => {
return String(val).length > 0 && !isNaN(val);
};
const keysToList = (obj) => {
const result = [];
for (const key of Object.keys(obj)) {
result.push(key);
}
return result;
};
export const exportValue = (original, T, R = 1, data = {}) => {
try {
if (T) {
let v = evaluateExpr(original.toString(), data);
const result = [];
for (let i = 0; i < T; i++) {
result.push(v);
v *= R;
}
return result;
} else {
return evaluateExpr(original.toString(), data);
}
} catch {
// ignore;
}
try {
const parsed = JSON.parse(original);
return parsed;
} catch {
// ignore
}
return original;
};
const exportValueDict = (original, T) => {
const result = {};
for (const [key, val] of Object.entries(original)) {
if (key.length === 0) continue;
result[key] = exportValue(val, T);
}
if (Object.keys(result).length > 0) {
return result;
} else {
return null;
}
};
const computeTotalInitialAmount = (prod) => {
let total = null;
for (const locDict of Object.values(prod["initial amounts"])) {
const locAmount = locDict["amount (tonne)"];
if (!total) total = [...locAmount];
else {
for (let i = 0; i < locAmount.length; i++) {
total[i] += locAmount[i];
}
}
}
return total;
};
export const importList = (args, R = 1) => {
if (args === undefined) return "";
if (Array.isArray(args) && args.length > 0) {
let isConstant = true;
for (let i = 1; i < args.length; i++) {
if (Math.abs(args[i - 1] - args[i] / R) > 1e-3) {
isConstant = false;
break;
}
}
if (isConstant) {
return String(args[0]);
} else {
return JSON.stringify(args);
}
} else {
return args;
}
};
export const importDict = (args) => {
if (!args) return {};
const result = {};
for (const [key, val] of Object.entries(args)) {
result[key] = importList(val);
}
return result;
};
const computeAbsDisposal = (prod) => {
const disposalPerc = prod["disposal limit (%)"];
const total = computeTotalInitialAmount(prod);
const disposalAbs = [];
for (let i = 0; i < total.length; i++) {
disposalAbs[i] = (total[i] * disposalPerc) / 100;
}
return disposalAbs;
};
const computeInflationAndTimeHorizon = (obj, keys) => {
for (let i = 0; i < keys.length; i++) {
const list = obj[keys[i]];
if (
Array.isArray(list) &&
list.length > 1 &&
isNumeric(list[0]) &&
isNumeric(list[1]) &&
Math.abs(list[0]) > 0
) {
return [list[1] / list[0], list.length];
}
}
return [1, 1];
};
export const exportProduct = (original, parameters) => {
const result = {};
// Read time horizon
let T = parameters["time horizon (years)"];
if (isNumeric(T)) T = parseInt(T);
else T = 1;
// Read inflation
let R = parameters["inflation rate (%)"];
if (isNumeric(R)) R = parseFloat(R) / 100 + 1;
else R = 1;
// Copy constant time series
result["initial amounts"] = original["initial amounts"];
["disposal limit (tonne)", "transportation energy (J/km/tonne)"].forEach(
(key) => {
const v = exportValue(original[key], T);
if (v.length > 0) result[key] = v;
}
);
// Copy cost time series (with inflation)
[
"disposal cost ($/tonne)",
"acquisition cost ($/tonne)",
"transportation cost ($/km/tonne)",
].forEach((key) => {
const v = exportValue(original[key], T, R);
if (v.length > 0) result[key] = v;
});
// Copy dictionaries
["transportation emissions (tonne/km/tonne)"].forEach((key) => {
const v = exportValueDict(original[key], T);
if (v) result[key] = v;
});
// Transform percentage disposal limits into absolute
if (isNumeric(original["disposal limit (%)"])) {
result["disposal limit (tonne)"] = computeAbsDisposal(original);
}
return result;
};
export const exportPlant = (original, parameters) => {
const result = {};
// Read time horizon
let T = parameters["time horizon (years)"];
if (isNumeric(T)) T = parseInt(T);
else T = 1;
// Read inflation
let R = parameters["inflation rate (%)"];
if (isNumeric(R)) R = parseFloat(R) / 100 + 1;
else R = 1;
// Copy scalar values
["input"].forEach((key) => {
result[key] = original[key];
});
// Copy time series values
["energy (GJ/tonne)"].forEach((key) => {
result[key] = exportValue(original[key], T);
if (result[key] === undefined) {
delete result[key];
}
});
// Copy scalar dicts
["outputs (tonne/tonne)"].forEach((key) => {
const v = exportValueDict(original[key]);
if (v) result[key] = v;
});
// Copy time series dicts
["emissions (tonne/tonne)"].forEach((key) => {
const v = exportValueDict(original[key], T);
if (v) result[key] = v;
});
result.locations = {};
for (const [locName, origDict] of Object.entries(original["locations"])) {
const minCap = exportValue(
original["minimum capacity (tonne)"],
null,
null,
origDict
);
const maxCap = exportValue(
original["maximum capacity (tonne)"],
null,
null,
origDict
);
const resDict = (result.locations[locName] = {});
const capDict = (resDict["capacities (tonne)"] = {});
const acf = origDict["area cost factor"];
const exportValueAcf = (obj, data = {}) => {
const v = exportValue(obj, T, R, data);
if (Array.isArray(v)) {
return v.map((v) => v * acf);
}
return "";
};
// Copy scalar values
["latitude (deg)", "longitude (deg)", "initial capacity (tonne)"].forEach(
(key) => {
resDict[key] = origDict[key];
}
);
// Copy minimum capacity dict
capDict[minCap] = {};
for (const [resKeyName, origKeyName] of Object.entries({
"opening cost ($)": "opening cost (min capacity) ($)",
"fixed operating cost ($)": "fixed operating cost (min capacity) ($)",
"variable operating cost ($/tonne)": "variable operating cost ($/tonne)",
})) {
capDict[minCap][resKeyName] = exportValueAcf(
original[origKeyName],
origDict
);
}
if (maxCap !== minCap) {
// Copy maximum capacity dict
capDict[maxCap] = {};
for (const [resKeyName, origKeyName] of Object.entries({
"opening cost ($)": "opening cost (max capacity) ($)",
"fixed operating cost ($)": "fixed operating cost (max capacity) ($)",
"variable operating cost ($/tonne)":
"variable operating cost ($/tonne)",
})) {
capDict[maxCap][resKeyName] = exportValueAcf(
original[origKeyName],
origDict
);
}
}
// Copy disposal
resDict.disposal = {};
for (const [dispName, dispCost] of Object.entries(
original["disposal cost ($/tonne)"]
)) {
if (dispName.length === 0) continue;
const v = exportValueAcf(dispCost, origDict);
if (v) {
resDict.disposal[dispName] = { "cost ($/tonne)": v };
const limit = original["disposal limit (tonne)"][dispName];
if (limit.length > 0) {
resDict.disposal[dispName]["limit (tonne)"] = exportValue(
limit,
T,
1,
origDict
);
}
}
}
// Copy storage
resDict.storage = {
"cost ($/tonne)": exportValueAcf(
original["storage"]["cost ($/tonne)"],
origDict
),
};
const storLimit = original["storage"]["limit (tonne)"];
if (storLimit.length > 0) {
resDict.storage["limit (tonne)"] = exportValue(
storLimit,
null,
1,
origDict
);
}
}
return result;
};
export const exportData = (original) => {
const result = {
parameters: {},
products: {},
plants: {},
};
// Export parameters
["time horizon (years)", "building period (years)"].forEach((key) => {
result.parameters[key] = exportValue(original.parameters[key]);
});
["distance metric"].forEach((key) => {
if (original.parameters[key].length > 0) {
result.parameters[key] = original.parameters[key];
}
});
console.log(original.parameters);
console.log(result.parameters);
// Read time horizon
let T = result.parameters["time horizon (years)"];
if (!isNumeric(T)) T = 1;
// Export products
for (const [prodName, prodDict] of Object.entries(original.products)) {
result.products[prodName] = exportProduct(prodDict, original.parameters);
}
// Export plants
for (const [plantName, plantDict] of Object.entries(original.plants)) {
result.plants[plantName] = exportPlant(plantDict, original.parameters);
}
// Export original data
result["case builder"] = original;
return result;
};
const compressDisposalLimits = (original, result) => {
if (!("disposal limit (tonne)" in original)) {
return;
}
const total = computeTotalInitialAmount(original);
if (!total) return;
const limit = original["disposal limit (tonne)"];
let perc = Math.round((limit[0] / total[0]) * 1e6) / 1e6;
for (let i = 1; i < limit.length; i++) {
if (Math.abs(limit[i] / total[i] - perc) > 1e-5) {
return;
}
}
result["disposal limit (tonne)"] = "";
result["disposal limit (%)"] = String(perc * 100);
};
export const importProduct = (original) => {
const prod = {};
const parameters = {};
prod["initial amounts"] = { ...original["initial amounts"] };
// Initialize null values
["x", "y"].forEach((key) => {
prod[key] = null;
});
// Initialize empty values
["disposal limit (%)"].forEach((key) => {
prod[key] = "";
});
// Import constant lists
["transportation energy (J/km/tonne)", "disposal limit (tonne)"].forEach(
(key) => {
prod[key] = importList(original[key]);
}
);
// Compute inflation and time horizon
const [R, T] = computeInflationAndTimeHorizon(original, [
"transportation cost ($/km/tonne)",
"disposal cost ($/tonne)",
"acquisition cost ($/tonne)",
]);
parameters["inflation rate (%)"] = String((R - 1) * 100);
parameters["time horizon (years)"] = String(T);
// Import cost lists
[
"transportation cost ($/km/tonne)",
"disposal cost ($/tonne)",
"acquisition cost ($/tonne)",
].forEach((key) => {
prod[key] = importList(original[key], R);
});
// Import dicts
["transportation emissions (tonne/km/tonne)"].forEach((key) => {
prod[key] = importDict(original[key]);
});
// Attempt to convert absolute disposal limits to relative
compressDisposalLimits(original, prod);
return [prod, parameters];
};
export const importPlant = (original) => {
const plant = {};
const parameters = {};
plant["storage"] = {};
plant["storage"]["cost ($/tonne)"] = 0;
plant["storage"]["limit (tonne)"] = 0;
plant["disposal cost ($/tonne)"] = 0;
plant["disposal limit (tonne)"] = 0;
// Initialize null values
["x", "y"].forEach((key) => {
plant[key] = null;
});
// Initialize defaults
if (!original["outputs (tonne/tonne)"]) {
original["outputs (tonne/tonne)"] = {};
}
// Import scalar values
["input"].forEach((key) => {
plant[key] = original[key];
});
// Import timeseries values
["energy (GJ/tonne)"].forEach((key) => {
plant[key] = importList(original[key]);
if (plant[key] === "") {
delete plant[key];
}
});
// Import dicts
["outputs (tonne/tonne)", "emissions (tonne/tonne)"].forEach((key) => {
plant[key] = importDict(original[key]);
});
let costsInitialized = false;
// Read locations
const resLocDict = (plant.locations = {});
for (const [locName, origLocDict] of Object.entries(original["locations"])) {
resLocDict[locName] = {};
// Import scalars
["latitude (deg)", "longitude (deg)", "initial capacity (tonne)"].forEach(
(key) => {
resLocDict[locName][key] = origLocDict[key];
}
);
const capacities = keysToList(origLocDict["capacities (tonne)"]);
const last = capacities.length - 1;
const minCap = capacities[0];
const maxCap = capacities[last];
const minCapDict = origLocDict["capacities (tonne)"][minCap];
const maxCapDict = origLocDict["capacities (tonne)"][maxCap];
// Import min/max capacity
if ("minimum capacity (tonne)" in plant) {
if (
plant["minimum capacity (tonne)"] !== minCap ||
plant["maximum capacity (tonne)"] !== maxCap
) {
throw "Data loss";
}
} else {
plant["minimum capacity (tonne)"] = minCap;
plant["maximum capacity (tonne)"] = maxCap;
}
// Compute area cost factor
let acf = 1;
if (costsInitialized) {
acf = plant["opening cost (max capacity) ($)"];
if (Array.isArray(acf)) acf = acf[0];
acf = maxCapDict["opening cost ($)"][0] / acf;
}
resLocDict[locName]["area cost factor"] = acf;
const [R, T] = computeInflationAndTimeHorizon(maxCapDict, [
"opening cost ($)",
"fixed operating cost ($)",
"variable operating cost ($/tonne)",
]);
parameters["inflation rate (%)"] = String((R - 1) * 100);
parameters["time horizon (years)"] = String(T);
// Initialize defaults
if (!origLocDict.storage) {
origLocDict.storage = {
"cost ($/tonne)": new Array(T).fill(0),
"limit (tonne)": new Array(T).fill(0),
};
}
// Read adjusted costs
const importListAcf = (obj) =>
importList(
obj.map((v) => v / acf),
R
);
const openCostMax = importListAcf(maxCapDict["opening cost ($)"]);
const openCostMin = importListAcf(minCapDict["opening cost ($)"]);
const fixCostMax = importListAcf(maxCapDict["fixed operating cost ($)"]);
const fixCostMin = importListAcf(minCapDict["fixed operating cost ($)"]);
const storCost = importListAcf(origLocDict.storage["cost ($/tonne)"]);
const storLimit = String(origLocDict.storage["limit (tonne)"]);
const varCost = importListAcf(
minCapDict["variable operating cost ($/tonne)"]
);
const dispCost = {};
const dispLimit = {};
for (const prodName of Object.keys(original["outputs (tonne/tonne)"])) {
dispCost[prodName] = "";
dispLimit[prodName] = "";
if (prodName in origLocDict["disposal"]) {
const prodDict = origLocDict["disposal"][prodName];
dispCost[prodName] = importListAcf(prodDict["cost ($/tonne)"]);
if ("limit (tonne)" in prodDict)
dispLimit[prodName] = importList(prodDict["limit (tonne)"]);
}
}
const check = (left, right) => {
let valid = true;
if (isNumeric(left) && isNumeric(right)) {
valid = Math.abs(left - right) < 1.0;
} else {
valid = left === right;
}
if (!valid)
console.warn(`Data loss detected: ${locName}, ${left} != ${right}`);
};
if (costsInitialized) {
// Verify that location costs match the previously initialized ones
check(plant["opening cost (max capacity) ($)"], openCostMax);
check(plant["opening cost (min capacity) ($)"], openCostMin);
check(plant["fixed operating cost (max capacity) ($)"], fixCostMax);
check(plant["fixed operating cost (min capacity) ($)"], fixCostMin);
check(plant["variable operating cost ($/tonne)"], varCost);
check(plant["storage"]["cost ($/tonne)"], storCost);
check(plant["storage"]["limit (tonne)"], storLimit);
check(String(plant["disposal cost ($/tonne)"]), String(dispCost));
check(String(plant["disposal limit (tonne)"]), String(dispLimit));
} else {
// Initialize plant costs
costsInitialized = true;
plant["opening cost (max capacity) ($)"] = openCostMax;
plant["opening cost (min capacity) ($)"] = openCostMin;
plant["fixed operating cost (max capacity) ($)"] = fixCostMax;
plant["fixed operating cost (min capacity) ($)"] = fixCostMin;
plant["variable operating cost ($/tonne)"] = varCost;
plant["storage"] = {};
plant["storage"]["cost ($/tonne)"] = storCost;
plant["storage"]["limit (tonne)"] = storLimit;
plant["disposal cost ($/tonne)"] = dispCost;
plant["disposal limit (tonne)"] = dispLimit;
parameters["inflation rate (%)"] = String((R - 1) * 100);
}
}
return [plant, parameters];
};
export const importData = (original) => {
["parameters", "plants", "products"].forEach((key) => {
if (!(key in original)) {
throw "File not recognized.";
}
});
const result = {};
result.parameters = importDict(original.parameters);
["building period (years)"].forEach((k) => {
result.parameters[k] = JSON.stringify(original.parameters[k]);
});
["distance metric"].forEach((k) => {
result.parameters[k] = original.parameters[k];
});
result.parameters["inflation rate (%)"] = "0";
// Import products
result.products = {};
for (const [prodName, origProdDict] of Object.entries(original.products)) {
const [recoveredProd, recoveredParams] = importProduct(origProdDict);
result.products[prodName] = recoveredProd;
result.parameters = { ...result.parameters, ...recoveredParams };
}
// Import plants
result.plants = {};
for (const [plantName, origPlantDict] of Object.entries(original.plants)) {
const [recoveredPlant, recoveredParams] = importPlant(origPlantDict);
result.plants[plantName] = recoveredPlant;
result.parameters = { ...result.parameters, ...recoveredParams };
}
return result;
};

View File

@@ -1,736 +0,0 @@
import {
exportProduct,
exportPlant,
importProduct,
importList,
importDict,
importPlant,
} from "./export";
const sampleProductsOriginal = [
// basic product
{
"initial amounts": {
"Washakie County": {
"latitude (deg)": 43.8356,
"longitude (deg)": -107.6602,
"amount (tonne)": [100, 200, 300],
},
"Platte County": {
"latitude (deg)": 42.1314,
"longitude (deg)": -104.9676,
"amount (tonne)": [100, 200, 300],
},
"Park County": {
"latitude (deg)": 44.4063,
"longitude (deg)": -109.4153,
"amount (tonne)": [100, 200, 300],
},
},
"acquisition cost ($/tonne)": "4",
"disposal cost ($/tonne)": "50",
"disposal limit (tonne)": "30",
"disposal limit (%)": "",
"transportation cost ($/km/tonne)": "0",
"transportation energy (J/km/tonne)": "10",
"transportation emissions (tonne/km/tonne)": {
CO2: "0.5",
},
x: null,
y: null,
},
// product with percentage disposal limit
{
"initial amounts": {
"Washakie County": {
"latitude (deg)": 43.8356,
"longitude (deg)": -107.6602,
"amount (tonne)": [100, 200, 300],
},
"Platte County": {
"latitude (deg)": 42.1314,
"longitude (deg)": -104.9676,
"amount (tonne)": [100, 200, 300],
},
"Park County": {
"latitude (deg)": 44.4063,
"longitude (deg)": -109.4153,
"amount (tonne)": [100, 200, 300],
},
},
"acquisition cost ($/tonne)": "4",
"disposal cost ($/tonne)": "50",
"disposal limit (tonne)": "",
"disposal limit (%)": "10",
"transportation cost ($/km/tonne)": "5",
"transportation energy (J/km/tonne)": "10",
"transportation emissions (tonne/km/tonne)": {
CO2: "0.5",
},
x: null,
y: null,
},
// product using defaults
{
"initial amounts": {
"Washakie County": {
"latitude (deg)": 43.8356,
"longitude (deg)": -107.6602,
"amount (tonne)": [100, 200, 300],
},
"Platte County": {
"latitude (deg)": 42.1314,
"longitude (deg)": -104.9676,
"amount (tonne)": [100, 200, 300],
},
"Park County": {
"latitude (deg)": 44.4063,
"longitude (deg)": -109.4153,
"amount (tonne)": [100, 200, 300],
},
},
"acquisition cost ($/tonne)": "4",
"disposal cost ($/tonne)": "50",
"disposal limit (tonne)": "",
"disposal limit (%)": "",
"transportation cost ($/km/tonne)": "5",
"transportation energy (J/km/tonne)": "",
"transportation emissions (tonne/km/tonne)": {},
x: null,
y: null,
},
];
const sampleProductsExported = [
// basic product
{
"initial amounts": {
"Washakie County": {
"latitude (deg)": 43.8356,
"longitude (deg)": -107.6602,
"amount (tonne)": [100, 200, 300],
},
"Platte County": {
"latitude (deg)": 42.1314,
"longitude (deg)": -104.9676,
"amount (tonne)": [100, 200, 300],
},
"Park County": {
"latitude (deg)": 44.4063,
"longitude (deg)": -109.4153,
"amount (tonne)": [100, 200, 300],
},
},
"acquisition cost ($/tonne)": [4, 8, 16],
"disposal cost ($/tonne)": [50, 100, 200],
"disposal limit (tonne)": [30, 30, 30],
"transportation cost ($/km/tonne)": [0, 0, 0],
"transportation energy (J/km/tonne)": [10, 10, 10],
"transportation emissions (tonne/km/tonne)": {
CO2: [0.5, 0.5, 0.5],
},
},
// product with percentage disposal limit
{
"initial amounts": {
"Washakie County": {
"latitude (deg)": 43.8356,
"longitude (deg)": -107.6602,
"amount (tonne)": [100, 200, 300],
},
"Platte County": {
"latitude (deg)": 42.1314,
"longitude (deg)": -104.9676,
"amount (tonne)": [100, 200, 300],
},
"Park County": {
"latitude (deg)": 44.4063,
"longitude (deg)": -109.4153,
"amount (tonne)": [100, 200, 300],
},
},
"acquisition cost ($/tonne)": [4, 4, 4],
"disposal cost ($/tonne)": [50, 50, 50],
"disposal limit (tonne)": [30, 60, 90],
"transportation cost ($/km/tonne)": [5, 5, 5],
"transportation energy (J/km/tonne)": [10, 10, 10],
"transportation emissions (tonne/km/tonne)": {
CO2: [0.5, 0.5, 0.5],
},
},
// product using defaults
{
"initial amounts": {
"Washakie County": {
"latitude (deg)": 43.8356,
"longitude (deg)": -107.6602,
"amount (tonne)": [100, 200, 300],
},
"Platte County": {
"latitude (deg)": 42.1314,
"longitude (deg)": -104.9676,
"amount (tonne)": [100, 200, 300],
},
"Park County": {
"latitude (deg)": 44.4063,
"longitude (deg)": -109.4153,
"amount (tonne)": [100, 200, 300],
},
},
"acquisition cost ($/tonne)": [4, 4, 4],
"disposal cost ($/tonne)": [50, 50, 50],
"transportation cost ($/km/tonne)": [5, 5, 5],
},
];
const samplePlantsOriginal = [
// basic plant
{
input: "Baled agricultural biomass",
"outputs (tonne/tonne)": {
"Hydrogen gas": 0.095,
"Carbon dioxide": 1.164,
Tar: 0,
},
locations: {
"Washakie County": {
"latitude (deg)": 43.8356,
"longitude (deg)": -107.6602,
"area cost factor": 1.0,
"initial capacity (tonne)": 0,
},
"Platte County": {
"latitude (deg)": 42.1314,
"longitude (deg)": -104.9676,
"area cost factor": 0.5,
"initial capacity (tonne)": 0,
},
},
"disposal cost ($/tonne)": {
"Hydrogen gas": "0",
"Carbon dioxide": "0",
Tar: "200",
},
"disposal limit (tonne)": {
"Hydrogen gas": "10",
"Carbon dioxide": "",
Tar: "",
},
"emissions (tonne/tonne)": {
CO2: "100",
},
storage: {
"cost ($/tonne)": "5",
"limit (tonne)": "10000",
},
"maximum capacity (tonne)": "730000",
"minimum capacity (tonne)": "182500",
"opening cost (max capacity) ($)": "300000",
"opening cost (min capacity) ($)": "200000",
"fixed operating cost (max capacity) ($)": "7000",
"fixed operating cost (min capacity) ($)": "5000",
"variable operating cost ($/tonne)": "10",
x: null,
y: null,
},
// plant with fixed capacity
{
input: "Baled agricultural biomass",
"outputs (tonne/tonne)": {
"Hydrogen gas": 0.095,
"Carbon dioxide": 1.164,
Tar: 0.06,
},
"energy (GJ/tonne)": "50",
locations: {
"Washakie County": {
"latitude (deg)": 43.8356,
"longitude (deg)": -107.6602,
"area cost factor": 1.0,
"initial capacity (tonne)": 0,
},
"Platte County": {
"latitude (deg)": 42.1314,
"longitude (deg)": -104.9676,
"area cost factor": 0.5,
"initial capacity (tonne)": 0,
},
},
"disposal cost ($/tonne)": {
"Hydrogen gas": "0",
"Carbon dioxide": "0",
Tar: "200",
},
"disposal limit (tonne)": {
"Hydrogen gas": "10",
"Carbon dioxide": "",
Tar: "",
},
"emissions (tonne/tonne)": {
CO2: "100",
},
storage: {
"cost ($/tonne)": "5",
"limit (tonne)": "10000",
},
"maximum capacity (tonne)": "182500",
"minimum capacity (tonne)": "182500",
"opening cost (max capacity) ($)": "200000",
"opening cost (min capacity) ($)": "200000",
"fixed operating cost (max capacity) ($)": "5000",
"fixed operating cost (min capacity) ($)": "5000",
"variable operating cost ($/tonne)": "10",
x: null,
y: null,
},
// plant with defaults
{
input: "Baled agricultural biomass",
"outputs (tonne/tonne)": {
"Hydrogen gas": 0.095,
"Carbon dioxide": 1.164,
Tar: 0.06,
},
"energy (GJ/tonne)": "50",
locations: {
"Washakie County": {
"latitude (deg)": 43.8356,
"longitude (deg)": -107.6602,
"area cost factor": 1.0,
"initial capacity (tonne)": 0,
},
"Platte County": {
"latitude (deg)": 42.1314,
"longitude (deg)": -104.9676,
"area cost factor": 0.5,
"initial capacity (tonne)": 0,
},
},
"disposal cost ($/tonne)": {
"Hydrogen gas": "",
"Carbon dioxide": "",
Tar: "",
},
"disposal limit (tonne)": {
"Hydrogen gas": "",
"Carbon dioxide": "",
Tar: "",
},
"emissions (tonne/tonne)": {
CO2: "100",
},
storage: {
"cost ($/tonne)": "5",
"limit (tonne)": "10000",
},
"maximum capacity (tonne)": "730000",
"minimum capacity (tonne)": "182500",
"opening cost (max capacity) ($)": "300000",
"opening cost (min capacity) ($)": "200000",
"fixed operating cost (max capacity) ($)": "7000",
"fixed operating cost (min capacity) ($)": "5000",
"variable operating cost ($/tonne)": "10",
x: null,
y: null,
},
// plant with expresions
{
input: "Baled agricultural biomass",
"outputs (tonne/tonne)": {
"Hydrogen gas": 0.095,
"Carbon dioxide": 1.164,
Tar: 0,
},
locations: {
"Washakie County": {
"latitude (deg)": 43.8356,
"longitude (deg)": -107.6602,
"area cost factor": 1.0,
"initial capacity (tonne)": 0,
x: 2,
},
"Platte County": {
"latitude (deg)": 42.1314,
"longitude (deg)": -104.9676,
"area cost factor": 0.5,
"initial capacity (tonne)": 0,
x: 4,
},
},
"disposal cost ($/tonne)": {
"Hydrogen gas": "0 + x",
"Carbon dioxide": "0 + x",
Tar: "200 + x",
},
"disposal limit (tonne)": {
"Hydrogen gas": "10 + x",
"Carbon dioxide": "",
Tar: "",
},
"emissions (tonne/tonne)": {
CO2: "100",
},
storage: {
"cost ($/tonne)": "5 + x",
"limit (tonne)": "10000 + x",
},
"maximum capacity (tonne)": "730000 + x",
"minimum capacity (tonne)": "182500 + x",
"opening cost (max capacity) ($)": "300000 + x",
"opening cost (min capacity) ($)": "200000 + x",
"fixed operating cost (max capacity) ($)": "7000 + x",
"fixed operating cost (min capacity) ($)": "5000 + x",
"variable operating cost ($/tonne)": "10 + x",
x: null,
y: null,
},
];
const samplePlantsExported = [
//basic plant
{
input: "Baled agricultural biomass",
"outputs (tonne/tonne)": {
"Hydrogen gas": 0.095,
"Carbon dioxide": 1.164,
Tar: 0,
},
locations: {
"Washakie County": {
"latitude (deg)": 43.8356,
"longitude (deg)": -107.6602,
disposal: {
"Hydrogen gas": {
"cost ($/tonne)": [0, 0, 0],
"limit (tonne)": [10, 10, 10],
},
"Carbon dioxide": {
"cost ($/tonne)": [0, 0, 0],
},
Tar: {
"cost ($/tonne)": [200, 400, 800],
},
},
storage: {
"cost ($/tonne)": [5, 10, 20],
"limit (tonne)": 10000,
},
"initial capacity (tonne)": 0,
"capacities (tonne)": {
182500: {
"opening cost ($)": [200000, 400000, 800000],
"fixed operating cost ($)": [5000, 10000, 20000],
"variable operating cost ($/tonne)": [10, 20, 40],
},
730000: {
"opening cost ($)": [300000, 600000, 1200000],
"fixed operating cost ($)": [7000, 14000, 28000],
"variable operating cost ($/tonne)": [10, 20, 40],
},
},
},
"Platte County": {
"latitude (deg)": 42.1314,
"longitude (deg)": -104.9676,
disposal: {
"Hydrogen gas": {
"cost ($/tonne)": [0, 0, 0],
"limit (tonne)": [10, 10, 10],
},
"Carbon dioxide": {
"cost ($/tonne)": [0, 0, 0],
},
Tar: {
"cost ($/tonne)": [100, 200.0, 400],
},
},
storage: {
"cost ($/tonne)": [2.5, 5, 10],
"limit (tonne)": 10000,
},
"initial capacity (tonne)": 0,
"capacities (tonne)": {
182500: {
"opening cost ($)": [100000, 200000, 400000],
"fixed operating cost ($)": [2500, 5000, 10000],
"variable operating cost ($/tonne)": [5, 10, 20],
},
730000: {
"opening cost ($)": [150000, 300000, 600000],
"fixed operating cost ($)": [3500, 7000, 14000],
"variable operating cost ($/tonne)": [5, 10, 20],
},
},
},
},
"emissions (tonne/tonne)": {
CO2: [100, 100, 100],
},
},
// plant with fixed capacity
{
input: "Baled agricultural biomass",
"outputs (tonne/tonne)": {
"Hydrogen gas": 0.095,
"Carbon dioxide": 1.164,
Tar: 0.06,
},
"energy (GJ/tonne)": [50, 50, 50],
locations: {
"Washakie County": {
"latitude (deg)": 43.8356,
"longitude (deg)": -107.6602,
disposal: {
"Hydrogen gas": {
"cost ($/tonne)": [0, 0, 0],
"limit (tonne)": [10, 10, 10],
},
"Carbon dioxide": {
"cost ($/tonne)": [0, 0, 0],
},
Tar: {
"cost ($/tonne)": [200.0, 200.0, 200.0],
},
},
storage: {
"cost ($/tonne)": [5, 5, 5],
"limit (tonne)": 10000,
},
"initial capacity (tonne)": 0,
"capacities (tonne)": {
182500: {
"opening cost ($)": [200000, 200000, 200000],
"fixed operating cost ($)": [5000, 5000, 5000],
"variable operating cost ($/tonne)": [10, 10, 10],
},
},
},
"Platte County": {
"latitude (deg)": 42.1314,
"longitude (deg)": -104.9676,
disposal: {
"Hydrogen gas": {
"cost ($/tonne)": [0, 0, 0],
"limit (tonne)": [10, 10, 10],
},
"Carbon dioxide": {
"cost ($/tonne)": [0, 0, 0],
},
Tar: {
"cost ($/tonne)": [100.0, 100.0, 100.0],
},
},
storage: {
"cost ($/tonne)": [2.5, 2.5, 2.5],
"limit (tonne)": 10000,
},
"initial capacity (tonne)": 0,
"capacities (tonne)": {
182500: {
"opening cost ($)": [100000, 100000, 100000],
"fixed operating cost ($)": [2500, 2500, 2500],
"variable operating cost ($/tonne)": [5, 5, 5],
},
},
},
},
"emissions (tonne/tonne)": {
CO2: [100, 100, 100],
},
},
// plant with defaults
{
input: "Baled agricultural biomass",
"outputs (tonne/tonne)": {
"Hydrogen gas": 0.095,
"Carbon dioxide": 1.164,
Tar: 0.06,
},
"energy (GJ/tonne)": [50, 50, 50],
locations: {
"Washakie County": {
"latitude (deg)": 43.8356,
"longitude (deg)": -107.6602,
disposal: {},
storage: {
"cost ($/tonne)": [5, 5, 5],
"limit (tonne)": 10000,
},
"initial capacity (tonne)": 0,
"capacities (tonne)": {
182500: {
"opening cost ($)": [200000, 200000, 200000],
"fixed operating cost ($)": [5000, 5000, 5000],
"variable operating cost ($/tonne)": [10, 10, 10],
},
730000: {
"opening cost ($)": [300000, 300000, 300000],
"fixed operating cost ($)": [7000, 7000, 7000],
"variable operating cost ($/tonne)": [10, 10, 10],
},
},
},
"Platte County": {
"latitude (deg)": 42.1314,
"longitude (deg)": -104.9676,
disposal: {},
storage: {
"cost ($/tonne)": [2.5, 2.5, 2.5],
"limit (tonne)": 10000,
},
"initial capacity (tonne)": 0,
"capacities (tonne)": {
182500: {
"opening cost ($)": [100000, 100000, 100000],
"fixed operating cost ($)": [2500, 2500, 2500],
"variable operating cost ($/tonne)": [5, 5, 5],
},
730000: {
"opening cost ($)": [150000, 150000, 150000],
"fixed operating cost ($)": [3500, 3500, 3500],
"variable operating cost ($/tonne)": [5, 5, 5],
},
},
},
},
"emissions (tonne/tonne)": {
CO2: [100, 100, 100],
},
},
// plant with expressions
{
input: "Baled agricultural biomass",
"outputs (tonne/tonne)": {
"Hydrogen gas": 0.095,
"Carbon dioxide": 1.164,
Tar: 0,
},
locations: {
"Washakie County": {
"latitude (deg)": 43.8356,
"longitude (deg)": -107.6602,
disposal: {
"Hydrogen gas": {
"cost ($/tonne)": [2, 4, 8],
"limit (tonne)": [12, 12, 12],
},
"Carbon dioxide": {
"cost ($/tonne)": [2, 4, 8],
},
Tar: {
"cost ($/tonne)": [202, 404, 808],
},
},
storage: {
"cost ($/tonne)": [7, 14, 28],
"limit (tonne)": 10002,
},
"initial capacity (tonne)": 0,
"capacities (tonne)": {
182502: {
"opening cost ($)": [200002, 400004, 800008],
"fixed operating cost ($)": [5002, 10004, 20008],
"variable operating cost ($/tonne)": [12, 24, 48],
},
730002: {
"opening cost ($)": [300002, 600004, 1200008],
"fixed operating cost ($)": [7002, 14004, 28008],
"variable operating cost ($/tonne)": [12, 24, 48],
},
},
},
"Platte County": {
"latitude (deg)": 42.1314,
"longitude (deg)": -104.9676,
disposal: {
"Hydrogen gas": {
"cost ($/tonne)": [2, 4, 8],
"limit (tonne)": [14, 14, 14],
},
"Carbon dioxide": {
"cost ($/tonne)": [2, 4, 8],
},
Tar: {
"cost ($/tonne)": [102, 204.0, 408],
},
},
storage: {
"cost ($/tonne)": [4.5, 9, 18],
"limit (tonne)": 10004,
},
"initial capacity (tonne)": 0,
"capacities (tonne)": {
182504: {
"opening cost ($)": [100002, 200004, 400008],
"fixed operating cost ($)": [2502, 5004, 10008],
"variable operating cost ($/tonne)": [7, 14, 28],
},
730004: {
"opening cost ($)": [150002, 300004, 600008],
"fixed operating cost ($)": [3502, 7004, 14008],
"variable operating cost ($/tonne)": [7, 14, 28],
},
},
},
},
"emissions (tonne/tonne)": {
CO2: [100, 100, 100],
},
},
];
const sampleParameters = [
{
"time horizon (years)": "3",
"inflation rate (%)": "100",
},
{
"time horizon (years)": "3",
"inflation rate (%)": "0",
},
{
"time horizon (years)": "3",
"inflation rate (%)": "0",
},
{
"time horizon (years)": "3",
"inflation rate (%)": "100",
},
];
test("export products", () => {
for (let i = 0; i < sampleProductsOriginal.length; i++) {
const original = sampleProductsOriginal[i];
const exported = sampleProductsExported[i];
expect(exportProduct(original, sampleParameters[i])).toEqual(exported);
const [recoveredProd, recoveredParams] = importProduct(exported);
expect(recoveredProd).toEqual(original);
expect(recoveredParams).toEqual(sampleParameters[i]);
}
});
test("export plants", () => {
for (let i = 0; i < samplePlantsOriginal.length; i++) {
const original = samplePlantsOriginal[i];
const exported = samplePlantsExported[i];
expect(exportPlant(original, sampleParameters[i])).toEqual(exported);
// const [recoveredPlant, recoveredParams] = importPlant(exported);
// expect(recoveredPlant).toEqual(original);
// expect(recoveredParams).toEqual(sampleParameters[i]);
}
});
test("importList", () => {
expect(importList("invalid")).toEqual("invalid");
expect(importList([1, 1, 1])).toEqual("1");
expect(importList([1, 2, 3])).toEqual("[1,2,3]");
expect(importList(["A", "A", "A"])).toEqual("A");
});
test("importDict", () => {
expect(importDict({ a: [5, 5, 5] })).toEqual({ a: "5" });
expect(importDict({ a: [1, 2, 3] })).toEqual({ a: "[1,2,3]" });
expect(importDict({ a: "invalid" })).toEqual({ a: "invalid" });
});

View File

@@ -1,50 +0,0 @@
import { Jsep } from "jsep";
import { exportValue } from "./export";
export const evaluateExpr = (expr, data) => {
const node = Jsep.parse(expr);
return evaluateNode(node, data);
};
const evaluateNode = (node, data) => {
if (node.type == "BinaryExpression") {
return evaluateBinaryExprNode(node, data);
} else if (node.type == "UnaryExpression") {
return evaluateUnaryExprNode(node, data);
} else if (node.type == "Literal") {
return node.value;
} else if (node.type == "Identifier") {
return data[node.name];
} else {
throw `Unknown type: ${node.type}`;
}
};
const evaluateBinaryExprNode = (node, data) => {
const leftVal = evaluateNode(node.left, data);
const rightVal = evaluateNode(node.right, data);
if (node.operator == "+") {
return leftVal + rightVal;
} else if (node.operator == "*") {
return leftVal * rightVal;
} else if (node.operator == "/") {
return leftVal / rightVal;
} else if (node.operator == "-") {
return leftVal - rightVal;
} else if (node.operator == "^") {
return Math.pow(leftVal, rightVal);
} else {
throw `Unknown operator: ${node.operator}`;
}
};
const evaluateUnaryExprNode = (node, data) => {
const arg = evaluateNode(node.argument, data);
if (node.operator == "+") {
return arg;
} else if (node.operator == "-") {
return -arg;
} else {
throw `Unknown operator: ${node.operator}`;
}
};

View File

@@ -1,19 +0,0 @@
import { evaluateExpr } from "./expr";
test("parse expression", () => {
// Basic expressions
expect(evaluateExpr("1 + 1")).toEqual(2);
expect(evaluateExpr("2 * 5")).toEqual(10);
expect(evaluateExpr("2 * (3 + 5)")).toEqual(16);
expect(evaluateExpr("14 / 2")).toEqual(7);
expect(evaluateExpr("10 - 3")).toEqual(7);
expect(evaluateExpr("-10")).toEqual(-10);
expect(evaluateExpr("+10")).toEqual(10);
expect(evaluateExpr("2^3")).toEqual(8);
expect(evaluateExpr("2^(3 + 1)")).toEqual(16);
// With data
expect(evaluateExpr("x + 1", { x: 10 })).toEqual(11);
expect(evaluateExpr("2 ^ (3 + x)", { x: 1 })).toEqual(16);
expect(evaluateExpr("x + y", { x: 1, y: 2 })).toEqual(3);
});

View File

@@ -1,194 +0,0 @@
const Ajv = require("ajv");
const ajv = new Ajv();
const schema = {
$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",
},
"distance metric": {
type: "string",
},
},
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",
},
"acquisition 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"],
};
export const validate = ajv.compile(schema);

View File

@@ -1,26 +0,0 @@
import styles from "./Button.module.css";
const Button = (props) => {
let className = styles.Button;
if (props.kind === "inline") {
className += " " + styles.inline;
}
let tooltip = "";
if (props.tooltip !== undefined) {
tooltip = <span className={styles.tooltip}>{props.tooltip}</span>;
}
return (
<button
className={className}
onClick={props.onClick}
disabled={props.disabled}
>
{tooltip}
{props.label}
</button>
);
};
export default Button;

View File

@@ -1,67 +0,0 @@
.Button {
padding: 6px 36px;
margin: 12px 6px;
line-height: 24px;
border: var(--box-border);
/* background-color: white; */
box-shadow: var(--box-shadow);
border-radius: var(--border-radius);
cursor: pointer;
color: rgba(0, 0, 0, 0.8);
text-transform: uppercase;
font-weight: bold;
font-size: 12px;
background: linear-gradient(rgb(255, 255, 255) 25%, rgb(245, 245, 245) 100%);
}
.Button:hover {
background: rgb(245, 245, 245);
}
.Button:active {
background: rgba(220, 220, 220);
}
.inline {
padding: 0 12px;
margin: 2px 4px 2px 0;
height: 32px;
font-size: 11px;
}
/* .inline:last-child {
margin: 2px 1px;
} */
.tooltip {
visibility: hidden;
background-color: #333;
color: white;
opacity: 0%;
width: 180px;
margin-top: 36px;
margin-left: -180px;
position: absolute;
z-index: 100;
text-transform: none;
font-size: 13px;
border-radius: 4px;
box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.25);
line-height: 18px;
padding: 6px;
transition: opacity 0.5s;
font-weight: normal;
text-align: left;
padding: 6px 12px;
}
.Button:hover .tooltip {
visibility: visible;
opacity: 100%;
transition: opacity 0.5s;
}
.Button:disabled {
color: rgba(0, 0, 0, 0.25);
cursor: default;
}

View File

@@ -1,7 +0,0 @@
import styles from "./Card.module.css";
const Card = (props) => {
return <div className={styles.Card}>{props.children}</div>;
};
export default Card;

View File

@@ -1,22 +0,0 @@
.Card {
border: var(--box-border);
box-shadow: var(--box-shadow);
border-radius: var(--border-radius);
background-color: white;
padding: 12px;
min-height: 24px;
}
.Card h1 {
margin: 12px -12px 0px -12px;
padding: 6px 12px 0px 12px;
font-size: 14px;
line-height: 35px;
border-top: 1px solid #ddd;
}
.Card h1:first-child {
margin: -12px -12px 0px -12px;
border-top: none;
background: none;
}

View File

@@ -1,91 +0,0 @@
import form_styles from "./Form.module.css";
import Button from "./Button";
import { validate } from "./Form";
const DictInputRow = (props) => {
const dict = { ...props.value };
if (!props.disableKeys) {
dict[""] = "0";
}
let unit = "";
if (props.unit) {
unit = <span className={form_styles.FormRow_unit}>({props.unit})</span>;
}
let tooltip = "";
if (props.tooltip !== undefined) {
tooltip = <Button label="?" kind="inline" tooltip={props.tooltip} />;
}
const onChangeValue = (key, v) => {
const newDict = { ...dict };
newDict[key] = v;
props.onChange(newDict);
};
const onChangeKey = (prevKey, newKey) => {
const newDict = renameKey(dict, prevKey, newKey);
if (!("" in newDict)) newDict[""] = "";
props.onChange(newDict);
};
const form = [];
Object.keys(dict).forEach((key, index) => {
let label = (
<span>
{props.label} {unit}
</span>
);
if (index > 0) {
label = "";
}
let isValid = true;
if (props.validate !== undefined) {
isValid = validate(props.validate, dict[key]);
}
let className = "";
if (!isValid) className = form_styles.invalid;
form.push(
<div className={form_styles.FormRow} key={index}>
<label>{label}</label>
<input
type="text"
data-index={index}
value={key}
placeholder={props.keyPlaceholder}
disabled={props.disableKeys}
onChange={(e) => onChangeKey(key, e.target.value)}
/>
<input
type="text"
data-index={index}
value={dict[key]}
placeholder={props.valuePlaceholder}
className={className}
onChange={(e) => onChangeValue(key, e.target.value)}
/>
{tooltip}
</div>
);
});
return <>{form}</>;
};
export function renameKey(obj, prevKey, newKey) {
const keys = Object.keys(obj);
return keys.reduce((acc, val) => {
if (val === prevKey) {
acc[newKey] = obj[prevKey];
} else {
acc[val] = obj[val];
}
return acc;
}, {});
}
export default DictInputRow;

View File

@@ -1,59 +0,0 @@
import form_styles from "./Form.module.css";
import Button from "./Button";
import { useRef } from "react";
const FileInputRow = (props) => {
let tooltip = "";
if (props.tooltip !== undefined) {
tooltip = <Button label="?" kind="inline" tooltip={props.tooltip} />;
}
const fileElem = useRef();
const onClickUpload = () => {
fileElem.current.click();
};
const onFileSelected = () => {
const file = fileElem.current.files[0];
if (file) {
const reader = new FileReader();
reader.addEventListener("load", () => {
props.onFile(reader.result);
});
reader.readAsText(file);
}
fileElem.current.value = "";
};
return (
<div className={form_styles.FormRow}>
<label>{props.label}</label>
<input type="text" value={props.value} disabled="disabled" />
<Button label="Upload" kind="inline" onClick={onClickUpload} />
<Button
label="Download"
kind="inline"
onClick={props.onDownload}
disabled={props.disableDownload}
/>
<Button
label="Clear"
kind="inline"
onClick={props.onClear}
disabled={props.disableClear}
/>
<Button label="Template" kind="inline" onClick={props.onTemplate} />
{tooltip}
<input
type="file"
ref={fileElem}
accept={props.accept}
style={{ display: "none" }}
onChange={onFileSelected}
/>
</div>
);
};
export default FileInputRow;

View File

@@ -1,15 +0,0 @@
import styles from "./Footer.module.css";
const Footer = () => {
return (
<div className={styles.Footer}>
<p>RELOG: Reverse Logistics Optimization</p>
<p>
Copyright &copy; 2020&mdash;2022, UChicago Argonne, LLC. All Rights
Reserved.
</p>
</div>
);
};
export default Footer;

View File

@@ -1,8 +0,0 @@
.Footer {
padding: 12px;
color: rgba(255, 255, 255, 0.5);
text-align: center;
font-size: 14px;
line-height: 8px;
min-width: 900px;
}

View File

@@ -1,19 +0,0 @@
const VALIDATION_REGEX = {
int: new RegExp("^[0-9]+$"),
intList: new RegExp("[[0-9]*]$"),
float: new RegExp("^[0-9]*\\.?[0-9]*$"),
floatList: new RegExp("^[?[0-9,.]*]?$"),
};
export const validate = (kind, value) => {
if (!VALIDATION_REGEX[kind].test(value)) {
return false;
}
return true;
};
const Form = (props) => {
return <>{props.children}</>;
};
export default Form;

View File

@@ -1,28 +0,0 @@
.FormRow {
display: flex;
line-height: 24px;
}
.FormRow label {
width: 350px;
padding: 6px 12px;
text-align: right;
}
.FormRow input {
flex: 1;
font-family: monospace;
border: var(--box-border);
border-radius: var(--border-radius);
padding: 4px;
margin: 2px 3px;
}
.FormRow_unit {
color: rgba(0, 0, 0, 0.4);
}
.invalid {
border: 2px solid #faa !important;
background-color: rgba(255, 0, 0, 0.05);
}

View File

@@ -1,17 +0,0 @@
import styles from "./Header.module.css";
const Header = (props) => {
return (
<div className={styles.HeaderBox}>
<div className={styles.HeaderContent}>
<h1>RELOG</h1>
<h2>{props.title}</h2>
<div style={{ float: "right", paddingTop: "5px" }}>
{props.children}
</div>
</div>
</div>
);
};
export default Header;

View File

@@ -1,28 +0,0 @@
.HeaderBox {
background-color: white;
border-bottom: var(--box-border);
box-shadow: var(--box-shadow);
padding: 0;
margin: 0;
}
.HeaderContent {
margin: 0 auto;
max-width: var(--site-width);
}
.HeaderContent h1,
.HeaderContent h2 {
line-height: 48px;
font-size: 28px;
padding: 12px;
margin: 0;
display: inline-block;
vertical-align: middle;
}
.HeaderContent h2 {
font-size: 22px;
font-weight: normal;
color: rgba(0, 0, 0, 0.6);
}

View File

@@ -1,7 +0,0 @@
import styles from "./Section.module.css";
const Section = (props) => {
return <h2 className={styles.Section}>{props.title}</h2>;
};
export default Section;

View File

@@ -1,6 +0,0 @@
.Section {
line-height: 36px;
margin: 12px;
font-size: 16px;
font-weight: bold;
}

View File

@@ -1,44 +0,0 @@
import form_styles from "./Form.module.css";
import Button from "./Button";
import { validate } from "./Form";
import React from "react";
const TextInputRow = React.forwardRef((props, ref) => {
let unit = "";
if (props.unit) {
unit = <span className={form_styles.FormRow_unit}>({props.unit})</span>;
}
let tooltip = "";
if (props.tooltip !== undefined) {
tooltip = <Button label="?" kind="inline" tooltip={props.tooltip} />;
}
let isValid = true;
if (!props.disabled && props.validate !== undefined) {
isValid = validate(props.validate, props.value);
}
let className = "";
if (!isValid) className = form_styles.invalid;
return (
<div className={form_styles.FormRow}>
<label>
{props.label} {unit}
</label>
<input
type="text"
placeholder={props.default}
disabled={props.disabled}
value={props.value}
className={className}
onChange={(e) => props.onChange(e.target.value)}
ref={ref}
/>
{tooltip}
</div>
);
});
export default TextInputRow;

View File

@@ -1,109 +0,0 @@
:root {
--site-width: 1200px;
--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;
}
html,
body {
margin: 0;
padding: 0;
border: 0;
font-family: sans-serif;
}
body {
background-color: #333;
color: rgba(0, 0, 0, 0.95);
}
#contentBackground {
background-color: #f6f6f6;
}
#content {
max-width: var(--site-width);
min-width: 900px;
margin: 0 auto;
padding: 1px 6px 32px 6px;
}
.react-flow__node.selected {
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2) !important;
border-width: 2px !important;
margin-top: -1px !important;
margin-left: -1px !important;
border-radius: 8px !important;
}
.react-flow__handle {
width: 6px !important;
height: 6px !important;
background-color: white !important;
border: 1px solid black !important;
}
.react-flow__handle:hover {
background-color: black !important;
}
.react-flow__handle-right {
right: -4px !important;
}
.react-flow__handle-left {
left: -4px !important;
}
#messageTray {
max-width: var(--site-width);
margin: 0 auto;
position: fixed;
bottom: 12px;
left: 0;
right: 0;
z-index: 100;
}
#messageTray .message {
background-color: rgb(221, 69, 69);
color: #eee;
padding: 12px;
border-radius: var(--border-radius);
box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.4);
display: flex;
margin-top: 12px;
}
#messageTray .message p {
flex: 1;
margin: 0;
padding: 12px 0;
}
#messageTray .message button {
margin: 0;
background: transparent;
border: 1px solid #eee;
color: #eee;
float: right;
padding: 0 24px;
line-height: 6px;
}
#messageTray .message button:hover {
background: rgba(255, 255, 255, 0.05);
}
#messageTray .message button:active {
background: rgba(255, 255, 255, 0.1);
}
.nodata {
text-align: center;
padding: 24px 0;
color: #888;
margin: 0;
}

View File

@@ -1,27 +0,0 @@
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import InputPage from "./casebuilder/InputPage";
import SolverPage from "./solver/SolverPage";
import { Route, BrowserRouter, Switch, Redirect } from "react-router-dom";
export const SERVER_URL = "";
ReactDOM.render(
<BrowserRouter>
<React.StrictMode>
<Switch>
<Route path="/casebuilder">
<InputPage />
</Route>
<Route path="/solver/:job_id">
<SolverPage />
</Route>
<Route path="/">
<Redirect to="/casebuilder" />
</Route>
</Switch>
</React.StrictMode>
</BrowserRouter>,
document.getElementById("root")
);

View File

@@ -1,46 +0,0 @@
import { useState } from "react";
import { useEffect } from "react";
import Section from "../common/Section";
import Card from "../common/Card";
import styles from "./FilesBlock.module.css";
import { SERVER_URL } from "..";
const FilesBlock = (props) => {
const [filesFound, setFilesFound] = useState(false);
const fetchFiles = async () => {
const response = await fetch(`${SERVER_URL}/jobs/${props.job}/output.json`);
if (response.ok) {
setFilesFound(true);
}
};
// Fetch files periodically from the server
useEffect(() => {
fetchFiles();
if (!filesFound) {
const interval = setInterval(() => {
fetchFiles();
}, 1000);
return () => clearInterval(interval);
}
}, [filesFound]);
let content = <div className="nodata">No files available</div>;
if (filesFound) {
content = (
<div className={styles.files}>
<a href={`${SERVER_URL}/jobs/${props.job}/output.zip`}>output.zip</a>
</div>
);
}
return (
<>
<Section title="Output Files" />
<Card>{content}</Card>
</>
);
};
export default FilesBlock;

View File

@@ -1,19 +0,0 @@
.files a {
display: block;
padding: 16px;
text-decoration: none;
color: var(--primary);
}
.files a:hover {
background-color: var(--primary);
color: white;
border-radius: var(--border-radius);
}
.nodata {
text-align: center;
padding: 24px 0;
color: #888;
margin: 0;
}

View File

@@ -1,47 +0,0 @@
import { useState } from "react";
import { useEffect } from "react";
import Section from "../common/Section";
import Card from "../common/Card";
import styles from "./LogBlock.module.css";
import { useRef } from "react";
import { SERVER_URL } from "..";
const LogBlock = (props) => {
const [log, setLog] = useState();
const preRef = useRef(null);
const fetchLog = async () => {
const response = await fetch(`${SERVER_URL}/jobs/${props.job}/solve.log`);
const data = await response.text();
if (log !== data) {
setLog(data);
}
};
// Fetch log periodically from the server
useEffect(() => {
fetchLog();
const interval = setInterval(() => {
fetchLog();
}, 1000);
return () => clearInterval(interval);
}, []);
// Scroll to bottom whenever the log is updated
useEffect(() => {
preRef.current.scrollTop = preRef.current.scrollHeight;
}, [log]);
return (
<>
<Section title="Optimization Log" />
<Card>
<pre ref={preRef} className={styles.log}>
{log}
</pre>
</Card>
</>
);
};
export default LogBlock;

View File

@@ -1,8 +0,0 @@
.log {
max-height: 500px;
min-height: 500px;
border: 0;
margin: 0;
overflow: auto;
line-height: 1.4em;
}

View File

@@ -1,238 +0,0 @@
import * as d3 from "d3";
import { group } from "d3-array";
import * as L from "leaflet";
import "leaflet/dist/leaflet.css";
import { useEffect, useState } from "react";
import { SERVER_URL } from "..";
import Card from "../common/Card";
import Section from "../common/Section";
function drawMap(csv_plants, csv_tr) {
const mapLink = '<a href="http://openstreetmap.org">OpenStreetMap</a>';
const base = L.tileLayer(
"https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png",
{
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>',
subdomains: "abcd",
maxZoom: 10,
}
);
const plant_types = [...new Set(csv_plants.map((d) => d["plant type"]))];
plant_types.push("Multiple");
const plant_color = d3
.scaleOrdinal()
.domain(plant_types)
.range([
"#558B2F",
"#FF8F00",
"#0277BD",
"#AD1457",
"#00838F",
"#4527A0",
"#C62828",
"#424242",
]);
const plant_locations = d3
.nest()
.key((d) => d["location name"])
.rollup(function (v) {
return {
amount_processed: d3.sum(v, function (d) {
return d["amount processed (tonne)"];
}),
latitude: d3.mean(v, function (d) {
return d["latitude (deg)"];
}),
longitude: d3.mean(v, function (d) {
return d["longitude (deg)"];
}),
plant_types: [...new Set(v.map((d) => d["plant type"]))],
};
})
.entries(csv_plants);
const plant_scale = d3
.scaleSqrt()
.range([2, 10])
.domain([0, d3.max(plant_locations, (d) => d.value.amount_processed)]);
const plants_array = [];
plant_locations.forEach((d) => {
if (d.value.plant_types.length > 1) {
d.value.plant_type = "Multiple";
} else {
d.value.plant_type = d.value.plant_types[0];
}
const marker = L.circleMarker([d.value.latitude, d.value.longitude], {
id: "circleMarker",
className: "marker",
color: "#222",
weight: 1,
fillColor: plant_color(d.value.plant_type),
fillOpacity: 0.9,
radius: plant_scale(d.value.amount_processed),
});
const num = d.value.amount_processed.toFixed(2);
const num_parts = num.toString().split(".");
num_parts[0] = num_parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
marker.bindTooltip(
`<b>${d.key}</b>
<br>
Amount processed:
${num_parts.join(".")}
<br>
Plant types:
${d.value.plant_types}`
);
plants_array.push(marker);
});
const collection_centers = d3
.nest()
.key((d) => d["source location name"])
.rollup(function (v) {
return {
source_lat: d3.mean(v, (d) => d["source latitude (deg)"]),
source_long: d3.mean(v, (d) => d["source longitude (deg)"]),
amount: d3.sum(v, (d) => d["amount (tonne)"]),
};
})
.entries(csv_tr);
//Color scale for the collection centers
const colors = d3
.scaleLog()
.domain([
d3.min(collection_centers, (d) => d.value.amount),
d3.max(collection_centers, (d) => d.value.amount),
])
.range(["#777", "#777"]);
//Plot the collection centers
const collection_array = [];
collection_centers.forEach(function (d) {
const marker = L.circleMarker([d.value.source_lat, d.value.source_long], {
color: "#000",
fillColor: colors(d.value.amount),
fillOpacity: 1,
radius: 1.25,
weight: 0,
className: "marker",
});
collection_array.push(marker);
});
const transportation_lines = group(
csv_tr,
(d) => d["source location name"],
(d) => d["destination location name"]
);
//Plot the transportation lines
const transport_array = [];
transportation_lines.forEach(function (d1) {
d1.forEach(function (d2) {
const object = d2[0];
const line = L.polyline(
[
[object["source latitude (deg)"], object["source longitude (deg)"]],
[
object["destination latitude (deg)"],
object["destination longitude (deg)"],
],
],
{
color: "#666",
stroke: true,
weight: 0.5,
opacity: Math.max(0.1, 0.5 / d1.size),
}
);
transport_array.push(line);
});
});
const plants = L.layerGroup(plants_array);
const cities = L.layerGroup(collection_array);
const transport = L.layerGroup(transport_array);
const baseMaps = {
"Open Street Map": base,
};
const overlayMaps = {
Plants: plants,
"Collection Centers": cities,
"Transportation Lines": transport,
};
cities.on({
add: function () {
cities.eachLayer((layer) => layer.bringToBack());
},
});
transport.on({
add: function () {
plants.eachLayer((layer) => layer.bringToFront());
},
});
function setHeight() {
let mapDiv = document.getElementById("map");
mapDiv.style.height = `${+mapDiv.offsetWidth * 0.55}px`;
}
//$(window).resize(setHeight);
setHeight();
const map = L.map("map", {
layers: [base, plants],
}).setView([37.8, -96.9], 4);
const svg6 = d3.select(map.getPanes().overlayPane).append("svg");
svg6.append("g").attr("class", "leaflet-zoom-hide");
L.control.layers(baseMaps, overlayMaps).addTo(map);
}
const MapBlock = (props) => {
const [filesFound, setFilesFound] = useState(false);
const fetchFiles = () => {
const file_prefix = `${SERVER_URL}/jobs/${props.job}/case`;
d3.csv(`${file_prefix}_plants.csv`).then((csv_plants) => {
d3.csv(`${file_prefix}_tr.csv`).then((csv_tr) => {
setFilesFound(true);
drawMap(csv_plants, csv_tr, file_prefix);
});
});
};
// Fetch files periodically from the server
useEffect(() => {
fetchFiles();
if (!filesFound) {
const interval = setInterval(() => {
fetchFiles();
}, 1000);
return () => clearInterval(interval);
}
}, [filesFound]);
return (
<>
<Section title="Map" />
<Card>
<div id="map">
<div className="nodata">No data available</div>
</div>
</Card>
</>
);
};
export default MapBlock;

View File

@@ -1,28 +0,0 @@
import React from "react";
import { useParams } from "react-router-dom";
import Footer from "../common/Footer";
import Header from "../common/Header";
import LogBlock from "./LogBlock";
import FilesBlock from "./FilesBlock";
import MapBlock from "./MapBlock";
const SolverPage = () => {
const params = useParams();
return (
<>
<Header title="Solver"></Header>
<div id="contentBackground">
{" "}
<div id="content">
<LogBlock job={params.job_id} />
<FilesBlock job={params.job_id} />
<MapBlock job={params.job_id} />
</div>
</div>
<Footer />
</>
);
};
export default SolverPage;

View File

@@ -1,33 +1,20 @@
# 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
using Pkg
version() = Pkg.dependencies()[Base.UUID("a2afcdf7-cf04-4913-85f9-c0d81ddf2008")].version
function _round(x::Number)
if abs(x) < 1e-5
return 0
else
return round(x, digits = 5)
end
end
include("instance/structs.jl")
include("graph/structs.jl")
include("instance/geodb.jl")
include("graph/dist.jl")
include("graph/build.jl")
include("graph/csv.jl")
include("instance/compress.jl")
include("instance/parse.jl")
include("instance/validate.jl")
include("model/jumpext.jl")
include("model/dist.jl")
include("model/build.jl")
include("model/getsol.jl")
include("model/resolve.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")
include("web/web.jl")
end
include("reports/transportation.jl")
include("reports/centers.jl")
end # module RELOG

View File

@@ -1,96 +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.
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,
instance.distance_metric,
)
values = Dict("distance" => distance)
arc = Arc(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(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

View File

@@ -1,11 +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.
function to_csv(graph::Graph)
result = ""
for a in graph.arcs
result *= "$(a.source.index),$(a.dest.index)\n"
end
return result
end

View File

@@ -1,60 +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 Geodesy
using NearestNeighbors
using DataFrames
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 _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
if !isfile(csv_filename)
_download_zip(
"https://axavier.org/RELOG/0.6/data/dist_driving_0b9a6ad6.zip",
basedir,
csv_filename,
0x0b9a6ad6,
)
end
# Fit kNN model
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
# Compute Euclidean distance
dist_euclidean =
_calculate_distance(source_lat, source_lon, dest_lat, dest_lon, EuclideanDistance())
# Predict ratio
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")
return dist_pred
end

View File

@@ -1,45 +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 Geodesy
abstract type Node end
mutable struct Arc
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

View File

@@ -1,60 +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 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
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

View File

@@ -1,212 +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 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

View File

@@ -1,233 +1,183 @@
# 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
using OrderedCollections
function parsefile(path::String)::Instance
return RELOG.parse(JSON.parsefile(path))
return RELOG.parse(JSON.parsefile(path; dicttype = OrderedDict))
end
function parse(json)::Instance
basedir = dirname(@__FILE__)
json_schema = JSON.parsefile("$basedir/../schemas/input.json")
validate(json, Schema(json_schema))
# Read parameters
time_horizon = json["parameters"]["time horizon (years)"]
building_period = json["parameters"]["building period (years)"]
T = json["parameters"]["time horizon (years)"]
json_schema["definitions"]["TimeSeries"]["minItems"] = T
json_schema["definitions"]["TimeSeries"]["maxItems"] = T
validate(json, Schema(json_schema))
building_period = [1]
if "building period (years)" in keys(json["parameters"])
building_period = json["parameters"]["building period (years)"]
# Read distance metric
distance_metric_str = lowercase(json["parameters"]["distance metric"])
if distance_metric_str == "driving"
distance_metric = KnnDrivingDistance()
elseif distance_metric_str == "euclidean"
distance_metric = EuclideanDistance()
else
error("Invalid distance metric: $distance_metric_str")
end
distance_metric = EuclideanDistance()
if "distance metric" in keys(json["parameters"])
metric_name = json["parameters"]["distance metric"]
if metric_name == "driving"
distance_metric = KnnDrivingDistance()
elseif metric_name == "Euclidean"
# nop
else
error("Unknown distance metric: $metric_name")
timeseries(::Nothing; null_val = nothing) = repeat([null_val], time_horizon)
timeseries(x::Number; null_val = nothing) = repeat([x], time_horizon)
timeseries(x::Array; null_val = nothing) = [xi === nothing ? null_val : xi for xi in x]
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
plants = Plant[]
products = Product[]
collection_centers = CollectionCenter[]
prod_name_to_product = Dict{String,Product}()
# Create products
for (product_name, product_dict) in json["products"]
cost = product_dict["transportation cost (\$/km/tonne)"]
energy = zeros(T)
emissions = Dict()
disposal_limit = zeros(T)
disposal_cost = zeros(T)
acquisition_cost = zeros(T)
if "transportation energy (J/km/tonne)" in keys(product_dict)
energy = product_dict["transportation energy (J/km/tonne)"]
end
if "transportation emissions (tonne/km/tonne)" in keys(product_dict)
emissions = product_dict["transportation emissions (tonne/km/tonne)"]
end
if "disposal limit (tonne)" in keys(product_dict)
disposal_limit = product_dict["disposal limit (tonne)"]
end
if "disposal cost (\$/tonne)" in keys(product_dict)
disposal_cost = product_dict["disposal cost (\$/tonne)"]
end
if "acquisition cost (\$/tonne)" in keys(product_dict)
acquisition_cost = product_dict["acquisition cost (\$/tonne)"]
end
prod_centers = []
product = Product(
acquisition_cost = acquisition_cost,
collection_centers = prod_centers,
disposal_cost = disposal_cost,
disposal_limit = disposal_limit,
name = product_name,
transportation_cost = cost,
transportation_emissions = emissions,
transportation_energy = energy,
plants_by_name = OrderedDict{String,Plant}()
for (name, pdict) in json["plants"]
prod_dict(key; scale = 1.0, null_val = Inf) = OrderedDict{Product,Vector{Float64}}(
products_by_name[p] => [
v === nothing ? null_val : v * scale for v in timeseries(pdict[key][p])
] for p in keys(pdict[key])
)
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(
amount = center_dict["amount (tonne)"],
index = length(collection_centers) + 1,
latitude = center_dict["latitude (deg)"],
longitude = center_dict["longitude (deg)"],
name = center_name,
product = product,
)
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
latitude = pdict["latitude (deg)"]
longitude = pdict["longitude (deg)"]
input_mix = prod_dict("input mix (%)", scale = 0.01)
output = prod_dict("output (tonne)")
emissions = timeseries(pdict["processing emissions (tonne)"])
storage_cost = prod_dict("storage cost (\$/tonne)")
storage_limit = prod_dict("storage limit (tonne)")
disposal_cost = prod_dict("disposal cost (\$/tonne)")
disposal_limit = prod_dict("disposal limit (tonne)")
initial_capacity = pdict["initial capacity (tonne)"]
capacities = PlantCapacity[]
for cdict in pdict["capacities"]
size = cdict["size (tonne)"]
opening_cost = timeseries(cdict["opening cost (\$)"])
fix_operating_cost = timeseries(cdict["fixed operating cost (\$)"])
var_operating_cost = timeseries(cdict["variable operating cost (\$/tonne)"])
push!(
capacities,
PlantCapacity(; size, opening_cost, fix_operating_cost, var_operating_cost),
)
end
energy = zeros(T)
emissions = Dict()
if "energy (GJ/tonne)" in keys(plant_dict)
energy = plant_dict["energy (GJ/tonne)"]
end
if "emissions (tonne/tonne)" in keys(plant_dict)
emissions = plant_dict["emissions (tonne/tonne)"]
end
for (location_name, location_dict) in plant_dict["locations"]
sizes = PlantSize[]
disposal_limit = Dict(p => [0.0 for t = 1:T] for p in keys(output))
disposal_cost = Dict(p => [0.0 for t = 1:T] for p in keys(output))
# 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(
capacity = Base.parse(Float64, capacity_name),
fixed_operating_cost = capacity_dict["fixed operating cost (\$)"],
opening_cost = capacity_dict["opening cost (\$)"],
variable_operating_cost = capacity_dict["variable operating cost (\$/tonne)"],
),
)
end
length(sizes) > 1 || push!(sizes, sizes[1])
sort!(sizes, by = x -> x.capacity)
# Initial capacity
initial_capacity = 0
if "initial capacity (tonne)" in keys(location_dict)
initial_capacity = location_dict["initial capacity (tonne)"]
end
# 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(
disposal_cost = disposal_cost,
disposal_limit = disposal_limit,
emissions = emissions,
energy = energy,
index = length(plants) + 1,
initial_capacity = initial_capacity,
input = input,
latitude = location_dict["latitude (deg)"],
location_name = location_name,
longitude = location_dict["longitude (deg)"],
output = output,
plant_name = plant_name,
sizes = sizes,
storage_cost = storage_cost,
storage_limit = storage_limit,
# Validate capacity count and duplicate if needed
if length(capacities) == 0
error("Plant '$name' must have at least one capacity defined")
elseif length(capacities) == 1
# Duplicate the single capacity
push!(capacities, capacities[1])
elseif length(capacities) > 2
error(
"Plant '$name' cannot have more than 2 capacities, got $(length(capacities))",
)
end
push!(plants, plant)
# Validate capacity sizes are non-decreasing
if capacities[1].size > capacities[2].size
error(
"Plant '$name' capacity sizes must be non-decreasing: $(capacities[1].size) > $(capacities[2].size)",
)
end
# Validate variable operating costs are the same
if capacities[1].var_operating_cost != capacities[2].var_operating_cost
error(
"Plant '$name' variable operating costs must be the same across all capacities",
)
end
plant = Plant(;
name,
latitude,
longitude,
input_mix,
output,
emissions,
storage_cost,
storage_limit,
disposal_cost,
disposal_limit,
capacities,
initial_capacity,
)
push!(plants, plant)
plants_by_name[name] = plant
end
# Read emissions
emissions = Emissions[]
emissions_by_name = OrderedDict{String,Emissions}()
if haskey(json, "emissions")
for (name, edict) in json["emissions"]
limit = timeseries(edict["limit (tonne)"], null_val = Inf)
penalty = timeseries(edict["penalty (\$/tonne)"])
emission = Emissions(; name, limit, penalty)
push!(emissions, emission)
emissions_by_name[name] = emission
end
end
@info @sprintf("%12d collection centers", length(collection_centers))
@info @sprintf("%12d candidate plant locations", length(plants))
return Instance(
time = T,
products = products,
collection_centers = collection_centers,
plants = plants,
building_period = building_period,
distance_metric = distance_metric,
return Instance(;
time_horizon,
building_period,
distance_metric,
products,
products_by_name,
centers,
centers_by_name,
plants,
plants_by_name,
emissions,
emissions_by_name,
)
end

View File

@@ -1,58 +1,4 @@
# 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
Base.@kwdef mutable struct Product
acquisition_cost::Vector{Float64}
collection_centers::Vector
disposal_cost::Vector{Float64}
disposal_limit::Vector{Float64}
name::String
transportation_cost::Vector{Float64}
transportation_emissions::Dict{String,Vector{Float64}}
transportation_energy::Vector{Float64}
end
Base.@kwdef mutable struct CollectionCenter
amount::Vector{Float64}
index::Int64
latitude::Float64
longitude::Float64
name::String
product::Product
end
Base.@kwdef mutable struct PlantSize
capacity::Float64
fixed_operating_cost::Vector{Float64}
opening_cost::Vector{Float64}
variable_operating_cost::Vector{Float64}
end
Base.@kwdef mutable struct Plant
disposal_cost::Dict{Product,Vector{Float64}}
disposal_limit::Dict{Product,Vector{Float64}}
emissions::Dict{String,Vector{Float64}}
energy::Vector{Float64}
index::Int64
initial_capacity::Float64
input::Product
latitude::Float64
location_name::String
longitude::Float64
output::Dict{Product,Float64}
plant_name::String
sizes::Vector{PlantSize}
storage_cost::Vector{Float64}
storage_limit::Float64
end
using OrderedCollections
abstract type DistanceMetric end
@@ -63,11 +9,67 @@ end
mutable struct EuclideanDistance <: DistanceMetric end
Base.@kwdef mutable struct Instance
building_period::Vector{Int64}
collection_centers::Vector{CollectionCenter}
distance_metric::DistanceMetric
plants::Vector{Plant}
products::Vector{Product}
time::Int64
Base.@kwdef struct Product
name::String
tr_cost::Vector{Float64}
tr_energy::Vector{Float64}
tr_emissions::OrderedDict{String,Vector{Float64}}
disposal_limit::Vector{Float64}
end
Base.@kwdef struct Center
name::String
latitude::Float64
longitude::Float64
input::Union{Product,Nothing}
outputs::Vector{Product}
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
Base.@kwdef struct PlantCapacity
size::Float64
opening_cost::Vector{Float64}
fix_operating_cost::Vector{Float64}
var_operating_cost::Vector{Float64}
end
Base.@kwdef struct Plant
name::String
latitude::Float64
longitude::Float64
input_mix::OrderedDict{Product,Vector{Float64}}
output::OrderedDict{Product,Vector{Float64}}
emissions::OrderedDict{String,Vector{Float64}}
storage_cost::OrderedDict{Product,Vector{Float64}}
storage_limit::OrderedDict{Product,Vector{Float64}}
disposal_cost::OrderedDict{Product,Vector{Float64}}
disposal_limit::OrderedDict{Product,Vector{Float64}}
capacities::Vector{PlantCapacity}
initial_capacity::Float64
end
Base.@kwdef struct Emissions
name::String
limit::Vector{Float64}
penalty::Vector{Float64}
end
Base.@kwdef struct Instance
building_period::Vector{Int}
centers_by_name::OrderedDict{String,Center}
centers::Vector{Center}
distance_metric::DistanceMetric
products_by_name::OrderedDict{String,Product}
products::Vector{Product}
time_horizon::Int
plants::Vector{Plant}
plants_by_name::OrderedDict{String,Plant}
emissions_by_name::OrderedDict{String,Emissions}
emissions::Vector{Emissions}
end

View File

@@ -1,21 +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 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

View File

@@ -2,287 +2,498 @@
# 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
using JuMP
function build_model(instance::Instance, graph::Graph, optimizer)::JuMP.Model
model = Model(optimizer)
model[:instance] = instance
model[:graph] = graph
create_vars!(model)
create_objective_function!(model)
create_shipping_node_constraints!(model)
create_process_node_constraints!(model)
return model
end
function create_vars!(model::JuMP.Model)
graph, T = model[:graph], model[:instance].time
model[:flow] =
Dict((a, t) => @variable(model, lower_bound = 0) for a in graph.arcs, t = 1:T)
model[:plant_dispose] = Dict(
(n, t) => @variable(
model,
lower_bound = 0,
upper_bound = n.location.disposal_limit[n.product][t]
) for n in values(graph.plant_shipping_nodes), t = 1:T
)
model[:collection_dispose] = Dict(
(n, t) => @variable(model, lower_bound = 0,) for
n in values(graph.collection_shipping_nodes), t = 1:T
)
model[:store] = Dict(
(n, t) =>
@variable(model, lower_bound = 0, upper_bound = n.location.storage_limit)
for n in values(graph.process_nodes), t = 1:T
)
model[:process] = Dict(
(n, t) => @variable(model, lower_bound = 0) for
n in values(graph.process_nodes), t = 1:T
)
model[:open_plant] = Dict(
(n, t) => @variable(model, binary = true) for n in values(graph.process_nodes),
t = 1:T
)
model[:is_open] = Dict{Tuple,Any}(
(n, t) => @variable(model, binary = true) for n in values(graph.process_nodes),
t = 1:T
)
model[:capacity] = Dict(
(n, t) => @variable(
model,
lower_bound = 0,
upper_bound = n.location.sizes[2].capacity
) for n in values(graph.process_nodes), t = 1:T
)
model[:expansion] = Dict{Tuple,Any}(
(n, t) => @variable(
model,
lower_bound = 0,
upper_bound = n.location.sizes[2].capacity - n.location.sizes[1].capacity
) for n in values(graph.process_nodes), t = 1:T
)
# Boundary constants
for n in values(graph.process_nodes)
m_init = n.location.initial_capacity
m_min = n.location.sizes[1].capacity
model[:is_open][n, 0] = m_init == 0 ? 0 : 1
model[:expansion][n, 0] = max(0, m_init - m_min)
function R_expand(p::Plant, t::Int)
denominator = p.capacities[2].size - p.capacities[1].size
if denominator == 0
return 0.0
end
return (p.capacities[2].opening_cost[t] - p.capacities[1].opening_cost[t]) / denominator
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)
function R_fix_exp(p::Plant, t::Int)
denominator = p.capacities[2].size - p.capacities[1].size
if denominator == 0
return 0.0
end
return (p.capacities[2].fix_operating_cost[t] - p.capacities[1].fix_operating_cost[t]) /
denominator
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)
function build_model(instance::Instance; optimizer, variable_names::Bool = false)
model = JuMP.Model(optimizer)
centers = instance.centers
products = instance.products
plants = instance.plants
T = 1:instance.time_horizon
model.ext[:instance] = instance
# Constants
# -------------------------------------------------------------------------
K_cap_min = Dict(p => p.capacities[1].size for p in plants)
K_cap_max = Dict(p => p.capacities[2].size for p in plants)
R_open = Dict((p, t) => p.capacities[1].opening_cost[t] for p in plants for t in T)
R_fix_min =
Dict((p, t) => p.capacities[1].fix_operating_cost[t] for p in plants for t in T)
# Transportation edges
# -------------------------------------------------------------------------
# Connectivity
model.ext[:E] = E = []
model.ext[:E_in] = E_in = Dict(src => [] for src in plants centers)
model.ext[:E_out] = E_out = Dict(src => [] for src in plants centers)
function push_edge!(src, dst, m)
push!(E, (src, dst, m))
push!(E_out[src], (dst, m))
push!(E_in[dst], (src, m))
end
end
function create_objective_function!(model::JuMP.Model)
graph, T = model[:graph], model[:instance].time
obj = AffExpr(0.0)
for m in products
for p1 in plants
m keys(p1.output) || continue
# Process node costs
for n in values(graph.process_nodes), t = 1:T
# Plant to plant
for p2 in plants
p1 != p2 || continue
m keys(p2.input_mix) || continue
push_edge!(p1, p2, m)
end
# Transportation and variable operating costs
for a in n.incoming_arcs
c = n.location.input.transportation_cost[t] * a.values["distance"]
add_to_expression!(obj, c, model[:flow][a, t])
# Plant to center
for c in centers
m == c.input || continue
push_edge!(p1, c, m)
end
end
# Opening costs
add_to_expression!(
obj,
n.location.sizes[1].opening_cost[t],
model[:open_plant][n, t],
)
for c1 in centers
m c1.outputs || continue
# Fixed operating costs (base)
add_to_expression!(
obj,
n.location.sizes[1].fixed_operating_cost[t],
model[:is_open][n, t],
)
# Center to plant
for p in plants
m keys(p.input_mix) || continue
push_edge!(c1, p, m)
end
# Fixed operating costs (expansion)
add_to_expression!(obj, slope_fix_oper_cost(n.location, t), model[:expansion][n, t])
# Processing costs
add_to_expression!(
obj,
n.location.sizes[1].variable_operating_cost[t],
model[:process][n, t],
)
# Storage costs
add_to_expression!(obj, n.location.storage_cost[t], model[:store][n, t])
# Expansion costs
if t < T
add_to_expression!(
obj,
slope_open(n.location, t) - slope_open(n.location, t + 1),
model[:expansion][n, t],
)
else
add_to_expression!(obj, slope_open(n.location, t), model[:expansion][n, t])
add_to_expression!(obj, -slope_open(n.location, 1) * model[:expansion][n, 0])
# Center to center
for c2 in centers
m == c2.input || continue
push_edge!(c1, c2, m)
end
end
end
# Plant shipping node costs
for n in values(graph.plant_shipping_nodes), t = 1:T
# Distances
model.ext[:distances] = distances = Dict()
for (p1, p2, m) in E
d = _calculate_distance(
p1.latitude,
p1.longitude,
p2.latitude,
p2.longitude,
instance.distance_metric,
)
distances[p1, p2, m] = d
end
# Disposal costs
# Decision variables
# -------------------------------------------------------------------------
# Plant p is operational at time t
x = _init(model, :x)
for p in plants
x[p.name, 0] = p.initial_capacity > 0 ? 1 : 0
end
for p in plants, t in T
x[p.name, t] = @variable(model, binary = true)
end
# Amount of product m sent from center/plant u to center/plant v at time T
y = _init(model, :y)
for (p1, p2, m) in E, t in T
y[p1.name, p2.name, m.name, t] = @variable(model, lower_bound = 0)
end
# Amount of product m produced by plant/center at time T
z_prod = _init(model, :z_prod)
for p in plants, m in keys(p.output), t in T
z_prod[p.name, m.name, t] = @variable(model, lower_bound = 0)
end
# Amount of product m disposed at plant/center p at time T
z_disp = _init(model, :z_disp)
for p in plants, m in keys(p.output), t in T
z_disp[p.name, m.name, t] = @variable(model, lower_bound = 0)
end
for c in centers, m in c.outputs, t in T
z_disp[c.name, m.name, t] = @variable(model, lower_bound = 0)
end
# Total plant/center input
z_input = _init(model, :z_input)
for p in plants, t in T
z_input[p.name, t] = @variable(model, lower_bound = 0)
end
for c in centers, t in T
z_input[c.name, t] = @variable(model, lower_bound = 0)
end
# Plant expansion
z_exp = _init(model, :z_exp)
for p in plants
z_exp[p.name, 0] = max(0, p.initial_capacity - K_cap_min[p])
end
for p in plants, t in T
z_exp[p.name, t] = @variable(model, lower_bound = 0)
end
# Total amount collected by the center
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)
end
# Amount of input material stored at plant at end of time period
z_storage = _init(model, :z_storage)
for p in plants
for m in keys(p.input_mix)
z_storage[p.name, m.name, 0] = 0 # Initial storage is zero
end
end
for p in plants, m in keys(p.input_mix), t in T
z_storage[p.name, m.name, t] = @variable(model, lower_bound = 0)
end
# Total amount of input material processed by plant
z_process = _init(model, :z_process)
for p in plants, t in T
z_process[p.name, t] = @variable(model, lower_bound = 0)
end
# Transportation emissions by greenhouse gas
z_em_tr = _init(model, :z_em_tr)
for (p1, p2, m) in E, t in T, g in keys(m.tr_emissions)
z_em_tr[g, p1.name, p2.name, m.name, t] = @variable(model, lower_bound = 0)
end
# Plant emissions by greenhouse gas
z_em_plant = _init(model, :z_em_plant)
for p in plants, t in T, g in keys(p.emissions)
z_em_plant[g, p.name, t] = @variable(model, lower_bound = 0)
end
# Objective function
# -------------------------------------------------------------------------
obj = AffExpr()
# Transportation cost
for (p1, p2, m) in E, t in T
add_to_expression!(
obj,
n.location.disposal_cost[n.product][t],
model[:plant_dispose][n, t],
distances[p1, p2, m] * m.tr_cost[t],
y[p1.name, p2.name, m.name, t],
)
end
# Collection shipping node costs
for n in values(graph.collection_shipping_nodes), t = 1:T
# Center: Revenue
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
# Acquisition costs
# Center: Collection cost
for c in centers, (p, m) in E_out[c], t in T
add_to_expression!(obj, c.collection_cost[m][t], y[c.name, p.name, m.name, t])
end
# Center: Disposal cost
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
# Center: Operating cost
for c in centers, t in T
add_to_expression!(obj, c.operating_cost[t])
end
# Plants: Disposal cost
for p in plants, m in keys(p.output), t in T
add_to_expression!(obj, p.disposal_cost[m][t], z_disp[p.name, m.name, t])
end
# Plants: Opening cost
for p in plants, t in T
add_to_expression!(obj, R_open[p, t], (x[p.name, t] - x[p.name, t-1]))
end
# Plants: Fixed operating cost
for p in plants, t in T
add_to_expression!(obj, R_fix_min[p, t], x[p.name, t])
add_to_expression!(obj, R_fix_exp(p, t), z_exp[p.name, t])
end
# Plants: Expansion cost
for p in plants, t in T
add_to_expression!(obj, R_expand(p, t), z_exp[p.name, t] - z_exp[p.name, t-1])
end
# Plants: Variable operating cost
for p in plants, (src, m) in E_in[p], t in T
add_to_expression!(
obj,
n.location.product.acquisition_cost[t] * n.location.amount[t],
p.capacities[1].var_operating_cost[t],
y[src.name, p.name, m.name, t],
)
end
# Disposal costs -- in this case, we recover the acquisition cost.
add_to_expression!(
obj,
(n.location.product.disposal_cost[t] - n.location.product.acquisition_cost[t]),
model[:collection_dispose][n, t],
)
# Plants: Storage cost
for p in plants, m in keys(p.storage_cost), t in T
add_to_expression!(obj, p.storage_cost[m][t], z_storage[p.name, m.name, t])
end
# Emissions penalty cost
for emission in instance.emissions, t in T
# Plant emissions penalty
for p in plants
if emission.name in keys(p.emissions)
add_to_expression!(
obj,
emission.penalty[t],
z_em_plant[emission.name, p.name, t],
)
end
end
# Transportation emissions penalty
for (p1, p2, m) in E
if emission.name in keys(m.tr_emissions)
add_to_expression!(
obj,
emission.penalty[t],
z_em_tr[emission.name, p1.name, p2.name, m.name, t],
)
end
end
end
@objective(model, Min, obj)
end
# Constraints
# -------------------------------------------------------------------------
function create_shipping_node_constraints!(model::JuMP.Model)
graph, T = model[:graph], model[:instance].time
model[:eq_balance] = OrderedDict()
for t = 1:T
# Collection centers
for n in graph.collection_shipping_nodes
model[:eq_balance][n, t] = @constraint(
model,
sum(model[:flow][a, t] for a in n.outgoing_arcs) ==
n.location.amount[t] + model[:collection_dispose][n, t]
# Plants: Definition of total plant input
eq_z_input = _init(model, :eq_z_input)
for p in plants, t in T
eq_z_input[p.name, t] = @constraint(
model,
z_input[p.name, t] ==
sum(y[src.name, p.name, m.name, t] for (src, m) in E_in[p])
)
end
# Plants: Definition of total processing amount
eq_z_process = _init(model, :eq_z_process)
for p in plants, t in T
eq_z_process[p.name, t] = @constraint(
model,
z_process[p.name, t] ==
z_input[p.name, t] + sum(
z_storage[p.name, m.name, t-1] - z_storage[p.name, m.name, t] for
m in keys(p.input_mix)
)
end
for prod in model[:instance].products
if isempty(prod.collection_centers)
continue
end
expr = AffExpr()
for center in prod.collection_centers
n = graph.collection_center_to_node[center]
add_to_expression!(expr, model[:collection_dispose][n, t])
end
@constraint(model, expr <= prod.disposal_limit[t])
end
)
end
# Plants
for n in graph.plant_shipping_nodes
@constraint(
model,
sum(model[:flow][a, t] for a in n.incoming_arcs) ==
sum(model[:flow][a, t] for a in n.outgoing_arcs) +
model[:plant_dispose][n, t]
)
# Plants: Processing mix must have correct proportion
eq_process_mix = _init(model, :eq_process_mix)
for p in plants, m in keys(p.input_mix), t in T
eq_process_mix[p.name, m.name, t] = @constraint(
model,
sum(y[src.name, p.name, m.name, t] for (src, m2) in E_in[p] if m == m2) +
z_storage[p.name, m.name, t-1] - z_storage[p.name, m.name, t] ==
z_process[p.name, t] * p.input_mix[m][t]
)
end
# Plants: Calculate amount produced
eq_z_prod = _init(model, :eq_z_prod)
for p in plants, m in keys(p.output), t in T
eq_z_prod[p.name, m.name, t] = @constraint(
model,
z_prod[p.name, m.name, t] == z_process[p.name, t] * p.output[m][t]
)
end
# Plants: Produced material must be sent or disposed
eq_balance = _init(model, :eq_balance)
for p in plants, m in keys(p.output), t in T
eq_balance[p.name, m.name, t] = @constraint(
model,
z_prod[p.name, m.name, 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
# Plants: Expansion upper bound
eq_exp_ub = _init(model, :eq_exp_ub)
for p in plants, t in T
eq_exp_ub[p.name, t] = @constraint(
model,
z_exp[p.name, t] <= (K_cap_max[p] - K_cap_min[p]) * x[p.name, t]
)
end
# Plants: Processing limit
eq_process_limit = _init(model, :eq_process_limit)
for p in plants, t in T
eq_process_limit[p.name, t] = @constraint(
model,
z_process[p.name, t] <= K_cap_min[p] * x[p.name, t] + z_exp[p.name, t]
)
end
# Plants: Disposal limit
eq_disposal_limit = _init(model, :eq_disposal_limit)
for p in plants, m in keys(p.output), t in T
isfinite(p.disposal_limit[m][t]) || continue
eq_disposal_limit[p.name, m.name, t] =
@constraint(model, z_disp[p.name, m.name, t] <= p.disposal_limit[m][t])
end
# Plants: Plant remains open
eq_keep_open = _init(model, :eq_keep_open)
for p in plants, t in T
eq_keep_open[p.name, t] = @constraint(model, x[p.name, t] >= x[p.name, t-1])
end
# Plants: Capacity cannot decrease over time
eq_capacity_nondecreasing = _init(model, :eq_capacity_nondecreasing)
for p in plants, t in T
eq_capacity_nondecreasing[p.name, t] =
@constraint(model, z_exp[p.name, t] >= z_exp[p.name, t-1])
end
# Plants: Building period
eq_building_period = _init(model, :eq_building_period)
for p in plants, t in T
if t instance.building_period
eq_building_period[p.name, t] =
@constraint(model, x[p.name, t] - x[p.name, t-1] <= 0)
end
end
end
function create_process_node_constraints!(model::JuMP.Model)
graph, T = model[:graph], model[:instance].time
for t = 1:T, n in graph.process_nodes
input_sum = AffExpr(0.0)
for a in n.incoming_arcs
add_to_expression!(input_sum, 1.0, model[:flow][a, t])
end
# Output amount is implied by amount processed
for a in n.outgoing_arcs
@constraint(
model,
model[:flow][a, t] == a.values["weight"] * model[:process][n, t]
)
end
# If plant is closed, capacity is zero
@constraint(
# Centers: Definition of total center input
eq_z_input = _init(model, :eq_z_input)
for c in centers, t in T
eq_z_input[c.name, t] = @constraint(
model,
model[:capacity][n, t] <= n.location.sizes[2].capacity * model[:is_open][n, t]
z_input[c.name, t] ==
sum(y[src.name, c.name, m.name, t] for (src, m) in E_in[c])
)
end
# If plant is open, capacity is greater than base
@constraint(
# Centers: Calculate amount collected
eq_z_collected = _init(model, :eq_z_collected)
for c in centers, m in c.outputs, t in T
M = length(c.var_output[m])
eq_z_collected[c.name, m.name, t] = @constraint(
model,
model[:capacity][n, t] >= n.location.sizes[1].capacity * model[:is_open][n, t]
z_collected[c.name, m.name, t] ==
sum(
z_input[c.name, t-offset] * c.var_output[m][offset+1] for
offset = 0:min(M-1, t-1)
) + c.fixed_output[m][t]
)
end
# Capacity is linked to expansion
@constraint(
# Centers: Collected products must be disposed or sent
eq_balance = _init(model, :eq_balance)
for c in centers, m in c.outputs, t in T
eq_balance[c.name, m.name, t] = @constraint(
model,
model[:capacity][n, t] <=
n.location.sizes[1].capacity + model[:expansion][n, t]
z_collected[c.name, m.name, t] ==
sum(y[c.name, dst.name, m.name, t] for (dst, m2) in E_out[c] if m == m2) +
z_disp[c.name, m.name, t]
)
end
# Can only process up to capacity
@constraint(model, model[:process][n, t] <= model[:capacity][n, t])
# Centers: Disposal limit
eq_disposal_limit = _init(model, :eq_disposal_limit)
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] =
@constraint(model, z_disp[c.name, m.name, t] <= c.disposal_limit[m][t])
end
# Plant capacity can only increase over time
if t > 1
@constraint(model, model[:capacity][n, t] >= model[:capacity][n, t-1])
end
@constraint(model, model[:expansion][n, t] >= model[:expansion][n, t-1])
# Amount received equals amount processed plus stored
store_in = 0
if t > 1
store_in = model[:store][n, t-1]
end
if t == T
@constraint(model, model[:store][n, t] == 0)
end
@constraint(
# Global disposal limit
eq_disposal_limit = _init(model, :eq_disposal_limit)
for m in products, t in T
isfinite(m.disposal_limit[t]) || continue
eq_disposal_limit[m.name, t] = @constraint(
model,
input_sum + store_in == model[:store][n, t] + model[:process][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]
)
end
# Plant is currently open if it was already open in the previous time period or
# if it was built just now
@constraint(
# Transportation emissions
eq_emission_tr = _init(model, :eq_emission_tr)
for (p1, p2, m) in E, t in T, g in keys(m.tr_emissions)
eq_emission_tr[g, p1.name, p2.name, m.name, t] = @constraint(
model,
model[:is_open][n, t] == model[:is_open][n, t-1] + model[:open_plant][n, t]
z_em_tr[g, p1.name, p2.name, m.name, t] ==
distances[p1, p2, m] * m.tr_emissions[g][t] * y[p1.name, p2.name, m.name, t]
)
end
# Plant can only be opened during building period
if t model[:instance].building_period
@constraint(model, model[:open_plant][n, t] == 0)
# Plant emissions
eq_emission_plant = _init(model, :eq_emission_plant)
for p in plants, t in T, g in keys(p.emissions)
eq_emission_plant[g, p.name, t] = @constraint(
model,
z_em_plant[g, p.name, t] == p.emissions[g][t] * z_process[p.name, t]
)
end
# Storage limit at plants
eq_storage_limit = _init(model, :eq_storage_limit)
for p in plants, m in keys(p.storage_limit), t in T
if isfinite(p.storage_limit[m][t])
eq_storage_limit[p.name, m.name, t] =
@constraint(model, z_storage[p.name, m.name, t] <= p.storage_limit[m][t])
end
end
# All stored materials must be processed by end of time horizon
eq_storage_final = _init(model, :eq_storage_final)
for p in plants, m in keys(p.input_mix)
eq_storage_final[p.name, m.name] =
@constraint(model, z_storage[p.name, m.name, instance.time_horizon] == 0)
end
# Global emissions limit
eq_emission_limit = _init(model, :eq_emission_limit)
for emission in instance.emissions, t in T
isfinite(emission.limit[t]) || continue
eq_emission_limit[emission.name, t] = @constraint(
model,
sum(
z_em_plant[emission.name, p.name, t] for
p in plants if emission.name in keys(p.emissions)
) + sum(
z_em_tr[emission.name, p1.name, p2.name, m.name, t] for
(p1, p2, m) in E if emission.name in keys(m.tr_emissions)
) <= emission.limit[t]
)
end
if variable_names
_set_names!(model)
end
return model
end

110
src/model/dist.jl Normal file
View File

@@ -0,0 +1,110 @@
# 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

View File

@@ -1,243 +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 JuMP, LinearAlgebra, Geodesy, ProgressBars, Printf, DataStructures
function get_solution(model::JuMP.Model; marginal_costs = true)
graph, instance = model[:graph], model[:instance]
T = instance.time
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(),
),
)
plant_to_process_node = OrderedDict(n.location => n for n in graph.process_nodes)
plant_to_shipping_nodes = OrderedDict()
for p in instance.plants
plant_to_shipping_nodes[p] = []
for a in plant_to_process_node[p].outgoing_arcs
push!(plant_to_shipping_nodes[p], a.dest)
end
end
# Products
for n in graph.collection_shipping_nodes
location_dict = OrderedDict{Any,Any}(
"Latitude (deg)" => n.location.latitude,
"Longitude (deg)" => n.location.longitude,
"Amount (tonne)" => n.location.amount,
"Dispose (tonne)" =>
[JuMP.value(model[:collection_dispose][n, t]) for t = 1:T],
"Acquisition cost (\$)" => [
(n.location.amount[t] - JuMP.value(model[:collection_dispose][n, t])) * n.location.product.acquisition_cost[t] for t = 1:T
],
"Disposal cost (\$)" => [
(
JuMP.value(model[:collection_dispose][n, t]) *
n.location.product.disposal_cost[t]
) for t = 1:T
],
)
if marginal_costs
location_dict["Marginal cost (\$/tonne)"] = [
round(abs(JuMP.shadow_price(model[:eq_balance][n, t])), digits = 2) for
t = 1:T
]
end
if n.product.name keys(output["Products"])
output["Products"][n.product.name] = OrderedDict()
end
output["Products"][n.product.name][n.location.name] = location_dict
end
# Plants
for plant in instance.plants
skip_plant = true
process_node = plant_to_process_node[plant]
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)" =>
[JuMP.value(model[:capacity][process_node, t]) for t = 1:T],
"Opening cost (\$)" => [
JuMP.value(model[:open_plant][process_node, t]) *
plant.sizes[1].opening_cost[t] for t = 1:T
],
"Fixed operating cost (\$)" => [
JuMP.value(model[:is_open][process_node, t]) *
plant.sizes[1].fixed_operating_cost[t] +
JuMP.value(model[:expansion][process_node, t]) *
slope_fix_oper_cost(plant, t) for t = 1:T
],
"Expansion cost (\$)" => [
(
if t == 1
slope_open(plant, t) * (
JuMP.value(model[:expansion][process_node, t]) -
model[:expansion][process_node, 0]
)
else
slope_open(plant, t) * (
JuMP.value(model[:expansion][process_node, t]) -
JuMP.value(model[:expansion][process_node, t-1])
)
end
) for t = 1:T
],
"Process (tonne)" =>
[JuMP.value(model[:process][process_node, t]) for t = 1:T],
"Variable operating cost (\$)" => [
JuMP.value(model[:process][process_node, t]) *
plant.sizes[1].variable_operating_cost[t] for t = 1:T
],
"Storage (tonne)" =>
[JuMP.value(model[:store][process_node, t]) for t = 1:T],
"Storage cost (\$)" => [
JuMP.value(model[:store][process_node, 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 = [JuMP.value(model[:flow][a, 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 shipping_node in plant_to_shipping_nodes[plant]
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 =
[JuMP.value(model[:plant_dispose][shipping_node, 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)"] =
[JuMP.value(model[:plant_dispose][shipping_node, 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 = [JuMP.value(model[:flow][a, 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

120
src/model/jumpext.jl Normal file
View File

@@ -0,0 +1,120 @@
# 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(::Number, ::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
"""
_add_pwl_constraints(model, xvar, yvars, xpts, ypts)
Add piecewise-linear constraints to a JuMP model for multiple y variables.
Creates constraints y_i = f_i(x) where each f_i is a piecewise-linear function
defined by the breakpoints (xpts, ypts[:, i]).
# Arguments
- `model`: JuMP model
- `xvar`: The x variable (JuMP variable)
- `yvars`: Vector of y variables (JuMP variables)
- `xpts`: Vector of x values for breakpoints (must be in non-decreasing order)
- `ypts`: Matrix of y values where ypts[i, j] is the y value for the j-th variable
at the i-th breakpoint
# Example
```julia
@variable(model, y1)
@variable(model, y2)
ypts_matrix = [1.5 2.0; 0.0 1.5; 3.0 0.5] # 3 breakpoints, 2 y variables
_add_pwl_constraints(model, x, [y1, y2], [0.0, 1.0, 2.0], ypts_matrix, name="multiPWL")
```
"""
function _add_pwl_constraints(model, xvar, yvars, xpts, ypts)
# Input validation
ypts isa AbstractMatrix || throw(ArgumentError("ypts must be a matrix"))
length(xpts) == size(ypts, 1) ||
throw(ArgumentError("xpts length must match number of rows in ypts"))
length(yvars) == size(ypts, 2) ||
throw(ArgumentError("Number of y variables must match number of columns in ypts"))
length(xpts) >= 1 || throw(ArgumentError("At least one breakpoint is required"))
# Check that xpts is increasing
for i = 2:length(xpts)
xpts[i] > xpts[i-1] || throw(ArgumentError("xpts must be in increasing order"))
end
n_points = length(xpts)
n_yvars = length(yvars)
if n_points == 1
# Single point case: y_j = ypts[1,j], x = xpts[1]
@constraint(model, xvar == xpts[1])
for j = 1:n_yvars
@constraint(model, yvars[j] == ypts[1, j])
end
elseif n_points == 2
# Two points case: single linear segment for each y variable
x1, x2 = xpts[1], xpts[2]
# Linear relationship for each y variable: y_j = y1_j + slope_j * (x-x1)
for j = 1:n_yvars
y1, y2 = ypts[1, j], ypts[2, j]
slope = (y2 - y1) / (x2 - x1)
@constraint(model, yvars[j] == y1 + slope * (xvar - x1))
end
else
# Multiple segments case (3+ points): use SOS2 formulation
λ = @variable(model, [1:n_points], lower_bound = 0, upper_bound = 1)
@constraint(model, λ in SOS2())
@constraint(model, sum(λ) == 1)
@constraint(model, xvar == sum(xpts[i] * λ[i] for i = 1:n_points))
for j = 1:n_yvars
@constraint(model, yvars[j] == sum(ypts[i, j] * λ[i] for i = 1:n_points))
end
end
return
end

View File

@@ -1,99 +0,0 @@
# RELOG: Reverse Logistics Optimization
# Copyright (C) 2020-2021, UChicago Argonne, LLC. All rights reserved.
# Released under the modified BSD license. See COPYING.md for more details.
using JuMP
function resolve(model_old, filename::AbstractString; kwargs...)::OrderedDict
@info "Reading $filename..."
instance = RELOG.parsefile(filename)
return resolve(model_old, instance; kwargs...)
end
function resolve(model_old, instance::Instance; optimizer = nothing)::OrderedDict
milp_optimizer = lp_optimizer = optimizer
if optimizer === nothing
milp_optimizer = _get_default_milp_optimizer()
lp_optimizer = _get_default_lp_optimizer()
end
@info "Building new graph..."
graph = build_graph(instance)
_print_graph_stats(instance, graph)
@info "Building new optimization model..."
model_new = RELOG.build_model(instance, graph, milp_optimizer)
@info "Fixing decision variables..."
_fix_plants!(model_old, model_new)
JuMP.set_optimizer(model_new, lp_optimizer)
@info "Optimizing MILP..."
JuMP.optimize!(model_new)
if !has_values(model_new)
@warn("No solution available")
return OrderedDict()
end
@info "Extracting solution..."
solution = get_solution(model_new, marginal_costs = true)
return solution
end
function _fix_plants!(model_old, model_new)::Nothing
T = model_new[:instance].time
# Fix open_plant variables
for ((node_old, t), var_old) in model_old[:open_plant]
value_old = JuMP.value(var_old)
node_new = model_new[:graph].name_to_process_node_map[(
node_old.location.plant_name,
node_old.location.location_name,
)]
var_new = model_new[:open_plant][node_new, t]
JuMP.unset_binary(var_new)
JuMP.fix(var_new, value_old)
end
# Fix is_open variables
for ((node_old, t), var_old) in model_old[:is_open]
t > 0 || continue
value_old = JuMP.value(var_old)
node_new = model_new[:graph].name_to_process_node_map[(
node_old.location.plant_name,
node_old.location.location_name,
)]
var_new = model_new[:is_open][node_new, t]
JuMP.unset_binary(var_new)
JuMP.fix(var_new, value_old)
end
# Fix plant capacities
for ((node_old, t), var_old) in model_old[:capacity]
value_old = JuMP.value(var_old)
node_new = model_new[:graph].name_to_process_node_map[(
node_old.location.plant_name,
node_old.location.location_name,
)]
var_new = model_new[:capacity][node_new, t]
JuMP.delete_lower_bound(var_new)
JuMP.delete_upper_bound(var_new)
JuMP.fix(var_new, value_old)
end
# Fix plant expansion
for ((node_old, t), var_old) in model_old[:expansion]
t > 0 || continue
value_old = JuMP.value(var_old)
node_new = model_new[:graph].name_to_process_node_map[(
node_old.location.plant_name,
node_old.location.location_name,
)]
var_new = model_new[:expansion][node_new, t]
JuMP.delete_lower_bound(var_new)
JuMP.delete_upper_bound(var_new)
JuMP.fix(var_new, value_old)
end
end

View File

@@ -1,126 +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 JuMP, LinearAlgebra, Geodesy, ProgressBars, Printf, DataStructures, HiGHS
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(
instance::Instance;
optimizer = nothing,
lp_optimizer = nothing,
output = nothing,
marginal_costs = true,
return_model = false,
)
if lp_optimizer == nothing
if optimizer == nothing
# If neither is provided, use default LP optimizer.
lp_optimizer = _get_default_lp_optimizer()
else
# If only MIP optimizer is provided, use it as
# LP solver too.
lp_optimizer = optimizer
end
end
if optimizer == nothing
optimizer = _get_default_milp_optimizer()
end
@info "Building graph..."
graph = RELOG.build_graph(instance)
_print_graph_stats(instance, graph)
@info "Building optimization model..."
model = RELOG.build_model(instance, graph, optimizer)
@info "Optimizing MILP..."
JuMP.optimize!(model)
if !has_values(model)
error("No solution available")
end
if marginal_costs
@info "Re-optimizing with integer variables fixed..."
all_vars = JuMP.all_variables(model)
vals = OrderedDict(var => JuMP.value(var) for var in all_vars)
JuMP.set_optimizer(model, lp_optimizer)
for var in all_vars
if JuMP.is_binary(var)
JuMP.unset_binary(var)
JuMP.fix(var, vals[var])
end
end
JuMP.optimize!(model)
end
@info "Extracting solution..."
solution = get_solution(model, marginal_costs = marginal_costs)
if output != nothing
write(solution, output)
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, _ = solve(
compressed;
return_model = true,
output = nothing,
marginal_costs = false,
kwargs...,
)
@info "Filtering candidate locations..."
selected_pairs = []
for (plant_name, plant_dict) in csol["Plants"]
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

101
src/reports/centers.jl Normal file
View 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 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))

View File

@@ -1,38 +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 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))

View File

@@ -1,66 +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 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))

View File

@@ -5,75 +5,201 @@
using DataFrames
using CSV
function plants_report(solution)::DataFrame
function plants_report(model)::DataFrame
df = DataFrame()
df."plant type" = String[]
df."location name" = String[]
df."plant" = String[]
df."latitude" = Float64[]
df."longitude" = Float64[]
df."initial capacity" = Float64[]
df."current capacity" = Float64[]
df."year" = Int[]
df."latitude (deg)" = 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."operational?" = Bool[]
df."input amount (tonne)" = Float64[]
df."stored amount (tonne)" = Float64[]
df."processed amount (tonne)" = Float64[]
df."opening cost (\$)" = Float64[]
df."expansion cost (\$)" = Float64[]
df."fixed operating cost (\$)" = Float64[]
df."variable operating cost (\$)" = Float64[]
df."expansion cost (\$)" = Float64[]
df."storage cost (\$)" = Float64[]
df."total 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 year = 1:T
capacity = round(location_dict["Capacity (tonne)"][year], digits = 2)
received = round(location_dict["Total input (tonne)"][year], digits = 2)
processed = round(location_dict["Process (tonne)"][year], digits = 2)
in_storage = round(location_dict["Storage (tonne)"][year], digits = 2)
utilization_factor = round(processed / capacity * 100.0, digits = 2)
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
plants = model.ext[:instance].plants
T = 1:model.ext[:instance].time_horizon
for p in plants, t in T
operational = JuMP.value(model[:x][p.name, t]) > 0.5
input = value(model[:z_input][p.name, t])
processed = value(model[:z_process][p.name, t])
# Calculate total stored amount across all input materials
stored = sum(value(model[:z_storage][p.name, m.name, t]) for m in keys(p.input_mix))
# Calculate total storage cost
storage_cost = sum(
p.storage_cost[m][t] * value(model[:z_storage][p.name, m.name, t]) for
m in keys(p.storage_cost)
)
var_operating_cost = input * p.capacities[1].var_operating_cost[t]
opening_cost = 0
curr_capacity = 0
expansion_cost = 0
fix_operating_cost = 0
if value(model[:x][p.name, t]) > 0.5 && value(model[:x][p.name, t-1]) < 0.5
opening_cost = p.capacities[1].opening_cost[t]
end
if operational
curr_expansion = JuMP.value(model[:z_exp][p.name, t])
prev_expansion = JuMP.value(model[:z_exp][p.name, t-1])
curr_capacity = p.capacities[1].size + curr_expansion
expansion_cost = R_expand(p, t) * (curr_expansion - prev_expansion)
fix_operating_cost =
p.capacities[1].fix_operating_cost[t] + R_fix_exp(p, t) * curr_expansion
end
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),
"stored amount (tonne)" => _round(stored),
"processed amount (tonne)" => _round(processed),
"opening cost (\$)" => _round(opening_cost),
"fixed operating cost (\$)" => _round(fix_operating_cost),
"variable operating cost (\$)" => _round(var_operating_cost),
"expansion cost (\$)" => _round(expansion_cost),
"storage cost (\$)" => _round(storage_cost),
),
)
end
return df
end
function plant_inputs_report(model)::DataFrame
df = DataFrame()
df."plant" = String[]
df."latitude" = Float64[]
df."longitude" = Float64[]
df."input product" = String[]
df."year" = Int[]
df."amount received (tonne)" = Float64[]
df."current storage level (tonne)" = Float64[]
df."storage limit (tonne)" = Float64[]
df."storage cost (\$)" = Float64[]
plants = model.ext[:instance].plants
T = 1:model.ext[:instance].time_horizon
for p in plants, m in keys(p.input_mix), t in T
amount_received = sum(
value(model[:y][src.name, p.name, m.name, t]) for
(src, prod) in model.ext[:E_in][p] if prod == m
)
storage_level = value(model[:z_storage][p.name, m.name, t])
storage_cost = p.storage_cost[m][t] * storage_level
push!(
df,
Dict(
"plant" => p.name,
"latitude" => p.latitude,
"longitude" => p.longitude,
"input product" => m.name,
"year" => t,
"amount received (tonne)" => _round(amount_received),
"current storage level (tonne)" => _round(storage_level),
"storage limit (tonne)" => _round(p.storage_limit[m][t]),
"storage cost (\$)" => _round(storage_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
return df
end
function plant_emissions_report(model)::DataFrame
df = DataFrame()
df."plant" = String[]
df."latitude" = Float64[]
df."longitude" = Float64[]
df."emission" = String[]
df."year" = Int[]
df."processed amount (tonne)" = Float64[]
df."emission factor (tonne/tonne)" = Float64[]
df."emissions amount (tonne)" = Float64[]
plants = model.ext[:instance].plants
T = 1:model.ext[:instance].time_horizon
for p in plants, t in T, g in keys(p.emissions)
processed_amount = JuMP.value(model[:z_process][p.name, t])
processed_amount > 1e-3 || continue
emissions = JuMP.value(model[:z_em_plant][g, p.name, t])
emission_factor = p.emissions[g][t]
push!(
df,
Dict(
"plant" => p.name,
"latitude" => p.latitude,
"longitude" => p.longitude,
"emission" => g,
"year" => t,
"processed amount (tonne)" => _round(processed_amount),
"emission factor (tonne/tonne)" => _round(emission_factor),
"emissions amount (tonne)" => _round(emissions),
),
)
end
return df
end
write_plants_report(solution, filename) = CSV.write(filename, plants_report(solution))
write_plant_inputs_report(solution, filename) =
CSV.write(filename, plant_inputs_report(solution))
write_plant_outputs_report(solution, filename) =
CSV.write(filename, plant_outputs_report(solution))
write_plant_emissions_report(solution, filename) =
CSV.write(filename, plant_emissions_report(solution))

View File

@@ -1,52 +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 products_report(solution; marginal_costs = true)::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."amount disposed (tonne)" = Float64[]
df."marginal cost (\$/tonne)" = Float64[]
df."acquisition cost (\$)" = 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 = location_dict["Marginal cost (\$/tonne)"][year]
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]
acquisition_cost = location_dict["Acquisition cost (\$)"][year]
disposal_cost = location_dict["Disposal cost (\$)"][year]
push!(
df,
[
prod_name,
location_name,
latitude,
longitude,
year,
amount,
marginal_cost,
amount_disposed,
acquisition_cost,
disposal_cost,
],
)
end
end
end
return df
end
write_products_report(solution, filename) = CSV.write(filename, products_report(solution))

View File

@@ -1,75 +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(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))

View File

@@ -1,71 +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_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))

View File

@@ -0,0 +1,99 @@
# 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_em_tr][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))

View File

@@ -1,14 +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
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

View File

@@ -1,192 +0,0 @@
{
"$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"
},
"distance metric": {
"type": "string"
}
},
"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"
},
"initial capacity (tonne)": {
"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"
},
"acquisition 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"]
}

View File

@@ -1,116 +0,0 @@
println("Initializing...")
using Logging
using JSON
using JuMP
using HiGHS
using RELOG
function solve(root, filename)
ref_file = "$root/$filename"
optimizer = optimizer_with_attributes(
HiGHS.Optimizer,
"time_limit" => parse(Float64, ENV["RELOG_TIME_LIMIT_SEC"]),
)
ref_solution, ref_model = RELOG.solve(
ref_file,
heuristic = true,
optimizer = optimizer,
lp_optimizer = HiGHS.Optimizer,
return_model = true,
marginal_costs = true,
)
Libc.flush_cstdio()
flush(stdout)
sleep(1)
if length(ref_solution) == 0
return
end
RELOG.write_products_report(ref_solution, replace(ref_file, ".json" => "_products.csv"))
RELOG.write_plants_report(ref_solution, replace(ref_file, ".json" => "_plants.csv"))
RELOG.write_plant_outputs_report(
ref_solution,
replace(ref_file, ".json" => "_plant_outputs.csv"),
)
RELOG.write_plant_emissions_report(
ref_solution,
replace(ref_file, ".json" => "_plant_emissions.csv"),
)
RELOG.write_transportation_report(ref_solution, replace(ref_file, ".json" => "_tr.csv"))
RELOG.write_transportation_emissions_report(
ref_solution,
replace(ref_file, ".json" => "_tr_emissions.csv"),
)
isdir("$root/scenarios") || return
for filename in readdir("$root/scenarios")
scenario = "$root/scenarios/$filename"
endswith(filename, ".json") || continue
sc_solution = RELOG.resolve(
ref_model,
scenario,
optimizer = optimizer,
lp_optimizer = HiGHS.Optimizer,
)
if length(sc_solution) == 0
return
end
RELOG.write_plants_report(sc_solution, replace(scenario, ".json" => "_plants.csv"))
RELOG.write_products_report(
sc_solution,
replace(scenario, ".json" => "_products.csv"),
)
RELOG.write_plant_outputs_report(
sc_solution,
replace(scenario, ".json" => "_plant_outputs.csv"),
)
RELOG.write_plant_emissions_report(
sc_solution,
replace(scenario, ".json" => "_plant_emissions.csv"),
)
RELOG.write_transportation_report(
sc_solution,
replace(scenario, ".json" => "_tr.csv"),
)
RELOG.write_transportation_emissions_report(
sc_solution,
replace(scenario, ".json" => "_tr_emissions.csv"),
)
end
end
function solve_recursive(path)
cd(path)
# Solve instances
for (root, dirs, files) in walkdir(".")
if occursin(r"scenarios"i, root)
continue
end
for filename in files
endswith(filename, ".json") || continue
solve(root, filename)
end
end
# Collect results
results = []
for (root, dirs, files) in walkdir(".")
for filename in files
endswith(filename, "_plants.csv") || continue
push!(
results,
joinpath(replace(root, path => ""), replace(filename, "_plants.csv" => "")),
)
end
end
open("output.json", "w") do file
JSON.print(file, results)
end
run(`zip -r output.zip .`)
end
solve_recursive(ARGS[1])

View File

@@ -1,65 +0,0 @@
import HTTP
import JSON
using Random
const ROUTER = HTTP.Router()
const PROJECT_DIR = joinpath(dirname(@__FILE__), "..", "..")
const STATIC_DIR = joinpath(PROJECT_DIR, "relog-web", "build", "static")
const JOBS_DIR = joinpath(PROJECT_DIR, "jobs")
function serve_file(req::HTTP.Request, filename)
if isfile(filename)
open(filename) do file
return HTTP.Response(200, read(file))
end
else
return HTTP.Response(404)
end
end
function submit(req::HTTP.Request)
# Generate random job id
job_id = lowercase(randstring(12))
# Create job folder
job_path = joinpath(JOBS_DIR, job_id)
mkpath(job_path)
# Write JSON file
case = JSON.parse(String(req.body))
open(joinpath(job_path, "case.json"), "w") do file
JSON.print(file, case)
end
# Run job
run(
`bash -c "(julia --project=$PROJECT_DIR $PROJECT_DIR/src/web/run.jl $job_path 2>&1 | tee $job_path/solve.log) >/dev/null 2>&1 &"`,
)
response = Dict("job_id" => job_id)
return HTTP.Response(200, body = JSON.json(response))
end
function get_index(req::HTTP.Request)
return serve_file(req, joinpath(STATIC_DIR, "..", "index.html"))
end
function get_static(req::HTTP.Request)
return serve_file(req, joinpath(STATIC_DIR, req.target[9:end]))
end
function get_jobs(req::HTTP.Request)
return serve_file(req, joinpath(JOBS_DIR, req.target[7:end]))
end
HTTP.@register(ROUTER, "GET", "/static", get_static)
HTTP.@register(ROUTER, "GET", "/jobs", get_jobs)
HTTP.@register(ROUTER, "POST", "/submit", submit)
HTTP.@register(ROUTER, "GET", "/", get_index)
function web(host = "127.0.0.1", port = 8080)
@info "Launching web interface: http://$(host):$(port)/"
Base.exit_on_sigint(false)
HTTP.serve(ROUTER, host, port)
Base.exit_on_sigint(true)
end

View File

@@ -1,19 +1,14 @@
name = "RELOGT"
uuid = "a6dae211-05d8-42ed-9081-b88c982fc90a"
uuid = "d5238ab2-e29b-4856-ba0f-d2b80f40b47d"
authors = ["Alinson S. Xavier <git@axavier.org>"]
version = "0.1.0"
[deps]
GZip = "92fee26a-97fe-5a0c-ad85-20a5f3185b63"
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
RELOG = "a2afcdf7-cf04-4913-85f9-c0d81ddf2008"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
RELOG = "7cafaa7a-b311-45f0-b313-80bf15b5e5e5"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[compat]
JuliaFormatter = "1"

188
test/fixtures/boat_example.jl vendored Normal file
View File

@@ -0,0 +1,188 @@
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_inputs_report(model, fixture("boat_example/plant_inputs.csv"))
RELOG.write_plant_outputs_report(model, fixture("boat_example/plant_outputs.csv"))
RELOG.write_plant_emissions_report(model, fixture("boat_example/plant_emissions.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 Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,81 @@
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
1 center latitude longitude output product year amount collected (tonne) amount disposed (tonne) disposal limit (tonne) collection cost ($) disposal cost ($)
2 NailFactory (Chicago) 41.881832 -87.623177 Nail 1 1.0 0.0 Inf 1000.0 0.0
3 NailFactory (Chicago) 41.881832 -87.623177 Nail 2 1.0 0.0 Inf 1000.0 0.0
4 NailFactory (Chicago) 41.881832 -87.623177 Nail 3 1.0 0.0 Inf 1000.0 0.0
5 NailFactory (Chicago) 41.881832 -87.623177 Nail 4 1.0 0.0 Inf 1000.0 0.0
6 NailFactory (Chicago) 41.881832 -87.623177 Nail 5 1.0 0.0 Inf 1000.0 0.0
7 NailFactory (Phoenix) 33.448376 -112.074036 Nail 1 1.0 0.0 Inf 1000.0 0.0
8 NailFactory (Phoenix) 33.448376 -112.074036 Nail 2 1.0 0.0 Inf 1000.0 0.0
9 NailFactory (Phoenix) 33.448376 -112.074036 Nail 3 1.0 0.0 Inf 1000.0 0.0
10 NailFactory (Phoenix) 33.448376 -112.074036 Nail 4 1.0 0.0 Inf 1000.0 0.0
11 NailFactory (Phoenix) 33.448376 -112.074036 Nail 5 1.0 0.0 Inf 1000.0 0.0
12 NailFactory (Dallas) 32.776664 -96.796988 Nail 1 1.0 0.0 Inf 1000.0 0.0
13 NailFactory (Dallas) 32.776664 -96.796988 Nail 2 1.0 0.0 Inf 1000.0 0.0
14 NailFactory (Dallas) 32.776664 -96.796988 Nail 3 1.0 0.0 Inf 1000.0 0.0
15 NailFactory (Dallas) 32.776664 -96.796988 Nail 4 1.0 0.0 Inf 1000.0 0.0
16 NailFactory (Dallas) 32.776664 -96.796988 Nail 5 1.0 0.0 Inf 1000.0 0.0
17 Forest (Chicago) 41.881832 -87.623177 Wood 1 100.0 100.0 Inf 0.0 0.0
18 Forest (Chicago) 41.881832 -87.623177 Wood 2 100.0 100.0 Inf 0.0 0.0
19 Forest (Chicago) 41.881832 -87.623177 Wood 3 100.0 100.0 Inf 0.0 0.0
20 Forest (Chicago) 41.881832 -87.623177 Wood 4 100.0 100.0 Inf 0.0 0.0
21 Forest (Chicago) 41.881832 -87.623177 Wood 5 100.0 100.0 Inf 0.0 0.0
22 Forest (Phoenix) 33.448376 -112.074036 Wood 1 100.0 100.0 Inf 0.0 0.0
23 Forest (Phoenix) 33.448376 -112.074036 Wood 2 100.0 100.0 Inf 0.0 0.0
24 Forest (Phoenix) 33.448376 -112.074036 Wood 3 100.0 100.0 Inf 0.0 0.0
25 Forest (Phoenix) 33.448376 -112.074036 Wood 4 100.0 100.0 Inf 0.0 0.0
26 Forest (Phoenix) 33.448376 -112.074036 Wood 5 100.0 100.0 Inf 0.0 0.0
27 Forest (Dallas) 32.776664 -96.796988 Wood 1 100.0 43.0 Inf 14250.0 0.0
28 Forest (Dallas) 32.776664 -96.796988 Wood 2 100.0 43.0 Inf 14250.0 0.0
29 Forest (Dallas) 32.776664 -96.796988 Wood 3 100.0 43.0 Inf 14250.0 0.0
30 Forest (Dallas) 32.776664 -96.796988 Wood 4 100.0 43.0 Inf 14250.0 0.0
31 Forest (Dallas) 32.776664 -96.796988 Wood 5 100.0 43.0 Inf 14250.0 0.0
32 Retail (Chicago) 41.881832 -87.623177 UsedBoat 1 0.0 0.0 0.0 0.0 0.0
33 Retail (Chicago) 41.881832 -87.623177 UsedBoat 2 0.0 0.0 0.0 0.0 0.0
34 Retail (Chicago) 41.881832 -87.623177 UsedBoat 3 0.0 0.0 0.0 0.0 0.0
35 Retail (Chicago) 41.881832 -87.623177 UsedBoat 4 0.0 0.0 0.0 0.0 0.0
36 Retail (Chicago) 41.881832 -87.623177 UsedBoat 5 0.0 0.0 0.0 0.0 0.0
37 Retail (New York City) 40.712776 -74.005974 UsedBoat 1 0.0 0.0 0.0 0.0 0.0
38 Retail (New York City) 40.712776 -74.005974 UsedBoat 2 0.0 0.0 0.0 0.0 0.0
39 Retail (New York City) 40.712776 -74.005974 UsedBoat 3 0.0 0.0 0.0 0.0 0.0
40 Retail (New York City) 40.712776 -74.005974 UsedBoat 4 0.0 0.0 0.0 0.0 0.0
41 Retail (New York City) 40.712776 -74.005974 UsedBoat 5 0.0 0.0 0.0 0.0 0.0
42 Retail (Los Angeles) 34.052235 -118.243683 UsedBoat 1 0.0 0.0 0.0 0.0 0.0
43 Retail (Los Angeles) 34.052235 -118.243683 UsedBoat 2 0.0 0.0 0.0 0.0 0.0
44 Retail (Los Angeles) 34.052235 -118.243683 UsedBoat 3 0.0 0.0 0.0 0.0 0.0
45 Retail (Los Angeles) 34.052235 -118.243683 UsedBoat 4 0.0 0.0 0.0 0.0 0.0
46 Retail (Los Angeles) 34.052235 -118.243683 UsedBoat 5 0.0 0.0 0.0 0.0 0.0
47 Retail (Houston) 29.760427 -95.369804 UsedBoat 1 0.0 0.0 0.0 0.0 0.0
48 Retail (Houston) 29.760427 -95.369804 UsedBoat 2 0.0 0.0 0.0 0.0 0.0
49 Retail (Houston) 29.760427 -95.369804 UsedBoat 3 0.0 0.0 0.0 0.0 0.0
50 Retail (Houston) 29.760427 -95.369804 UsedBoat 4 0.0 0.0 0.0 0.0 0.0
51 Retail (Houston) 29.760427 -95.369804 UsedBoat 5 0.0 0.0 0.0 0.0 0.0
52 Retail (Phoenix) 33.448376 -112.074036 UsedBoat 1 0.0 0.0 0.0 0.0 0.0
53 Retail (Phoenix) 33.448376 -112.074036 UsedBoat 2 0.0 0.0 0.0 0.0 0.0
54 Retail (Phoenix) 33.448376 -112.074036 UsedBoat 3 0.0 0.0 0.0 0.0 0.0
55 Retail (Phoenix) 33.448376 -112.074036 UsedBoat 4 0.0 0.0 0.0 0.0 0.0
56 Retail (Phoenix) 33.448376 -112.074036 UsedBoat 5 0.0 0.0 0.0 0.0 0.0
57 Retail (Philadelphia) 39.952583 -75.165222 UsedBoat 1 0.0 0.0 0.0 0.0 0.0
58 Retail (Philadelphia) 39.952583 -75.165222 UsedBoat 2 0.0 0.0 0.0 0.0 0.0
59 Retail (Philadelphia) 39.952583 -75.165222 UsedBoat 3 0.0 0.0 0.0 0.0 0.0
60 Retail (Philadelphia) 39.952583 -75.165222 UsedBoat 4 0.0 0.0 0.0 0.0 0.0
61 Retail (Philadelphia) 39.952583 -75.165222 UsedBoat 5 0.0 0.0 0.0 0.0 0.0
62 Retail (San Antonio) 29.424122 -98.493629 UsedBoat 1 0.0 0.0 0.0 0.0 0.0
63 Retail (San Antonio) 29.424122 -98.493629 UsedBoat 2 0.0 0.0 0.0 0.0 0.0
64 Retail (San Antonio) 29.424122 -98.493629 UsedBoat 3 0.0 0.0 0.0 0.0 0.0
65 Retail (San Antonio) 29.424122 -98.493629 UsedBoat 4 0.0 0.0 0.0 0.0 0.0
66 Retail (San Antonio) 29.424122 -98.493629 UsedBoat 5 0.0 0.0 0.0 0.0 0.0
67 Retail (San Diego) 32.715736 -117.161087 UsedBoat 1 0.0 0.0 0.0 0.0 0.0
68 Retail (San Diego) 32.715736 -117.161087 UsedBoat 2 0.0 0.0 0.0 0.0 0.0
69 Retail (San Diego) 32.715736 -117.161087 UsedBoat 3 0.0 0.0 0.0 0.0 0.0
70 Retail (San Diego) 32.715736 -117.161087 UsedBoat 4 0.0 0.0 0.0 0.0 0.0
71 Retail (San Diego) 32.715736 -117.161087 UsedBoat 5 0.0 0.0 0.0 0.0 0.0
72 Retail (Dallas) 32.776664 -96.796988 UsedBoat 1 6.31579 0.0 0.0 631.57895 0.0
73 Retail (Dallas) 32.776664 -96.796988 UsedBoat 2 22.93629 0.0 0.0 2293.62881 0.0
74 Retail (Dallas) 32.776664 -96.796988 UsedBoat 3 31.7714 0.0 0.0 3177.13952 0.0
75 Retail (Dallas) 32.776664 -96.796988 UsedBoat 4 33.80867 0.0 0.0 3380.86724 0.0
76 Retail (Dallas) 32.776664 -96.796988 UsedBoat 5 34.54174 0.0 0.0 3454.17409 0.0
77 Retail (San Jose) 37.338208 -121.886329 UsedBoat 1 0.0 0.0 0.0 0.0 0.0
78 Retail (San Jose) 37.338208 -121.886329 UsedBoat 2 0.0 0.0 0.0 0.0 0.0
79 Retail (San Jose) 37.338208 -121.886329 UsedBoat 3 0.0 0.0 0.0 0.0 0.0
80 Retail (San Jose) 37.338208 -121.886329 UsedBoat 4 0.0 0.0 0.0 0.0 0.0
81 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 Normal file
View File

@@ -0,0 +1,81 @@
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
1 center latitude longitude year input product input amount (tonne) revenue ($) operating cost ($)
2 NailFactory (Chicago) 41.881832 -87.623177 1 0.0 0.0 0.0
3 NailFactory (Chicago) 41.881832 -87.623177 2 0.0 0.0 0.0
4 NailFactory (Chicago) 41.881832 -87.623177 3 0.0 0.0 0.0
5 NailFactory (Chicago) 41.881832 -87.623177 4 0.0 0.0 0.0
6 NailFactory (Chicago) 41.881832 -87.623177 5 0.0 0.0 0.0
7 NailFactory (Phoenix) 33.448376 -112.074036 1 0.0 0.0 0.0
8 NailFactory (Phoenix) 33.448376 -112.074036 2 0.0 0.0 0.0
9 NailFactory (Phoenix) 33.448376 -112.074036 3 0.0 0.0 0.0
10 NailFactory (Phoenix) 33.448376 -112.074036 4 0.0 0.0 0.0
11 NailFactory (Phoenix) 33.448376 -112.074036 5 0.0 0.0 0.0
12 NailFactory (Dallas) 32.776664 -96.796988 1 0.0 0.0 0.0
13 NailFactory (Dallas) 32.776664 -96.796988 2 0.0 0.0 0.0
14 NailFactory (Dallas) 32.776664 -96.796988 3 0.0 0.0 0.0
15 NailFactory (Dallas) 32.776664 -96.796988 4 0.0 0.0 0.0
16 NailFactory (Dallas) 32.776664 -96.796988 5 0.0 0.0 0.0
17 Forest (Chicago) 41.881832 -87.623177 1 0.0 0.0 0.0
18 Forest (Chicago) 41.881832 -87.623177 2 0.0 0.0 0.0
19 Forest (Chicago) 41.881832 -87.623177 3 0.0 0.0 0.0
20 Forest (Chicago) 41.881832 -87.623177 4 0.0 0.0 0.0
21 Forest (Chicago) 41.881832 -87.623177 5 0.0 0.0 0.0
22 Forest (Phoenix) 33.448376 -112.074036 1 0.0 0.0 0.0
23 Forest (Phoenix) 33.448376 -112.074036 2 0.0 0.0 0.0
24 Forest (Phoenix) 33.448376 -112.074036 3 0.0 0.0 0.0
25 Forest (Phoenix) 33.448376 -112.074036 4 0.0 0.0 0.0
26 Forest (Phoenix) 33.448376 -112.074036 5 0.0 0.0 0.0
27 Forest (Dallas) 32.776664 -96.796988 1 0.0 0.0 0.0
28 Forest (Dallas) 32.776664 -96.796988 2 0.0 0.0 0.0
29 Forest (Dallas) 32.776664 -96.796988 3 0.0 0.0 0.0
30 Forest (Dallas) 32.776664 -96.796988 4 0.0 0.0 0.0
31 Forest (Dallas) 32.776664 -96.796988 5 0.0 0.0 0.0
32 Retail (Chicago) 41.881832 -87.623177 1 NewBoat 0.0 0.0 125000.0
33 Retail (Chicago) 41.881832 -87.623177 2 NewBoat 0.0 0.0 125000.0
34 Retail (Chicago) 41.881832 -87.623177 3 NewBoat 0.0 0.0 125000.0
35 Retail (Chicago) 41.881832 -87.623177 4 NewBoat 0.0 0.0 125000.0
36 Retail (Chicago) 41.881832 -87.623177 5 NewBoat 0.0 0.0 125000.0
37 Retail (New York City) 40.712776 -74.005974 1 NewBoat 0.0 0.0 125000.0
38 Retail (New York City) 40.712776 -74.005974 2 NewBoat 0.0 0.0 125000.0
39 Retail (New York City) 40.712776 -74.005974 3 NewBoat 0.0 0.0 125000.0
40 Retail (New York City) 40.712776 -74.005974 4 NewBoat 0.0 0.0 125000.0
41 Retail (New York City) 40.712776 -74.005974 5 NewBoat 0.0 0.0 125000.0
42 Retail (Los Angeles) 34.052235 -118.243683 1 NewBoat 0.0 0.0 125000.0
43 Retail (Los Angeles) 34.052235 -118.243683 2 NewBoat 0.0 0.0 125000.0
44 Retail (Los Angeles) 34.052235 -118.243683 3 NewBoat 0.0 0.0 125000.0
45 Retail (Los Angeles) 34.052235 -118.243683 4 NewBoat 0.0 0.0 125000.0
46 Retail (Los Angeles) 34.052235 -118.243683 5 NewBoat 0.0 0.0 125000.0
47 Retail (Houston) 29.760427 -95.369804 1 NewBoat 0.0 0.0 125000.0
48 Retail (Houston) 29.760427 -95.369804 2 NewBoat 0.0 0.0 125000.0
49 Retail (Houston) 29.760427 -95.369804 3 NewBoat 0.0 0.0 125000.0
50 Retail (Houston) 29.760427 -95.369804 4 NewBoat 0.0 0.0 125000.0
51 Retail (Houston) 29.760427 -95.369804 5 NewBoat 0.0 0.0 125000.0
52 Retail (Phoenix) 33.448376 -112.074036 1 NewBoat 0.0 0.0 125000.0
53 Retail (Phoenix) 33.448376 -112.074036 2 NewBoat 0.0 0.0 125000.0
54 Retail (Phoenix) 33.448376 -112.074036 3 NewBoat 0.0 0.0 125000.0
55 Retail (Phoenix) 33.448376 -112.074036 4 NewBoat 0.0 0.0 125000.0
56 Retail (Phoenix) 33.448376 -112.074036 5 NewBoat 0.0 0.0 125000.0
57 Retail (Philadelphia) 39.952583 -75.165222 1 NewBoat 0.0 0.0 125000.0
58 Retail (Philadelphia) 39.952583 -75.165222 2 NewBoat 0.0 0.0 125000.0
59 Retail (Philadelphia) 39.952583 -75.165222 3 NewBoat 0.0 0.0 125000.0
60 Retail (Philadelphia) 39.952583 -75.165222 4 NewBoat 0.0 0.0 125000.0
61 Retail (Philadelphia) 39.952583 -75.165222 5 NewBoat 0.0 0.0 125000.0
62 Retail (San Antonio) 29.424122 -98.493629 1 NewBoat 0.0 0.0 125000.0
63 Retail (San Antonio) 29.424122 -98.493629 2 NewBoat 0.0 0.0 125000.0
64 Retail (San Antonio) 29.424122 -98.493629 3 NewBoat 0.0 0.0 125000.0
65 Retail (San Antonio) 29.424122 -98.493629 4 NewBoat 0.0 0.0 125000.0
66 Retail (San Antonio) 29.424122 -98.493629 5 NewBoat 0.0 0.0 125000.0
67 Retail (San Diego) 32.715736 -117.161087 1 NewBoat 0.0 0.0 125000.0
68 Retail (San Diego) 32.715736 -117.161087 2 NewBoat 0.0 0.0 125000.0
69 Retail (San Diego) 32.715736 -117.161087 3 NewBoat 0.0 0.0 125000.0
70 Retail (San Diego) 32.715736 -117.161087 4 NewBoat 0.0 0.0 125000.0
71 Retail (San Diego) 32.715736 -117.161087 5 NewBoat 0.0 0.0 125000.0
72 Retail (Dallas) 32.776664 -96.796988 1 NewBoat 63.15789 757894.73684 125000.0
73 Retail (Dallas) 32.776664 -96.796988 2 NewBoat 71.46814 857617.72853 125000.0
74 Retail (Dallas) 32.776664 -96.796988 3 NewBoat 75.8857 910628.37148 125000.0
75 Retail (Dallas) 32.776664 -96.796988 4 NewBoat 76.90434 922852.03459 125000.0
76 Retail (Dallas) 32.776664 -96.796988 5 NewBoat 77.27087 927250.44516 125000.0
77 Retail (San Jose) 37.338208 -121.886329 1 NewBoat 0.0 0.0 125000.0
78 Retail (San Jose) 37.338208 -121.886329 2 NewBoat 0.0 0.0 125000.0
79 Retail (San Jose) 37.338208 -121.886329 3 NewBoat 0.0 0.0 125000.0
80 Retail (San Jose) 37.338208 -121.886329 4 NewBoat 0.0 0.0 125000.0
81 Retail (San Jose) 37.338208 -121.886329 5 NewBoat 0.0 0.0 125000.0

View File

@@ -0,0 +1,11 @@
plant,latitude,longitude,emission,year,processed amount (tonne),emission factor (tonne/tonne),emissions amount (tonne)
BoatFactory (Dallas),32.776664,-96.796988,CO2,1,63.15789,5.0,315.78947
BoatFactory (Dallas),32.776664,-96.796988,CO2,2,71.46814,5.0,357.34072
BoatFactory (Dallas),32.776664,-96.796988,CO2,3,75.8857,5.0,379.42849
BoatFactory (Dallas),32.776664,-96.796988,CO2,4,76.90434,5.0,384.52168
BoatFactory (Dallas),32.776664,-96.796988,CO2,5,77.27087,5.0,386.35435
RecyclingPlant (Dallas),32.776664,-96.796988,CO2,1,6.31579,5.0,31.57895
RecyclingPlant (Dallas),32.776664,-96.796988,CO2,2,22.93629,5.0,114.68144
RecyclingPlant (Dallas),32.776664,-96.796988,CO2,3,31.7714,5.0,158.85698
RecyclingPlant (Dallas),32.776664,-96.796988,CO2,4,33.80867,5.0,169.04336
RecyclingPlant (Dallas),32.776664,-96.796988,CO2,5,34.54174,5.0,172.7087
1 plant latitude longitude emission year processed amount (tonne) emission factor (tonne/tonne) emissions amount (tonne)
2 BoatFactory (Dallas) 32.776664 -96.796988 CO2 1 63.15789 5.0 315.78947
3 BoatFactory (Dallas) 32.776664 -96.796988 CO2 2 71.46814 5.0 357.34072
4 BoatFactory (Dallas) 32.776664 -96.796988 CO2 3 75.8857 5.0 379.42849
5 BoatFactory (Dallas) 32.776664 -96.796988 CO2 4 76.90434 5.0 384.52168
6 BoatFactory (Dallas) 32.776664 -96.796988 CO2 5 77.27087 5.0 386.35435
7 RecyclingPlant (Dallas) 32.776664 -96.796988 CO2 1 6.31579 5.0 31.57895
8 RecyclingPlant (Dallas) 32.776664 -96.796988 CO2 2 22.93629 5.0 114.68144
9 RecyclingPlant (Dallas) 32.776664 -96.796988 CO2 3 31.7714 5.0 158.85698
10 RecyclingPlant (Dallas) 32.776664 -96.796988 CO2 4 33.80867 5.0 169.04336
11 RecyclingPlant (Dallas) 32.776664 -96.796988 CO2 5 34.54174 5.0 172.7087

View File

@@ -0,0 +1,151 @@
plant,latitude,longitude,input product,year,amount received (tonne),current storage level (tonne),storage limit (tonne),storage cost ($)
BoatFactory (Chicago),41.881832,-87.623177,Wood,1,0.0,0.0,5.0,0.0
BoatFactory (Chicago),41.881832,-87.623177,Wood,2,0.0,0.0,5.0,0.0
BoatFactory (Chicago),41.881832,-87.623177,Wood,3,0.0,0.0,5.0,0.0
BoatFactory (Chicago),41.881832,-87.623177,Wood,4,0.0,0.0,5.0,0.0
BoatFactory (Chicago),41.881832,-87.623177,Wood,5,0.0,0.0,5.0,0.0
BoatFactory (Chicago),41.881832,-87.623177,Nail,1,0.0,0.0,1.0,0.0
BoatFactory (Chicago),41.881832,-87.623177,Nail,2,0.0,0.0,1.0,0.0
BoatFactory (Chicago),41.881832,-87.623177,Nail,3,0.0,0.0,1.0,0.0
BoatFactory (Chicago),41.881832,-87.623177,Nail,4,0.0,0.0,1.0,0.0
BoatFactory (Chicago),41.881832,-87.623177,Nail,5,0.0,0.0,1.0,0.0
BoatFactory (New York City),40.712776,-74.005974,Wood,1,0.0,0.0,5.0,0.0
BoatFactory (New York City),40.712776,-74.005974,Wood,2,0.0,0.0,5.0,0.0
BoatFactory (New York City),40.712776,-74.005974,Wood,3,0.0,0.0,5.0,0.0
BoatFactory (New York City),40.712776,-74.005974,Wood,4,0.0,0.0,5.0,0.0
BoatFactory (New York City),40.712776,-74.005974,Wood,5,0.0,0.0,5.0,0.0
BoatFactory (New York City),40.712776,-74.005974,Nail,1,0.0,0.0,1.0,0.0
BoatFactory (New York City),40.712776,-74.005974,Nail,2,0.0,0.0,1.0,0.0
BoatFactory (New York City),40.712776,-74.005974,Nail,3,0.0,0.0,1.0,0.0
BoatFactory (New York City),40.712776,-74.005974,Nail,4,0.0,0.0,1.0,0.0
BoatFactory (New York City),40.712776,-74.005974,Nail,5,0.0,0.0,1.0,0.0
BoatFactory (Los Angeles),34.052235,-118.243683,Wood,1,0.0,0.0,5.0,0.0
BoatFactory (Los Angeles),34.052235,-118.243683,Wood,2,0.0,0.0,5.0,0.0
BoatFactory (Los Angeles),34.052235,-118.243683,Wood,3,0.0,0.0,5.0,0.0
BoatFactory (Los Angeles),34.052235,-118.243683,Wood,4,0.0,0.0,5.0,0.0
BoatFactory (Los Angeles),34.052235,-118.243683,Wood,5,0.0,0.0,5.0,0.0
BoatFactory (Los Angeles),34.052235,-118.243683,Nail,1,0.0,0.0,1.0,0.0
BoatFactory (Los Angeles),34.052235,-118.243683,Nail,2,0.0,0.0,1.0,0.0
BoatFactory (Los Angeles),34.052235,-118.243683,Nail,3,0.0,0.0,1.0,0.0
BoatFactory (Los Angeles),34.052235,-118.243683,Nail,4,0.0,0.0,1.0,0.0
BoatFactory (Los Angeles),34.052235,-118.243683,Nail,5,0.0,0.0,1.0,0.0
BoatFactory (Houston),29.760427,-95.369804,Wood,1,0.0,0.0,5.0,0.0
BoatFactory (Houston),29.760427,-95.369804,Wood,2,0.0,0.0,5.0,0.0
BoatFactory (Houston),29.760427,-95.369804,Wood,3,0.0,0.0,5.0,0.0
BoatFactory (Houston),29.760427,-95.369804,Wood,4,0.0,0.0,5.0,0.0
BoatFactory (Houston),29.760427,-95.369804,Wood,5,0.0,0.0,5.0,0.0
BoatFactory (Houston),29.760427,-95.369804,Nail,1,0.0,0.0,1.0,0.0
BoatFactory (Houston),29.760427,-95.369804,Nail,2,0.0,0.0,1.0,0.0
BoatFactory (Houston),29.760427,-95.369804,Nail,3,0.0,0.0,1.0,0.0
BoatFactory (Houston),29.760427,-95.369804,Nail,4,0.0,0.0,1.0,0.0
BoatFactory (Houston),29.760427,-95.369804,Nail,5,0.0,0.0,1.0,0.0
BoatFactory (Phoenix),33.448376,-112.074036,Wood,1,0.0,0.0,5.0,0.0
BoatFactory (Phoenix),33.448376,-112.074036,Wood,2,0.0,0.0,5.0,0.0
BoatFactory (Phoenix),33.448376,-112.074036,Wood,3,0.0,0.0,5.0,0.0
BoatFactory (Phoenix),33.448376,-112.074036,Wood,4,0.0,0.0,5.0,0.0
BoatFactory (Phoenix),33.448376,-112.074036,Wood,5,0.0,0.0,5.0,0.0
BoatFactory (Phoenix),33.448376,-112.074036,Nail,1,0.0,0.0,1.0,0.0
BoatFactory (Phoenix),33.448376,-112.074036,Nail,2,0.0,0.0,1.0,0.0
BoatFactory (Phoenix),33.448376,-112.074036,Nail,3,0.0,0.0,1.0,0.0
BoatFactory (Phoenix),33.448376,-112.074036,Nail,4,0.0,0.0,1.0,0.0
BoatFactory (Phoenix),33.448376,-112.074036,Nail,5,0.0,0.0,1.0,0.0
BoatFactory (Philadelphia),39.952583,-75.165222,Wood,1,0.0,0.0,5.0,0.0
BoatFactory (Philadelphia),39.952583,-75.165222,Wood,2,0.0,0.0,5.0,0.0
BoatFactory (Philadelphia),39.952583,-75.165222,Wood,3,0.0,0.0,5.0,0.0
BoatFactory (Philadelphia),39.952583,-75.165222,Wood,4,0.0,0.0,5.0,0.0
BoatFactory (Philadelphia),39.952583,-75.165222,Wood,5,0.0,0.0,5.0,0.0
BoatFactory (Philadelphia),39.952583,-75.165222,Nail,1,0.0,0.0,1.0,0.0
BoatFactory (Philadelphia),39.952583,-75.165222,Nail,2,0.0,0.0,1.0,0.0
BoatFactory (Philadelphia),39.952583,-75.165222,Nail,3,0.0,0.0,1.0,0.0
BoatFactory (Philadelphia),39.952583,-75.165222,Nail,4,0.0,0.0,1.0,0.0
BoatFactory (Philadelphia),39.952583,-75.165222,Nail,5,0.0,0.0,1.0,0.0
BoatFactory (San Antonio),29.424122,-98.493629,Wood,1,0.0,0.0,5.0,0.0
BoatFactory (San Antonio),29.424122,-98.493629,Wood,2,0.0,0.0,5.0,0.0
BoatFactory (San Antonio),29.424122,-98.493629,Wood,3,0.0,0.0,5.0,0.0
BoatFactory (San Antonio),29.424122,-98.493629,Wood,4,0.0,0.0,5.0,0.0
BoatFactory (San Antonio),29.424122,-98.493629,Wood,5,0.0,0.0,5.0,0.0
BoatFactory (San Antonio),29.424122,-98.493629,Nail,1,0.0,0.0,1.0,0.0
BoatFactory (San Antonio),29.424122,-98.493629,Nail,2,0.0,0.0,1.0,0.0
BoatFactory (San Antonio),29.424122,-98.493629,Nail,3,0.0,0.0,1.0,0.0
BoatFactory (San Antonio),29.424122,-98.493629,Nail,4,0.0,0.0,1.0,0.0
BoatFactory (San Antonio),29.424122,-98.493629,Nail,5,0.0,0.0,1.0,0.0
BoatFactory (San Diego),32.715736,-117.161087,Wood,1,0.0,0.0,5.0,0.0
BoatFactory (San Diego),32.715736,-117.161087,Wood,2,0.0,0.0,5.0,0.0
BoatFactory (San Diego),32.715736,-117.161087,Wood,3,0.0,0.0,5.0,0.0
BoatFactory (San Diego),32.715736,-117.161087,Wood,4,0.0,0.0,5.0,0.0
BoatFactory (San Diego),32.715736,-117.161087,Wood,5,0.0,0.0,5.0,0.0
BoatFactory (San Diego),32.715736,-117.161087,Nail,1,0.0,0.0,1.0,0.0
BoatFactory (San Diego),32.715736,-117.161087,Nail,2,0.0,0.0,1.0,0.0
BoatFactory (San Diego),32.715736,-117.161087,Nail,3,0.0,0.0,1.0,0.0
BoatFactory (San Diego),32.715736,-117.161087,Nail,4,0.0,0.0,1.0,0.0
BoatFactory (San Diego),32.715736,-117.161087,Nail,5,0.0,0.0,1.0,0.0
BoatFactory (Dallas),32.776664,-96.796988,Wood,1,60.0,0.0,5.0,0.0
BoatFactory (Dallas),32.776664,-96.796988,Wood,2,67.89474,0.0,5.0,0.0
BoatFactory (Dallas),32.776664,-96.796988,Wood,3,72.09141,0.0,5.0,0.0
BoatFactory (Dallas),32.776664,-96.796988,Wood,4,73.05912,0.0,5.0,0.0
BoatFactory (Dallas),32.776664,-96.796988,Wood,5,73.40733,0.0,5.0,0.0
BoatFactory (Dallas),32.776664,-96.796988,Nail,1,3.15789,0.0,1.0,0.0
BoatFactory (Dallas),32.776664,-96.796988,Nail,2,3.57341,0.0,1.0,0.0
BoatFactory (Dallas),32.776664,-96.796988,Nail,3,3.79428,0.0,1.0,0.0
BoatFactory (Dallas),32.776664,-96.796988,Nail,4,3.84522,0.0,1.0,0.0
BoatFactory (Dallas),32.776664,-96.796988,Nail,5,3.86354,0.0,1.0,0.0
BoatFactory (San Jose),37.338208,-121.886329,Wood,1,0.0,0.0,5.0,0.0
BoatFactory (San Jose),37.338208,-121.886329,Wood,2,0.0,0.0,5.0,0.0
BoatFactory (San Jose),37.338208,-121.886329,Wood,3,0.0,0.0,5.0,0.0
BoatFactory (San Jose),37.338208,-121.886329,Wood,4,0.0,0.0,5.0,0.0
BoatFactory (San Jose),37.338208,-121.886329,Wood,5,0.0,0.0,5.0,0.0
BoatFactory (San Jose),37.338208,-121.886329,Nail,1,0.0,0.0,1.0,0.0
BoatFactory (San Jose),37.338208,-121.886329,Nail,2,0.0,0.0,1.0,0.0
BoatFactory (San Jose),37.338208,-121.886329,Nail,3,0.0,0.0,1.0,0.0
BoatFactory (San Jose),37.338208,-121.886329,Nail,4,0.0,0.0,1.0,0.0
BoatFactory (San Jose),37.338208,-121.886329,Nail,5,0.0,0.0,1.0,0.0
RecyclingPlant (Chicago),41.881832,-87.623177,UsedBoat,1,0.0,0.0,0.0,0.0
RecyclingPlant (Chicago),41.881832,-87.623177,UsedBoat,2,0.0,0.0,0.0,0.0
RecyclingPlant (Chicago),41.881832,-87.623177,UsedBoat,3,0.0,0.0,0.0,0.0
RecyclingPlant (Chicago),41.881832,-87.623177,UsedBoat,4,0.0,0.0,0.0,0.0
RecyclingPlant (Chicago),41.881832,-87.623177,UsedBoat,5,0.0,0.0,0.0,0.0
RecyclingPlant (New York City),40.712776,-74.005974,UsedBoat,1,0.0,0.0,0.0,0.0
RecyclingPlant (New York City),40.712776,-74.005974,UsedBoat,2,0.0,0.0,0.0,0.0
RecyclingPlant (New York City),40.712776,-74.005974,UsedBoat,3,0.0,0.0,0.0,0.0
RecyclingPlant (New York City),40.712776,-74.005974,UsedBoat,4,0.0,0.0,0.0,0.0
RecyclingPlant (New York City),40.712776,-74.005974,UsedBoat,5,0.0,0.0,0.0,0.0
RecyclingPlant (Los Angeles),34.052235,-118.243683,UsedBoat,1,0.0,0.0,0.0,0.0
RecyclingPlant (Los Angeles),34.052235,-118.243683,UsedBoat,2,0.0,0.0,0.0,0.0
RecyclingPlant (Los Angeles),34.052235,-118.243683,UsedBoat,3,0.0,0.0,0.0,0.0
RecyclingPlant (Los Angeles),34.052235,-118.243683,UsedBoat,4,0.0,0.0,0.0,0.0
RecyclingPlant (Los Angeles),34.052235,-118.243683,UsedBoat,5,0.0,0.0,0.0,0.0
RecyclingPlant (Houston),29.760427,-95.369804,UsedBoat,1,0.0,0.0,0.0,0.0
RecyclingPlant (Houston),29.760427,-95.369804,UsedBoat,2,0.0,0.0,0.0,0.0
RecyclingPlant (Houston),29.760427,-95.369804,UsedBoat,3,0.0,0.0,0.0,0.0
RecyclingPlant (Houston),29.760427,-95.369804,UsedBoat,4,0.0,0.0,0.0,0.0
RecyclingPlant (Houston),29.760427,-95.369804,UsedBoat,5,0.0,0.0,0.0,0.0
RecyclingPlant (Phoenix),33.448376,-112.074036,UsedBoat,1,0.0,0.0,0.0,0.0
RecyclingPlant (Phoenix),33.448376,-112.074036,UsedBoat,2,0.0,0.0,0.0,0.0
RecyclingPlant (Phoenix),33.448376,-112.074036,UsedBoat,3,0.0,0.0,0.0,0.0
RecyclingPlant (Phoenix),33.448376,-112.074036,UsedBoat,4,0.0,0.0,0.0,0.0
RecyclingPlant (Phoenix),33.448376,-112.074036,UsedBoat,5,0.0,0.0,0.0,0.0
RecyclingPlant (Philadelphia),39.952583,-75.165222,UsedBoat,1,0.0,0.0,0.0,0.0
RecyclingPlant (Philadelphia),39.952583,-75.165222,UsedBoat,2,0.0,0.0,0.0,0.0
RecyclingPlant (Philadelphia),39.952583,-75.165222,UsedBoat,3,0.0,0.0,0.0,0.0
RecyclingPlant (Philadelphia),39.952583,-75.165222,UsedBoat,4,0.0,0.0,0.0,0.0
RecyclingPlant (Philadelphia),39.952583,-75.165222,UsedBoat,5,0.0,0.0,0.0,0.0
RecyclingPlant (San Antonio),29.424122,-98.493629,UsedBoat,1,0.0,0.0,0.0,0.0
RecyclingPlant (San Antonio),29.424122,-98.493629,UsedBoat,2,0.0,0.0,0.0,0.0
RecyclingPlant (San Antonio),29.424122,-98.493629,UsedBoat,3,0.0,0.0,0.0,0.0
RecyclingPlant (San Antonio),29.424122,-98.493629,UsedBoat,4,0.0,0.0,0.0,0.0
RecyclingPlant (San Antonio),29.424122,-98.493629,UsedBoat,5,0.0,0.0,0.0,0.0
RecyclingPlant (San Diego),32.715736,-117.161087,UsedBoat,1,0.0,0.0,0.0,0.0
RecyclingPlant (San Diego),32.715736,-117.161087,UsedBoat,2,0.0,0.0,0.0,0.0
RecyclingPlant (San Diego),32.715736,-117.161087,UsedBoat,3,0.0,0.0,0.0,0.0
RecyclingPlant (San Diego),32.715736,-117.161087,UsedBoat,4,0.0,0.0,0.0,0.0
RecyclingPlant (San Diego),32.715736,-117.161087,UsedBoat,5,0.0,0.0,0.0,0.0
RecyclingPlant (Dallas),32.776664,-96.796988,UsedBoat,1,6.31579,0.0,0.0,0.0
RecyclingPlant (Dallas),32.776664,-96.796988,UsedBoat,2,22.93629,0.0,0.0,0.0
RecyclingPlant (Dallas),32.776664,-96.796988,UsedBoat,3,31.7714,0.0,0.0,0.0
RecyclingPlant (Dallas),32.776664,-96.796988,UsedBoat,4,33.80867,0.0,0.0,0.0
RecyclingPlant (Dallas),32.776664,-96.796988,UsedBoat,5,34.54174,0.0,0.0,0.0
RecyclingPlant (San Jose),37.338208,-121.886329,UsedBoat,1,0.0,0.0,0.0,0.0
RecyclingPlant (San Jose),37.338208,-121.886329,UsedBoat,2,0.0,0.0,0.0,0.0
RecyclingPlant (San Jose),37.338208,-121.886329,UsedBoat,3,0.0,0.0,0.0,0.0
RecyclingPlant (San Jose),37.338208,-121.886329,UsedBoat,4,0.0,0.0,0.0,0.0
RecyclingPlant (San Jose),37.338208,-121.886329,UsedBoat,5,0.0,0.0,0.0,0.0
1 plant latitude longitude input product year amount received (tonne) current storage level (tonne) storage limit (tonne) storage cost ($)
2 BoatFactory (Chicago) 41.881832 -87.623177 Wood 1 0.0 0.0 5.0 0.0
3 BoatFactory (Chicago) 41.881832 -87.623177 Wood 2 0.0 0.0 5.0 0.0
4 BoatFactory (Chicago) 41.881832 -87.623177 Wood 3 0.0 0.0 5.0 0.0
5 BoatFactory (Chicago) 41.881832 -87.623177 Wood 4 0.0 0.0 5.0 0.0
6 BoatFactory (Chicago) 41.881832 -87.623177 Wood 5 0.0 0.0 5.0 0.0
7 BoatFactory (Chicago) 41.881832 -87.623177 Nail 1 0.0 0.0 1.0 0.0
8 BoatFactory (Chicago) 41.881832 -87.623177 Nail 2 0.0 0.0 1.0 0.0
9 BoatFactory (Chicago) 41.881832 -87.623177 Nail 3 0.0 0.0 1.0 0.0
10 BoatFactory (Chicago) 41.881832 -87.623177 Nail 4 0.0 0.0 1.0 0.0
11 BoatFactory (Chicago) 41.881832 -87.623177 Nail 5 0.0 0.0 1.0 0.0
12 BoatFactory (New York City) 40.712776 -74.005974 Wood 1 0.0 0.0 5.0 0.0
13 BoatFactory (New York City) 40.712776 -74.005974 Wood 2 0.0 0.0 5.0 0.0
14 BoatFactory (New York City) 40.712776 -74.005974 Wood 3 0.0 0.0 5.0 0.0
15 BoatFactory (New York City) 40.712776 -74.005974 Wood 4 0.0 0.0 5.0 0.0
16 BoatFactory (New York City) 40.712776 -74.005974 Wood 5 0.0 0.0 5.0 0.0
17 BoatFactory (New York City) 40.712776 -74.005974 Nail 1 0.0 0.0 1.0 0.0
18 BoatFactory (New York City) 40.712776 -74.005974 Nail 2 0.0 0.0 1.0 0.0
19 BoatFactory (New York City) 40.712776 -74.005974 Nail 3 0.0 0.0 1.0 0.0
20 BoatFactory (New York City) 40.712776 -74.005974 Nail 4 0.0 0.0 1.0 0.0
21 BoatFactory (New York City) 40.712776 -74.005974 Nail 5 0.0 0.0 1.0 0.0
22 BoatFactory (Los Angeles) 34.052235 -118.243683 Wood 1 0.0 0.0 5.0 0.0
23 BoatFactory (Los Angeles) 34.052235 -118.243683 Wood 2 0.0 0.0 5.0 0.0
24 BoatFactory (Los Angeles) 34.052235 -118.243683 Wood 3 0.0 0.0 5.0 0.0
25 BoatFactory (Los Angeles) 34.052235 -118.243683 Wood 4 0.0 0.0 5.0 0.0
26 BoatFactory (Los Angeles) 34.052235 -118.243683 Wood 5 0.0 0.0 5.0 0.0
27 BoatFactory (Los Angeles) 34.052235 -118.243683 Nail 1 0.0 0.0 1.0 0.0
28 BoatFactory (Los Angeles) 34.052235 -118.243683 Nail 2 0.0 0.0 1.0 0.0
29 BoatFactory (Los Angeles) 34.052235 -118.243683 Nail 3 0.0 0.0 1.0 0.0
30 BoatFactory (Los Angeles) 34.052235 -118.243683 Nail 4 0.0 0.0 1.0 0.0
31 BoatFactory (Los Angeles) 34.052235 -118.243683 Nail 5 0.0 0.0 1.0 0.0
32 BoatFactory (Houston) 29.760427 -95.369804 Wood 1 0.0 0.0 5.0 0.0
33 BoatFactory (Houston) 29.760427 -95.369804 Wood 2 0.0 0.0 5.0 0.0
34 BoatFactory (Houston) 29.760427 -95.369804 Wood 3 0.0 0.0 5.0 0.0
35 BoatFactory (Houston) 29.760427 -95.369804 Wood 4 0.0 0.0 5.0 0.0
36 BoatFactory (Houston) 29.760427 -95.369804 Wood 5 0.0 0.0 5.0 0.0
37 BoatFactory (Houston) 29.760427 -95.369804 Nail 1 0.0 0.0 1.0 0.0
38 BoatFactory (Houston) 29.760427 -95.369804 Nail 2 0.0 0.0 1.0 0.0
39 BoatFactory (Houston) 29.760427 -95.369804 Nail 3 0.0 0.0 1.0 0.0
40 BoatFactory (Houston) 29.760427 -95.369804 Nail 4 0.0 0.0 1.0 0.0
41 BoatFactory (Houston) 29.760427 -95.369804 Nail 5 0.0 0.0 1.0 0.0
42 BoatFactory (Phoenix) 33.448376 -112.074036 Wood 1 0.0 0.0 5.0 0.0
43 BoatFactory (Phoenix) 33.448376 -112.074036 Wood 2 0.0 0.0 5.0 0.0
44 BoatFactory (Phoenix) 33.448376 -112.074036 Wood 3 0.0 0.0 5.0 0.0
45 BoatFactory (Phoenix) 33.448376 -112.074036 Wood 4 0.0 0.0 5.0 0.0
46 BoatFactory (Phoenix) 33.448376 -112.074036 Wood 5 0.0 0.0 5.0 0.0
47 BoatFactory (Phoenix) 33.448376 -112.074036 Nail 1 0.0 0.0 1.0 0.0
48 BoatFactory (Phoenix) 33.448376 -112.074036 Nail 2 0.0 0.0 1.0 0.0
49 BoatFactory (Phoenix) 33.448376 -112.074036 Nail 3 0.0 0.0 1.0 0.0
50 BoatFactory (Phoenix) 33.448376 -112.074036 Nail 4 0.0 0.0 1.0 0.0
51 BoatFactory (Phoenix) 33.448376 -112.074036 Nail 5 0.0 0.0 1.0 0.0
52 BoatFactory (Philadelphia) 39.952583 -75.165222 Wood 1 0.0 0.0 5.0 0.0
53 BoatFactory (Philadelphia) 39.952583 -75.165222 Wood 2 0.0 0.0 5.0 0.0
54 BoatFactory (Philadelphia) 39.952583 -75.165222 Wood 3 0.0 0.0 5.0 0.0
55 BoatFactory (Philadelphia) 39.952583 -75.165222 Wood 4 0.0 0.0 5.0 0.0
56 BoatFactory (Philadelphia) 39.952583 -75.165222 Wood 5 0.0 0.0 5.0 0.0
57 BoatFactory (Philadelphia) 39.952583 -75.165222 Nail 1 0.0 0.0 1.0 0.0
58 BoatFactory (Philadelphia) 39.952583 -75.165222 Nail 2 0.0 0.0 1.0 0.0
59 BoatFactory (Philadelphia) 39.952583 -75.165222 Nail 3 0.0 0.0 1.0 0.0
60 BoatFactory (Philadelphia) 39.952583 -75.165222 Nail 4 0.0 0.0 1.0 0.0
61 BoatFactory (Philadelphia) 39.952583 -75.165222 Nail 5 0.0 0.0 1.0 0.0
62 BoatFactory (San Antonio) 29.424122 -98.493629 Wood 1 0.0 0.0 5.0 0.0
63 BoatFactory (San Antonio) 29.424122 -98.493629 Wood 2 0.0 0.0 5.0 0.0
64 BoatFactory (San Antonio) 29.424122 -98.493629 Wood 3 0.0 0.0 5.0 0.0
65 BoatFactory (San Antonio) 29.424122 -98.493629 Wood 4 0.0 0.0 5.0 0.0
66 BoatFactory (San Antonio) 29.424122 -98.493629 Wood 5 0.0 0.0 5.0 0.0
67 BoatFactory (San Antonio) 29.424122 -98.493629 Nail 1 0.0 0.0 1.0 0.0
68 BoatFactory (San Antonio) 29.424122 -98.493629 Nail 2 0.0 0.0 1.0 0.0
69 BoatFactory (San Antonio) 29.424122 -98.493629 Nail 3 0.0 0.0 1.0 0.0
70 BoatFactory (San Antonio) 29.424122 -98.493629 Nail 4 0.0 0.0 1.0 0.0
71 BoatFactory (San Antonio) 29.424122 -98.493629 Nail 5 0.0 0.0 1.0 0.0
72 BoatFactory (San Diego) 32.715736 -117.161087 Wood 1 0.0 0.0 5.0 0.0
73 BoatFactory (San Diego) 32.715736 -117.161087 Wood 2 0.0 0.0 5.0 0.0
74 BoatFactory (San Diego) 32.715736 -117.161087 Wood 3 0.0 0.0 5.0 0.0
75 BoatFactory (San Diego) 32.715736 -117.161087 Wood 4 0.0 0.0 5.0 0.0
76 BoatFactory (San Diego) 32.715736 -117.161087 Wood 5 0.0 0.0 5.0 0.0
77 BoatFactory (San Diego) 32.715736 -117.161087 Nail 1 0.0 0.0 1.0 0.0
78 BoatFactory (San Diego) 32.715736 -117.161087 Nail 2 0.0 0.0 1.0 0.0
79 BoatFactory (San Diego) 32.715736 -117.161087 Nail 3 0.0 0.0 1.0 0.0
80 BoatFactory (San Diego) 32.715736 -117.161087 Nail 4 0.0 0.0 1.0 0.0
81 BoatFactory (San Diego) 32.715736 -117.161087 Nail 5 0.0 0.0 1.0 0.0
82 BoatFactory (Dallas) 32.776664 -96.796988 Wood 1 60.0 0.0 5.0 0.0
83 BoatFactory (Dallas) 32.776664 -96.796988 Wood 2 67.89474 0.0 5.0 0.0
84 BoatFactory (Dallas) 32.776664 -96.796988 Wood 3 72.09141 0.0 5.0 0.0
85 BoatFactory (Dallas) 32.776664 -96.796988 Wood 4 73.05912 0.0 5.0 0.0
86 BoatFactory (Dallas) 32.776664 -96.796988 Wood 5 73.40733 0.0 5.0 0.0
87 BoatFactory (Dallas) 32.776664 -96.796988 Nail 1 3.15789 0.0 1.0 0.0
88 BoatFactory (Dallas) 32.776664 -96.796988 Nail 2 3.57341 0.0 1.0 0.0
89 BoatFactory (Dallas) 32.776664 -96.796988 Nail 3 3.79428 0.0 1.0 0.0
90 BoatFactory (Dallas) 32.776664 -96.796988 Nail 4 3.84522 0.0 1.0 0.0
91 BoatFactory (Dallas) 32.776664 -96.796988 Nail 5 3.86354 0.0 1.0 0.0
92 BoatFactory (San Jose) 37.338208 -121.886329 Wood 1 0.0 0.0 5.0 0.0
93 BoatFactory (San Jose) 37.338208 -121.886329 Wood 2 0.0 0.0 5.0 0.0
94 BoatFactory (San Jose) 37.338208 -121.886329 Wood 3 0.0 0.0 5.0 0.0
95 BoatFactory (San Jose) 37.338208 -121.886329 Wood 4 0.0 0.0 5.0 0.0
96 BoatFactory (San Jose) 37.338208 -121.886329 Wood 5 0.0 0.0 5.0 0.0
97 BoatFactory (San Jose) 37.338208 -121.886329 Nail 1 0.0 0.0 1.0 0.0
98 BoatFactory (San Jose) 37.338208 -121.886329 Nail 2 0.0 0.0 1.0 0.0
99 BoatFactory (San Jose) 37.338208 -121.886329 Nail 3 0.0 0.0 1.0 0.0
100 BoatFactory (San Jose) 37.338208 -121.886329 Nail 4 0.0 0.0 1.0 0.0
101 BoatFactory (San Jose) 37.338208 -121.886329 Nail 5 0.0 0.0 1.0 0.0
102 RecyclingPlant (Chicago) 41.881832 -87.623177 UsedBoat 1 0.0 0.0 0.0 0.0
103 RecyclingPlant (Chicago) 41.881832 -87.623177 UsedBoat 2 0.0 0.0 0.0 0.0
104 RecyclingPlant (Chicago) 41.881832 -87.623177 UsedBoat 3 0.0 0.0 0.0 0.0
105 RecyclingPlant (Chicago) 41.881832 -87.623177 UsedBoat 4 0.0 0.0 0.0 0.0
106 RecyclingPlant (Chicago) 41.881832 -87.623177 UsedBoat 5 0.0 0.0 0.0 0.0
107 RecyclingPlant (New York City) 40.712776 -74.005974 UsedBoat 1 0.0 0.0 0.0 0.0
108 RecyclingPlant (New York City) 40.712776 -74.005974 UsedBoat 2 0.0 0.0 0.0 0.0
109 RecyclingPlant (New York City) 40.712776 -74.005974 UsedBoat 3 0.0 0.0 0.0 0.0
110 RecyclingPlant (New York City) 40.712776 -74.005974 UsedBoat 4 0.0 0.0 0.0 0.0
111 RecyclingPlant (New York City) 40.712776 -74.005974 UsedBoat 5 0.0 0.0 0.0 0.0
112 RecyclingPlant (Los Angeles) 34.052235 -118.243683 UsedBoat 1 0.0 0.0 0.0 0.0
113 RecyclingPlant (Los Angeles) 34.052235 -118.243683 UsedBoat 2 0.0 0.0 0.0 0.0
114 RecyclingPlant (Los Angeles) 34.052235 -118.243683 UsedBoat 3 0.0 0.0 0.0 0.0
115 RecyclingPlant (Los Angeles) 34.052235 -118.243683 UsedBoat 4 0.0 0.0 0.0 0.0
116 RecyclingPlant (Los Angeles) 34.052235 -118.243683 UsedBoat 5 0.0 0.0 0.0 0.0
117 RecyclingPlant (Houston) 29.760427 -95.369804 UsedBoat 1 0.0 0.0 0.0 0.0
118 RecyclingPlant (Houston) 29.760427 -95.369804 UsedBoat 2 0.0 0.0 0.0 0.0
119 RecyclingPlant (Houston) 29.760427 -95.369804 UsedBoat 3 0.0 0.0 0.0 0.0
120 RecyclingPlant (Houston) 29.760427 -95.369804 UsedBoat 4 0.0 0.0 0.0 0.0
121 RecyclingPlant (Houston) 29.760427 -95.369804 UsedBoat 5 0.0 0.0 0.0 0.0
122 RecyclingPlant (Phoenix) 33.448376 -112.074036 UsedBoat 1 0.0 0.0 0.0 0.0
123 RecyclingPlant (Phoenix) 33.448376 -112.074036 UsedBoat 2 0.0 0.0 0.0 0.0
124 RecyclingPlant (Phoenix) 33.448376 -112.074036 UsedBoat 3 0.0 0.0 0.0 0.0
125 RecyclingPlant (Phoenix) 33.448376 -112.074036 UsedBoat 4 0.0 0.0 0.0 0.0
126 RecyclingPlant (Phoenix) 33.448376 -112.074036 UsedBoat 5 0.0 0.0 0.0 0.0
127 RecyclingPlant (Philadelphia) 39.952583 -75.165222 UsedBoat 1 0.0 0.0 0.0 0.0
128 RecyclingPlant (Philadelphia) 39.952583 -75.165222 UsedBoat 2 0.0 0.0 0.0 0.0
129 RecyclingPlant (Philadelphia) 39.952583 -75.165222 UsedBoat 3 0.0 0.0 0.0 0.0
130 RecyclingPlant (Philadelphia) 39.952583 -75.165222 UsedBoat 4 0.0 0.0 0.0 0.0
131 RecyclingPlant (Philadelphia) 39.952583 -75.165222 UsedBoat 5 0.0 0.0 0.0 0.0
132 RecyclingPlant (San Antonio) 29.424122 -98.493629 UsedBoat 1 0.0 0.0 0.0 0.0
133 RecyclingPlant (San Antonio) 29.424122 -98.493629 UsedBoat 2 0.0 0.0 0.0 0.0
134 RecyclingPlant (San Antonio) 29.424122 -98.493629 UsedBoat 3 0.0 0.0 0.0 0.0
135 RecyclingPlant (San Antonio) 29.424122 -98.493629 UsedBoat 4 0.0 0.0 0.0 0.0
136 RecyclingPlant (San Antonio) 29.424122 -98.493629 UsedBoat 5 0.0 0.0 0.0 0.0
137 RecyclingPlant (San Diego) 32.715736 -117.161087 UsedBoat 1 0.0 0.0 0.0 0.0
138 RecyclingPlant (San Diego) 32.715736 -117.161087 UsedBoat 2 0.0 0.0 0.0 0.0
139 RecyclingPlant (San Diego) 32.715736 -117.161087 UsedBoat 3 0.0 0.0 0.0 0.0
140 RecyclingPlant (San Diego) 32.715736 -117.161087 UsedBoat 4 0.0 0.0 0.0 0.0
141 RecyclingPlant (San Diego) 32.715736 -117.161087 UsedBoat 5 0.0 0.0 0.0 0.0
142 RecyclingPlant (Dallas) 32.776664 -96.796988 UsedBoat 1 6.31579 0.0 0.0 0.0
143 RecyclingPlant (Dallas) 32.776664 -96.796988 UsedBoat 2 22.93629 0.0 0.0 0.0
144 RecyclingPlant (Dallas) 32.776664 -96.796988 UsedBoat 3 31.7714 0.0 0.0 0.0
145 RecyclingPlant (Dallas) 32.776664 -96.796988 UsedBoat 4 33.80867 0.0 0.0 0.0
146 RecyclingPlant (Dallas) 32.776664 -96.796988 UsedBoat 5 34.54174 0.0 0.0 0.0
147 RecyclingPlant (San Jose) 37.338208 -121.886329 UsedBoat 1 0.0 0.0 0.0 0.0
148 RecyclingPlant (San Jose) 37.338208 -121.886329 UsedBoat 2 0.0 0.0 0.0 0.0
149 RecyclingPlant (San Jose) 37.338208 -121.886329 UsedBoat 3 0.0 0.0 0.0 0.0
150 RecyclingPlant (San Jose) 37.338208 -121.886329 UsedBoat 4 0.0 0.0 0.0 0.0
151 RecyclingPlant (San Jose) 37.338208 -121.886329 UsedBoat 5 0.0 0.0 0.0 0.0

View File

@@ -0,0 +1,151 @@
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
1 plant latitude longitude output product year amount produced (tonne) amount disposed (tonne) disposal limit (tonne) disposal cost ($)
2 BoatFactory (Chicago) 41.881832 -87.623177 NewBoat 1 0.0 0.0 0.0 0.0
3 BoatFactory (Chicago) 41.881832 -87.623177 NewBoat 2 0.0 0.0 0.0 0.0
4 BoatFactory (Chicago) 41.881832 -87.623177 NewBoat 3 0.0 0.0 0.0 0.0
5 BoatFactory (Chicago) 41.881832 -87.623177 NewBoat 4 0.0 0.0 0.0 0.0
6 BoatFactory (Chicago) 41.881832 -87.623177 NewBoat 5 0.0 0.0 0.0 0.0
7 BoatFactory (New York City) 40.712776 -74.005974 NewBoat 1 0.0 0.0 0.0 0.0
8 BoatFactory (New York City) 40.712776 -74.005974 NewBoat 2 0.0 0.0 0.0 0.0
9 BoatFactory (New York City) 40.712776 -74.005974 NewBoat 3 0.0 0.0 0.0 0.0
10 BoatFactory (New York City) 40.712776 -74.005974 NewBoat 4 0.0 0.0 0.0 0.0
11 BoatFactory (New York City) 40.712776 -74.005974 NewBoat 5 0.0 0.0 0.0 0.0
12 BoatFactory (Los Angeles) 34.052235 -118.243683 NewBoat 1 0.0 0.0 0.0 0.0
13 BoatFactory (Los Angeles) 34.052235 -118.243683 NewBoat 2 0.0 0.0 0.0 0.0
14 BoatFactory (Los Angeles) 34.052235 -118.243683 NewBoat 3 0.0 0.0 0.0 0.0
15 BoatFactory (Los Angeles) 34.052235 -118.243683 NewBoat 4 0.0 0.0 0.0 0.0
16 BoatFactory (Los Angeles) 34.052235 -118.243683 NewBoat 5 0.0 0.0 0.0 0.0
17 BoatFactory (Houston) 29.760427 -95.369804 NewBoat 1 0.0 0.0 0.0 0.0
18 BoatFactory (Houston) 29.760427 -95.369804 NewBoat 2 0.0 0.0 0.0 0.0
19 BoatFactory (Houston) 29.760427 -95.369804 NewBoat 3 0.0 0.0 0.0 0.0
20 BoatFactory (Houston) 29.760427 -95.369804 NewBoat 4 0.0 0.0 0.0 0.0
21 BoatFactory (Houston) 29.760427 -95.369804 NewBoat 5 0.0 0.0 0.0 0.0
22 BoatFactory (Phoenix) 33.448376 -112.074036 NewBoat 1 0.0 0.0 0.0 0.0
23 BoatFactory (Phoenix) 33.448376 -112.074036 NewBoat 2 0.0 0.0 0.0 0.0
24 BoatFactory (Phoenix) 33.448376 -112.074036 NewBoat 3 0.0 0.0 0.0 0.0
25 BoatFactory (Phoenix) 33.448376 -112.074036 NewBoat 4 0.0 0.0 0.0 0.0
26 BoatFactory (Phoenix) 33.448376 -112.074036 NewBoat 5 0.0 0.0 0.0 0.0
27 BoatFactory (Philadelphia) 39.952583 -75.165222 NewBoat 1 0.0 0.0 0.0 0.0
28 BoatFactory (Philadelphia) 39.952583 -75.165222 NewBoat 2 0.0 0.0 0.0 0.0
29 BoatFactory (Philadelphia) 39.952583 -75.165222 NewBoat 3 0.0 0.0 0.0 0.0
30 BoatFactory (Philadelphia) 39.952583 -75.165222 NewBoat 4 0.0 0.0 0.0 0.0
31 BoatFactory (Philadelphia) 39.952583 -75.165222 NewBoat 5 0.0 0.0 0.0 0.0
32 BoatFactory (San Antonio) 29.424122 -98.493629 NewBoat 1 0.0 0.0 0.0 0.0
33 BoatFactory (San Antonio) 29.424122 -98.493629 NewBoat 2 0.0 0.0 0.0 0.0
34 BoatFactory (San Antonio) 29.424122 -98.493629 NewBoat 3 0.0 0.0 0.0 0.0
35 BoatFactory (San Antonio) 29.424122 -98.493629 NewBoat 4 0.0 0.0 0.0 0.0
36 BoatFactory (San Antonio) 29.424122 -98.493629 NewBoat 5 0.0 0.0 0.0 0.0
37 BoatFactory (San Diego) 32.715736 -117.161087 NewBoat 1 0.0 0.0 0.0 0.0
38 BoatFactory (San Diego) 32.715736 -117.161087 NewBoat 2 0.0 0.0 0.0 0.0
39 BoatFactory (San Diego) 32.715736 -117.161087 NewBoat 3 0.0 0.0 0.0 0.0
40 BoatFactory (San Diego) 32.715736 -117.161087 NewBoat 4 0.0 0.0 0.0 0.0
41 BoatFactory (San Diego) 32.715736 -117.161087 NewBoat 5 0.0 0.0 0.0 0.0
42 BoatFactory (Dallas) 32.776664 -96.796988 NewBoat 1 63.15789 0.0 0.0 0.0
43 BoatFactory (Dallas) 32.776664 -96.796988 NewBoat 2 71.46814 0.0 0.0 0.0
44 BoatFactory (Dallas) 32.776664 -96.796988 NewBoat 3 75.8857 0.0 0.0 0.0
45 BoatFactory (Dallas) 32.776664 -96.796988 NewBoat 4 76.90434 0.0 0.0 0.0
46 BoatFactory (Dallas) 32.776664 -96.796988 NewBoat 5 77.27087 0.0 0.0 0.0
47 BoatFactory (San Jose) 37.338208 -121.886329 NewBoat 1 0.0 0.0 0.0 0.0
48 BoatFactory (San Jose) 37.338208 -121.886329 NewBoat 2 0.0 0.0 0.0 0.0
49 BoatFactory (San Jose) 37.338208 -121.886329 NewBoat 3 0.0 0.0 0.0 0.0
50 BoatFactory (San Jose) 37.338208 -121.886329 NewBoat 4 0.0 0.0 0.0 0.0
51 BoatFactory (San Jose) 37.338208 -121.886329 NewBoat 5 0.0 0.0 0.0 0.0
52 RecyclingPlant (Chicago) 41.881832 -87.623177 Nail 1 0.0 0.0 0.0 0.0
53 RecyclingPlant (Chicago) 41.881832 -87.623177 Nail 2 0.0 0.0 0.0 0.0
54 RecyclingPlant (Chicago) 41.881832 -87.623177 Nail 3 0.0 0.0 0.0 0.0
55 RecyclingPlant (Chicago) 41.881832 -87.623177 Nail 4 0.0 0.0 0.0 0.0
56 RecyclingPlant (Chicago) 41.881832 -87.623177 Nail 5 0.0 0.0 0.0 0.0
57 RecyclingPlant (Chicago) 41.881832 -87.623177 Wood 1 0.0 0.0 0.0 0.0
58 RecyclingPlant (Chicago) 41.881832 -87.623177 Wood 2 0.0 0.0 0.0 0.0
59 RecyclingPlant (Chicago) 41.881832 -87.623177 Wood 3 0.0 0.0 0.0 0.0
60 RecyclingPlant (Chicago) 41.881832 -87.623177 Wood 4 0.0 0.0 0.0 0.0
61 RecyclingPlant (Chicago) 41.881832 -87.623177 Wood 5 0.0 0.0 0.0 0.0
62 RecyclingPlant (New York City) 40.712776 -74.005974 Nail 1 0.0 0.0 0.0 0.0
63 RecyclingPlant (New York City) 40.712776 -74.005974 Nail 2 0.0 0.0 0.0 0.0
64 RecyclingPlant (New York City) 40.712776 -74.005974 Nail 3 0.0 0.0 0.0 0.0
65 RecyclingPlant (New York City) 40.712776 -74.005974 Nail 4 0.0 0.0 0.0 0.0
66 RecyclingPlant (New York City) 40.712776 -74.005974 Nail 5 0.0 0.0 0.0 0.0
67 RecyclingPlant (New York City) 40.712776 -74.005974 Wood 1 0.0 0.0 0.0 0.0
68 RecyclingPlant (New York City) 40.712776 -74.005974 Wood 2 0.0 0.0 0.0 0.0
69 RecyclingPlant (New York City) 40.712776 -74.005974 Wood 3 0.0 0.0 0.0 0.0
70 RecyclingPlant (New York City) 40.712776 -74.005974 Wood 4 0.0 0.0 0.0 0.0
71 RecyclingPlant (New York City) 40.712776 -74.005974 Wood 5 0.0 0.0 0.0 0.0
72 RecyclingPlant (Los Angeles) 34.052235 -118.243683 Nail 1 0.0 0.0 0.0 0.0
73 RecyclingPlant (Los Angeles) 34.052235 -118.243683 Nail 2 0.0 0.0 0.0 0.0
74 RecyclingPlant (Los Angeles) 34.052235 -118.243683 Nail 3 0.0 0.0 0.0 0.0
75 RecyclingPlant (Los Angeles) 34.052235 -118.243683 Nail 4 0.0 0.0 0.0 0.0
76 RecyclingPlant (Los Angeles) 34.052235 -118.243683 Nail 5 0.0 0.0 0.0 0.0
77 RecyclingPlant (Los Angeles) 34.052235 -118.243683 Wood 1 0.0 0.0 0.0 0.0
78 RecyclingPlant (Los Angeles) 34.052235 -118.243683 Wood 2 0.0 0.0 0.0 0.0
79 RecyclingPlant (Los Angeles) 34.052235 -118.243683 Wood 3 0.0 0.0 0.0 0.0
80 RecyclingPlant (Los Angeles) 34.052235 -118.243683 Wood 4 0.0 0.0 0.0 0.0
81 RecyclingPlant (Los Angeles) 34.052235 -118.243683 Wood 5 0.0 0.0 0.0 0.0
82 RecyclingPlant (Houston) 29.760427 -95.369804 Nail 1 0.0 0.0 0.0 0.0
83 RecyclingPlant (Houston) 29.760427 -95.369804 Nail 2 0.0 0.0 0.0 0.0
84 RecyclingPlant (Houston) 29.760427 -95.369804 Nail 3 0.0 0.0 0.0 0.0
85 RecyclingPlant (Houston) 29.760427 -95.369804 Nail 4 0.0 0.0 0.0 0.0
86 RecyclingPlant (Houston) 29.760427 -95.369804 Nail 5 0.0 0.0 0.0 0.0
87 RecyclingPlant (Houston) 29.760427 -95.369804 Wood 1 0.0 0.0 0.0 0.0
88 RecyclingPlant (Houston) 29.760427 -95.369804 Wood 2 0.0 0.0 0.0 0.0
89 RecyclingPlant (Houston) 29.760427 -95.369804 Wood 3 0.0 0.0 0.0 0.0
90 RecyclingPlant (Houston) 29.760427 -95.369804 Wood 4 0.0 0.0 0.0 0.0
91 RecyclingPlant (Houston) 29.760427 -95.369804 Wood 5 0.0 0.0 0.0 0.0
92 RecyclingPlant (Phoenix) 33.448376 -112.074036 Nail 1 0.0 0.0 0.0 0.0
93 RecyclingPlant (Phoenix) 33.448376 -112.074036 Nail 2 0.0 0.0 0.0 0.0
94 RecyclingPlant (Phoenix) 33.448376 -112.074036 Nail 3 0.0 0.0 0.0 0.0
95 RecyclingPlant (Phoenix) 33.448376 -112.074036 Nail 4 0.0 0.0 0.0 0.0
96 RecyclingPlant (Phoenix) 33.448376 -112.074036 Nail 5 0.0 0.0 0.0 0.0
97 RecyclingPlant (Phoenix) 33.448376 -112.074036 Wood 1 0.0 0.0 0.0 0.0
98 RecyclingPlant (Phoenix) 33.448376 -112.074036 Wood 2 0.0 0.0 0.0 0.0
99 RecyclingPlant (Phoenix) 33.448376 -112.074036 Wood 3 0.0 0.0 0.0 0.0
100 RecyclingPlant (Phoenix) 33.448376 -112.074036 Wood 4 0.0 0.0 0.0 0.0
101 RecyclingPlant (Phoenix) 33.448376 -112.074036 Wood 5 0.0 0.0 0.0 0.0
102 RecyclingPlant (Philadelphia) 39.952583 -75.165222 Nail 1 0.0 0.0 0.0 0.0
103 RecyclingPlant (Philadelphia) 39.952583 -75.165222 Nail 2 0.0 0.0 0.0 0.0
104 RecyclingPlant (Philadelphia) 39.952583 -75.165222 Nail 3 0.0 0.0 0.0 0.0
105 RecyclingPlant (Philadelphia) 39.952583 -75.165222 Nail 4 0.0 0.0 0.0 0.0
106 RecyclingPlant (Philadelphia) 39.952583 -75.165222 Nail 5 0.0 0.0 0.0 0.0
107 RecyclingPlant (Philadelphia) 39.952583 -75.165222 Wood 1 0.0 0.0 0.0 0.0
108 RecyclingPlant (Philadelphia) 39.952583 -75.165222 Wood 2 0.0 0.0 0.0 0.0
109 RecyclingPlant (Philadelphia) 39.952583 -75.165222 Wood 3 0.0 0.0 0.0 0.0
110 RecyclingPlant (Philadelphia) 39.952583 -75.165222 Wood 4 0.0 0.0 0.0 0.0
111 RecyclingPlant (Philadelphia) 39.952583 -75.165222 Wood 5 0.0 0.0 0.0 0.0
112 RecyclingPlant (San Antonio) 29.424122 -98.493629 Nail 1 0.0 0.0 0.0 0.0
113 RecyclingPlant (San Antonio) 29.424122 -98.493629 Nail 2 0.0 0.0 0.0 0.0
114 RecyclingPlant (San Antonio) 29.424122 -98.493629 Nail 3 0.0 0.0 0.0 0.0
115 RecyclingPlant (San Antonio) 29.424122 -98.493629 Nail 4 0.0 0.0 0.0 0.0
116 RecyclingPlant (San Antonio) 29.424122 -98.493629 Nail 5 0.0 0.0 0.0 0.0
117 RecyclingPlant (San Antonio) 29.424122 -98.493629 Wood 1 0.0 0.0 0.0 0.0
118 RecyclingPlant (San Antonio) 29.424122 -98.493629 Wood 2 0.0 0.0 0.0 0.0
119 RecyclingPlant (San Antonio) 29.424122 -98.493629 Wood 3 0.0 0.0 0.0 0.0
120 RecyclingPlant (San Antonio) 29.424122 -98.493629 Wood 4 0.0 0.0 0.0 0.0
121 RecyclingPlant (San Antonio) 29.424122 -98.493629 Wood 5 0.0 0.0 0.0 0.0
122 RecyclingPlant (San Diego) 32.715736 -117.161087 Nail 1 0.0 0.0 0.0 0.0
123 RecyclingPlant (San Diego) 32.715736 -117.161087 Nail 2 0.0 0.0 0.0 0.0
124 RecyclingPlant (San Diego) 32.715736 -117.161087 Nail 3 0.0 0.0 0.0 0.0
125 RecyclingPlant (San Diego) 32.715736 -117.161087 Nail 4 0.0 0.0 0.0 0.0
126 RecyclingPlant (San Diego) 32.715736 -117.161087 Nail 5 0.0 0.0 0.0 0.0
127 RecyclingPlant (San Diego) 32.715736 -117.161087 Wood 1 0.0 0.0 0.0 0.0
128 RecyclingPlant (San Diego) 32.715736 -117.161087 Wood 2 0.0 0.0 0.0 0.0
129 RecyclingPlant (San Diego) 32.715736 -117.161087 Wood 3 0.0 0.0 0.0 0.0
130 RecyclingPlant (San Diego) 32.715736 -117.161087 Wood 4 0.0 0.0 0.0 0.0
131 RecyclingPlant (San Diego) 32.715736 -117.161087 Wood 5 0.0 0.0 0.0 0.0
132 RecyclingPlant (Dallas) 32.776664 -96.796988 Nail 1 0.15789 0.0 0.0 0.0
133 RecyclingPlant (Dallas) 32.776664 -96.796988 Nail 2 0.57341 0.0 0.0 0.0
134 RecyclingPlant (Dallas) 32.776664 -96.796988 Nail 3 0.79428 0.0 0.0 0.0
135 RecyclingPlant (Dallas) 32.776664 -96.796988 Nail 4 0.84522 0.0 0.0 0.0
136 RecyclingPlant (Dallas) 32.776664 -96.796988 Nail 5 0.86354 0.0 0.0 0.0
137 RecyclingPlant (Dallas) 32.776664 -96.796988 Wood 1 3.0 0.0 0.0 0.0
138 RecyclingPlant (Dallas) 32.776664 -96.796988 Wood 2 10.89474 0.0 0.0 0.0
139 RecyclingPlant (Dallas) 32.776664 -96.796988 Wood 3 15.09141 0.0 0.0 0.0
140 RecyclingPlant (Dallas) 32.776664 -96.796988 Wood 4 16.05912 0.0 0.0 0.0
141 RecyclingPlant (Dallas) 32.776664 -96.796988 Wood 5 16.40733 0.0 0.0 0.0
142 RecyclingPlant (San Jose) 37.338208 -121.886329 Nail 1 0.0 0.0 0.0 0.0
143 RecyclingPlant (San Jose) 37.338208 -121.886329 Nail 2 0.0 0.0 0.0 0.0
144 RecyclingPlant (San Jose) 37.338208 -121.886329 Nail 3 0.0 0.0 0.0 0.0
145 RecyclingPlant (San Jose) 37.338208 -121.886329 Nail 4 0.0 0.0 0.0 0.0
146 RecyclingPlant (San Jose) 37.338208 -121.886329 Nail 5 0.0 0.0 0.0 0.0
147 RecyclingPlant (San Jose) 37.338208 -121.886329 Wood 1 0.0 0.0 0.0 0.0
148 RecyclingPlant (San Jose) 37.338208 -121.886329 Wood 2 0.0 0.0 0.0 0.0
149 RecyclingPlant (San Jose) 37.338208 -121.886329 Wood 3 0.0 0.0 0.0 0.0
150 RecyclingPlant (San Jose) 37.338208 -121.886329 Wood 4 0.0 0.0 0.0 0.0
151 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 Normal file
View File

@@ -0,0 +1,101 @@
plant,latitude,longitude,initial capacity,current capacity,year,operational?,input amount (tonne),stored amount (tonne),processed amount (tonne),opening cost ($),fixed operating cost ($),variable operating cost ($),expansion cost ($),storage cost ($)
BoatFactory (Chicago),41.881832,-87.623177,0.0,0.0,1,false,0.0,0.0,0.0,0.0,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,0.0,0.0,0.0,0.0
BoatFactory (Dallas),32.776664,-96.796988,0.0,500.0,1,true,63.15789,0.0,63.15789,100000.0,250000.0,315.78947,0.0,0.0
BoatFactory (Dallas),32.776664,-96.796988,0.0,500.0,2,true,71.46814,0.0,71.46814,0.0,250000.0,357.34072,0.0,0.0
BoatFactory (Dallas),32.776664,-96.796988,0.0,500.0,3,true,75.8857,0.0,75.8857,0.0,250000.0,379.42849,0.0,0.0
BoatFactory (Dallas),32.776664,-96.796988,0.0,500.0,4,true,76.90434,0.0,76.90434,0.0,250000.0,384.52168,0.0,0.0
BoatFactory (Dallas),32.776664,-96.796988,0.0,500.0,5,true,77.27087,0.0,77.27087,0.0,250000.0,386.35435,0.0,0.0
BoatFactory (San Jose),37.338208,-121.886329,0.0,0.0,1,false,0.0,0.0,0.0,0.0,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,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,0.0,0.0,0.0,0.0
RecyclingPlant (Dallas),32.776664,-96.796988,0.0,500.0,1,true,6.31579,0.0,6.31579,500000.0,125000.0,15.78947,0.0,0.0
RecyclingPlant (Dallas),32.776664,-96.796988,0.0,500.0,2,true,22.93629,0.0,22.93629,0.0,125000.0,57.34072,0.0,0.0
RecyclingPlant (Dallas),32.776664,-96.796988,0.0,500.0,3,true,31.7714,0.0,31.7714,0.0,125000.0,79.42849,0.0,0.0
RecyclingPlant (Dallas),32.776664,-96.796988,0.0,500.0,4,true,33.80867,0.0,33.80867,0.0,125000.0,84.52168,0.0,0.0
RecyclingPlant (Dallas),32.776664,-96.796988,0.0,500.0,5,true,34.54174,0.0,34.54174,0.0,125000.0,86.35435,0.0,0.0
RecyclingPlant (San Jose),37.338208,-121.886329,0.0,0.0,1,false,0.0,0.0,0.0,0.0,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,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,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,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,0.0,0.0,0.0,0.0
1 plant latitude longitude initial capacity current capacity year operational? input amount (tonne) stored amount (tonne) processed amount (tonne) opening cost ($) fixed operating cost ($) variable operating cost ($) expansion cost ($) storage cost ($)
2 BoatFactory (Chicago) 41.881832 -87.623177 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
3 BoatFactory (Chicago) 41.881832 -87.623177 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
4 BoatFactory (Chicago) 41.881832 -87.623177 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
5 BoatFactory (Chicago) 41.881832 -87.623177 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
6 BoatFactory (Chicago) 41.881832 -87.623177 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
7 BoatFactory (New York City) 40.712776 -74.005974 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
8 BoatFactory (New York City) 40.712776 -74.005974 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
9 BoatFactory (New York City) 40.712776 -74.005974 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
10 BoatFactory (New York City) 40.712776 -74.005974 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
11 BoatFactory (New York City) 40.712776 -74.005974 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
12 BoatFactory (Los Angeles) 34.052235 -118.243683 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
13 BoatFactory (Los Angeles) 34.052235 -118.243683 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
14 BoatFactory (Los Angeles) 34.052235 -118.243683 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
15 BoatFactory (Los Angeles) 34.052235 -118.243683 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
16 BoatFactory (Los Angeles) 34.052235 -118.243683 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
17 BoatFactory (Houston) 29.760427 -95.369804 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
18 BoatFactory (Houston) 29.760427 -95.369804 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
19 BoatFactory (Houston) 29.760427 -95.369804 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
20 BoatFactory (Houston) 29.760427 -95.369804 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
21 BoatFactory (Houston) 29.760427 -95.369804 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
22 BoatFactory (Phoenix) 33.448376 -112.074036 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
23 BoatFactory (Phoenix) 33.448376 -112.074036 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
24 BoatFactory (Phoenix) 33.448376 -112.074036 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
25 BoatFactory (Phoenix) 33.448376 -112.074036 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
26 BoatFactory (Phoenix) 33.448376 -112.074036 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
27 BoatFactory (Philadelphia) 39.952583 -75.165222 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
28 BoatFactory (Philadelphia) 39.952583 -75.165222 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
29 BoatFactory (Philadelphia) 39.952583 -75.165222 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
30 BoatFactory (Philadelphia) 39.952583 -75.165222 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
31 BoatFactory (Philadelphia) 39.952583 -75.165222 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
32 BoatFactory (San Antonio) 29.424122 -98.493629 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
33 BoatFactory (San Antonio) 29.424122 -98.493629 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
34 BoatFactory (San Antonio) 29.424122 -98.493629 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
35 BoatFactory (San Antonio) 29.424122 -98.493629 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
36 BoatFactory (San Antonio) 29.424122 -98.493629 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
37 BoatFactory (San Diego) 32.715736 -117.161087 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
38 BoatFactory (San Diego) 32.715736 -117.161087 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
39 BoatFactory (San Diego) 32.715736 -117.161087 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
40 BoatFactory (San Diego) 32.715736 -117.161087 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
41 BoatFactory (San Diego) 32.715736 -117.161087 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
42 BoatFactory (Dallas) 32.776664 -96.796988 0.0 500.0 1 true 63.15789 0.0 63.15789 100000.0 250000.0 315.78947 0.0 0.0
43 BoatFactory (Dallas) 32.776664 -96.796988 0.0 500.0 2 true 71.46814 0.0 71.46814 0.0 250000.0 357.34072 0.0 0.0
44 BoatFactory (Dallas) 32.776664 -96.796988 0.0 500.0 3 true 75.8857 0.0 75.8857 0.0 250000.0 379.42849 0.0 0.0
45 BoatFactory (Dallas) 32.776664 -96.796988 0.0 500.0 4 true 76.90434 0.0 76.90434 0.0 250000.0 384.52168 0.0 0.0
46 BoatFactory (Dallas) 32.776664 -96.796988 0.0 500.0 5 true 77.27087 0.0 77.27087 0.0 250000.0 386.35435 0.0 0.0
47 BoatFactory (San Jose) 37.338208 -121.886329 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
48 BoatFactory (San Jose) 37.338208 -121.886329 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
49 BoatFactory (San Jose) 37.338208 -121.886329 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
50 BoatFactory (San Jose) 37.338208 -121.886329 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
51 BoatFactory (San Jose) 37.338208 -121.886329 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
52 RecyclingPlant (Chicago) 41.881832 -87.623177 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
53 RecyclingPlant (Chicago) 41.881832 -87.623177 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
54 RecyclingPlant (Chicago) 41.881832 -87.623177 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
55 RecyclingPlant (Chicago) 41.881832 -87.623177 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
56 RecyclingPlant (Chicago) 41.881832 -87.623177 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
57 RecyclingPlant (New York City) 40.712776 -74.005974 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
58 RecyclingPlant (New York City) 40.712776 -74.005974 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
59 RecyclingPlant (New York City) 40.712776 -74.005974 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
60 RecyclingPlant (New York City) 40.712776 -74.005974 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
61 RecyclingPlant (New York City) 40.712776 -74.005974 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
62 RecyclingPlant (Los Angeles) 34.052235 -118.243683 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
63 RecyclingPlant (Los Angeles) 34.052235 -118.243683 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
64 RecyclingPlant (Los Angeles) 34.052235 -118.243683 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
65 RecyclingPlant (Los Angeles) 34.052235 -118.243683 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
66 RecyclingPlant (Los Angeles) 34.052235 -118.243683 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
67 RecyclingPlant (Houston) 29.760427 -95.369804 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
68 RecyclingPlant (Houston) 29.760427 -95.369804 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
69 RecyclingPlant (Houston) 29.760427 -95.369804 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
70 RecyclingPlant (Houston) 29.760427 -95.369804 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
71 RecyclingPlant (Houston) 29.760427 -95.369804 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
72 RecyclingPlant (Phoenix) 33.448376 -112.074036 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
73 RecyclingPlant (Phoenix) 33.448376 -112.074036 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
74 RecyclingPlant (Phoenix) 33.448376 -112.074036 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
75 RecyclingPlant (Phoenix) 33.448376 -112.074036 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
76 RecyclingPlant (Phoenix) 33.448376 -112.074036 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
77 RecyclingPlant (Philadelphia) 39.952583 -75.165222 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
78 RecyclingPlant (Philadelphia) 39.952583 -75.165222 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
79 RecyclingPlant (Philadelphia) 39.952583 -75.165222 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
80 RecyclingPlant (Philadelphia) 39.952583 -75.165222 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
81 RecyclingPlant (Philadelphia) 39.952583 -75.165222 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
82 RecyclingPlant (San Antonio) 29.424122 -98.493629 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
83 RecyclingPlant (San Antonio) 29.424122 -98.493629 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
84 RecyclingPlant (San Antonio) 29.424122 -98.493629 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
85 RecyclingPlant (San Antonio) 29.424122 -98.493629 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
86 RecyclingPlant (San Antonio) 29.424122 -98.493629 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
87 RecyclingPlant (San Diego) 32.715736 -117.161087 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
88 RecyclingPlant (San Diego) 32.715736 -117.161087 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
89 RecyclingPlant (San Diego) 32.715736 -117.161087 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
90 RecyclingPlant (San Diego) 32.715736 -117.161087 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
91 RecyclingPlant (San Diego) 32.715736 -117.161087 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
92 RecyclingPlant (Dallas) 32.776664 -96.796988 0.0 500.0 1 true 6.31579 0.0 6.31579 500000.0 125000.0 15.78947 0.0 0.0
93 RecyclingPlant (Dallas) 32.776664 -96.796988 0.0 500.0 2 true 22.93629 0.0 22.93629 0.0 125000.0 57.34072 0.0 0.0
94 RecyclingPlant (Dallas) 32.776664 -96.796988 0.0 500.0 3 true 31.7714 0.0 31.7714 0.0 125000.0 79.42849 0.0 0.0
95 RecyclingPlant (Dallas) 32.776664 -96.796988 0.0 500.0 4 true 33.80867 0.0 33.80867 0.0 125000.0 84.52168 0.0 0.0
96 RecyclingPlant (Dallas) 32.776664 -96.796988 0.0 500.0 5 true 34.54174 0.0 34.54174 0.0 125000.0 86.35435 0.0 0.0
97 RecyclingPlant (San Jose) 37.338208 -121.886329 0.0 0.0 1 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
98 RecyclingPlant (San Jose) 37.338208 -121.886329 0.0 0.0 2 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
99 RecyclingPlant (San Jose) 37.338208 -121.886329 0.0 0.0 3 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
100 RecyclingPlant (San Jose) 37.338208 -121.886329 0.0 0.0 4 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
101 RecyclingPlant (San Jose) 37.338208 -121.886329 0.0 0.0 5 false 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

View File

@@ -0,0 +1,81 @@
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
1 source destination product emission year amount sent (tonne) distance (km) emission factor (tonne/km/tonne) emission amount (tonne)
2 RecyclingPlant (Dallas) BoatFactory (Dallas) Nail CO2 1 0.15789 0.0 2.68 0.0
3 RecyclingPlant (Dallas) BoatFactory (Dallas) Nail NH4 1 0.15789 0.0 1.02 0.0
4 RecyclingPlant (Dallas) BoatFactory (Dallas) Nail CO2 2 0.57341 0.0 2.68 0.0
5 RecyclingPlant (Dallas) BoatFactory (Dallas) Nail NH4 2 0.57341 0.0 1.02 0.0
6 RecyclingPlant (Dallas) BoatFactory (Dallas) Nail CO2 3 0.79428 0.0 2.68 0.0
7 RecyclingPlant (Dallas) BoatFactory (Dallas) Nail NH4 3 0.79428 0.0 1.02 0.0
8 RecyclingPlant (Dallas) BoatFactory (Dallas) Nail CO2 4 0.84522 0.0 2.68 0.0
9 RecyclingPlant (Dallas) BoatFactory (Dallas) Nail NH4 4 0.84522 0.0 1.02 0.0
10 RecyclingPlant (Dallas) BoatFactory (Dallas) Nail CO2 5 0.86354 0.0 2.68 0.0
11 RecyclingPlant (Dallas) BoatFactory (Dallas) Nail NH4 5 0.86354 0.0 1.02 0.0
12 NailFactory (Chicago) BoatFactory (Dallas) Nail CO2 1 1.0 1293.093 2.68 3465.48924
13 NailFactory (Chicago) BoatFactory (Dallas) Nail NH4 1 1.0 1293.093 1.02 1318.95486
14 NailFactory (Chicago) BoatFactory (Dallas) Nail CO2 2 1.0 1293.093 2.68 3465.48924
15 NailFactory (Chicago) BoatFactory (Dallas) Nail NH4 2 1.0 1293.093 1.02 1318.95486
16 NailFactory (Chicago) BoatFactory (Dallas) Nail CO2 3 1.0 1293.093 2.68 3465.48924
17 NailFactory (Chicago) BoatFactory (Dallas) Nail NH4 3 1.0 1293.093 1.02 1318.95486
18 NailFactory (Chicago) BoatFactory (Dallas) Nail CO2 4 1.0 1293.093 2.68 3465.48924
19 NailFactory (Chicago) BoatFactory (Dallas) Nail NH4 4 1.0 1293.093 1.02 1318.95486
20 NailFactory (Chicago) BoatFactory (Dallas) Nail CO2 5 1.0 1293.093 2.68 3465.48924
21 NailFactory (Chicago) BoatFactory (Dallas) Nail NH4 5 1.0 1293.093 1.02 1318.95486
22 NailFactory (Phoenix) BoatFactory (Dallas) Nail CO2 1 1.0 1423.57 2.68 3815.1676
23 NailFactory (Phoenix) BoatFactory (Dallas) Nail NH4 1 1.0 1423.57 1.02 1452.0414
24 NailFactory (Phoenix) BoatFactory (Dallas) Nail CO2 2 1.0 1423.57 2.68 3815.1676
25 NailFactory (Phoenix) BoatFactory (Dallas) Nail NH4 2 1.0 1423.57 1.02 1452.0414
26 NailFactory (Phoenix) BoatFactory (Dallas) Nail CO2 3 1.0 1423.57 2.68 3815.1676
27 NailFactory (Phoenix) BoatFactory (Dallas) Nail NH4 3 1.0 1423.57 1.02 1452.0414
28 NailFactory (Phoenix) BoatFactory (Dallas) Nail CO2 4 1.0 1423.57 2.68 3815.1676
29 NailFactory (Phoenix) BoatFactory (Dallas) Nail NH4 4 1.0 1423.57 1.02 1452.0414
30 NailFactory (Phoenix) BoatFactory (Dallas) Nail CO2 5 1.0 1423.57 2.68 3815.1676
31 NailFactory (Phoenix) BoatFactory (Dallas) Nail NH4 5 1.0 1423.57 1.02 1452.0414
32 NailFactory (Dallas) BoatFactory (Dallas) Nail CO2 1 1.0 0.0 2.68 0.0
33 NailFactory (Dallas) BoatFactory (Dallas) Nail NH4 1 1.0 0.0 1.02 0.0
34 NailFactory (Dallas) BoatFactory (Dallas) Nail CO2 2 1.0 0.0 2.68 0.0
35 NailFactory (Dallas) BoatFactory (Dallas) Nail NH4 2 1.0 0.0 1.02 0.0
36 NailFactory (Dallas) BoatFactory (Dallas) Nail CO2 3 1.0 0.0 2.68 0.0
37 NailFactory (Dallas) BoatFactory (Dallas) Nail NH4 3 1.0 0.0 1.02 0.0
38 NailFactory (Dallas) BoatFactory (Dallas) Nail CO2 4 1.0 0.0 2.68 0.0
39 NailFactory (Dallas) BoatFactory (Dallas) Nail NH4 4 1.0 0.0 1.02 0.0
40 NailFactory (Dallas) BoatFactory (Dallas) Nail CO2 5 1.0 0.0 2.68 0.0
41 NailFactory (Dallas) BoatFactory (Dallas) Nail NH4 5 1.0 0.0 1.02 0.0
42 RecyclingPlant (Dallas) BoatFactory (Dallas) Wood CO2 1 3.0 0.0 2.68 0.0
43 RecyclingPlant (Dallas) BoatFactory (Dallas) Wood NH4 1 3.0 0.0 1.02 0.0
44 RecyclingPlant (Dallas) BoatFactory (Dallas) Wood CO2 2 10.89474 0.0 2.68 0.0
45 RecyclingPlant (Dallas) BoatFactory (Dallas) Wood NH4 2 10.89474 0.0 1.02 0.0
46 RecyclingPlant (Dallas) BoatFactory (Dallas) Wood CO2 3 15.09141 0.0 2.68 0.0
47 RecyclingPlant (Dallas) BoatFactory (Dallas) Wood NH4 3 15.09141 0.0 1.02 0.0
48 RecyclingPlant (Dallas) BoatFactory (Dallas) Wood CO2 4 16.05912 0.0 2.68 0.0
49 RecyclingPlant (Dallas) BoatFactory (Dallas) Wood NH4 4 16.05912 0.0 1.02 0.0
50 RecyclingPlant (Dallas) BoatFactory (Dallas) Wood CO2 5 16.40733 0.0 2.68 0.0
51 RecyclingPlant (Dallas) BoatFactory (Dallas) Wood NH4 5 16.40733 0.0 1.02 0.0
52 Forest (Dallas) BoatFactory (Dallas) Wood CO2 1 57.0 0.0 2.68 0.0
53 Forest (Dallas) BoatFactory (Dallas) Wood NH4 1 57.0 0.0 1.02 0.0
54 Forest (Dallas) BoatFactory (Dallas) Wood CO2 2 57.0 0.0 2.68 0.0
55 Forest (Dallas) BoatFactory (Dallas) Wood NH4 2 57.0 0.0 1.02 0.0
56 Forest (Dallas) BoatFactory (Dallas) Wood CO2 3 57.0 0.0 2.68 0.0
57 Forest (Dallas) BoatFactory (Dallas) Wood NH4 3 57.0 0.0 1.02 0.0
58 Forest (Dallas) BoatFactory (Dallas) Wood CO2 4 57.0 0.0 2.68 0.0
59 Forest (Dallas) BoatFactory (Dallas) Wood NH4 4 57.0 0.0 1.02 0.0
60 Forest (Dallas) BoatFactory (Dallas) Wood CO2 5 57.0 0.0 2.68 0.0
61 Forest (Dallas) BoatFactory (Dallas) Wood NH4 5 57.0 0.0 1.02 0.0
62 BoatFactory (Dallas) Retail (Dallas) NewBoat CO2 1 63.15789 0.0 2.68 0.0
63 BoatFactory (Dallas) Retail (Dallas) NewBoat NH4 1 63.15789 0.0 1.02 0.0
64 BoatFactory (Dallas) Retail (Dallas) NewBoat CO2 2 71.46814 0.0 2.68 0.0
65 BoatFactory (Dallas) Retail (Dallas) NewBoat NH4 2 71.46814 0.0 1.02 0.0
66 BoatFactory (Dallas) Retail (Dallas) NewBoat CO2 3 75.8857 0.0 2.68 0.0
67 BoatFactory (Dallas) Retail (Dallas) NewBoat NH4 3 75.8857 0.0 1.02 0.0
68 BoatFactory (Dallas) Retail (Dallas) NewBoat CO2 4 76.90434 0.0 2.68 0.0
69 BoatFactory (Dallas) Retail (Dallas) NewBoat NH4 4 76.90434 0.0 1.02 0.0
70 BoatFactory (Dallas) Retail (Dallas) NewBoat CO2 5 77.27087 0.0 2.68 0.0
71 BoatFactory (Dallas) Retail (Dallas) NewBoat NH4 5 77.27087 0.0 1.02 0.0
72 Retail (Dallas) RecyclingPlant (Dallas) UsedBoat CO2 1 6.31579 0.0 2.68 0.0
73 Retail (Dallas) RecyclingPlant (Dallas) UsedBoat NH4 1 6.31579 0.0 1.02 0.0
74 Retail (Dallas) RecyclingPlant (Dallas) UsedBoat CO2 2 22.93629 0.0 2.68 0.0
75 Retail (Dallas) RecyclingPlant (Dallas) UsedBoat NH4 2 22.93629 0.0 1.02 0.0
76 Retail (Dallas) RecyclingPlant (Dallas) UsedBoat CO2 3 31.7714 0.0 2.68 0.0
77 Retail (Dallas) RecyclingPlant (Dallas) UsedBoat NH4 3 31.7714 0.0 1.02 0.0
78 Retail (Dallas) RecyclingPlant (Dallas) UsedBoat CO2 4 33.80867 0.0 2.68 0.0
79 Retail (Dallas) RecyclingPlant (Dallas) UsedBoat NH4 4 33.80867 0.0 1.02 0.0
80 Retail (Dallas) RecyclingPlant (Dallas) UsedBoat CO2 5 34.54174 0.0 2.68 0.0
81 Retail (Dallas) RecyclingPlant (Dallas) UsedBoat NH4 5 34.54174 0.0 1.02 0.0

View File

@@ -0,0 +1,41 @@
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
1 source destination product year amount sent (tonne) distance (km) transportation cost ($) center revenue ($) center collection cost ($)
2 RecyclingPlant (Dallas) BoatFactory (Dallas) Nail 1 0.15789 0.0 0.0 0.0 0.0
3 RecyclingPlant (Dallas) BoatFactory (Dallas) Nail 2 0.57341 0.0 0.0 0.0 0.0
4 RecyclingPlant (Dallas) BoatFactory (Dallas) Nail 3 0.79428 0.0 0.0 0.0 0.0
5 RecyclingPlant (Dallas) BoatFactory (Dallas) Nail 4 0.84522 0.0 0.0 0.0 0.0
6 RecyclingPlant (Dallas) BoatFactory (Dallas) Nail 5 0.86354 0.0 0.0 0.0 0.0
7 NailFactory (Chicago) BoatFactory (Dallas) Nail 1 1.0 1293.093 387.9279 0.0 1000.0
8 NailFactory (Chicago) BoatFactory (Dallas) Nail 2 1.0 1293.093 387.9279 0.0 1000.0
9 NailFactory (Chicago) BoatFactory (Dallas) Nail 3 1.0 1293.093 387.9279 0.0 1000.0
10 NailFactory (Chicago) BoatFactory (Dallas) Nail 4 1.0 1293.093 387.9279 0.0 1000.0
11 NailFactory (Chicago) BoatFactory (Dallas) Nail 5 1.0 1293.093 387.9279 0.0 1000.0
12 NailFactory (Phoenix) BoatFactory (Dallas) Nail 1 1.0 1423.57 427.071 0.0 1000.0
13 NailFactory (Phoenix) BoatFactory (Dallas) Nail 2 1.0 1423.57 427.071 0.0 1000.0
14 NailFactory (Phoenix) BoatFactory (Dallas) Nail 3 1.0 1423.57 427.071 0.0 1000.0
15 NailFactory (Phoenix) BoatFactory (Dallas) Nail 4 1.0 1423.57 427.071 0.0 1000.0
16 NailFactory (Phoenix) BoatFactory (Dallas) Nail 5 1.0 1423.57 427.071 0.0 1000.0
17 NailFactory (Dallas) BoatFactory (Dallas) Nail 1 1.0 0.0 0.0 0.0 1000.0
18 NailFactory (Dallas) BoatFactory (Dallas) Nail 2 1.0 0.0 0.0 0.0 1000.0
19 NailFactory (Dallas) BoatFactory (Dallas) Nail 3 1.0 0.0 0.0 0.0 1000.0
20 NailFactory (Dallas) BoatFactory (Dallas) Nail 4 1.0 0.0 0.0 0.0 1000.0
21 NailFactory (Dallas) BoatFactory (Dallas) Nail 5 1.0 0.0 0.0 0.0 1000.0
22 RecyclingPlant (Dallas) BoatFactory (Dallas) Wood 1 3.0 0.0 0.0 0.0 0.0
23 RecyclingPlant (Dallas) BoatFactory (Dallas) Wood 2 10.89474 0.0 0.0 0.0 0.0
24 RecyclingPlant (Dallas) BoatFactory (Dallas) Wood 3 15.09141 0.0 0.0 0.0 0.0
25 RecyclingPlant (Dallas) BoatFactory (Dallas) Wood 4 16.05912 0.0 0.0 0.0 0.0
26 RecyclingPlant (Dallas) BoatFactory (Dallas) Wood 5 16.40733 0.0 0.0 0.0 0.0
27 Forest (Dallas) BoatFactory (Dallas) Wood 1 57.0 0.0 0.0 0.0 14250.0
28 Forest (Dallas) BoatFactory (Dallas) Wood 2 57.0 0.0 0.0 0.0 14250.0
29 Forest (Dallas) BoatFactory (Dallas) Wood 3 57.0 0.0 0.0 0.0 14250.0
30 Forest (Dallas) BoatFactory (Dallas) Wood 4 57.0 0.0 0.0 0.0 14250.0
31 Forest (Dallas) BoatFactory (Dallas) Wood 5 57.0 0.0 0.0 0.0 14250.0
32 BoatFactory (Dallas) Retail (Dallas) NewBoat 1 63.15789 0.0 0.0 757894.73684 0.0
33 BoatFactory (Dallas) Retail (Dallas) NewBoat 2 71.46814 0.0 0.0 857617.72853 0.0
34 BoatFactory (Dallas) Retail (Dallas) NewBoat 3 75.8857 0.0 0.0 910628.37148 0.0
35 BoatFactory (Dallas) Retail (Dallas) NewBoat 4 76.90434 0.0 0.0 922852.03459 0.0
36 BoatFactory (Dallas) Retail (Dallas) NewBoat 5 77.27087 0.0 0.0 927250.44516 0.0
37 Retail (Dallas) RecyclingPlant (Dallas) UsedBoat 1 6.31579 0.0 0.0 0.0 631.57895
38 Retail (Dallas) RecyclingPlant (Dallas) UsedBoat 2 22.93629 0.0 0.0 0.0 2293.62881
39 Retail (Dallas) RecyclingPlant (Dallas) UsedBoat 3 31.7714 0.0 0.0 0.0 3177.13952
40 Retail (Dallas) RecyclingPlant (Dallas) UsedBoat 4 33.80867 0.0 0.0 0.0 3380.86724
41 Retail (Dallas) RecyclingPlant (Dallas) UsedBoat 5 34.54174 0.0 0.0 0.0 3454.17409

View File

@@ -1,202 +0,0 @@
{
"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]
}
}
}
}
}
}
}

207
test/fixtures/s1.json vendored
View File

@@ -1,207 +0,0 @@
{
"parameters": {
"time horizon (years)": 2,
"distance metric": "driving"
},
"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.05],
"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],
"acquisition cost ($/tonne)": [0.5, 0.5]
},
"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.05],
"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]
}
},
"initial capacity (tonne)": 500.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.8
},
"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.2,
"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]
}
}
}
}
}
}
}

BIN
test/fixtures/s1.zip vendored

Binary file not shown.

347
test/fixtures/s2.json vendored
View File

@@ -1,347 +0,0 @@
{
"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
]
}
}
}
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More