1 Commits

Author SHA1 Message Date
d85868c71a Docs: Add description of resolve 2021-02-26 11:39:41 -06:00
75 changed files with 11971 additions and 4487 deletions

View File

@@ -1,4 +0,0 @@
build
jobs
relog-web/node_modules
relog-web/build

View File

@@ -1,27 +0,0 @@
name: Lint
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: '1'
- uses: actions/checkout@v1
- name: Format check
shell: julia --color=yes {0}
run: |
using Pkg
Pkg.add(PackageSpec(name="JuliaFormatter", version="1"))
using JuliaFormatter
format("src", verbose=true)
format("test/src", verbose=true)
out = String(read(Cmd(`git diff`)))
if isempty(out)
exit(0)
end
@error "Some files have not been formatted !!!"
write(stdout, out)
exit(1)

View File

@@ -1,15 +0,0 @@
name: TagBot
on:
issue_comment:
types:
- created
workflow_dispatch:
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
ssh: ${{ secrets.DOCUMENTER_KEY }}

View File

@@ -1,16 +1,14 @@
name: Build & Test
on:
push:
pull_request:
schedule:
- cron: '45 10 * * *'
- push
- pull_request
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
version: ['1.6', '1.7', '1.8']
version: ['1.3', '1.4', '1.5', 'nightly']
os:
- ubuntu-latest
arch:
@@ -21,15 +19,5 @@ jobs:
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- name: Run tests
shell: julia --color=yes --project=test {0}
run: |
using Pkg
Pkg.develop(path=".")
Pkg.update()
using RELOGT
try
runtests()
catch
exit(1)
end
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1

9
.gitignore vendored
View File

@@ -8,12 +8,3 @@ instances/*.py
notebooks
.idea
*.lp
Manifest.toml
data
build
benchmark
run.jl
relog-web-legacy
.vscode
jobs
**/tmp

View File

@@ -1,28 +0,0 @@
{
"creators": [
{
"orcid": "0000-0002-5022-9802",
"affiliation": "Argonne National Laboratory",
"name": "Santos Xavier, Alinson"
},
{
"orcid": "0000-0002-3426-9425",
"affiliation": "Argonne National Laboratory",
"name": "Iloeje, Chukwunwike"
},
{
"affiliation": "Argonne National Laboratory",
"name": "Atkins, John"
},
{
"affiliation": "Argonne National Laboratory",
"name": "Sun, Kyle"
},
{
"affiliation": "Argonne National Laboratory",
"name": "Gallier, Audrey"
}
],
"title": "RELOG: Reverse Logistics Optimization",
"description": "<b>RELOG</b> is a supply chain optimization package focusing on reverse logistics and reverse manufacturing. For example, the package can be used to determine where to build recycling plants, what sizes should they have and which customers should be served by which plants. The package supports customized reverse logistics pipelines, with multiple types of plants, multiple types of product and multiple time periods."
}

28
CHANGELOG.md Normal file
View File

@@ -0,0 +1,28 @@
# Version 0.5.0 (TBD)
- Allow plants to store input material for processing in later years
# Version 0.4.0 (Sep 18, 2020)
- Generate simplified solution reports (CSV)
# Version 0.3.3 (Aug 13, 2020)
- Add option to write solution to JSON file in RELOG.solve
- Improve error message when instance is infeasible
- Make output file more readable
# Version 0.3.2 (Aug 7, 2020)
- Add "building period" parameter
# Version 0.3.1 (July 17, 2020)
- Fix expansion cost breakdown
# Version 0.3.0 (June 25, 2020)
- Track emissions and energy (transportation and plants)
- Minor changes to input file format:
- Make all dictionary keys lowercase
- Rename "outputs (tonne)" to "outputs (tonne/tonne)"

25
COPYING.md Normal file
View File

@@ -0,0 +1,25 @@
Copyright © 2020, UChicago Argonne, LLC
All Rights Reserved
Software Name: RELOG
By: Argonne National Laboratory
OPEN SOURCE LICENSE
-------------------
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
********************************************************************************
DISCLAIMER
----------
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
********************************************************************************

25
Makefile Normal file
View File

@@ -0,0 +1,25 @@
JULIA := julia --color=yes --project=@.
SRC_FILES := $(wildcard src/*.jl test/*.jl)
VERSION := 0.5
all: docs test
build/sysimage.so: src/sysimage.jl Project.toml Manifest.toml
mkdir -p build
$(JULIA) src/sysimage.jl
build/test.log: $(SRC_FILES) build/sysimage.so
cd test; $(JULIA) --sysimage ../build/sysimage.so runtests.jl
clean:
rm -rf build/*
docs:
mkdocs build -d ../docs/$(VERSION)/
test: build/test.log
test-watch:
bash -c "while true; do make test --quiet; sleep 1; done"
.PHONY: docs test

441
Manifest.toml Normal file
View File

@@ -0,0 +1,441 @@
# This file is machine-generated - editing it directly is not advised
[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
[[BenchmarkTools]]
deps = ["JSON", "Logging", "Printf", "Statistics", "UUIDs"]
git-tree-sha1 = "9e62e66db34540a0c919d72172cc2f642ac71260"
uuid = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
version = "0.5.0"
[[BinaryProvider]]
deps = ["Libdl", "Logging", "SHA"]
git-tree-sha1 = "ecdec412a9abc8db54c0efc5548c64dfce072058"
uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
version = "0.5.10"
[[Bzip2_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "03a44490020826950c68005cafb336e5ba08b7e8"
uuid = "6e34b625-4abd-537c-b88f-471c36dfa7a0"
version = "1.0.6+4"
[[CEnum]]
git-tree-sha1 = "215a9aa4a1f23fbd05b92769fdd62559488d70e9"
uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82"
version = "0.4.1"
[[CSV]]
deps = ["CategoricalArrays", "DataFrames", "Dates", "Mmap", "Parsers", "PooledArrays", "SentinelArrays", "Tables", "Unicode"]
git-tree-sha1 = "a390152e6850405a48ca51bd7ca33d11a21d6230"
uuid = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
version = "0.7.7"
[[Calculus]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "f641eb0a4f00c343bbc32346e1217b86f3ce9dad"
uuid = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
version = "0.5.1"
[[CategoricalArrays]]
deps = ["DataAPI", "Future", "JSON", "Missings", "Printf", "Statistics", "StructTypes", "Unicode"]
git-tree-sha1 = "2ac27f59196a68070e132b25713f9a5bbc5fa0d2"
uuid = "324d7699-5711-5eae-9e2f-1d82baa6b597"
version = "0.8.3"
[[Cbc]]
deps = ["BinaryProvider", "Libdl", "MathOptInterface", "MathProgBase", "SparseArrays", "Test"]
git-tree-sha1 = "62d80f448b5d77b3f0a59cecf6197aad2a3aa280"
uuid = "9961bab8-2fa3-5c5a-9d89-47fab24efd76"
version = "0.6.7"
[[Clp]]
deps = ["BinaryProvider", "CEnum", "Clp_jll", "Libdl", "MathOptInterface", "SparseArrays"]
git-tree-sha1 = "581763750759c1e38df2a35a0b3bdee496a062c7"
uuid = "e2554f3b-3117-50c0-817c-e040a3ddf72d"
version = "0.8.1"
[[Clp_jll]]
deps = ["CoinUtils_jll", "CompilerSupportLibraries_jll", "Libdl", "OpenBLAS32_jll", "Osi_jll", "Pkg"]
git-tree-sha1 = "79263d9383ca89b35f31c33ab5b880536a8413a4"
uuid = "06985876-5285-5a41-9fcb-8948a742cc53"
version = "1.17.6+6"
[[CodecBzip2]]
deps = ["Bzip2_jll", "Libdl", "TranscodingStreams"]
git-tree-sha1 = "2e62a725210ce3c3c2e1a3080190e7ca491f18d7"
uuid = "523fee87-0ab8-5b00-afb7-3ecf72e48cfd"
version = "0.7.2"
[[CodecZlib]]
deps = ["TranscodingStreams", "Zlib_jll"]
git-tree-sha1 = "ded953804d019afa9a3f98981d99b33e3db7b6da"
uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
version = "0.7.0"
[[CoinUtils_jll]]
deps = ["CompilerSupportLibraries_jll", "Libdl", "OpenBLAS32_jll", "Pkg"]
git-tree-sha1 = "ee1f06ab89337b7f194c29377ab174e752cdf60d"
uuid = "be027038-0da8-5614-b30d-e42594cb92df"
version = "2.11.3+3"
[[CommonSubexpressions]]
deps = ["MacroTools", "Test"]
git-tree-sha1 = "7b8a93dba8af7e3b42fecabf646260105ac373f7"
uuid = "bbf7d656-a473-5ed7-a52c-81e309532950"
version = "0.3.0"
[[Compat]]
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"]
git-tree-sha1 = "7c7f4cda0d58ec999189d70f5ee500348c4b4df1"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "3.16.0"
[[CompilerSupportLibraries_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "7c4f882c41faa72118841185afc58a2eb00ef612"
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "0.3.3+0"
[[CoordinateTransformations]]
deps = ["LinearAlgebra", "StaticArrays"]
git-tree-sha1 = "c230b1d94db9fdd073168830437e64b9db627fcb"
uuid = "150eb455-5306-5404-9cee-2592286d6298"
version = "0.6.0"
[[DataAPI]]
git-tree-sha1 = "176e23402d80e7743fc26c19c681bfb11246af32"
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
version = "1.3.0"
[[DataFrames]]
deps = ["CategoricalArrays", "Compat", "DataAPI", "Future", "InvertedIndices", "IteratorInterfaceExtensions", "Missings", "PooledArrays", "Printf", "REPL", "Reexport", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"]
git-tree-sha1 = "a7c1c9a6e47a92321bbc9d500dab9b04cc4a6a39"
uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
version = "0.21.7"
[[DataStructures]]
deps = ["InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "88d48e133e6d3dd68183309877eac74393daa7eb"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.17.20"
[[DataValueInterfaces]]
git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6"
uuid = "e2d170a0-9d28-54be-80f0-106bbe20a464"
version = "1.0.0"
[[Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
[[DelimitedFiles]]
deps = ["Mmap"]
uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"
[[DiffResults]]
deps = ["StaticArrays"]
git-tree-sha1 = "da24935df8e0c6cf28de340b958f6aac88eaa0cc"
uuid = "163ba53b-c6d8-5494-b064-1a9d43ac40c5"
version = "1.0.2"
[[DiffRules]]
deps = ["NaNMath", "Random", "SpecialFunctions"]
git-tree-sha1 = "eb0c34204c8410888844ada5359ac8b96292cfd1"
uuid = "b552c78f-8df3-52c6-915a-8e097449b14b"
version = "1.0.1"
[[Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
[[ForwardDiff]]
deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "NaNMath", "Random", "SpecialFunctions", "StaticArrays"]
git-tree-sha1 = "1d090099fb82223abc48f7ce176d3f7696ede36d"
uuid = "f6369f11-7733-5829-9624-2563aa707210"
version = "0.10.12"
[[Future]]
deps = ["Random"]
uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820"
[[GZip]]
deps = ["Libdl"]
git-tree-sha1 = "039be665faf0b8ae36e089cd694233f5dee3f7d6"
uuid = "92fee26a-97fe-5a0c-ad85-20a5f3185b63"
version = "0.5.1"
[[Geodesy]]
deps = ["CoordinateTransformations", "Dates", "LinearAlgebra", "StaticArrays", "Test"]
git-tree-sha1 = "f80ea86cb88db337a1906e245e495592f0b5cc25"
uuid = "0ef565a4-170c-5f04-8de2-149903a85f3d"
version = "0.5.0"
[[HTTP]]
deps = ["Base64", "Dates", "IniFile", "MbedTLS", "Sockets"]
git-tree-sha1 = "c7ec02c4c6a039a98a15f955462cd7aea5df4508"
uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3"
version = "0.8.19"
[[IniFile]]
deps = ["Test"]
git-tree-sha1 = "098e4d2c533924c921f9f9847274f2ad89e018b8"
uuid = "83e8ac13-25f8-5344-8a64-a9f2b223428f"
version = "0.5.0"
[[InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
[[InvertedIndices]]
deps = ["Test"]
git-tree-sha1 = "15732c475062348b0165684ffe28e85ea8396afc"
uuid = "41ab1584-1d38-5bbf-9106-f11c6c58b48f"
version = "1.0.0"
[[IteratorInterfaceExtensions]]
git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856"
uuid = "82899510-4779-5014-852e-03e436cf321d"
version = "1.0.0"
[[JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
git-tree-sha1 = "81690084b6198a2e1da36fcfda16eeca9f9f24e4"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.1"
[[JSONSchema]]
deps = ["BinaryProvider", "HTTP", "JSON"]
git-tree-sha1 = "b0a7f9328967df5213691d318a03cf70ea8c76b1"
uuid = "7d188eb4-7ad8-530c-ae41-71a32a6d4692"
version = "0.2.0"
[[JuMP]]
deps = ["Calculus", "DataStructures", "ForwardDiff", "LinearAlgebra", "MathOptInterface", "MutableArithmetics", "NaNMath", "Random", "SparseArrays", "Statistics"]
git-tree-sha1 = "cbab42e2e912109d27046aa88f02a283a9abac7c"
uuid = "4076af6c-e467-56ae-b986-b466b2749572"
version = "0.21.3"
[[LibGit2]]
deps = ["Printf"]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
[[Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
[[LinearAlgebra]]
deps = ["Libdl"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
[[MacroTools]]
deps = ["Markdown", "Random"]
git-tree-sha1 = "f7d2e3f654af75f01ec49be82c231c382214223a"
uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
version = "0.5.5"
[[Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
[[MathOptInterface]]
deps = ["BenchmarkTools", "CodecBzip2", "CodecZlib", "JSON", "JSONSchema", "LinearAlgebra", "MutableArithmetics", "OrderedCollections", "SparseArrays", "Test", "Unicode"]
git-tree-sha1 = "27f2ef85879b8f1d144266ab44f076ba0dfbd8a1"
uuid = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
version = "0.9.13"
[[MathProgBase]]
deps = ["LinearAlgebra", "SparseArrays"]
git-tree-sha1 = "9abbe463a1e9fc507f12a69e7f29346c2cdc472c"
uuid = "fdba3010-5040-5b88-9595-932c9decdf73"
version = "0.7.8"
[[MbedTLS]]
deps = ["Dates", "MbedTLS_jll", "Random", "Sockets"]
git-tree-sha1 = "426a6978b03a97ceb7ead77775a1da066343ec6e"
uuid = "739be429-bea8-5141-9913-cc70e7f3736d"
version = "1.0.2"
[[MbedTLS_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "c0b1286883cac4e2b617539de41111e0776d02e8"
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
version = "2.16.8+0"
[[Missings]]
deps = ["DataAPI"]
git-tree-sha1 = "ed61674a0864832495ffe0a7e889c0da76b0f4c8"
uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
version = "0.4.4"
[[Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
[[MutableArithmetics]]
deps = ["LinearAlgebra", "SparseArrays", "Test"]
git-tree-sha1 = "6cf09794783b9de2e662c4e8b60d743021e338d0"
uuid = "d8a4904e-b15c-11e9-3269-09a3773c0cb0"
version = "0.2.10"
[[NaNMath]]
git-tree-sha1 = "c84c576296d0e2fbb3fc134d3e09086b3ea617cd"
uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
version = "0.3.4"
[[OpenBLAS32_jll]]
deps = ["CompilerSupportLibraries_jll", "Libdl", "Pkg"]
git-tree-sha1 = "793b33911239d2651c356c823492b58d6490d36a"
uuid = "656ef2d0-ae68-5445-9ca0-591084a874a2"
version = "0.3.9+4"
[[OpenSpecFun_jll]]
deps = ["CompilerSupportLibraries_jll", "Libdl", "Pkg"]
git-tree-sha1 = "d51c416559217d974a1113522d5919235ae67a87"
uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e"
version = "0.5.3+3"
[[OrderedCollections]]
git-tree-sha1 = "16c08bf5dba06609fe45e30860092d6fa41fde7b"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.3.1"
[[Osi_jll]]
deps = ["CoinUtils_jll", "CompilerSupportLibraries_jll", "Libdl", "OpenBLAS32_jll", "Pkg"]
git-tree-sha1 = "bd436a97280df40938e66ae8d18e57aceb072856"
uuid = "7da25872-d9ce-5375-a4d3-7a845f58efdd"
version = "0.108.5+3"
[[PackageCompiler]]
deps = ["Libdl", "Pkg", "UUIDs"]
git-tree-sha1 = "98aa9c653e1dc3473bb5050caf8501293db9eee1"
uuid = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
version = "1.2.1"
[[Parsers]]
deps = ["Dates", "Test"]
git-tree-sha1 = "8077624b3c450b15c087944363606a6ba12f925e"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "1.0.10"
[[Pkg]]
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
[[PooledArrays]]
deps = ["DataAPI"]
git-tree-sha1 = "b1333d4eced1826e15adbdf01a4ecaccca9d353c"
uuid = "2dfb63ee-cc39-5dd5-95bd-886bf059d720"
version = "0.5.3"
[[Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
[[ProgressBars]]
deps = ["Printf"]
git-tree-sha1 = "e66732bbdaad368cfc642cef1f639df5812dc818"
uuid = "49802e3a-d2f1-5c88-81d8-b72133a6f568"
version = "0.6.0"
[[REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
[[Random]]
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
[[Reexport]]
deps = ["Pkg"]
git-tree-sha1 = "7b1d07f411bc8ddb7977ec7f377b97b158514fe0"
uuid = "189a3867-3050-52da-a836-e630ba90ab69"
version = "0.2.0"
[[SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
[[SentinelArrays]]
deps = ["Dates", "Random"]
git-tree-sha1 = "7a74946ace3b34fbb6c10e61b6e250b33d7e758c"
uuid = "91c51154-3ec4-41a3-a24f-3f23e20d615c"
version = "1.2.15"
[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
[[SharedArrays]]
deps = ["Distributed", "Mmap", "Random", "Serialization"]
uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383"
[[Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
[[SortingAlgorithms]]
deps = ["DataStructures", "Random", "Test"]
git-tree-sha1 = "03f5898c9959f8115e30bc7226ada7d0df554ddd"
uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c"
version = "0.3.1"
[[SparseArrays]]
deps = ["LinearAlgebra", "Random"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
[[SpecialFunctions]]
deps = ["OpenSpecFun_jll"]
git-tree-sha1 = "d8d8b8a9f4119829410ecd706da4cc8594a1e020"
uuid = "276daf66-3868-5448-9aa4-cd146d93841b"
version = "0.10.3"
[[StaticArrays]]
deps = ["LinearAlgebra", "Random", "Statistics"]
git-tree-sha1 = "016d1e1a00fabc556473b07161da3d39726ded35"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "0.12.4"
[[Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
[[StructTypes]]
deps = ["Dates", "UUIDs"]
git-tree-sha1 = "1ed04f622a39d2e5a6747c3a70be040c00333933"
uuid = "856f2bd8-1eba-4b0a-8007-ebc267875bd4"
version = "1.1.0"
[[TableTraits]]
deps = ["IteratorInterfaceExtensions"]
git-tree-sha1 = "b1ad568ba658d8cbb3b892ed5380a6f3e781a81e"
uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c"
version = "1.0.0"
[[Tables]]
deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "TableTraits", "Test"]
git-tree-sha1 = "b7f762e9820b7fab47544c36f26f54ac59cf8abf"
uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
version = "1.0.5"
[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[[TranscodingStreams]]
deps = ["Random", "Test"]
git-tree-sha1 = "7c53c35547de1c5b9d46a4797cf6d8253807108c"
uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
version = "0.9.5"
[[UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
[[Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
[[Zlib_jll]]
deps = ["Libdl", "Pkg"]
git-tree-sha1 = "fdd89e5ab270ea0f2a0174bd9093e557d06d4bfa"
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
version = "1.2.11+16"

View File

@@ -1,13 +1,39 @@
name = "RELOG"
uuid = "7cafaa7a-b311-45f0-b313-80bf15b5e5e5"
authors = ["Alinson S. Xavier <git@axavier.org>"]
version = "0.1.0"
uuid = "a2afcdf7-cf04-4913-85f9-c0d81ddf2008"
authors = ["Alinson S Xavier <axavier@anl.gov>"]
version = "0.5.0"
[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Cbc = "9961bab8-2fa3-5c5a-9d89-47fab24efd76"
Clp = "e2554f3b-3117-50c0-817c-e040a3ddf72d"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
GZip = "92fee26a-97fe-5a0c-ad85-20a5f3185b63"
Geodesy = "0ef565a4-170c-5f04-8de2-149903a85f3d"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
JSONSchema = "7d188eb4-7ad8-530c-ae41-71a32a6d4692"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
ProgressBars = "49802e3a-d2f1-5c88-81d8-b72133a6f568"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[compat]
CSV = "0.7"
Cbc = "0.6"
Clp = "0.8"
DataFrames = "0.21"
DataStructures = "0.17"
GZip = "0.5"
Geodesy = "0.5"
JSON = "0.21"
JSONSchema = "0.2"
JuMP = "0.21"
MathOptInterface = "0.9"
PackageCompiler = "1"
ProgressBars = "0.6"
julia = "1"

59
README.md Normal file
View File

@@ -0,0 +1,59 @@
<h1 align="center">RELOG: Reverse Logistics Optimization</h1>
<p align="center">
<a href="https://github.com/ANL-CEEESA/RELOG/actions">
<img src="https://github.com/ANL-CEEESA/RELOG/workflows/CI/badge.svg">
</a>
<a href="https://doi.org/10.5281/zenodo.4302341">
<img src="https://zenodo.org/badge/DOI/10.5281/zenodo.4302341.svg">
</a>
<a href="https://github.com/ANL-CEEESA/RELOG/releases/">
<img src="https://img.shields.io/github/v/release/ANL-CEEESA/RELOG?include_prereleases&label=pre-release">
</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.
<img src="https://anl-ceeesa.github.io/RELOG/0.5/images/ex_transportation.png" width="1000px"/>
### Documentation
* [Usage](https://anl-ceeesa.github.io/RELOG/0.5/usage)
* [Input and Output Data Formats](https://anl-ceeesa.github.io/RELOG/0.5/format)
* [Simplified Solution Reports](https://anl-ceeesa.github.io/RELOG/0.5/reports)
* [Optimization Model](https://anl-ceeesa.github.io/RELOG/0.5/model)
### Authors
* **Alinson S. Xavier,** Argonne National Laboratory <<axavier@anl.gov>>
* **Nwike Iloeje,** Argonne National Laboratory <<ciloeje@anl.gov>>
### License
```text
RELOG: Reverse Logistics Optimization
Copyright © 2020, 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:
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.
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,306 +0,0 @@
# RELOG: Composition Format
## Input Data Format (JSON)
## Glossary of types
| Type | Description | Example |
| --------------------- | -------------------------------------------------------- | ------------------------ |
| `int` | An integer number. | `1` |
| `float` | A real number. | `3.1415` |
| `str` | A string. | `"Euclidean"` |
| `vec(int)` | A vector of integer numbers, with any length. | `[1, 2, 3]` |
| `vec(int, 5)` | A vector of integer numbers, with 5 elements. | `[1, 2, 3, 4, 5]` |
| `mat(float, 2, 3, 4)` | A matrix of floating point numbers with shape (2, 3, 5). | `rand(Float64, 2, 3, 4)` |
| `dict(str, int)` | A dictionary mapping strings to integer numbers. | `Dict("A" => 1)` |
### Parameters
| Key | Type | Description |
| :------------------------ | ---------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `time horizon (years)` | `int` | Number of years in the simulation. |
| `building period (years)` | `vec(int)` | List of years in which we are allowed to open new plants. For example, if this parameter is set to `[1,2,3]`, we can only open plants during the first three years. By default, this equals `[1]`; that is, plants can only be opened during the first year. |
| `distance metric` | `str` | Metric used to compute distances between pairs of locations. Valid options are: `"Euclidean"`, for the straight-line distance between points; or `"driving"` for an approximated driving distance. If not specified, defaults to `"Euclidean"`. |
#### Example
```json
{
"parameters": {
"time horizon (years)": 4,
"building period (years)": [1],
"distance metric": "driving"
}
}
```
### Products
| Key | Type | Description |
| :------------------------------------------ | :------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `transportation cost ($/km/tonne)` | `vec(float, T)` | The cost (in dollars) to transport one tonne of the product over one kilometer at time $t$. |
| `transportation energy (J/km/tonne)` | `vec(float, T)` | The energy (in J) required to transport this product at time $t$. |
| `transportation emissions (tonne/km/tonne)` | `dict(str, vec(float, T))` | A dictionary mapping the name of each greenhouse gas (produced during the transportation of one tonne of this product along one kilometer at time $t$) to the amount of gas produced (in tonnes). |
| `components` | `vec(str)` | List of components for the product. |
#### Example
```json
{
"products": {
"P1": {
"transportation cost ($/km/tonne)": [0.015, 0.015, 0.015, 0.015],
"transportation energy (J/km/tonne)": [0.12, 0.12, 0.12, 0.12],
"transportation emissions (tonne/km/tonne)": {
"CO2": [0.052, 0.052, 0.052, 0.052],
"CH4": [0.003, 0.003, 0.003, 0.003]
},
"components": ["P1a", "P1b", "P1c"]
}
}
}
```
### Centers
| Key | Type | Description |
| :------------------------------ | ------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `latitude (deg)` | `float` | The latitude of the center. |
| `longitude (deg)` | `float` | The longitude of the center. |
| `input` | `str` | The name of the product this center takes as input. May be `null` if the center accept no input product. |
| `outputs` | `vec(str)` | List of output products collected by the center. May be `[]` if none. |
| `fixed output (tonne)` | `dict(str, mat(float, T, C))` | Dictionary mapping the name of each output product $p$ to a matrix $M$, where $M_{t,c}$ is the amount (in tonne) of output product component $c$ produced by the center at time $t$, regardless of how much input material the center received. |
| `variable output (tonne/tonne)` | `dict(str,mat(float, T, M, N))` | Dictionary mapping the name of each output product $p$ to a $(T \times m \times n)$ matrix $M$ that describes the amount (in tonnes) of output product component produced by the center, depending on how much input material the center received in prior years, where $T$ is the number of years, $m$ is the number of components of $p$ and $n$ is the number of components of the input product. |
| `revenue ($/tonne)` | `vec(float, T)` | 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)` | `dict(str,vec(float,T))` | Dictionary mapping the name of each output product to the cost of collecting one tonne of the product. |
| `operating cost ($)` | `vec(float,T)` | Fixed cost to operate the center for one year, regardless of amount of product received or generated. |
| `disposal limit (tonne)` | `dict(str,vec(float,T))` | Dictionary mapping the name of each output product to the maximum disposal amount allower per year of the product at the center. Entry may be `null` if unlimited. |
| `disposal cost ($/tonne)` | `dict(str,vec(float,T))` | Dictionary mapping the name of each output product to the cost to dispose one tonne of the product at the center. |
```json
{
"centers": {
"C1": {
"latitude (deg)": 41.881,
"longitude (deg)": -87.623,
"input": "P1",
"outputs": ["P2", "P3"],
"fixed output (tonne)": {
"P2": [
[50, 20, 10],
[5, 2, 1],
[0, 0, 0],
[0, 0, 0]
],
"P3": [
[20, 10],
[10, 5],
[0, 0],
[0, 0]
]
},
"variable output (tonne/tonne)": {
"P2": [
[
[1, 0, 0],
[0, 1, 1]
],
[
[1, 0, 0],
[0, 1, 1]
],
[
[1, 0, 0],
[0, 1, 1]
],
[
[1, 0, 0],
[0, 1, 1]
]
],
"P3": [
[
[1, 0, 0],
[0, 1, 1]
],
[
[1, 0, 0],
[0, 1, 1]
],
[
[1, 0, 0],
[0, 1, 1]
],
[
[1, 0, 0],
[0, 1, 1]
]
]
},
"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"],
"fixed output (tonne)": {
"P4": [
[50, 5],
[60, 6],
[70, 7],
[80, 8]
]
},
"revenue ($/tonne)": null,
"collection cost ($/tonne)": {
"P4": [0.25, 0.25, 0.25, 0.25]
},
"operating cost ($)": [150.0, 150.0, 150.0, 150.0],
"disposal limit (tonne)": {
"P4": [null, null, null, null]
},
"disposal cost ($/tonne)": {
"P4": [0, 0, 0, 0]
}
},
"C3": {
"latitude (deg)": 41.881,
"longitude (deg)": -87.623,
"input": "P1",
"outputs": [],
"variable output (tonne/tonne)": {},
"constant output (tonne)": {},
"revenue ($/tonne)": [12.0, 12.0, 12.0, 12.0],
"collection cost ($/tonne)": {},
"operating cost ($)": [150.0, 150.0, 150.0, 150.0],
"disposal limit (tonne)": {},
"disposal cost ($/tonne)": {}
}
}
}
```
### Plants
| Key | | Description |
| :----------------------------- | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `latitude (deg)` | `float` | The latitude of the plant, in degrees. |
| `longitude (deg)` | `float` | The longitude of the plant, in degrees. |
| `input mix (%)` | `dict(str,float)` | Dictionary mapping the name of each input product to the amount required (as a percentage). Must sum to 100%. |
| `output (tonne/tonne)` | `dict(str,dict(str,mat(float, T, M, N)))` | Dictionary of matrices describing the component outputs. |
| `processing emissions (tonne)` | `dict(str,vec(float,T))` | 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)` | `dict(str,vec(float,T))` | Dictionary mapping the name of each input product to the cost of storing the product for one year at the plant for later processing. |
| `storage limit (tonne)` | | Dictionary mapping the name of each input product to the maximum amount allowed in storage at any time. May be `null` if unlimited. |
| `disposal cost ($/tonne)` | | Dictionary mapping the name of each output product to the cost of disposing it at the plant. |
| `disposal limit (tonne)` | | Dictionary mapping the name of each output product to the maximum amount allowed to be disposed of at the plant. May be `null` if unlimited. |
| `capacities` | | List describing what plant sizes are allowed, and their characteristics. |
The entries in the `capacities` list should be dictionaries with the following
keys:
| Key | Description |
| :---------------------------------- | :-------------------------------------------------------------------------------------------------- |
| `size (tonne)` | The size of the plant. |
| `opening cost ($)` | The cost to open a plant of this size. |
| `fixed operating cost ($)` | The cost to keep the plant open, even if the plant doesn't process anything. Must be a time series. |
| `variable operating cost ($/tonne)` | The cost that the plant incurs to process each tonne of input. Must be a time series. |
| `initial capacity (tonne)` | Capacity already available. If the plant has not been built yet, this should be `0`. |
```json
{
"plants": {
"L1": {
"latitude (deg)": 41.881,
"longitude (deg)": -87.623,
"input mix (%)": {
"P1": 95.3,
"P2": 4.7
},
"output (tonne/tonne)": {
"P3": {
"P1": [
[[1, 0, 0], [0, 1, 1]],
[[1, 0, 0], [0, 1, 1]],
[[1, 0, 0], [0, 1, 1]],
[[1, 0, 0], [0, 1, 1]]
],
"P2": [
[[0, 1], [1, 0]],
[[0, 1], [1, 0]],
[[0, 1], [1, 0]],
[[0, 1], [1, 0]]
]
},
"P4": {
"P1": [
[[1, 0, 0], [0, 1, 1]],
[[1, 0, 0], [0, 1, 1]],
[[1, 0, 0], [0, 1, 1]],
[[1, 0, 0], [0, 1, 1]]
],
"P2": [
[[0, 1], [1, 0]],
[[0, 1], [1, 0]],
[[0, 1], [1, 0]],
[[0, 1], [1, 0]]
]
},
"P5": {
"P1": [[1, 0, 0], [0, 1, 1]],
"P2": [[0, 1], [1, 0]],
}
},
"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,
}
}
}
```

202
instances/s1.json Normal file
View File

@@ -0,0 +1,202 @@
{
"parameters": {
"time horizon (years)": 2
},
"products": {
"P1": {
"transportation cost ($/km/tonne)": [0.015, 0.015],
"transportation energy (J/km/tonne)": [0.12, 0.11],
"transportation emissions (tonne/km/tonne)": {
"CO2": [0.052, 0.050],
"CH4": [0.003, 0.002]
},
"initial amounts": {
"C1": {
"latitude (deg)": 7.0,
"longitude (deg)": 7.0,
"amount (tonne)": [934.56, 934.56]
},
"C2": {
"latitude (deg)": 7.0,
"longitude (deg)": 19.0,
"amount (tonne)": [198.95, 198.95]
},
"C3": {
"latitude (deg)": 84.0,
"longitude (deg)": 76.0,
"amount (tonne)": [212.97, 212.97]
},
"C4": {
"latitude (deg)": 21.0,
"longitude (deg)": 16.0,
"amount (tonne)": [352.19, 352.19]
},
"C5": {
"latitude (deg)": 32.0,
"longitude (deg)": 92.0,
"amount (tonne)": [510.33, 510.33]
},
"C6": {
"latitude (deg)": 14.0,
"longitude (deg)": 62.0,
"amount (tonne)": [471.66, 471.66]
},
"C7": {
"latitude (deg)": 30.0,
"longitude (deg)": 83.0,
"amount (tonne)": [785.21, 785.21]
},
"C8": {
"latitude (deg)": 35.0,
"longitude (deg)": 40.0,
"amount (tonne)": [706.17, 706.17]
},
"C9": {
"latitude (deg)": 74.0,
"longitude (deg)": 52.0,
"amount (tonne)": [30.08, 30.08]
},
"C10": {
"latitude (deg)": 22.0,
"longitude (deg)": 54.0,
"amount (tonne)": [536.52, 536.52]
}
}
},
"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]
}
}
}
}
}
}
}

950
instances/solutions/s1.json Normal file
View File

@@ -0,0 +1,950 @@
{
"Energy": {
"Plants (GJ)": [
568.6368,
521.2504
],
"Transportation (GJ)": [
3.120910400232,
2.860834533546
]
},
"Costs": {
"Variable operating ($)": [
216672.818,
216672.818
],
"Transportation ($)": [
714499.27483131,
714499.27483131
],
"Disposal ($)": [
-20.0,
-20.0
],
"Total ($)": [
939896.86883131,
931282.09283131
],
"Fixed operating ($)": [
130.0,
130.0
],
"Opening ($)": [
4500.0,
0.0
],
"Expansion ($)": [
4114.776,
0.0
]
},
"Plants": {
"F3": {
"L5": {
"Opening cost ($)": [
0.0,
0.0
],
"Emissions (tonne)": {},
"Expansion cost ($)": [
0.0,
0.0
],
"Longitude (deg)": 100.0,
"Energy (GJ)": [
0.0,
0.0
],
"Total output": {},
"Capacity (tonne)": [
15000.0,
15000.0
],
"Latitude (deg)": 100.0,
"Output": {
"Send": {},
"Dispose": {}
},
"Total input (tonne)": [
757.3824000000001,
757.3824000000001
],
"Fixed operating cost ($)": [
0.0,
0.0
],
"Input": {
"F2": {
"L4": {
"Distance (km)": 8811.73,
"Amount (tonne)": [
757.3824000000001,
757.3824000000001
],
"Transportation energy (J)": [
0.0,
0.0
],
"Transportation cost ($)": [
116792.36127216002,
116792.36127216002
],
"Longitude (deg)": 0.2,
"Variable operating cost ($)": [
-11360.736,
-11360.736
],
"Latitude (deg)": 0.75,
"Emissions (tonne)": {}
}
}
}
}
},
"F1": {
"L1": {
"Opening cost ($)": [
500.0,
0.0
],
"Emissions (tonne)": {
"CH4": [
3.0,
2.0
],
"CO2": [
52.0,
50.0
]
},
"Expansion cost ($)": [
750.0,
0.0
],
"Longitude (deg)": 0.0,
"Energy (GJ)": [
120.0,
110.0
],
"Total output": {
"P2": [
200.0,
200.0
],
"P3": [
500.0,
500.0
]
},
"Capacity (tonne)": [
1000.0,
1000.0
],
"Latitude (deg)": 0.0,
"Output": {
"Send": {
"P2": {
"F2": {
"L4": {
"Distance (km)": 85.87,
"Amount (tonne)": [
199.0,
199.0
],
"Longitude (deg)": 0.2,
"Latitude (deg)": 0.75
}
}
},
"P3": {
"F4": {
"L6": {
"Distance (km)": 6893.41,
"Amount (tonne)": [
499.0,
499.0
],
"Longitude (deg)": 50.0,
"Latitude (deg)": 50.0
}
}
}
},
"Dispose": {
"P2": {
"Amount (tonne)": [
1.0,
1.0
],
"Cost ($)": [
-10.0,
-10.0
]
},
"P3": {
"Amount (tonne)": [
1.0,
1.0
],
"Cost ($)": [
-10.0,
-10.0
]
}
}
},
"Total input (tonne)": [
1000.0,
1000.0
],
"Fixed operating cost ($)": [
30.0,
30.0
],
"Input": {
"Origin": {
"C3": {
"Distance (km)": 8889.75,
"Amount (tonne)": [
212.97000000000003,
212.97000000000003
],
"Transportation energy (J)": [
227190.00690000004,
208257.50632500005
],
"Transportation cost ($)": [
28398.750862500005,
28398.750862500005
],
"Longitude (deg)": 76.0,
"Variable operating cost ($)": [
6389.1,
6389.1
],
"Latitude (deg)": 84.0,
"Emissions (tonne)": {
"CH4": [
0.6389100000000001,
0.42594000000000004
],
"CO2": [
11.074440000000001,
10.648500000000002
]
}
},
"C7": {
"Distance (km)": 8526.39,
"Amount (tonne)": [
246.62,
246.62
],
"Transportation energy (J)": [
252333.396216,
231305.613198
],
"Transportation cost ($)": [
31541.674527,
31541.674527
],
"Longitude (deg)": 83.0,
"Variable operating cost ($)": [
7398.6,
7398.6
],
"Latitude (deg)": 30.0,
"Emissions (tonne)": {
"CH4": [
0.7398600000000001,
0.49324
],
"CO2": [
12.82424,
12.331000000000001
]
}
},
"C5": {
"Distance (km)": 9148.52,
"Amount (tonne)": [
510.3299999999999,
510.3299999999999
],
"Transportation energy (J)": [
560251.7053919999,
513564.0632759999
],
"Transportation cost ($)": [
70031.46317399999,
70031.46317399999
],
"Longitude (deg)": 92.0,
"Variable operating cost ($)": [
15309.899999999998,
15309.899999999998
],
"Latitude (deg)": 32.0,
"Emissions (tonne)": {
"CH4": [
1.5309899999999999,
1.02066
],
"CO2": [
26.537159999999997,
25.516499999999997
]
}
},
"C9": {
"Distance (km)": 8201.21,
"Amount (tonne)": [
30.08,
30.08
],
"Transportation energy (J)": [
29603.087615999993,
27136.163647999994
],
"Transportation cost ($)": [
3700.385951999999,
3700.385951999999
],
"Longitude (deg)": 52.0,
"Variable operating cost ($)": [
902.4,
902.4
],
"Latitude (deg)": 74.0,
"Emissions (tonne)": {
"CH4": [
0.09024,
0.06016
],
"CO2": [
1.5641599999999998,
1.504
]
}
}
}
}
},
"L2": {
"Opening cost ($)": [
999.9999999999999,
0.0
],
"Emissions (tonne)": {
"CH4": [
11.21592,
7.4772799999999995
],
"CO2": [
194.40928,
186.93200000000002
]
},
"Expansion cost ($)": [
3364.7759999999994,
0.0
],
"Longitude (deg)": 0.5,
"Energy (GJ)": [
448.6368,
411.2504
],
"Total output": {
"P2": [
747.728,
747.728
],
"P3": [
1869.32,
1869.32
]
},
"Capacity (tonne)": [
3738.6399999999994,
3738.6399999999994
],
"Latitude (deg)": 0.5,
"Output": {
"Send": {
"P2": {
"F2": {
"L4": {
"Distance (km)": 43.35,
"Amount (tonne)": [
747.728,
747.728
],
"Longitude (deg)": 0.2,
"Latitude (deg)": 0.75
}
}
},
"P3": {
"F4": {
"L6": {
"Distance (km)": 6828.89,
"Amount (tonne)": [
1869.32,
1869.32
],
"Longitude (deg)": 50.0,
"Latitude (deg)": 50.0
}
}
}
},
"Dispose": {}
},
"Total input (tonne)": [
3738.64,
3738.64
],
"Fixed operating cost ($)": [
50.0,
50.0
],
"Input": {
"Origin": {
"C1": {
"Distance (km)": 1017.44,
"Amount (tonne)": [
934.56,
934.56
],
"Transportation energy (J)": [
114103.047168,
104594.459904
],
"Transportation cost ($)": [
14262.880895999999,
14262.880895999999
],
"Longitude (deg)": 7.0,
"Variable operating cost ($)": [
46728.0,
46728.0
],
"Latitude (deg)": 7.0,
"Emissions (tonne)": {
"CH4": [
2.80368,
1.86912
],
"CO2": [
48.59712,
46.728
]
}
},
"C2": {
"Distance (km)": 2165.47,
"Amount (tonne)": [
198.95,
198.95
],
"Transportation energy (J)": [
51698.430779999995,
47390.228214999996
],
"Transportation cost ($)": [
6462.303847499999,
6462.303847499999
],
"Longitude (deg)": 19.0,
"Variable operating cost ($)": [
9947.5,
9947.5
],
"Latitude (deg)": 7.0,
"Emissions (tonne)": {
"CH4": [
0.59685,
0.3979
],
"CO2": [
10.3454,
9.9475
]
}
},
"C8": {
"Distance (km)": 5421.1,
"Amount (tonne)": [
706.17,
706.17
],
"Transportation energy (J)": [
459386.18243999995,
421104.00057
],
"Transportation cost ($)": [
57423.272805,
57423.272805
],
"Longitude (deg)": 40.0,
"Variable operating cost ($)": [
35308.5,
35308.5
],
"Latitude (deg)": 35.0,
"Emissions (tonne)": {
"CH4": [
2.11851,
1.41234
],
"CO2": [
36.720839999999995,
35.3085
]
}
},
"C6": {
"Distance (km)": 6595.52,
"Amount (tonne)": [
471.66,
471.66
],
"Transportation energy (J)": [
373301.15558400005,
342192.72595200007
],
"Transportation cost ($)": [
46662.64444800001,
46662.64444800001
],
"Longitude (deg)": 62.0,
"Variable operating cost ($)": [
23583.0,
23583.0
],
"Latitude (deg)": 14.0,
"Emissions (tonne)": {
"CH4": [
1.4149800000000001,
0.94332
],
"CO2": [
24.526320000000002,
23.583000000000002
]
}
},
"C10": {
"Distance (km)": 6014.13,
"Amount (tonne)": [
536.52,
536.52
],
"Transportation energy (J)": [
387204.123312,
354937.113036
],
"Transportation cost ($)": [
48400.515413999994,
48400.515413999994
],
"Longitude (deg)": 54.0,
"Variable operating cost ($)": [
26826.0,
26826.0
],
"Latitude (deg)": 22.0,
"Emissions (tonne)": {
"CH4": [
1.6095599999999999,
1.07304
],
"CO2": [
27.89904,
26.826
]
}
},
"C4": {
"Distance (km)": 2802.12,
"Amount (tonne)": [
352.19,
352.19
],
"Transportation energy (J)": [
118425.43713599998,
108556.65070799999
],
"Transportation cost ($)": [
14803.179642,
14803.179642
],
"Longitude (deg)": 16.0,
"Variable operating cost ($)": [
17609.5,
17609.5
],
"Latitude (deg)": 21.0,
"Emissions (tonne)": {
"CH4": [
1.05657,
0.70438
],
"CO2": [
18.313879999999997,
17.6095
]
}
},
"C7": {
"Distance (km)": 8469.86,
"Amount (tonne)": [
538.59,
538.59
],
"Transportation energy (J)": [
547413.827688,
501796.008714
],
"Transportation cost ($)": [
68426.728461,
68426.728461
],
"Longitude (deg)": 83.0,
"Variable operating cost ($)": [
26929.5,
26929.5
],
"Latitude (deg)": 30.0,
"Emissions (tonne)": {
"CH4": [
1.6157700000000002,
1.07718
],
"CO2": [
28.00668,
26.929500000000004
]
}
}
}
}
}
},
"F2": {
"L4": {
"Opening cost ($)": [
2999.9999999999995,
0.0
],
"Emissions (tonne)": {},
"Expansion cost ($)": [
0.0,
0.0
],
"Longitude (deg)": 0.2,
"Energy (GJ)": [
0.0,
0.0
],
"Total output": {
"P4": [
757.3824000000001,
757.3824000000001
],
"P3": [
47.336400000000005,
47.336400000000005
]
},
"Capacity (tonne)": [
10000.0,
10000.0
],
"Latitude (deg)": 0.75,
"Output": {
"Send": {
"P4": {
"F3": {
"L5": {
"Distance (km)": 8811.73,
"Amount (tonne)": [
757.3824000000001,
757.3824000000001
],
"Longitude (deg)": 100.0,
"Latitude (deg)": 100.0
}
}
},
"P3": {
"F4": {
"L6": {
"Distance (km)": 6824.63,
"Amount (tonne)": [
47.336400000000005,
47.336400000000005
],
"Longitude (deg)": 50.0,
"Latitude (deg)": 50.0
}
}
}
},
"Dispose": {}
},
"Total input (tonne)": [
946.728,
946.728
],
"Fixed operating cost ($)": [
50.0,
50.0
],
"Input": {
"F1": {
"L1": {
"Distance (km)": 85.87,
"Amount (tonne)": [
199.0,
199.0
],
"Transportation energy (J)": [
0.0,
0.0
],
"Transportation cost ($)": [
341.7626,
341.7626
],
"Longitude (deg)": 0.0,
"Variable operating cost ($)": [
9950.0,
9950.0
],
"Latitude (deg)": 0.0,
"Emissions (tonne)": {}
},
"L2": {
"Distance (km)": 43.35,
"Amount (tonne)": [
747.728,
747.728
],
"Transportation energy (J)": [
0.0,
0.0
],
"Transportation cost ($)": [
648.280176,
648.280176
],
"Longitude (deg)": 0.5,
"Variable operating cost ($)": [
37386.399999999994,
37386.399999999994
],
"Latitude (deg)": 0.5,
"Emissions (tonne)": {}
}
}
}
}
},
"F4": {
"L6": {
"Opening cost ($)": [
0.0,
0.0
],
"Emissions (tonne)": {},
"Expansion cost ($)": [
0.0,
0.0
],
"Longitude (deg)": 50.0,
"Energy (GJ)": [
0.0,
0.0
],
"Total output": {},
"Capacity (tonne)": [
10000.0,
10000.0
],
"Latitude (deg)": 50.0,
"Output": {
"Send": {},
"Dispose": {}
},
"Total input (tonne)": [
2415.6564,
2415.6564
],
"Fixed operating cost ($)": [
0.0,
0.0
],
"Input": {
"F1": {
"L1": {
"Distance (km)": 6893.41,
"Amount (tonne)": [
499.0,
499.0
],
"Transportation energy (J)": [
0.0,
0.0
],
"Transportation cost ($)": [
42997.644875000005,
42997.644875000005
],
"Longitude (deg)": 0.0,
"Variable operating cost ($)": [
-7485.0,
-7485.0
],
"Latitude (deg)": 0.0,
"Emissions (tonne)": {}
},
"L2": {
"Distance (km)": 6828.89,
"Amount (tonne)": [
1869.32,
1869.32
],
"Transportation energy (J)": [
0.0,
0.0
],
"Transportation cost ($)": [
159567.258185,
159567.258185
],
"Longitude (deg)": 0.5,
"Variable operating cost ($)": [
-28039.8,
-28039.8
],
"Latitude (deg)": 0.5,
"Emissions (tonne)": {}
}
},
"F2": {
"L4": {
"Distance (km)": 6824.63,
"Amount (tonne)": [
47.336400000000005,
47.336400000000005
],
"Transportation energy (J)": [
0.0,
0.0
],
"Transportation cost ($)": [
4038.1676941500004,
4038.1676941500004
],
"Longitude (deg)": 0.2,
"Variable operating cost ($)": [
-710.046,
-710.046
],
"Latitude (deg)": 0.75,
"Emissions (tonne)": {}
}
}
}
}
}
},
"Emissions": {
"Transportation (tonne)": {
"CH4": [
14.21592,
9.477279999999999
],
"CO2": [
246.40927999999994,
236.93200000000002
]
},
"Plants (tonne)": {
"CH4": [
14.21592,
9.47728
],
"CO2": [
246.40928,
236.93200000000002
]
}
},
"Products": {
"P1": {
"C1": {
"Marginal cost ($/tonne)": [
133.59,
134.49
]
},
"C2": {
"Marginal cost ($/tonne)": [
150.81,
151.71
]
},
"C3": {
"Marginal cost ($/tonne)": [
250.83,
251.73
]
},
"C8": {
"Marginal cost ($/tonne)": [
199.65,
200.55
]
},
"C6": {
"Marginal cost ($/tonne)": [
217.26,
218.16
]
},
"C10": {
"Marginal cost ($/tonne)": [
208.54,
209.44
]
},
"C4": {
"Marginal cost ($/tonne)": [
160.36,
161.26
]
},
"C5": {
"Marginal cost ($/tonne)": [
254.71,
255.61
]
},
"C7": {
"Marginal cost ($/tonne)": [
245.38,
246.28
]
},
"C9": {
"Marginal cost ($/tonne)": [
240.5,
241.4
]
}
}
}
}

View File

@@ -0,0 +1,11 @@
[ Info: Reading s1.json...
[ Info: Building graph...
[ Info: 2 time periods
[ Info: 6 process nodes
[ Info: 8 shipping nodes (plant)
[ Info: 10 shipping nodes (collection)
[ Info: 38 arcs
[ Info: Building optimization model...
[ Info: Optimizing MILP...
[ Info: Re-optimizing with integer variables fixed...
[ Info: Extracting solution...

23
mkdocs.yml Normal file
View File

@@ -0,0 +1,23 @@
site_name: RELOG
theme: cinder
copyright: "Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved."
repo_url: https://github.com/ANL-CEEESA/RELOG
edit_uri: edit/master/src/docs/
nav:
- Home: index.md
- Usage: usage.md
- Data Format: format.md
- Reports: reports.md
- Optimization Model: model.md
plugins:
- search
markdown_extensions:
- admonition
- mdx_math
extra_javascript:
- https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML
- js/mathjax.js
docs_dir: src/docs
site_dir: docs
extra_css:
- "css/custom.css"

View File

@@ -1,14 +1,11 @@
# RELOG: Reverse Logistics Optimization
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
# Released under the modified BSD license. See COPYING.md for more details.
module RELOG
_round(x::Number) = round(x, digits = 5)
include("instance/structs.jl")
include("instance/parse.jl")
include("model/jumpext.jl")
include("model/dist.jl")
include("model/build.jl")
include("reports/plants.jl")
include("reports/transportation.jl")
include("reports/centers.jl")
end # module RELOG
include("dotdict.jl")
include("instance.jl")
include("graph.jl")
include("model.jl")
include("reports.jl")
end

28
src/docs/css/custom.css Normal file
View File

@@ -0,0 +1,28 @@
.navbar-default {
border-bottom: 0px;
background-color: #fff;
box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.2);
}
a, .navbar-default a {
color: #06a !important;
font-weight: normal;
}
.disabled > a {
color: #999 !important;
}
.navbar-default a:hover,
.navbar-default .active,
.active > a {
background-color: #f0f0f0 !important;
}
.icon-bar {
background-color: #666 !important;
}
.navbar-collapse {
border-color: #fff !important;
}

195
src/docs/format.md Normal file
View File

@@ -0,0 +1,195 @@
# Input and Output Data Formats
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.
## 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.
| Key | Description
|:--------------------------|---------------|
|`time horizon (years)` | Number of years in the simulation.
|`building period (years)` | List of years in which we are allowed to open new plants. For example, if this parameter is set to `[1,2,3]`, we can only open plants during the first three years. By default, this equals `[1]`; that is, plants can only be opened during the first year. |
#### Example
```json
{
"parameters": {
"time horizon (years)": 2,
"building period (years)": [1]
}
}
```
### Products
The **products** section describes all products and subproducts in the simulation. The field `instance["Products"]` is a dictionary mapping the name of the product to a dictionary which describes its characteristics. Each product description contains the following keys:
| Key | Description
|:--------------------------------------|---------------|
|`transportation cost ($/km/tonne)` | The cost to transport this product. Must be a time series.
|`transportation energy (J/km/tonne)` | The energy required to transport this product. Must be a time series. Optional.
|`transportation emissions (tonne/km/tonne)` | A dictionary mapping the name of each greenhouse gas, produced to transport one tonne of this product along one kilometer, to the amount of gas produced (in tonnes). Must be a time series. Optional.
|`initial amounts` | A dictionary mapping the name of each location to its description (see below). If this product is not initially available, this key may be omitted. Must be a time series.
Each product may have some amount available at the beginning of each time period. In this case, the key `initial amounts` maps to a dictionary with the following keys:
| Key | Description
|:------------------------|---------------|
| `latitude (deg)` | The latitude of the location.
| `longitude (deg)` | The longitude of the location.
| `amount (tonne)` | The amount of the product initially available at the location. Must be a time series.
#### Example
```json
{
"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 emissions (tonne/km/tonne)": {
"CO2": [0.052, 0.050],
"CH4": [0.003, 0.002]
}
},
"P2": {
"transportation cost ($/km/tonne)": [0.022, 0.020]
},
"P3": {
"transportation cost ($/km/tonne)": [0.0125, 0.0125]
},
"P4": {
"transportation cost ($/km/tonne)": [0.0175, 0.0175]
}
}
}
```
### Processing plants
The **plants** section describes the available types of reverse manufacturing plants, their potential locations and associated costs, as well as their inputs and outputs. The field `instance["Plants"]` is a dictionary mapping the name of the plant to a dictionary with the following keys:
| Key | Description
|:------------------------|---------------|
| `input` | The name of the product that this plant takes as input. Only one input is accepted per plant.
| `outputs (tonne/tonne)` | A dictionary specifying how many tonnes of each product is produced for each tonnes of input. For example, if the plant outputs 0.5 tonnes of P2 and 0.25 tonnes of P3 for each tonnes of P1 provided, then this entry should be `{"P2": 0.5, "P3": 0.25}`. If the plant does not output anything, this key may be omitted.
|`energy (GJ/tonne)` | The energy required to process 1 tonne of the input. Must be a time series. Optional.
|`emissions (tonne/tonne)` | A dictionary mapping the name of each greenhouse gas, produced to process each tonne of input, to the amount of gas produced (in tonne). Must be a time series. Optional.
| `locations` | A dictionary mapping the name of the location to a dictionary which describes the site characteristics (see below).
Each type of plant is associated with a set of potential locations where it can be built. Each location is represented by a dictionary with the following keys:
| Key | Description
|:------------------------------|---------------|
| `latitude (deg)` | The latitude of the location, in degrees.
| `longitude (deg)` | The longitude of the location, in degrees.
| `disposal` | A dictionary describing what products can be disposed locally at the plant.
| `storage` | A dictionary describing the plant's storage.
| `capacities (tonne)` | A dictionary describing what plant sizes are allowed, and their characteristics.
The `storage` dictionary should contain the following keys:
| Key | Description
|:------------------------|---------------|
| `cost ($/tonne)` | The cost to store a tonne of input product for one time period. Must be a time series.
| `limit (tonne)` | The maximum amount of input product this plant can have in storage at any given time.
The keys in the `disposal` dictionary should be the names of the products. The values are dictionaries with the following keys:
| Key | Description
|:------------------------|---------------|
| `cost ($/tonne)` | The cost to dispose of the product. Must be a time series.
| `limit (tonne)` | The maximum amount that can be disposed of. If an unlimited amount can be disposed, this key may be omitted. Must be a time series.
The keys in the `capacities (tonne)` dictionary should be the amounts (in tonnes). The values are dictionaries with the following keys:
| Key | Description
|:--------------------------------------|---------------|
| `opening cost ($)` | The cost to open a plant of this size.
| `fixed operating cost ($)` | The cost to keep the plant open, even if the plant doesn't process anything. Must be a time series.
| `variable operating cost ($/tonne)` | The cost that the plant incurs to process each tonne of input. Must be a time series.
#### Example
```json
{
"plants": {
"F1": {
"input": "P1",
"outputs (tonne/tonne)": {
"P2": 0.2,
"P3": 0.5
},
"energy (GJ/tonne)": [0.12, 0.11],
"emissions (tonne/tonne)": {
"CO2": [0.052, 0.050],
"CH4": [0.003, 0.002]
},
"locations": {
"L1": {
"latitude (deg)": 0.0,
"longitude (deg)": 0.0,
"disposal": {
"P2": {
"cost ($/tonne)": [-10.0, -12.0],
"limit (tonne)": [1.0, 1.0]
}
},
"storage": {
"cost ($/tonne)": [5.0, 5.3],
"limit (tonne)": 100.0,
},
"capacities (tonne)": {
"100": {
"opening cost ($)": [500, 530],
"fixed operating cost ($)": [300.0, 310.0],
"variable operating cost ($/tonne)": [5.0, 5.2],
},
"500": {
"opening cost ($)": [750, 760],
"fixed operating cost ($)": [400.0, 450.0],
"variable operating cost ($/tonne)": [5.0, 5.2]
}
}
}
}
}
}
}
```
### Current limitations
* Each plant can only be opened exactly once. After open, the plant remains open until the end of the simulation.
* Plants can be expanded at any time, even long after they are open.
* All material available at the beginning of a time period must be entirely processed by the end of that time period. It is not possible to store unprocessed materials from one time period to the next.
* Up to two plant sizes are currently supported. Variable operating costs must be the same for all plant sizes.
## Output Data Format (JSON)
To be documented.

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

51
src/docs/index.md Normal file
View File

@@ -0,0 +1,51 @@
# RELOG: Reverse Logistics 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.
<img src="images/ex_transportation.png" width="1000px"/>
### Table of Contents
* [Usage](usage.md)
* [Input and Output Data Formats](format.md)
* [Simplified Solution Reports](reports.md)
* [Optimization Model](model.md)
### Source Code
* [https://github.com/ANL-CEEESA/RELOG](https://github.com/ANL-CEEESA/RELOG)
### Authors
* **Alinson S. Xavier,** Argonne National Laboratory <<axavier@anl.gov>>
* **Nwike Iloeje,** Argonne National Laboratory <<ciloeje@anl.gov>>
### License
```text
RELOG: Reverse Logistics Optimization
Copyright © 2020, 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:
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.
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.
```

8
src/docs/js/mathjax.js Normal file
View File

@@ -0,0 +1,8 @@
MathJax.Hub.Config({
"tex2jax": { inlineMath: [ [ '$', '$' ] ] }
});
MathJax.Hub.Config({
config: ["MMLorHTML.js"],
jax: ["input/TeX", "output/HTML-CSS", "output/NativeMML"],
extensions: ["MathMenu.js", "MathZoom.js"]
});

165
src/docs/model.md Normal file
View File

@@ -0,0 +1,165 @@
# 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
* $L$ - Set of locations holding the original material to be recycled
* $M$ - Set of materials recovered during the reverse manufacturing process
* $P$ - Set of potential plants to open
* $T = \{ 1, \ldots, t^{max} \} $ - Set of time periods
### Constants
**Plants:**
* $c^\text{disp}_{pmt}$ - Cost of disposing one tonne of material $m$ at plant $p$ during time $t$ (`$/tonne/km`)
* $c^\text{exp}_{pt}$ - Cost of adding one tonne of capacity to plant $p$ at time $t$ (`$/tonne`)
* $c^\text{open}_{pt}$ - Cost of opening plant $p$ at time $t$, at minimum capacity (`$`)
* $c^\text{f-base}_{pt}$ - Fixed cost of keeping plant $p$ open during time period $t$ (`$`)
* $c^\text{f-exp}_{pt}$ - Increase in fixed cost for each additional tonne of capacity (`$/tonne`)
* $c^\text{var}_{pt}$ - Variable cost of processing one tonne of input at plant $p$ at time $t$ (`$/tonne`)
* $c^\text{store}_{pt}$ - Cost of storing one tonne of original material at plant $p$ at time $t$ (`$/tonne`)
* $m^\text{min}_p$ - Minimum capacity of plant $p$ (`tonne`)
* $m^\text{max}_p$ - Maximum capacity of plant $p$ (`tonne`)
* $m^\text{disp}_{pmt}$ - Maximum amount of material $m$ that plant $p$ can dispose of during time $t$ (`tonne`)
* $m^\text{store}_p$ - Maximum amount of original material that plant $p$ can store for later processing.
**Products:**
* $\alpha_{pm}$ - Amount of material $m$ recovered by plant $t$ for each tonne of original material (`tonne/tonne`)
* $m^\text{initial}_{lt}$ - Amount of original material to be recycled at location $l$ during time $t$ (`tonne`)
**Transportation:**
* $c^\text{tr}_{t}$ - Transportation cost during time $t$ (`$/tonne/km`)
* $d_{lp}$ - Distance between plant $p$ and location $l$ (`km`)
### Decision variables
* $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$ (`bool`)
* $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$ (`bool`)
* $y_{lpt}$ - Amount of product sent from location $l$ to plant $p$ during time $t$ (`tonne`)
* $z^{\text{disp}}_{mpt}$ - Amount of material $m$ disposed of by plant $p$ during time $t$ (`tonne`)
* $z^{\text{store}}_{pt}$ - Amount of original material in storage at plant $p$ by the end of time period $t$ (`tonne`)
* $z^{\text{proc}}_{mpt}$ - Amount of original material processed by plant $p$ during time period $t$ (`tonne`)
### Objective function
RELOG minimizes the overall capital, production and transportation costs:
\begin{align*}
\text{minimize} \;\; &
\sum_{t \in T} \sum_{p \in P} \left[
c^\text{open}_{pt} u_{pt} +
c^\text{f-base}_{pt} x_{pt} +
\sum_{i=1}^t c^\text{f-exp}_{pt} w_{pi} +
c^{\text{exp}}_{pt} w_{pt}
\right] + \\
&
\sum_{t \in T} \sum_{p \in P} \left[
c^{\text{store}}_{pt} z^{\text{store}}_{pt} +
c^{\text{proc}}_{pt} z^{\text{proc}}_{pt}
\right] + \\
&
\sum_{t \in T} \sum_{l \in L} \sum_{p \in P}
c^{\text{tr}}_t d_{lp} y_{lpt}
\\
&
\sum_{t \in T} \sum_{p \in P} \sum_{m \in M} c^{\text{disp}}_{pmt} z_{pmt}
\end{align*}
In the first line, we have (i) opening costs, if plant starts operating at time $t$, (ii) fixed operating costs, if plant is operational, (iii) additional fixed operating costs coming from expansion performed in all previous time periods up to the current one, and finally (iv) the expansion costs during the current time period.
In the second line, we have storage and variable processing costs.
In the third line, we have transportation costs.
In the fourth line, we have the disposal costs.
### Constraints
* All original materials must be sent to a plant:
\begin{align}
& \sum_{p \in P} y_{lpt} = m^\text{initial}_{lt}
& \forall l \in L, t \in T
\end{align}
* Amount received equals amount processed plus stored. Furthermore, all original material should be processed by the end of the simulation.
\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:
\begin{align}
& z^{\text{proc}}_{pt} \leq m^\text{min}_p x_p + \sum_{i=1}^t w_p
& \forall p \in P, t \in T
\end{align}
* Plants have limited storage capacity. Furthermore, if a plant is closed, is has zero storage capacity:
\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:
\begin{align}
& \sum_{i=1}^t w_p \leq m^\text{max}_p x_p
& \forall p \in P, t \in T
\end{align}
* Amount of recovered material is proportional to amount processed:
\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.
\begin{align}
& q_{mpt} = z_{mpt}
& \forall m \in M, p \in P, t \in T
\end{align}
* A plant is operational at time $t$ if it was operational at time $t-1$ or it was built at time $t$. This constraint also prevents a plant from being built multiple times.
\begin{align}
& x_{pt} = x_{p,t-1} + u_{pt}
& \forall p \in P, t \in T \setminus \{1\} \\
& x_{p,1} = u_{p,1}
& \forall p \in P
\end{align}
* Variable bounds:
\begin{align}
& q_{mpt} \geq 0
& \forall m \in M, p \in P, t \in T \\
& u_{pt} \in \{0,1\}
& \forall p \in P, t \in T \\
& w_{pt} \geq 0
& \forall p \in P, t \in T \\
& x_{pt} \in \{0,1\}
& \forall p \in P, t \in T \\
& y_{lpt} \geq 0
& \forall l \in L, p \in P, t \in T \\
& z^{\text{store}}_{pt} \geq 0
& p \in P, t \in T \\
& z^{\text{disp}}_{mpt}, z^{\text{proc}}_{mpt} \geq 0
& \forall m \in M, p \in P, t \in T
\end{align}

273
src/docs/reports.md Normal file
View File

@@ -0,0 +1,273 @@
# Simplified Solution Reports
In addition to the full output format described in [data formats](format.md), RELOG can also generate a number of simplified reports in tabular data format (CSV), which can be more easily processed by spreadsheet software (such as Microsoft Excel), by data analysis libraries (such as Pandas) or by relational databases (such as SQLite).
In this page, we also illustrate what types of charts and visualizations can be produced from these tabular data files. The sample charts have been produced using Python, matplotlib, seaborn and geopandas.
## Plants report
Report showing plant costs, capacities, energy expenditure and utilization factors.
Generated by `RELOG.write_plants_report(solution, filename)`. For a concrete example, see [nimh_plants.csv](https://github.com/ANL-CEEESA/RELOG/blob/master/test/fixtures/nimh_plants.csv).
| Column | Description
|:--------------------------------------|---------------|
| `plant type` | Plant type.
| `location name` | Location name.
| `year` | What year this row corresponds to. This reports includes one row for each year in the simulation.
| `latitude (deg)` | Latitude of the plant.
| `longitude (deg)` | Longitude of the plant.
| `capacity (tonne)` | Capacity of the plant at this point in time.
| `amount received (tonne)` | Amount of input material received by the plant this year.
| `amount processed (tonne)` | Amount of input material processed by the plant this year.
| `amount in storage (tonne)` | Amount of input material in storage at the end of the year.
| `utilization factor (%)` | Amount processed by the plant this year divided by current plant capacity.
| `energy (GJ)` | Amount of energy expended by the plant this year.
| `opening cost ($)` | Amount spent opening the plant. This value is only positive if the plant became operational this year.
| `expansion cost ($)` | Amount spent this year expanding the plant capacity.
| `fixed operating cost ($)` | Amount spent for keeping the plant operational this year.
| `variable operating cost ($)` | Amount spent this year to process the input material.
| `storage cost ($)` | Amount spent this year on storage.
| `total cost ($)` | Sum of all previous plant costs.
### Sample charts
* Bar plot with total plant costs per year, grouped by plant type (in Python):
```python
import pandas as pd
import seaborn as sns; sns.set()
data = pd.read_csv("plants_report.csv")
sns.barplot(x="year",
y="total cost ($)",
hue="plant type",
data=data.groupby(["plant type", "year"])
.sum()
.reset_index());
```
<img src="../images/ex_plant_cost_per_year.png" width="500px"/>
* Map showing plant locations (in Python):
```python
import pandas as pd
import geopandas as gp
# Plot base map
world = gp.read_file(gp.datasets.get_path('naturalearth_lowres'))
ax = world.plot(color='white', edgecolor='50', figsize=(13,6))
ax.set_ylim([23, 50])
ax.set_xlim([-128, -65])
# Plot plant locations
data = pd.read_csv("nimh_plants.csv")
points = gp.points_from_xy(data["longitude (deg)"],
data["latitude (deg)"])
gp.GeoDataFrame(data, geometry=points).plot(ax=ax);
```
<img src="../images/ex_plant_locations.png" width="1000px"/>
## Plant outputs report
Report showing amount of products produced, sent and disposed of by each plant, as well as disposal costs.
Generated by `RELOG.write_plant_outputs_report(solution, filename)`. For a concrete example, see [nimh_plant_outputs.csv](https://github.com/ANL-CEEESA/RELOG/blob/master/test/fixtures/nimh_plant_outputs.csv).
| Column | Description
|:--------------------------------------|---------------|
| `plant type` | Plant type.
| `location name` | Location name.
| `year` | What year this row corresponds to. This reports includes one row for each year in the simulation.
| `product name` | Product being produced.
| `amount produced (tonne)` | Amount of product produced this year.
| `amount sent (tonne)` | Amount of product produced by this plant and sent to another plant for further processing this year.
| `amount disposed (tonne)` | Amount produced produced by this plant and immediately disposed of locally this year.
| `disposal cost ($)` | Disposal cost for this year.
### Sample charts
* Bar plot showing total amount produced for each product, grouped by year (in Python):
```python
import pandas as pd
import seaborn as sns; sns.set()
data = pd.read_csv("plant_outputs_report.csv")
sns.barplot(x="amount produced (tonne)",
y="product name",
hue="year",
data=data.groupby(["product name", "year"])
.sum()
.reset_index());
```
<img src="../images/ex_amount_produced.png" width="500px"/>
## Plant emissions report
Report showing amount of emissions produced by each plant.
Generated by `RELOG.write_plant_emissions_report(solution, filename)`. For a concrete example, see [nimh_plant_emissions.csv](https://github.com/ANL-CEEESA/RELOG/blob/master/test/fixtures/nimh_plant_emissions.csv).
| Column | Description
|:--------------------------------------|---------------|
| `plant type` | Plant type.
| `location name` | Location name.
| `year` | Year.
| `emission type` | Type of emission.
| `amount (tonne)` | Amount of emission produced by the plant this year.
### Sample charts
* Bar plot showing total emission by plant type, grouped type of emissions (in Python):
```python
import pandas as pd
import seaborn as sns; sns.set()
data = pd.read_csv("plant_emissions_report.csv")
sns.barplot(x="plant type",
y="emission amount (tonne)",
hue="emission type",
data=data.groupby(["plant type", "emission type"])
.sum()
.reset_index());
```
<img src="../images/ex_emissions.png" width="500px"/>
## Transportation report
Report showing amount of product sent from initial locations to plants, and from one plant to another. Includes the distance between each pair of locations, amount-distance shipped, transportation costs and energy expenditure.
Generated by `RELOG.write_transportation_report(solution, filename)`. For a concrete example, see [nimh_transportation.csv](https://github.com/ANL-CEEESA/RELOG/blob/master/test/fixtures/nimh_transportation.csv).
| Column | Description
|:--------------------------------------|---------------|
| `source type` | If product is being shipped from an initial location, equals `Origin`. If product is being shipped from a plant, equals plant type.
| `source location name` | Name of the location where the product is being shipped from.
| `source latitude (deg)` | Latitude of the source location.
| `source longitude (deg)` | Longitude of the source location.
| `destination type`| Type of plant the product is being shipped to.
| `destination location name`| Name of the location where the product is being shipped to.
| `destination latitude (deg)` | Latitude of the destination location.
| `destination longitude (deg)` | Longitude of the destination location.
| `product`| Product being shipped.
| `year`| Year.
| `distance (km)`| Distance between source and destination.
| `amount (tonne)`| Total amount of product being shipped between the two locations this year.
| `amount-distance (tonne-km)`| Total amount being shipped this year times distance.
| `transportation cost ($)`| Cost to transport this amount of product between the two locations for this year.
| `transportation energy (GJ)`| Energy expended transporting this amount of product between the two locations.
### Sample charts
* Bar plot showing total amount-distance for each product type, grouped by year (in Python):
```python
import pandas as pd
import seaborn as sns; sns.set()
data = pd.read_csv("transportation_report.csv")
sns.barplot(x="product",
y="amount-distance (tonne-km)",
hue="year",
data=data.groupby(["product", "year"])
.sum()
.reset_index());
```
<img src="../images/ex_transportation_amount_distance.png" width="500px"/>
* Map of transportation lines (in Python):
```python
import pandas as pd
import geopandas as gp
from shapely.geometry import Point, LineString
import matplotlib.pyplot as plt
from matplotlib import collections
# Plot base map
world = gp.read_file(gp.datasets.get_path('naturalearth_lowres'))
ax = world.plot(color='white', edgecolor='50', figsize=(14,7))
ax.set_ylim([23, 50])
ax.set_xlim([-128, -65])
# Draw transportation lines
data = pd.read_csv("transportation_report.csv")
lines = [[(row["source longitude (deg)"], row["source latitude (deg)"]),
(row["destination longitude (deg)"], row["destination latitude (deg)"])
] for (index, row) in data.iterrows()]
ax.add_collection(collections.LineCollection(lines,
linewidths=0.25,
zorder=1,
alpha=0.5,
color="50"))
# Draw source points
points = gp.points_from_xy(data["source longitude (deg)"],
data["source latitude (deg)"])
gp.GeoDataFrame(data, geometry=points).plot(ax=ax,
color="0.5",
markersize=1);
# Draw destination points
points = gp.points_from_xy(data["destination longitude (deg)"],
data["destination latitude (deg)"])
gp.GeoDataFrame(data, geometry=points).plot(ax=ax,
color="red",
markersize=50);
```
<img src="../images/ex_transportation.png" width="1000px"/>
## Transportation emissions report
Report showing emissions for each trip between initial locations and plants, and between pairs of plants.
Generated by `RELOG.write_transportation_emissions_report(solution, filename)`. For a concrete example, see [nimh_transportation_emissions.csv](https://github.com/ANL-CEEESA/RELOG/blob/master/test/fixtures/nimh_transportation_emissions.csv).
| Column | Description
|:--------------------------------------|---------------|
| `source type` | If product is being shipped from an initial location, equals `Origin`. If product is being shipped from a plant, equals plant type.
| `source location name` | Name of the location where the product is being shipped from.
| `source latitude (deg)` | Latitude of the source location.
| `source longitude (deg)` | Longitude of the source location.
| `destination type`| Type of plant the product is being shipped to.
| `destination location name`| Name of the location where the product is being shipped to.
| `destination latitude (deg)` | Latitude of the destination location.
| `destination longitude (deg)` | Longitude of the destination location.
| `product`| Product being shipped.
| `year`| Year.
| `distance (km)`| Distance between source and destination.
| `shipped amount (tonne)`| Total amount of product being shipped between the two locations this year.
| `shipped amount-distance (tonne-km)`| Total amount being shipped this year times distance.
| `emission type` | Type of emission.
| `emission amount (tonne)` | Amount of emission produced by transportation segment this year.
### Sample charts
* Bar plot showing total emission amount by emission type, grouped by type of product being transported (in Python):
```python
import pandas as pd
import seaborn as sns; sns.set()
data = pd.read_csv("transportation_emissions_report.csv")
sns.barplot(x="emission type",
y="emission amount (tonne)",
hue="product",
data=data.groupby(["product", "emission type"])
.sum()
.reset_index());
```
<img src="../images/ex_transportation_emissions.png" width="500px"/>

138
src/docs/usage.md Normal file
View File

@@ -0,0 +1,138 @@
Usage
=====
## 1. Installation
To use RELOG, the first step is to install the [Julia programming language](https://julialang.org/) on your machine. Note that RELOG was developed and tested with Julia 1.5 and may not be compatible with newer versions. After Julia is installed, launch the Julia console, type `]` to switch to package manger mode, then run:
```text
(@v1.5) pkg> add https://github.com/ANL-CEEESA/RELOG.git
```
After the package and all its dependencies have been installed, please run the RELOG test suite, as shown below, to make sure that the package has been correctly installed:
```text
(@v1.5) pkg> test RELOG
```
To update the package to a newer version, type `]` to enter the package manager mode, then run:
```text
(@v1.5) pkg> update RELOG
```
## 2. Modeling the problem
The two main model components in RELOG are **products** and **plants**.
A **product** is any material that needs to be recycled, any intermediary product produced during the recycling process, or any product recovered at the end of the process. For example, in a NiMH battery recycling study case, products could include (i) the original batteries to be recycled; (ii) the cathode and anode parts of the battery; (iii) rare-earth elements and (iv) scrap metals.
* The model assumes that some products are initially available at user-specified locations (described by their latitude, longitude and the amount available), while other products only become available during the recycling process.
* Products that are initially available must be sent to a plant for processing during the same time period they became available.
* Transporting products from one location to another incurs a transportation cost (`$/km/tonne`), spends some amount of energy (`J/km/tonne`) and may generate multiple types of emissions (`tonne/tonne`). All these parameters are user-specified and may be product- and time-specific.
A **plant** is a facility that converts one type of product to another. RELOG assumes that each plant receives a single type of product as input and converts this input into multiple types of products. Multiple types of plants, with different inputs, outputs and performance characteristics, may be specified. In the NiMH battery recycling study case, for example, one type of plant could be a *disassembly plant*, which converts *batteries* into *cathode* and *anode*. Another type of plant could be *anode recycling plant*, which converts *anode* into *rare-earth elements* and *scrap metals*.
* To process each tonne of input material, plants incur a variable operating cost (`$/tonne`), spend some amount of energy (`GJ/tonne`), and produce multiple types of emissions (`tonne/tonne`). Plants also incur a fixed operating cost (`$`) regardless of the amount of material they process. All these parameters are user-specified and may be region- and time-specific.
* Plants can be built at user-specified potential locations. Opening a plant incurs a one-time opening cost (`$`) which may be region- and time-specific. Plants also have a limited capacity (in `tonne`), which indicates the maximum amount of input material they are able to process per year. When specifying potential locations for each type of plant, it is also possible to specify the minimum and maximum capacity of the plants that can be built at that particular location. Different plants sizes may have different opening costs and fixed operating costs. After a plant is built, it can be further expanded in the following years, up to its maximum capacity.
* Products received by a plant can be either processed immediately or stored for later processing. Plants have a maximum storage capacity (`tonne`). Storage costs (`$/tonne`) can also be specified.
* All products generated by a plant can either be sent to another plant for further processing, or disposed of locally for either a profit or a loss (`$/tonne`). To model environmental regulations, it is also possible to specify the maximum amount of each product that can be disposed of at each location.
All user parameters specified above must be provided to RELOG as a JSON file, which is fully described in the [data format page](format.md).
## 3. Running the optimization
After creating a JSON file describing the reverse manufacturing process and the input data, the following example illustrates how to use the package to find the optimal set of decisions:
```julia
# Import package
using RELOG
# Solve optimization problem
solution = RELOG.solve("/home/user/instance.json")
# Write full solution in JSON format
RELOG.write(solution, "solution.json")
# Write simplified reports in CSV format
RELOG.write_plants_report(solution, "plants.csv")
RELOG.write_transportation_report(solution, "transportation.csv")
```
For a complete description of the file formats above, and for a complete list of available reports, see the [data format page](format.md).
## 4. What-If Analysis
Fundamentally, RELOG decides when and where to build plants based on a deterministic optimization problem that minimizes costs for a particular input file provided by the user. In practical situations, it may not be possible to perfectly estimate some (or most) entries in this input file in advance, such as costs, demands and emissions. In this situation, it may be interesting to evaluate how well does the facility location plan produced by RELOG work if costs, demands and emissions turn out to be different.
To simplify this what-if analysis, RELOG provides the `resolve` method, which updates a previous solution based on a new scenario. The method accepts a previous optimal solution, produced by RELOG, and a new input file, which describes the new scenario. The method reoptimizes the supply chain for this new input file, and produces a new solution which still builds the same set of plants as before, in exactly the same locations and with the same capacities, but that may now utilize the plants differently, based on the new data. For example, in the new solution, plants that were previously used at full capacity may now be utilized at half-capacity instead. As another example, regions that were previously served by a certain plant may now be served by a different one.
The following snippet shows how to use the method:
```julia
# Import package
using RELOG
# Optimize for the average scenario
solution_avg = RELOG.solve("input_avg.json")
# Write reports for the average scenario
RELOG.write_plants_report(solution_avg, "plants_avg.csv")
RELOG.write_transportation_report(solution_avg, "transportation_avg.csv")
# Re-optimize for the high-demand scenario, keeping plants fixed
solution_high = RELOG.resolve(solution_avg, "input_high.json")
# Write reports for the high-demand scenario
RELOG.write_plants_report(solution_high, "plants_high.csv")
RELOG.write_transportation_report(solution_high, "transportation_high.csv")
```
To use the `resolve` method, the new input file should be very similar to the original one. Only the following entries are allowed to change:
- **Products:** Transportation costs, energy, emissions and initial amounts (latitude, longitude and amount).
- **Plants:** Energy and emissions.
- **Plant's location:** Latitude and longitude.
- **Plant's storage:** Cost.
- **Plant's capacity:** Opening cost, fixed operating cost and variable operating cost.
## 5. Advanced options
### 5.1 Changing the solver
By default, RELOG internally uses [Cbc](https://github.com/coin-or/Cbc), an open-source and freely-available Mixed-Integer Linear Programming solver developed by the [COIN-OR Project](https://www.coin-or.org/). For larger-scale test cases, a commercial solver such as Gurobi, CPLEX or XPRESS is recommended. The following snippet shows how to switch from Cbc to Gurobi, for example:
```julia
using RELOG, Gurobi, JuMP
gurobi = optimizer_with_attributes(Gurobi.Optimizer,
"TimeLimit" => 3600,
"MIPGap" => 0.001)
RELOG.solve("instance.json",
output="solution.json",
optimizer=gurobi)
```
### 5.2 Multi-period heuristics
For large-scale instances, it may be too time-consuming to find an exact optimal solution to the multi-period version of the problem. For these situations, RELOG includes a heuristic solution method, which proceeds as follows:
1. First, RELOG creates a single-period version of the problem, in which most values are replaced by their averages. This single-period problem is typically much easier to solve.
2. After solving the simplified problem, RELOG resolves the multi-period version of the problem, but considering only candidate plant locations that were selected by the optimal solution to the single-period version of the problem. All remaining candidate plant locations are removed.
To solve an instance using this heuristic, use the option `heuristic=true`, as shown below.
```julia
using RELOG
solution = RELOG.solve("/home/user/instance.json",
heuristic=true)
```

68
src/dotdict.jl Normal file
View File

@@ -0,0 +1,68 @@
# 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.
struct DotDict
inner::Dict
end
DotDict() = DotDict(Dict())
function Base.setproperty!(d::DotDict, key::Symbol, value)
setindex!(getfield(d, :inner), value, key)
end
function Base.getproperty(d::DotDict, key::Symbol)
(key == :inner ? getfield(d, :inner) : d.inner[key])
end
function Base.getindex(d::DotDict, key::Int64)
d.inner[Symbol(key)]
end
function Base.getindex(d::DotDict, key::Symbol)
d.inner[key]
end
function Base.keys(d::DotDict)
keys(d.inner)
end
function Base.values(d::DotDict)
values(d.inner)
end
function Base.iterate(d::DotDict)
iterate(values(d.inner))
end
function Base.iterate(d::DotDict, v::Int64)
iterate(values(d.inner), v)
end
function Base.length(d::DotDict)
length(values(d.inner))
end
function Base.show(io::IO, d::DotDict)
print(io, "DotDict with $(length(keys(d.inner))) entries:\n")
count = 0
for k in keys(d.inner)
count += 1
if count > 10
print(io, " ...\n")
break
end
print(io, " :$(k) => $(d.inner[k])\n")
end
end
function recursive_to_dot_dict(el)
if typeof(el) == Dict{String, Any}
return DotDict(Dict(Symbol(k) => recursive_to_dot_dict(el[k]) for k in keys(el)))
else
return el
end
end
export recursive_to_dot_dict

126
src/graph.jl Normal file
View File

@@ -0,0 +1,126 @@
# 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::Array{Arc}
outgoing_arcs::Array{Arc}
end
mutable struct ShippingNode <: Node
index::Int
location::Union{Plant, CollectionCenter}
product::Product
incoming_arcs::Array{Arc}
outgoing_arcs::Array{Arc}
end
mutable struct Graph
process_nodes::Array{ProcessNode}
plant_shipping_nodes::Array{ShippingNode}
collection_shipping_nodes::Array{ShippingNode}
arcs::Array{Arc}
end
function build_graph(instance::Instance)::Graph
arcs = []
next_index = 0
process_nodes = ProcessNode[]
plant_shipping_nodes = ShippingNode[]
collection_shipping_nodes = ShippingNode[]
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
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)
for product in keys(plant.output)
sn = ShippingNode(next_index, plant, product, [], [])
next_index += 1
push!(plant_shipping_nodes, sn)
push!(shipping_nodes_by_plant[plant], sn)
end
end
# Build arcs from collection centers to plants, and from one plant to another
for source in [collection_shipping_nodes; plant_shipping_nodes]
for dest in process_nodes_by_input_product[source.product]
distance = calculate_distance(source.location.latitude,
source.location.longitude,
dest.location.latitude,
dest.location.longitude)
values = Dict("distance" => distance)
arc = Arc(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)
end
function to_csv(graph::Graph)
result = ""
for a in graph.arcs
result *= "$(a.source.index),$(a.dest.index)\n"
end
return result
end
function calculate_distance(source_lat, source_lon, dest_lat, dest_lon)::Float64
x = LLA(source_lat, source_lon, 0.0)
y = LLA(dest_lat, dest_lon, 0.0)
return round(distance(x, y) / 1000.0, digits=2)
end

281
src/instance.jl Normal file
View File

@@ -0,0 +1,281 @@
# 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
mutable struct Product
name::String
transportation_cost::Array{Float64}
transportation_energy::Array{Float64}
transportation_emissions::Dict{String, Array{Float64}}
end
mutable struct CollectionCenter
index::Int64
name::String
latitude::Float64
longitude::Float64
product::Product
amount::Array{Float64}
end
mutable struct PlantSize
capacity::Float64
variable_operating_cost::Array{Float64}
fixed_operating_cost::Array{Float64}
opening_cost::Array{Float64}
end
mutable struct Plant
index::Int64
plant_name::String
location_name::String
input::Product
output::Dict{Product, Float64}
latitude::Float64
longitude::Float64
disposal_limit::Dict{Product, Array{Float64}}
disposal_cost::Dict{Product, Array{Float64}}
sizes::Array{PlantSize}
energy::Array{Float64}
emissions::Dict{String, Array{Float64}}
storage_limit::Float64
storage_cost::Array{Float64}
end
mutable struct Instance
time::Int64
products::Array{Product, 1}
collection_centers::Array{CollectionCenter, 1}
plants::Array{Plant, 1}
building_period::Array{Int64}
end
function validate(json, schema)
result = JSONSchema.validate(json, schema)
if result !== nothing
if result isa JSONSchema.SingleIssue
path = join(result.path, "")
if length(path) == 0
path = "root"
end
msg = "$(result.msg) in $(path)"
else
msg = convert(String, result)
end
throw(msg)
end
end
function parsefile(path::String)::Instance
return RELOG.parse(JSON.parsefile(path))
end
function parse(json)::Instance
basedir = dirname(@__FILE__)
json_schema = JSON.parsefile("$basedir/schemas/input.json")
validate(json, Schema(json_schema))
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)
building_period = json["building period (years)"]
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()
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
product = Product(product_name, cost, energy, emissions)
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"]
center = CollectionCenter(length(collection_centers) + 1,
center_name,
center_dict["latitude (deg)"],
center_dict["longitude (deg)"],
product,
center_dict["amount (tonne)"])
push!(collection_centers, center)
end
end
end
# Create plants
for (plant_name, plant_dict) in json["plants"]
input = prod_name_to_product[plant_dict["input"]]
output = Dict()
# Plant outputs
if "outputs (tonne/tonne)" in keys(plant_dict)
output = Dict(prod_name_to_product[key] => value
for (key, value) in plant_dict["outputs (tonne/tonne)"]
if value > 0)
end
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 in 1:T] for p in keys(output))
disposal_cost = Dict(p => [0.0 for t in 1:T] for p in keys(output))
# Disposal
if "disposal" in keys(location_dict)
for (product_name, disposal_dict) in location_dict["disposal"]
limit = [1e8 for t in 1:T]
if "limit (tonne)" in keys(disposal_dict)
limit = disposal_dict["limit (tonne)"]
end
disposal_limit[prod_name_to_product[product_name]] = limit
disposal_cost[prod_name_to_product[product_name]] = disposal_dict["cost (\$/tonne)"]
end
end
# Capacities
for (capacity_name, capacity_dict) in location_dict["capacities (tonne)"]
push!(sizes, PlantSize(Base.parse(Float64, capacity_name),
capacity_dict["variable operating cost (\$/tonne)"],
capacity_dict["fixed operating cost (\$)"],
capacity_dict["opening cost (\$)"]))
end
length(sizes) > 1 || push!(sizes, sizes[1])
sort!(sizes, by = x -> x.capacity)
# Storage
storage_limit = 0
storage_cost = zeros(T)
if "storage" in keys(location_dict)
storage_dict = location_dict["storage"]
storage_limit = storage_dict["limit (tonne)"]
storage_cost = storage_dict["cost (\$/tonne)"]
end
# Validation: Capacities
if length(sizes) != 2
throw("At most two capacities are supported")
end
if sizes[1].variable_operating_cost != sizes[2].variable_operating_cost
throw("Variable operating costs must be the same for all capacities")
end
plant = Plant(length(plants) + 1,
plant_name,
location_name,
input,
output,
location_dict["latitude (deg)"],
location_dict["longitude (deg)"],
disposal_limit,
disposal_cost,
sizes,
energy,
emissions,
storage_limit,
storage_cost)
push!(plants, plant)
end
end
@info @sprintf("%12d collection centers", length(collection_centers))
@info @sprintf("%12d candidate plant locations", length(plants))
return Instance(T, products, collection_centers, plants, building_period)
end
"""
_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,145 +0,0 @@
using JSON
using OrderedCollections
function parsefile(path::String)::Instance
return RELOG.parse(JSON.parsefile(path, dicttype = () -> OrderedDict()))
end
function parse(json)::Instance
# Read parameters
time_horizon = json["parameters"]["time horizon (years)"]
building_period = json["parameters"]["building period (years)"]
distance_metric = json["parameters"]["distance metric"]
timeseries(x::Union{Nothing,Number}) = repeat([x], time_horizon)
timeseries(x::Array) = x
timeseries(d::OrderedDict) = OrderedDict(k => timeseries(v) 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)"])
components = pdict["components"]
prod = Product(; name, tr_cost, tr_energy, tr_emissions, components)
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 => [v === nothing ? null_val : v for v in timeseries(cdict[key][p.name])]
for p in outputs
)
to_array(x) = vcat(x'...)
prepend_time_dimension(x) = to_array(repeat([x], time_horizon))
fixed_output = Dict()
for p in outputs
m = to_array(cdict["fixed output (tonne)"][p.name])
if ndims(m) == 1
m = prepend_time_dimension(m)
end
@assert size(m) == (time_horizon, length(p.components))
fixed_output[p] = m
end
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[]
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])
)
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
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
return Instance(;
time_horizon,
building_period,
distance_metric,
products,
products_by_name,
centers,
centers_by_name,
plants,
plants_by_name,
)
end

View File

@@ -1,58 +0,0 @@
using OrderedCollections
Base.@kwdef struct Product
name::String
tr_cost::Vector{Float64}
tr_energy::Vector{Float64}
tr_emissions::OrderedDict{String,Vector{Float64}}
components::Vector{String}
end
Base.@kwdef struct Center
name::String
latitude::Float64
longitude::Float64
input::Union{Product,Nothing}
outputs::Vector{Product}
fixed_output::OrderedDict{Product,Array{Float64,2}}
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 Instance
building_period::Vector{Int}
centers_by_name::OrderedDict{String,Center}
centers::Vector{Center}
distance_metric::String
products_by_name::OrderedDict{String,Product}
products::Vector{Product}
time_horizon::Int
plants::Vector{Plant}
plants_by_name::OrderedDict{String,Plant}
end

535
src/model.jl Normal file
View File

@@ -0,0 +1,535 @@
# 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, Cbc, Clp, ProgressBars, Printf, DataStructures
mutable struct ManufacturingModel
mip::JuMP.Model
vars::DotDict
eqs::DotDict
instance::Instance
graph::Graph
end
function build_model(instance::Instance, graph::Graph, optimizer)::ManufacturingModel
model = ManufacturingModel(Model(optimizer), DotDict(), DotDict(), instance, 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::ManufacturingModel)
mip, vars, graph, T = model.mip, model.vars, model.graph, model.instance.time
vars.flow = Dict((a, t) => @variable(mip, lower_bound=0)
for a in graph.arcs, t in 1:T)
vars.dispose = Dict((n, t) => @variable(mip,
lower_bound=0,
upper_bound=n.location.disposal_limit[n.product][t])
for n in values(graph.plant_shipping_nodes), t in 1:T)
vars.store = Dict((n, t) => @variable(mip,
lower_bound=0,
upper_bound=n.location.storage_limit)
for n in values(graph.process_nodes), t in 1:T)
vars.process = Dict((n, t) => @variable(mip,
lower_bound = 0)
for n in values(graph.process_nodes), t in 1:T)
vars.open_plant = Dict((n, t) => @variable(mip, binary=true)
for n in values(graph.process_nodes), t in 1:T)
vars.is_open = Dict((n, t) => @variable(mip, binary=true)
for n in values(graph.process_nodes), t in 1:T)
vars.capacity = Dict((n, t) => @variable(mip,
lower_bound = 0,
upper_bound = n.location.sizes[2].capacity)
for n in values(graph.process_nodes), t in 1:T)
vars.expansion = Dict((n, t) => @variable(mip,
lower_bound = 0,
upper_bound = n.location.sizes[2].capacity -
n.location.sizes[1].capacity)
for n in values(graph.process_nodes), t in 1:T)
end
function slope_open(plant, t)
if plant.sizes[2].capacity <= plant.sizes[1].capacity
0.0
else
(plant.sizes[2].opening_cost[t] - plant.sizes[1].opening_cost[t]) /
(plant.sizes[2].capacity - plant.sizes[1].capacity)
end
end
function slope_fix_oper_cost(plant, t)
if plant.sizes[2].capacity <= plant.sizes[1].capacity
0.0
else
(plant.sizes[2].fixed_operating_cost[t] - plant.sizes[1].fixed_operating_cost[t]) /
(plant.sizes[2].capacity - plant.sizes[1].capacity)
end
end
function create_objective_function!(model::ManufacturingModel)
mip, vars, graph, T = model.mip, model.vars, model.graph, model.instance.time
obj = AffExpr(0.0)
# Process node costs
for n in values(graph.process_nodes), t in 1:T
# 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, vars.flow[a, t])
end
# Opening costs
add_to_expression!(obj,
n.location.sizes[1].opening_cost[t],
vars.open_plant[n, t])
# Fixed operating costs (base)
add_to_expression!(obj,
n.location.sizes[1].fixed_operating_cost[t],
vars.is_open[n, t])
# Fixed operating costs (expansion)
add_to_expression!(obj,
slope_fix_oper_cost(n.location, t),
vars.expansion[n, t])
# Processing costs
add_to_expression!(obj,
n.location.sizes[1].variable_operating_cost[t],
vars.process[n, t])
# Storage costs
add_to_expression!(obj,
n.location.storage_cost[t],
vars.store[n, t])
# Expansion costs
if t < T
add_to_expression!(obj,
slope_open(n.location, t) - slope_open(n.location, t + 1),
vars.expansion[n, t])
else
add_to_expression!(obj,
slope_open(n.location, t),
vars.expansion[n, t])
end
end
# Shipping node costs
for n in values(graph.plant_shipping_nodes), t in 1:T
# Disposal costs
add_to_expression!(obj,
n.location.disposal_cost[n.product][t],
vars.dispose[n, t])
end
@objective(mip, Min, obj)
end
function create_shipping_node_constraints!(model::ManufacturingModel)
mip, vars, graph, T = model.mip, model.vars, model.graph, model.instance.time
eqs = model.eqs
eqs.balance = OrderedDict()
for t in 1:T
# Collection centers
for n in graph.collection_shipping_nodes
eqs.balance[n, t] = @constraint(mip,
sum(vars.flow[a, t] for a in n.outgoing_arcs)
== n.location.amount[t])
end
# Plants
for n in graph.plant_shipping_nodes
@constraint(mip,
sum(vars.flow[a, t] for a in n.incoming_arcs) ==
sum(vars.flow[a, t] for a in n.outgoing_arcs) + vars.dispose[n, t])
end
end
end
function create_process_node_constraints!(model::ManufacturingModel)
mip, vars, graph, T = model.mip, model.vars, model.graph, model.instance.time
for t in 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, vars.flow[a, t])
end
# Output amount is implied by amount processed
for a in n.outgoing_arcs
@constraint(mip, vars.flow[a, t] == a.values["weight"] * vars.process[n, t])
end
# If plant is closed, capacity is zero
@constraint(mip, vars.capacity[n, t] <= n.location.sizes[2].capacity * vars.is_open[n, t])
# If plant is open, capacity is greater than base
@constraint(mip, vars.capacity[n, t] >= n.location.sizes[1].capacity * vars.is_open[n, t])
# Capacity is linked to expansion
@constraint(mip, vars.capacity[n, t] <= n.location.sizes[1].capacity + vars.expansion[n, t])
# Can only process up to capacity
@constraint(mip, vars.process[n, t] <= vars.capacity[n, t])
if t > 1
# Plant capacity can only increase over time
@constraint(mip, vars.capacity[n, t] >= vars.capacity[n, t-1])
@constraint(mip, vars.expansion[n, t] >= vars.expansion[n, t-1])
end
# Amount received equals amount processed plus stored
store_in = 0
if t > 1
store_in = vars.store[n, t-1]
end
if t == T
@constraint(mip, vars.store[n, t] == 0)
end
@constraint(mip,
input_sum + store_in == vars.store[n, t] + vars.process[n, t])
# Plant is currently open if it was already open in the previous time period or
# if it was built just now
if t > 1
@constraint(mip, vars.is_open[n, t] == vars.is_open[n, t-1] + vars.open_plant[n, t])
else
@constraint(mip, vars.is_open[n, t] == vars.open_plant[n, t])
end
# Plant can only be opened during building period
if t model.instance.building_period
@constraint(mip, vars.open_plant[n, t] == 0)
end
end
end
default_milp_optimizer = optimizer_with_attributes(Cbc.Optimizer, "logLevel" => 0)
default_lp_optimizer = optimizer_with_attributes(Clp.Optimizer, "LogLevel" => 0)
function solve(instance::Instance;
optimizer=nothing,
output=nothing,
marginal_costs=true,
)
milp_optimizer = lp_optimizer = optimizer
if optimizer == nothing
milp_optimizer = default_milp_optimizer
lp_optimizer = default_lp_optimizer
end
@info "Building graph..."
graph = RELOG.build_graph(instance)
@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))
@info "Building optimization model..."
model = RELOG.build_model(instance, graph, milp_optimizer)
@info "Optimizing MILP..."
JuMP.optimize!(model.mip)
if !has_values(model.mip)
@warn "No solution available"
return OrderedDict()
end
if marginal_costs
@info "Re-optimizing with integer variables fixed..."
all_vars = JuMP.all_variables(model.mip)
vals = OrderedDict(var => JuMP.value(var) for var in all_vars)
JuMP.set_optimizer(model.mip, 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.mip)
end
@info "Extracting solution..."
solution = get_solution(model, marginal_costs=marginal_costs)
if output != nothing
write(solution, output)
end
return solution
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;
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
function get_solution(model::ManufacturingModel;
marginal_costs=true,
)
mip, vars, eqs, graph, instance = model.mip, model.vars, model.eqs, 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
if marginal_costs
for n in graph.collection_shipping_nodes
location_dict = OrderedDict{Any, Any}(
"Marginal cost (\$/tonne)" => [round(abs(JuMP.shadow_price(eqs.balance[n, t])), digits=2)
for t in 1:T]
)
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
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 in 1:T],
"Total output" => OrderedDict(),
"Latitude (deg)" => plant.latitude,
"Longitude (deg)" => plant.longitude,
"Capacity (tonne)" => [JuMP.value(vars.capacity[process_node, t])
for t in 1:T],
"Opening cost (\$)" => [JuMP.value(vars.open_plant[process_node, t]) *
plant.sizes[1].opening_cost[t]
for t in 1:T],
"Fixed operating cost (\$)" => [JuMP.value(vars.is_open[process_node, t]) *
plant.sizes[1].fixed_operating_cost[t] +
JuMP.value(vars.expansion[process_node, t]) *
slope_fix_oper_cost(plant, t)
for t in 1:T],
"Expansion cost (\$)" => [(if t == 1
slope_open(plant, t) * JuMP.value(vars.expansion[process_node, t])
else
slope_open(plant, t) * (
JuMP.value(vars.expansion[process_node, t]) -
JuMP.value(vars.expansion[process_node, t - 1])
)
end)
for t in 1:T],
"Process (tonne)" => [JuMP.value(vars.process[process_node, t])
for t in 1:T],
"Variable operating cost (\$)" => [JuMP.value(vars.process[process_node, t]) *
plant.sizes[1].variable_operating_cost[t]
for t in 1:T],
"Storage (tonne)" => [JuMP.value(vars.store[process_node, t])
for t in 1:T],
"Storage cost (\$)" => [JuMP.value(vars.store[process_node, t]) *
plant.storage_cost[t]
for t in 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(vars.flow[a, t]) for t in 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(vars.dispose[shipping_node, t]) for t in 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.vars.dispose[shipping_node, t])
for t in 1:T]
disposal_dict["Cost (\$)"] = [disposal_dict["Amount (tonne)"][t] *
plant.disposal_cost[shipping_node.product][t]
for t in 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(vars.flow[a, t]) for t in 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

View File

@@ -1,302 +0,0 @@
using JuMP
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
# 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
for m in products
for p1 in plants
m keys(p1.output) || continue
# Plant to plant
for p2 in plants
p1 != p2 || continue
m keys(p2.input_mix) || continue
push_edge!(p1, p2, m)
end
# Plant to center
for c in centers
m == c.input || continue
push_edge!(p1, c, m)
end
end
for c1 in centers
m c1.outputs || continue
# Center to plant
for p in plants
m keys(p.input_mix) || continue
push_edge!(c1, p, m)
end
# Center to center
for c2 in centers
m == c2.input || continue
push_edge!(c1, c2, m)
end
end
end
# Distances
model.ext[:distances] = distances = Dict()
for (p1, p2, m) in E
d = _calculate_distance(p1.latitude, p1.longitude, p2.latitude, p2.longitude)
distances[p1, p2, m] = d
end
# 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
# 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
# Objective function
# -------------------------------------------------------------------------
obj = AffExpr()
# Transportation cost
for (p1, p2, m) in E, t in T
add_to_expression!(
obj,
distances[p1, p2, m] * m.tr_cost[t],
y[p1.name, p2.name, m.name, t],
)
end
# 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
# 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,
p.capacities[1].opening_cost[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, p.capacities[1].fix_operating_cost[t], x[p.name, t])
end
# Plants: Variable operating cost
for p in plants, (src, m) in E_in[p], t in T
add_to_expression!(
obj,
p.capacities[1].var_operating_cost[t],
y[src.name, p.name, m.name, t],
)
end
@objective(model, Min, obj)
# Constraints
# -------------------------------------------------------------------------
# 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: Must meet input mix
eq_input_mix = _init(model, :eq_input_mix)
for p in plants, m in keys(p.input_mix), t in T
eq_input_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_input[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_input[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: Capacity limit
eq_capacity = _init(model, :eq_capacity)
for p in plants, t in T
eq_capacity[p.name, t] =
@constraint(model, z_input[p.name, t] <= p.capacities[1].size * x[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: 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
# 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,
z_input[c.name, t] ==
sum(y[src.name, c.name, m.name, t] for (src, m) in E_in[c])
)
end
# 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,
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)
) + sum(
c.fixed_output[m][t,mi]
for mi in 1:length(m.components)
)
)
end
# 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,
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
# 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
if variable_names
_set_names!(model)
end
return model
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.
using Geodesy
function _calculate_distance(source_lat, source_lon, dest_lat, dest_lon)::Float64
x = LLA(source_lat, source_lon, 0.0)
y = LLA(dest_lat, dest_lon, 0.0)
return round(euclidean_distance(x, y) / 1000.0, digits = 3)
end

View File

@@ -1,47 +0,0 @@
# This file extends some JuMP functions so that decision variables can be safely
# replaced by (constant) floating point numbers.
using Printf
using JuMP
import JuMP: value, fix, set_name
function value(x::Float64)
return x
end
function fix(x::Float64, v::Float64; force)
return abs(x - v) < 1e-6 || error("Value mismatch: $x != $v")
end
function set_name(x::Number, n::String)
# nop
end
function _init(model::JuMP.Model, key::Symbol)::OrderedDict
if !(key in keys(object_dictionary(model)))
model[key] = OrderedDict()
end
return model[key]
end
function _set_names!(model::JuMP.Model)
@info "Setting variable and constraint names..."
time_varnames = @elapsed begin
_set_names!(object_dictionary(model))
end
@info @sprintf("Set names in %.2f seconds", time_varnames)
end
function _set_names!(dict::Dict)
for name in keys(dict)
dict[name] isa AbstractDict || continue
for idx in keys(dict[name])
if dict[name][idx] isa AffExpr
continue
end
idx_str = join(map(string, idx), ",")
set_name(dict[name][idx], "$name[$idx_str]")
end
end
end

278
src/reports.jl Normal file
View File

@@ -0,0 +1,278 @@
# 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 plants_report(solution)::DataFrame
df = DataFrame()
df."plant type" = String[]
df."location name" = String[]
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."opening cost (\$)" = Float64[]
df."expansion cost (\$)" = Float64[]
df."fixed operating cost (\$)" = Float64[]
df."variable operating 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 in 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
end
end
return df
end
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 in 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
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 in 1:T
push!(df, [
plant_name,
location_name,
year,
emission_name,
round(emission_amount[year], digits=2),
])
end
end
end
end
return df
end
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 in 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
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 in 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
function write(solution::AbstractDict, filename::AbstractString)
@info "Writing solution: $filename"
open(filename, "w") do file
JSON.print(file, solution, 2)
end
end
write_plants_report(solution, filename) =
CSV.write(filename, plants_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))
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,91 +0,0 @@
# RELOG: Reverse Logistics Optimization
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
# Released under the modified BSD license. See COPYING.md for more details.
using DataFrames
using CSV
function centers_report(model)::DataFrame
df = DataFrame()
df."center" = String[]
df."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,
[
c.name,
t,
input_name,
_round(input),
_round(revenue),
_round(c.operating_cost[t]),
],
)
end
return df
end
function center_outputs_report(model)::DataFrame
df = DataFrame()
df."center" = String[]
df."output product" = String[]
df."year" = Int[]
df."amount collected (tonne)" = Float64[]
df."amount disposed (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,
[
c.name,
m.name,
t,
_round(collected),
_round(disposed),
_round(collection_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,72 +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 plants_report(model)::DataFrame
df = DataFrame()
df."plant" = String[]
df."year" = Int[]
df."operational?" = Bool[]
df."input amount (tonne)" = Float64[]
df."opening cost (\$)" = Float64[]
df."fixed operating cost (\$)" = Float64[]
df."variable operating cost (\$)" = Float64[]
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])
opening_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
fix_operating_cost = (operational ? p.capacities[1].fix_operating_cost[t] : 0)
var_operating_cost = input * p.capacities[1].var_operating_cost[t]
push!(
df,
[
p.name,
t,
operational,
_round(input),
_round(opening_cost),
_round(fix_operating_cost),
_round(var_operating_cost),
],
)
end
return df
end
function plant_outputs_report(model)::DataFrame
df = DataFrame()
df."plant" = String[]
df."output product" = String[]
df."year" = Int[]
df."amount produced (tonne)" = Float64[]
df."amount disposed (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,
[p.name, m.name, t, _round(produced), _round(disposed), _round(disposal_cost)],
)
end
return df
end
write_plants_report(solution, filename) = CSV.write(filename, plants_report(solution))
write_plant_outputs_report(solution, filename) =
CSV.write(filename, plant_outputs_report(solution))

View File

@@ -1,56 +0,0 @@
# RELOG: Reverse Logistics Optimization
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
# Released under the modified BSD license. See COPYING.md for more details.
using DataFrames
using CSV
function transportation_report(model)::DataFrame
df = DataFrame()
df."source" = String[]
df."destination" = String[]
df."product" = String[]
df."year" = Int[]
df."amount sent (tonne)" = Float64[]
df."distance (km)" = Float64[]
df."transportation cost (\$)" = Float64[]
df."center revenue (\$)" = Float64[]
df."center collection cost (\$)" = Float64[]
E = model.ext[:E]
distances = model.ext[:distances]
T = 1:model.ext[:instance].time_horizon
for (p1, p2, m) in E, t in T
amount = value(model[:y][p1.name, p2.name, m.name, t])
amount > 1e-3 || continue
distance = distances[p1, p2, m]
tr_cost = distance * amount * m.tr_cost[t]
revenue = 0
if isa(p2, Center)
revenue = p2.revenue[t] * amount
end
collection_cost = 0
if isa(p1, Center)
collection_cost = p1.collection_cost[m][t] * amount
end
push!(
df,
[
p1.name,
p2.name,
m.name,
t,
_round(amount),
_round(distance),
_round(tr_cost),
_round(revenue),
_round(collection_cost),
],
)
end
return df
end
write_transportation_report(solution, filename) =
CSV.write(filename, transportation_report(solution))

145
src/schemas/input.json Normal file
View File

@@ -0,0 +1,145 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://anl-ceeesa.github.io/RELOG/input",
"title": "Schema for RELOG Input File",
"definitions": {
"TimeSeries": {
"type": "array",
"items": {
"type": "number"
}
},
"Parameters": {
"type": "object",
"properties": {
"time horizon (years)": { "type": "number" }
},
"required": [
"time horizon (years)"
]
},
"Plant": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"input": { "type": "string" },
"outputs (tonne/tonne)": {
"type": "object",
"additionalProperties": { "type": "number" }
},
"energy (GJ/tonne)": { "$ref": "#/definitions/TimeSeries" },
"emissions (tonne/tonne)": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/TimeSeries" }
},
"locations": { "$ref": "#/definitions/PlantLocation" }
},
"required": [
"input",
"locations"
]
}
},
"PlantLocation": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"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": [
"latitude (deg)",
"longitude (deg)",
"capacities (tonne)"
]
}
},
"InitialAmount": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"latitude (deg)": { "type": "number" },
"longitude (deg)": { "type": "number" },
"amount (tonne)": { "$ref": "#/definitions/TimeSeries" }
},
"required": [
"latitude (deg)",
"longitude (deg)",
"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" }
},
"required": [
"transportation cost ($/km/tonne)"
]
}
}
},
"type": "object",
"properties": {
"parameters": { "$ref": "#/definitions/Parameters" },
"plants": { "$ref": "#/definitions/Plant" },
"products": { "$ref": "#/definitions/Product" }
},
"required": [
"parameters",
"plants",
"products"
]
}

22
src/sysimage.jl Normal file
View File

@@ -0,0 +1,22 @@
using PackageCompiler
using Cbc
using Clp
using Geodesy
using JSON
using JSONSchema
using JuMP
using MathOptInterface
using ProgressBars
pkg = [:Cbc,
:Clp,
:Geodesy,
:JSON,
:JSONSchema,
:JuMP,
:MathOptInterface,
:ProgressBars]
@info "Building system image..."
create_sysimage(pkg, sysimage_path="build/sysimage.so")

View File

@@ -1,14 +0,0 @@
name = "RELOGT"
uuid = "d5238ab2-e29b-4856-ba0f-d2b80f40b47d"
authors = ["Alinson S. Xavier <git@axavier.org>"]
version = "0.1.0"
[deps]
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
RELOG = "7cafaa7a-b311-45f0-b313-80bf15b5e5e5"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

View File

@@ -1,181 +0,0 @@
using OrderedCollections
using JSON
using RELOG
dict = OrderedDict
function run_boat_example()
cities_a = dict(
"Chicago" => [41.881832, -87.623177],
"New York City" => [40.712776, -74.005974],
"Los Angeles" => [34.052235, -118.243683],
"Houston" => [29.760427, -95.369804],
"Phoenix" => [33.448376, -112.074036],
"Philadelphia" => [39.952583, -75.165222],
"San Antonio" => [29.424122, -98.493629],
"San Diego" => [32.715736, -117.161087],
"Dallas" => [32.776664, -96.796988],
"San Jose" => [37.338208, -121.886329],
)
cities_b = dict(
"Chicago" => [41.881832, -87.623177],
"Phoenix" => [33.448376, -112.074036],
"Dallas" => [32.776664, -96.796988],
)
parameters = dict(
"time horizon (years)" => 5,
"building period (years)" => [1],
"distance metric" => "Euclidean",
)
nail_factory = dict(
"input" => nothing,
"outputs" => ["Nail"],
"fixed output (tonne)" => dict("Nail" => [1]),
"variable output (tonne/tonne)" => dict("Nail" => 0),
"revenue (\$/tonne)" => nothing,
"collection cost (\$/tonne)" => dict("Nail" => 1000),
"operating cost (\$)" => 0,
"disposal limit (tonne)" => dict("Nail" => nothing),
"disposal cost (\$/tonne)" => dict("Nail" => 0),
)
forest = dict(
"input" => nothing,
"outputs" => ["Wood"],
"fixed output (tonne)" => dict("Wood" => [[100], [100], [100], [100], [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], [0], [0], [0], [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),
"components" => ["1"],
)
boat_factory = dict(
"input mix (%)" => dict("Wood" => 95, "Nail" => 5),
"output (tonne)" => dict("NewBoat" => 1.0),
"processing emissions (tonne)" => dict("CO2" => 5),
"storage cost (\$/tonne)" => dict("Wood" => 500, "Nail" => 200),
"storage limit (tonne)" => dict("Wood" => 5, "Nail" => 1),
"disposal cost (\$/tonne)" => dict("NewBoat" => 0),
"disposal limit (tonne)" => dict("NewBoat" => 0),
"capacities" => [
dict(
"size (tonne)" => 500,
"opening cost (\$)" => 1_00_000,
"fixed operating cost (\$)" => 250_000,
"variable operating cost (\$/tonne)" => 5,
),
dict(
"size (tonne)" => 1000,
"opening cost (\$)" => 2_000_000,
"fixed operating cost (\$)" => 500_000,
"variable operating cost (\$/tonne)" => 5,
),
],
"initial capacity (tonne)" => 0,
)
recycling_plant = dict(
"input mix (%)" => dict("UsedBoat" => 100),
"output (tonne)" => dict("Nail" => 0.025, "Wood" => 0.475),
"processing emissions (tonne)" => dict("CO2" => 5),
"storage cost (\$/tonne)" => dict("UsedBoat" => 0),
"storage limit (tonne)" => dict("UsedBoat" => 0),
"disposal cost (\$/tonne)" => dict("Nail" => 0, "Wood" => 0),
"disposal limit (tonne)" => dict("Nail" => 0, "Wood" => 0),
"capacities" => [
dict(
"size (tonne)" => 500,
"opening cost (\$)" => 500_000,
"fixed operating cost (\$)" => 125_000,
"variable operating cost (\$/tonne)" => 2.5,
),
dict(
"size (tonne)" => 1000,
"opening cost (\$)" => 1_000_000,
"fixed operating cost (\$)" => 250_000,
"variable operating cost (\$/tonne)" => 2.5,
),
],
"initial capacity (tonne)" => 0,
)
lat_lon_dict(city_location) =
dict("latitude (deg)" => city_location[1], "longitude (deg)" => city_location[2])
data = dict(
"parameters" => parameters,
"products" =>
dict("Nail" => prod, "Wood" => prod, "NewBoat" => prod, "UsedBoat" => prod),
"centers" => merge(
dict(
"NailFactory ($city_name)" =>
merge(nail_factory, lat_lon_dict(city_location)) for
(city_name, city_location) in cities_b
),
dict(
"Forest ($city_name)" => merge(forest, lat_lon_dict(city_location))
for (city_name, city_location) in cities_b
),
dict(
"Retail ($city_name)" => merge(retail, lat_lon_dict(city_location))
for (city_name, city_location) in cities_a
),
),
"plants" => merge(
dict(
"BoatFactory ($city_name)" =>
merge(boat_factory, lat_lon_dict(city_location)) for
(city_name, city_location) in cities_a
),
dict(
"RecyclingPlant ($city_name)" =>
merge(recycling_plant, lat_lon_dict(city_location)) for
(city_name, city_location) in cities_a
),
),
)
# Generate instance file
open(fixture("boat_example.json"), "w") do file
JSON.print(file, data, 2)
end
# Load and solve example
instance = RELOG.parsefile(fixture("boat_example.json"))
model = RELOG.build_model(instance, optimizer = HiGHS.Optimizer, variable_names = true)
optimize!(model)
# Write reports
mkpath(fixture("boat_example"))
write_to_file(model, fixture("boat_example/model.lp"))
RELOG.write_plants_report(model, fixture("boat_example/plants.csv"))
RELOG.write_plant_outputs_report(model, fixture("boat_example/plant_outputs.csv"))
RELOG.write_centers_report(model, fixture("boat_example/centers.csv"))
RELOG.write_center_outputs_report(model, fixture("boat_example/center_outputs.csv"))
RELOG.write_transportation_report(model, fixture("boat_example/transportation.csv"))
return
end

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,41 +0,0 @@
source,destination,product,year,amount sent (tonne),distance (km),transportation cost ($),center revenue ($),center collection cost ($)
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,1,0.15789,0.0,0.0,0.0,0.0
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,2,0.57341,0.0,0.0,0.0,0.0
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,3,0.79428,0.0,0.0,0.0,0.0
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,4,0.84522,0.0,0.0,0.0,0.0
RecyclingPlant (Dallas),BoatFactory (Dallas),Nail,5,0.86354,0.0,0.0,0.0,0.0
NailFactory (Chicago),BoatFactory (Dallas),Nail,1,1.0,1293.093,387.9279,0.0,1000.0
NailFactory (Chicago),BoatFactory (Dallas),Nail,2,1.0,1293.093,387.9279,0.0,1000.0
NailFactory (Chicago),BoatFactory (Dallas),Nail,3,1.0,1293.093,387.9279,0.0,1000.0
NailFactory (Chicago),BoatFactory (Dallas),Nail,4,1.0,1293.093,387.9279,0.0,1000.0
NailFactory (Chicago),BoatFactory (Dallas),Nail,5,1.0,1293.093,387.9279,0.0,1000.0
NailFactory (Phoenix),BoatFactory (Dallas),Nail,1,1.0,1423.57,427.071,0.0,1000.0
NailFactory (Phoenix),BoatFactory (Dallas),Nail,2,1.0,1423.57,427.071,0.0,1000.0
NailFactory (Phoenix),BoatFactory (Dallas),Nail,3,1.0,1423.57,427.071,0.0,1000.0
NailFactory (Phoenix),BoatFactory (Dallas),Nail,4,1.0,1423.57,427.071,0.0,1000.0
NailFactory (Phoenix),BoatFactory (Dallas),Nail,5,1.0,1423.57,427.071,0.0,1000.0
NailFactory (Dallas),BoatFactory (Dallas),Nail,1,1.0,0.0,0.0,0.0,1000.0
NailFactory (Dallas),BoatFactory (Dallas),Nail,2,1.0,0.0,0.0,0.0,1000.0
NailFactory (Dallas),BoatFactory (Dallas),Nail,3,1.0,0.0,0.0,0.0,1000.0
NailFactory (Dallas),BoatFactory (Dallas),Nail,4,1.0,0.0,0.0,0.0,1000.0
NailFactory (Dallas),BoatFactory (Dallas),Nail,5,1.0,0.0,0.0,0.0,1000.0
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,1,3.0,0.0,0.0,0.0,0.0
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,2,10.89474,0.0,0.0,0.0,0.0
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,3,15.09141,0.0,0.0,0.0,0.0
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,4,16.05912,0.0,0.0,0.0,0.0
RecyclingPlant (Dallas),BoatFactory (Dallas),Wood,5,16.40733,0.0,0.0,0.0,0.0
Forest (Dallas),BoatFactory (Dallas),Wood,1,57.0,0.0,0.0,0.0,14250.0
Forest (Dallas),BoatFactory (Dallas),Wood,2,57.0,0.0,0.0,0.0,14250.0
Forest (Dallas),BoatFactory (Dallas),Wood,3,57.0,0.0,0.0,0.0,14250.0
Forest (Dallas),BoatFactory (Dallas),Wood,4,57.0,0.0,0.0,0.0,14250.0
Forest (Dallas),BoatFactory (Dallas),Wood,5,57.0,0.0,0.0,0.0,14250.0
BoatFactory (Dallas),Retail (Dallas),NewBoat,1,63.15789,0.0,0.0,757894.73684,0.0
BoatFactory (Dallas),Retail (Dallas),NewBoat,2,71.46814,0.0,0.0,857617.72853,0.0
BoatFactory (Dallas),Retail (Dallas),NewBoat,3,75.8857,0.0,0.0,910628.37148,0.0
BoatFactory (Dallas),Retail (Dallas),NewBoat,4,76.90434,0.0,0.0,922852.03459,0.0
BoatFactory (Dallas),Retail (Dallas),NewBoat,5,77.27087,0.0,0.0,927250.44516,0.0
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,1,6.31579,0.0,0.0,0.0,631.57895
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,2,22.93629,0.0,0.0,0.0,2293.62881
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,3,31.7714,0.0,0.0,0.0,3177.13952
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,4,33.80867,0.0,0.0,0.0,3380.86724
Retail (Dallas),RecyclingPlant (Dallas),UsedBoat,5,34.54174,0.0,0.0,0.0,3454.17409
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

@@ -0,0 +1,7 @@
plant type,location name,year,emission type,emission amount (tonne)
Rare Earth Recycling Plant,"Sebastian, Arkansas",1,CO2,40711.3
Rare Earth Recycling Plant,"Stanly, North Carolina",1,CO2,23336.47
Rare Earth Recycling Plant,"Lynn, Texas",1,CO2,52927.44
Mega Plant,"Sebastian, Arkansas",1,CO2,110818.84
Mega Plant,"District of Columbia, District of Columbia",1,CO2,63523.43
Mega Plant,"Maricopa, Arizona",1,CO2,144072.0
1 plant type location name year emission type emission amount (tonne)
2 Rare Earth Recycling Plant Sebastian, Arkansas 1 CO2 40711.3
3 Rare Earth Recycling Plant Stanly, North Carolina 1 CO2 23336.47
4 Rare Earth Recycling Plant Lynn, Texas 1 CO2 52927.44
5 Mega Plant Sebastian, Arkansas 1 CO2 110818.84
6 Mega Plant District of Columbia, District of Columbia 1 CO2 63523.43
7 Mega Plant Maricopa, Arizona 1 CO2 144072.0

37
test/fixtures/nimh_plant_outputs.csv vendored Normal file
View File

@@ -0,0 +1,37 @@
plant type,location name,year,product name,amount produced (tonne),amount sent (tonne),amount disposed (tonne),disposal cost ($)
Rare Earth Recycling Plant,"Sebastian, Arkansas",1,rare earth cela,18045.12,0.0,18045.12,0.0
Rare Earth Recycling Plant,"Sebastian, Arkansas",1,rare earth diddy,7624.02,0.0,7624.02,0.0
Rare Earth Recycling Plant,"Sebastian, Arkansas",1,salt,6434.8,0.0,6434.8,324314.03
Rare Earth Recycling Plant,"Sebastian, Arkansas",1,rare earth misch,2188.78,0.0,2188.78,0.0
Rare Earth Recycling Plant,"Stanly, North Carolina",1,rare earth cela,10343.8,0.0,10343.8,0.0
Rare Earth Recycling Plant,"Stanly, North Carolina",1,rare earth diddy,4370.23,0.0,4370.23,0.0
Rare Earth Recycling Plant,"Stanly, North Carolina",1,salt,3688.55,0.0,3688.55,185902.85
Rare Earth Recycling Plant,"Stanly, North Carolina",1,rare earth misch,1254.65,0.0,1254.65,0.0
Rare Earth Recycling Plant,"Lynn, Texas",1,rare earth cela,23459.88,0.0,23459.88,0.0
Rare Earth Recycling Plant,"Lynn, Texas",1,rare earth diddy,9911.74,0.0,9911.74,0.0
Rare Earth Recycling Plant,"Lynn, Texas",1,salt,8365.68,0.0,8365.68,421630.2
Rare Earth Recycling Plant,"Lynn, Texas",1,rare earth misch,2845.56,0.0,2845.56,0.0
Mega Plant,"Sebastian, Arkansas",1,iron-nickel scrap,35656.28,0.0,35656.28,0.0
Mega Plant,"Sebastian, Arkansas",1,mixed-hydroxides,73141.86,0.0,73141.86,0.0
Mega Plant,"Sebastian, Arkansas",1,leach residue,31470.35,0.0,31470.35,6.38848022e6
Mega Plant,"Sebastian, Arkansas",1,plastic pack,96503.37,0.0,96503.37,4.86376966e6
Mega Plant,"Sebastian, Arkansas",1,salt,285304.6,0.0,285304.6,1.437935192e7
Mega Plant,"Sebastian, Arkansas",1,rare earth mix,44145.84,44145.84,0.0,0.0
Mega Plant,"Sebastian, Arkansas",1,nickel-iron scrap,178655.26,0.0,178655.26,0.0
Mega Plant,"Sebastian, Arkansas",1,nickel,37931.36,0.0,37931.36,0.0
Mega Plant,"District of Columbia, District of Columbia",1,iron-nickel scrap,20438.84,0.0,20438.84,0.0
Mega Plant,"District of Columbia, District of Columbia",1,mixed-hydroxides,41926.28,0.0,41926.28,0.0
Mega Plant,"District of Columbia, District of Columbia",1,leach residue,18039.39,0.0,18039.39,3.66199595e6
Mega Plant,"District of Columbia, District of Columbia",1,plastic pack,55317.53,0.0,55317.53,2.78800343e6
Mega Plant,"District of Columbia, District of Columbia",1,salt,163541.92,0.0,163541.92,8.24251257e6
Mega Plant,"District of Columbia, District of Columbia",1,rare earth mix,25305.22,25305.22,0.0,0.0
Mega Plant,"District of Columbia, District of Columbia",1,nickel-iron scrap,102408.52,0.0,102408.52,0.0
Mega Plant,"District of Columbia, District of Columbia",1,nickel,21742.96,0.0,21742.96,0.0
Mega Plant,"Maricopa, Arizona",1,iron-nickel scrap,46355.57,0.0,46355.57,0.0
Mega Plant,"Maricopa, Arizona",1,mixed-hydroxides,95089.37,0.0,95089.37,0.0
Mega Plant,"Maricopa, Arizona",1,leach residue,40913.58,0.0,40913.58,8.30545698e6
Mega Plant,"Maricopa, Arizona",1,plastic pack,125460.91,0.0,125460.91,6.32322998e6
Mega Plant,"Maricopa, Arizona",1,salt,370915.31,0.0,370915.31,1.869413141e7
Mega Plant,"Maricopa, Arizona",1,rare earth mix,57392.58,57392.58,0.0,0.0
Mega Plant,"Maricopa, Arizona",1,nickel-iron scrap,232263.93,0.0,232263.93,0.0
Mega Plant,"Maricopa, Arizona",1,nickel,49313.34,0.0,49313.34,0.0
1 plant type location name year product name amount produced (tonne) amount sent (tonne) amount disposed (tonne) disposal cost ($)
2 Rare Earth Recycling Plant Sebastian, Arkansas 1 rare earth cela 18045.12 0.0 18045.12 0.0
3 Rare Earth Recycling Plant Sebastian, Arkansas 1 rare earth diddy 7624.02 0.0 7624.02 0.0
4 Rare Earth Recycling Plant Sebastian, Arkansas 1 salt 6434.8 0.0 6434.8 324314.03
5 Rare Earth Recycling Plant Sebastian, Arkansas 1 rare earth misch 2188.78 0.0 2188.78 0.0
6 Rare Earth Recycling Plant Stanly, North Carolina 1 rare earth cela 10343.8 0.0 10343.8 0.0
7 Rare Earth Recycling Plant Stanly, North Carolina 1 rare earth diddy 4370.23 0.0 4370.23 0.0
8 Rare Earth Recycling Plant Stanly, North Carolina 1 salt 3688.55 0.0 3688.55 185902.85
9 Rare Earth Recycling Plant Stanly, North Carolina 1 rare earth misch 1254.65 0.0 1254.65 0.0
10 Rare Earth Recycling Plant Lynn, Texas 1 rare earth cela 23459.88 0.0 23459.88 0.0
11 Rare Earth Recycling Plant Lynn, Texas 1 rare earth diddy 9911.74 0.0 9911.74 0.0
12 Rare Earth Recycling Plant Lynn, Texas 1 salt 8365.68 0.0 8365.68 421630.2
13 Rare Earth Recycling Plant Lynn, Texas 1 rare earth misch 2845.56 0.0 2845.56 0.0
14 Mega Plant Sebastian, Arkansas 1 iron-nickel scrap 35656.28 0.0 35656.28 0.0
15 Mega Plant Sebastian, Arkansas 1 mixed-hydroxides 73141.86 0.0 73141.86 0.0
16 Mega Plant Sebastian, Arkansas 1 leach residue 31470.35 0.0 31470.35 6.38848022e6
17 Mega Plant Sebastian, Arkansas 1 plastic pack 96503.37 0.0 96503.37 4.86376966e6
18 Mega Plant Sebastian, Arkansas 1 salt 285304.6 0.0 285304.6 1.437935192e7
19 Mega Plant Sebastian, Arkansas 1 rare earth mix 44145.84 44145.84 0.0 0.0
20 Mega Plant Sebastian, Arkansas 1 nickel-iron scrap 178655.26 0.0 178655.26 0.0
21 Mega Plant Sebastian, Arkansas 1 nickel 37931.36 0.0 37931.36 0.0
22 Mega Plant District of Columbia, District of Columbia 1 iron-nickel scrap 20438.84 0.0 20438.84 0.0
23 Mega Plant District of Columbia, District of Columbia 1 mixed-hydroxides 41926.28 0.0 41926.28 0.0
24 Mega Plant District of Columbia, District of Columbia 1 leach residue 18039.39 0.0 18039.39 3.66199595e6
25 Mega Plant District of Columbia, District of Columbia 1 plastic pack 55317.53 0.0 55317.53 2.78800343e6
26 Mega Plant District of Columbia, District of Columbia 1 salt 163541.92 0.0 163541.92 8.24251257e6
27 Mega Plant District of Columbia, District of Columbia 1 rare earth mix 25305.22 25305.22 0.0 0.0
28 Mega Plant District of Columbia, District of Columbia 1 nickel-iron scrap 102408.52 0.0 102408.52 0.0
29 Mega Plant District of Columbia, District of Columbia 1 nickel 21742.96 0.0 21742.96 0.0
30 Mega Plant Maricopa, Arizona 1 iron-nickel scrap 46355.57 0.0 46355.57 0.0
31 Mega Plant Maricopa, Arizona 1 mixed-hydroxides 95089.37 0.0 95089.37 0.0
32 Mega Plant Maricopa, Arizona 1 leach residue 40913.58 0.0 40913.58 8.30545698e6
33 Mega Plant Maricopa, Arizona 1 plastic pack 125460.91 0.0 125460.91 6.32322998e6
34 Mega Plant Maricopa, Arizona 1 salt 370915.31 0.0 370915.31 1.869413141e7
35 Mega Plant Maricopa, Arizona 1 rare earth mix 57392.58 57392.58 0.0 0.0
36 Mega Plant Maricopa, Arizona 1 nickel-iron scrap 232263.93 0.0 232263.93 0.0
37 Mega Plant Maricopa, Arizona 1 nickel 49313.34 0.0 49313.34 0.0

7
test/fixtures/nimh_plants.csv vendored Normal file
View File

@@ -0,0 +1,7 @@
plant type,location name,year,latitude (deg),longitude (deg),capacity (tonne),amount processed (tonne),utilization factor (%),energy (GJ),opening cost ($),expansion cost ($),fixed operating cost ($),variable operating cost ($),total cost ($)
Rare Earth Recycling Plant,"Sebastian, Arkansas",1,35.23416,-94.212943,44145.84,44145.84,100.0,1.13360359e6,6.9926855e6,1.793555439e7,1.677420707e7,1.0080261442e8,1.4250506138e8
Rare Earth Recycling Plant,"Stanly, North Carolina",1,35.334445,-80.223231,25305.22,25305.22,100.0,649802.71,7.1653444e6,9.98954108e6,1.126536154e7,5.778193764e7,8.620218466e7
Rare Earth Recycling Plant,"Lynn, Texas",1,33.166444,-101.793455,57392.58,57392.58,100.0,1.47376145e6,7.4243328e6,2.5154042e7,2.06474474e7,1.310502261e8,1.842760483e8
Mega Plant,"Sebastian, Arkansas",1,35.23416,-94.212943,553817.3,553817.3,100.0,3.08574408e6,1.6858178e7,4.012879371e7,3.834652057e7,4.2898688058e8,5.2432037286e8
Mega Plant,"District of Columbia, District of Columbia",1,38.930028,-76.974164,317458.4,317458.4,100.0,1.76880602e6,2.12288167e7,2.746685387e7,2.602109584e7,2.4590327664e8,3.2062004305e8
Mega Plant,"Maricopa, Arizona",1,33.647365,-111.893669,720000.0,720000.0,100.0,4.0116763e6,2.10206911e7,6.60955172e7,4.70124619e7,5.57712e8,6.918406702e8
1 plant type location name year latitude (deg) longitude (deg) capacity (tonne) amount processed (tonne) utilization factor (%) energy (GJ) opening cost ($) expansion cost ($) fixed operating cost ($) variable operating cost ($) total cost ($)
2 Rare Earth Recycling Plant Sebastian, Arkansas 1 35.23416 -94.212943 44145.84 44145.84 100.0 1.13360359e6 6.9926855e6 1.793555439e7 1.677420707e7 1.0080261442e8 1.4250506138e8
3 Rare Earth Recycling Plant Stanly, North Carolina 1 35.334445 -80.223231 25305.22 25305.22 100.0 649802.71 7.1653444e6 9.98954108e6 1.126536154e7 5.778193764e7 8.620218466e7
4 Rare Earth Recycling Plant Lynn, Texas 1 33.166444 -101.793455 57392.58 57392.58 100.0 1.47376145e6 7.4243328e6 2.5154042e7 2.06474474e7 1.310502261e8 1.842760483e8
5 Mega Plant Sebastian, Arkansas 1 35.23416 -94.212943 553817.3 553817.3 100.0 3.08574408e6 1.6858178e7 4.012879371e7 3.834652057e7 4.2898688058e8 5.2432037286e8
6 Mega Plant District of Columbia, District of Columbia 1 38.930028 -76.974164 317458.4 317458.4 100.0 1.76880602e6 2.12288167e7 2.746685387e7 2.602109584e7 2.4590327664e8 3.2062004305e8
7 Mega Plant Maricopa, Arizona 1 33.647365 -111.893669 720000.0 720000.0 100.0 4.0116763e6 2.10206911e7 6.60955172e7 4.70124619e7 5.57712e8 6.918406702e8

BIN
test/fixtures/nimh_solution.json.gz vendored Normal file

Binary file not shown.

3618
test/fixtures/nimh_transportation.csv vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

202
test/fixtures/s1-wrong-length.json vendored Normal file
View File

@@ -0,0 +1,202 @@
{
"parameters": {
"time horizon (years)": 2
},
"products": {
"P1": {
"transportation cost ($/km/tonne)": [0.015, 0.015],
"transportation energy (J/km/tonne)": [0.12, 0.11],
"transportation emissions (tonne/km/tonne)": {
"CO2": [0.052],
"CH4": [0.003, 0.002]
},
"initial amounts": {
"C1": {
"latitude (deg)": 7.0,
"longitude (deg)": 7.0,
"amount (tonne)": [934.56, 934.56]
},
"C2": {
"latitude (deg)": 7.0,
"longitude (deg)": 19.0,
"amount (tonne)": [198.95, 198.95]
},
"C3": {
"latitude (deg)": 84.0,
"longitude (deg)": 76.0,
"amount (tonne)": [212.97, 212.97]
},
"C4": {
"latitude (deg)": 21.0,
"longitude (deg)": 16.0,
"amount (tonne)": [352.19, 352.19]
},
"C5": {
"latitude (deg)": 32.0,
"longitude (deg)": 92.0,
"amount (tonne)": [510.33, 510.33]
},
"C6": {
"latitude (deg)": 14.0,
"longitude (deg)": 62.0,
"amount (tonne)": [471.66, 471.66]
},
"C7": {
"latitude (deg)": 30.0,
"longitude (deg)": 83.0,
"amount (tonne)": [785.21, 785.21]
},
"C8": {
"latitude (deg)": 35.0,
"longitude (deg)": 40.0,
"amount (tonne)": [706.17, 706.17]
},
"C9": {
"latitude (deg)": 74.0,
"longitude (deg)": 52.0,
"amount (tonne)": [30.08, 30.08]
},
"C10": {
"latitude (deg)": 22.0,
"longitude (deg)": 54.0,
"amount (tonne)": [536.52, 536.52]
}
}
},
"P2": {
"transportation cost ($/km/tonne)": [0.02, 0.02]
},
"P3": {
"transportation cost ($/km/tonne)": [0.0125, 0.0125]
},
"P4": {
"transportation cost ($/km/tonne)": [0.0175, 0.0175]
}
},
"plants": {
"F1": {
"input": "P1",
"outputs (tonne/tonne)": {
"P2": 0.2,
"P3": 0.5
},
"energy (GJ/tonne)": [0.12, 0.11],
"emissions (tonne/tonne)": {
"CO2": [0.052, 0.050],
"CH4": [0.003, 0.002]
},
"locations": {
"L1": {
"latitude (deg)": 0.0,
"longitude (deg)": 0.0,
"disposal": {
"P2": {
"cost ($/tonne)": [-10.0, -10.0],
"limit (tonne)": [1.0, 1.0]
},
"P3": {
"cost ($/tonne)": [-10.0, -10.0],
"limit (tonne)": [1.0, 1.0]
}
},
"capacities (tonne)": {
"250.0": {
"opening cost ($)": [500.0, 500.0],
"fixed operating cost ($)": [30.0, 30.0],
"variable operating cost ($/tonne)": [30.0, 30.0]
},
"1000.0": {
"opening cost ($)": [1250.0, 1250.0],
"fixed operating cost ($)": [30.0, 30.0],
"variable operating cost ($/tonne)": [30.0, 30.0]
}
}
},
"L2": {
"latitude (deg)": 0.5,
"longitude (deg)": 0.5,
"capacities (tonne)": {
"0.0": {
"opening cost ($)": [1000, 1000],
"fixed operating cost ($)": [50.0, 50.0],
"variable operating cost ($/tonne)": [50.0, 50.0]
},
"10000.0": {
"opening cost ($)": [10000, 10000],
"fixed operating cost ($)": [50.0, 50.0],
"variable operating cost ($/tonne)": [50.0, 50.0]
}
}
}
}
},
"F2": {
"input": "P2",
"outputs (tonne/tonne)": {
"P3": 0.05,
"P4": 0.80
},
"locations": {
"L3": {
"latitude (deg)": 25.0,
"longitude (deg)": 65.0,
"disposal": {
"P3": {
"cost ($/tonne)": [100.0, 100.0]
}
},
"capacities (tonne)": {
"1000.0": {
"opening cost ($)": [3000, 3000],
"fixed operating cost ($)": [50.0, 50.0],
"variable operating cost ($/tonne)": [50.0, 50.0]
}
}
},
"L4": {
"latitude (deg)": 0.75,
"longitude (deg)": 0.20,
"capacities (tonne)": {
"10000": {
"opening cost ($)": [3000, 3000],
"fixed operating cost ($)": [50.0, 50.0],
"variable operating cost ($/tonne)": [50.0, 50.0]
}
}
}
}
},
"F3": {
"input": "P4",
"locations": {
"L5": {
"latitude (deg)": 100.0,
"longitude (deg)": 100.0,
"capacities (tonne)": {
"15000": {
"opening cost ($)": [0.0, 0.0],
"fixed operating cost ($)": [0.0, 0.0],
"variable operating cost ($/tonne)": [-15.0, -15.0]
}
}
}
}
},
"F4": {
"input": "P3",
"locations": {
"L6": {
"latitude (deg)": 50.0,
"longitude (deg)": 50.0,
"capacities (tonne)": {
"10000": {
"opening cost ($)": [0.0, 0.0],
"fixed operating cost ($)": [0.0, 0.0],
"variable operating cost ($/tonne)": [-15.0, -15.0]
}
}
}
}
}
}
}

View File

@@ -1,164 +0,0 @@
{
"parameters": {
"time horizon (years)": 4,
"building period (years)": [1],
"distance metric": "driving"
},
"products": {
"P1": {
"transportation cost ($/km/tonne)": 0.015,
"transportation energy (J/km/tonne)": 0.12,
"transportation emissions (tonne/km/tonne)": {
"CO2": 0.052,
"CH4": [0.003, 0.003, 0.003, 0.003]
},
"components": ["1", "2"]
},
"P2": {
"transportation cost ($/km/tonne)": [0.015, 0.015, 0.015, 0.015],
"transportation energy (J/km/tonne)": [0.12, 0.12, 0.12, 0.12],
"transportation emissions (tonne/km/tonne)": {
"CO2": [0.052, 0.052, 0.052, 0.052],
"CH4": [0.003, 0.003, 0.003, 0.003]
},
"components": ["1"]
},
"P3": {
"transportation cost ($/km/tonne)": [0.015, 0.015, 0.015, 0.015],
"transportation energy (J/km/tonne)": [0.12, 0.12, 0.12, 0.12],
"transportation emissions (tonne/km/tonne)": {
"CO2": [0.052, 0.052, 0.052, 0.052],
"CH4": [0.003, 0.003, 0.003, 0.003]
},
"components": ["1"]
},
"P4": {
"transportation cost ($/km/tonne)": [0.015, 0.015, 0.015, 0.015],
"transportation energy (J/km/tonne)": [0.12, 0.12, 0.12, 0.12],
"transportation emissions (tonne/km/tonne)": {
"CO2": [0.052, 0.052, 0.052, 0.052],
"CH4": [0.003, 0.003, 0.003, 0.003]
},
"components": ["1"]
}
},
"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.2, 0.25, 0.12],
"P3": [0.25, 0.25, 0.25]
},
"revenue ($/tonne)": 12.0,
"collection cost ($/tonne)": {
"P2": [0.25, 0.25, 0.25, 0.25],
"P3": [0.37, 0.37, 0.37, 0.37]
},
"operating cost ($)": [150.0, 150.0, 150.0, 150.0],
"disposal limit (tonne)": {
"P2": [0, 0, 0, 0],
"P3": [null, null, null, null]
},
"disposal cost ($/tonne)": {
"P2": [0.23, 0.23, 0.23, 0.23],
"P3": [1.0, 1.0, 1.0, 1.0]
}
},
"C2": {
"latitude (deg)": 42.881,
"longitude (deg)": -87.623,
"input": null,
"outputs": ["P1"],
"variable output (tonne/tonne)": {
"P1": 0
},
"fixed output (tonne)": {
"P1": [
[50, 5],
[60, 6],
[70, 7],
[80, 8]
]
},
"revenue ($/tonne)": null,
"collection cost ($/tonne)": {
"P1": 0.25
},
"operating cost ($)": [150.0, 150.0, 150.0, 150.0],
"disposal limit (tonne)": {
"P1": null
},
"disposal cost ($/tonne)": {
"P1": 0
}
},
"C3": {
"latitude (deg)": 43.881,
"longitude (deg)": -87.623,
"input": "P4",
"outputs": [],
"variable output (tonne/tonne)": {},
"constant output (tonne)": {},
"revenue ($/tonne)": [12.0, 12.0, 12.0, 12.0],
"collection cost ($/tonne)": {},
"operating cost ($)": 150.0,
"disposal limit (tonne)": {},
"disposal cost ($/tonne)": {}
}
},
"plants": {
"L1": {
"latitude (deg)": 44.881,
"longitude (deg)": -87.623,
"input mix (%)": {
"P1": 95.3,
"P2": 4.7
},
"output (tonne)": {
"P3": 0.25,
"P4": 0.12
},
"processing emissions (tonne)": {
"CO2": 0.1
},
"storage cost ($/tonne)": {
"P1": 0.1,
"P2": 0.1
},
"storage limit (tonne)": {
"P1": 100,
"P2": null
},
"disposal cost ($/tonne)": {
"P3": 0,
"P4": 0.86
},
"disposal limit (tonne)": {
"P3": null,
"P4": 1000.0
},
"capacities": [
{
"size (tonne)": 100,
"opening cost ($)": [300, 400, 450, 475],
"fixed operating cost ($)": 300,
"variable operating cost ($/tonne)": 5.0
},
{
"size (tonne)": 500,
"opening cost ($)": 1000.0,
"fixed operating cost ($)": 400.0,
"variable operating cost ($/tonne)": 5.0
}
],
"initial capacity (tonne)": 0
}
}
}

39
test/fixtures/storage.json vendored Normal file
View File

@@ -0,0 +1,39 @@
{
"parameters": {
"time horizon (years)": 3
},
"products": {
"battery": {
"initial amounts": {
"Chicago": {
"latitude (deg)": 0.0,
"longitude (deg)": 0.0,
"amount (tonne)": [100.0, 0.0, 0.0]
}
},
"transportation cost ($/km/tonne)": [0.01, 0.01, 0.01]
}
},
"plants": {
"mega plant": {
"input": "battery",
"locations": {
"Chicago": {
"latitude (deg)": 0.0,
"longitude (deg)": 0.0,
"storage": {
"cost ($/tonne)": [2.0, 1.5, 1.0],
"limit (tonne)": 50.0
},
"capacities (tonne)": {
"100": {
"opening cost ($)": [0.0, 0.0, 0],
"fixed operating cost ($)": [0.0, 0.0, 0.0],
"variable operating cost ($/tonne)": [10.0, 5.0, 2.0]
}
}
}
}
}
}
}

View File

@@ -1,650 +0,0 @@
{
"parameters": {
"time horizon (years)": 5,
"building period (years)": [1],
"distance metric": "Euclidean"
},
"products": {
"Waste": {
"transportation cost ($/km/tonne)": 0.3,
"transportation energy (J/km/tonne)": 7500,
"transportation emissions (tonne/km/tonne)": {
"CO2": 2.68
},
"components": ["Film", "Paper", "Cardboard"]
},
"Film Bale": {
"transportation cost ($/km/tonne)": 0.3,
"transportation energy (J/km/tonne)": 7500,
"transportation emissions (tonne/km/tonne)": {
"CO2": 2.68
},
"components": ["Film", "Paper", "Cardboard"]
},
"Cardboard Bale": {
"transportation cost ($/km/tonne)": 0.3,
"transportation energy (J/km/tonne)": 7500,
"transportation emissions (tonne/km/tonne)": {
"CO2": 2.68
},
"components": ["Film", "Paper", "Cardboard"]
}
},
"centers": {
"Collection Center (Chicago)": {
"input": null,
"outputs": ["Waste"],
"fixed output (tonne)": {
"Waste": [20, 100, 100]
},
"variable output (tonne/tonne)": {},
"revenue ($/tonne)": null,
"collection cost ($/tonne)": {
"Waste": 10
},
"operating cost ($)": 0,
"disposal limit (tonne)": {
"Waste": null
},
"disposal cost ($/tonne)": {
"Waste": 0
},
"latitude (deg)": 41.881832,
"longitude (deg)": -87.623177
},
"Collection Center (Phoenix)": {
"input": null,
"outputs": ["Waste"],
"fixed output (tonne)": {
"Waste": [20, 100, 100]
},
"variable output (tonne/tonne)": {},
"revenue ($/tonne)": null,
"collection cost ($/tonne)": {
"Waste": 10
},
"operating cost ($)": 0,
"disposal limit (tonne)": {
"Waste": null
},
"disposal cost ($/tonne)": {
"Waste": 0
},
"latitude (deg)": 33.448376,
"longitude (deg)": -112.074036
},
"Collection Center (Dallas)": {
"input": null,
"outputs": ["Waste"],
"fixed output (tonne)": {
"Waste": [20, 100, 100]
},
"variable output (tonne/tonne)": {},
"revenue ($/tonne)": null,
"collection cost ($/tonne)": {
"Waste": 10
},
"operating cost ($)": 0,
"disposal limit (tonne)": {
"Waste": null
},
"disposal cost ($/tonne)": {
"Waste": 0
},
"latitude (deg)": 32.776664,
"longitude (deg)": -96.796988
}
},
"plants": {
"RecyclingPlant (Chicago)": {
"input mix (%)": {
"Waste": 100
},
"output (tonne)": {
"Film Bale": {
"Waste": [
[0.98, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.02]
]
},
"Cardboard Bale": {
"Waste": [
[0.0, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.75]
]
}
},
"processing emissions (tonne)": {
"CO2": 5
},
"storage cost ($/tonne)": {
"Waste": 500
},
"storage limit (tonne)": {
"Waste": 5
},
"disposal cost ($/tonne)": {
"Film Bale": -10,
"Cardboard Bale": -10
},
"disposal limit (tonne)": {
"Film Bale": null,
"Cardboard Bale": null
},
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
{
"size (tonne)": 1000,
"opening cost ($)": 2000000,
"fixed operating cost ($)": 500000,
"variable operating cost ($/tonne)": 5
}
],
"initial capacity (tonne)": 0,
"latitude (deg)": 41.881832,
"longitude (deg)": -87.623177
},
"RecyclingPlant (New York City)": {
"input mix (%)": {
"Waste": 100
},
"output (tonne)": {
"Film Bale": {
"Waste": [
[0.98, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.02]
]
},
"Cardboard Bale": {
"Waste": [
[0.0, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.75]
]
}
},
"processing emissions (tonne)": {
"CO2": 5
},
"storage cost ($/tonne)": {
"Waste": 500
},
"storage limit (tonne)": {
"Waste": 5
},
"disposal cost ($/tonne)": {
"Film Bale": -10,
"Cardboard Bale": -10
},
"disposal limit (tonne)": {
"Film Bale": null,
"Cardboard Bale": null
},
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
{
"size (tonne)": 1000,
"opening cost ($)": 2000000,
"fixed operating cost ($)": 500000,
"variable operating cost ($/tonne)": 5
}
],
"initial capacity (tonne)": 0,
"latitude (deg)": 40.712776,
"longitude (deg)": -74.005974
},
"RecyclingPlant (Los Angeles)": {
"input mix (%)": {
"Waste": 100
},
"output (tonne)": {
"Film Bale": {
"Waste": [
[0.98, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.02]
]
},
"Cardboard Bale": {
"Waste": [
[0.0, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.75]
]
}
},
"processing emissions (tonne)": {
"CO2": 5
},
"storage cost ($/tonne)": {
"Waste": 500
},
"storage limit (tonne)": {
"Waste": 5
},
"disposal cost ($/tonne)": {
"Film Bale": -10,
"Cardboard Bale": -10
},
"disposal limit (tonne)": {
"Film Bale": null,
"Cardboard Bale": null
},
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
{
"size (tonne)": 1000,
"opening cost ($)": 2000000,
"fixed operating cost ($)": 500000,
"variable operating cost ($/tonne)": 5
}
],
"initial capacity (tonne)": 0,
"latitude (deg)": 34.052235,
"longitude (deg)": -118.243683
},
"RecyclingPlant (Houston)": {
"input mix (%)": {
"Waste": 100
},
"output (tonne)": {
"Film Bale": {
"Waste": [
[0.98, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.02]
]
},
"Cardboard Bale": {
"Waste": [
[0.0, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.75]
]
}
},
"processing emissions (tonne)": {
"CO2": 5
},
"storage cost ($/tonne)": {
"Waste": 500
},
"storage limit (tonne)": {
"Waste": 5
},
"disposal cost ($/tonne)": {
"Film Bale": -10,
"Cardboard Bale": -10
},
"disposal limit (tonne)": {
"Film Bale": null,
"Cardboard Bale": null
},
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
{
"size (tonne)": 1000,
"opening cost ($)": 2000000,
"fixed operating cost ($)": 500000,
"variable operating cost ($/tonne)": 5
}
],
"initial capacity (tonne)": 0,
"latitude (deg)": 29.760427,
"longitude (deg)": -95.369804
},
"RecyclingPlant (Phoenix)": {
"input mix (%)": {
"Waste": 100
},
"output (tonne)": {
"Film Bale": {
"Waste": [
[0.98, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.02]
]
},
"Cardboard Bale": {
"Waste": [
[0.0, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.75]
]
}
},
"processing emissions (tonne)": {
"CO2": 5
},
"storage cost ($/tonne)": {
"Waste": 500
},
"storage limit (tonne)": {
"Waste": 5
},
"disposal cost ($/tonne)": {
"Film Bale": -10,
"Cardboard Bale": -10
},
"disposal limit (tonne)": {
"Film Bale": null,
"Cardboard Bale": null
},
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
{
"size (tonne)": 1000,
"opening cost ($)": 2000000,
"fixed operating cost ($)": 500000,
"variable operating cost ($/tonne)": 5
}
],
"initial capacity (tonne)": 0,
"latitude (deg)": 33.448376,
"longitude (deg)": -112.074036
},
"RecyclingPlant (Philadelphia)": {
"input mix (%)": {
"Waste": 100
},
"output (tonne)": {
"Film Bale": {
"Waste": [
[0.98, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.02]
]
},
"Cardboard Bale": {
"Waste": [
[0.0, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.75]
]
}
},
"processing emissions (tonne)": {
"CO2": 5
},
"storage cost ($/tonne)": {
"Waste": 500
},
"storage limit (tonne)": {
"Waste": 5
},
"disposal cost ($/tonne)": {
"Film Bale": -10,
"Cardboard Bale": -10
},
"disposal limit (tonne)": {
"Film Bale": null,
"Cardboard Bale": null
},
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
{
"size (tonne)": 1000,
"opening cost ($)": 2000000,
"fixed operating cost ($)": 500000,
"variable operating cost ($/tonne)": 5
}
],
"initial capacity (tonne)": 0,
"latitude (deg)": 39.952583,
"longitude (deg)": -75.165222
},
"RecyclingPlant (San Antonio)": {
"input mix (%)": {
"Waste": 100
},
"output (tonne)": {
"Film Bale": {
"Waste": [
[0.98, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.02]
]
},
"Cardboard Bale": {
"Waste": [
[0.0, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.75]
]
}
},
"processing emissions (tonne)": {
"CO2": 5
},
"storage cost ($/tonne)": {
"Waste": 500
},
"storage limit (tonne)": {
"Waste": 5
},
"disposal cost ($/tonne)": {
"Film Bale": -10,
"Cardboard Bale": -10
},
"disposal limit (tonne)": {
"Film Bale": null,
"Cardboard Bale": null
},
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
{
"size (tonne)": 1000,
"opening cost ($)": 2000000,
"fixed operating cost ($)": 500000,
"variable operating cost ($/tonne)": 5
}
],
"initial capacity (tonne)": 0,
"latitude (deg)": 29.424122,
"longitude (deg)": -98.493629
},
"RecyclingPlant (San Diego)": {
"input mix (%)": {
"Waste": 100
},
"output (tonne)": {
"Film Bale": {
"Waste": [
[0.98, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.02]
]
},
"Cardboard Bale": {
"Waste": [
[0.0, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.75]
]
}
},
"processing emissions (tonne)": {
"CO2": 5
},
"storage cost ($/tonne)": {
"Waste": 500
},
"storage limit (tonne)": {
"Waste": 5
},
"disposal cost ($/tonne)": {
"Film Bale": -10,
"Cardboard Bale": -10
},
"disposal limit (tonne)": {
"Film Bale": null,
"Cardboard Bale": null
},
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
{
"size (tonne)": 1000,
"opening cost ($)": 2000000,
"fixed operating cost ($)": 500000,
"variable operating cost ($/tonne)": 5
}
],
"initial capacity (tonne)": 0,
"latitude (deg)": 32.715736,
"longitude (deg)": -117.161087
},
"RecyclingPlant (Dallas)": {
"input mix (%)": {
"Waste": 100
},
"output (tonne)": {
"Film Bale": {
"Waste": [
[0.98, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.02]
]
},
"Cardboard Bale": {
"Waste": [
[0.0, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.75]
]
}
},
"processing emissions (tonne)": {
"CO2": 5
},
"storage cost ($/tonne)": {
"Waste": 500
},
"storage limit (tonne)": {
"Waste": 5
},
"disposal cost ($/tonne)": {
"Film Bale": -10,
"Cardboard Bale": -10
},
"disposal limit (tonne)": {
"Film Bale": null,
"Cardboard Bale": null
},
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
{
"size (tonne)": 1000,
"opening cost ($)": 2000000,
"fixed operating cost ($)": 500000,
"variable operating cost ($/tonne)": 5
}
],
"initial capacity (tonne)": 0,
"latitude (deg)": 32.776664,
"longitude (deg)": -96.796988
},
"RecyclingPlant (San Jose)": {
"input mix (%)": {
"Waste": 100
},
"output (tonne)": {
"Film Bale": {
"Waste": [
[0.98, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.02]
]
},
"Cardboard Bale": {
"Waste": [
[0.0, 0.0, 0.0],
[0.0, 0.02, 0.0],
[0.0, 0.0, 0.75]
]
}
},
"processing emissions (tonne)": {
"CO2": 5
},
"storage cost ($/tonne)": {
"Waste": 500
},
"storage limit (tonne)": {
"Waste": 5
},
"disposal cost ($/tonne)": {
"Film Bale": -10,
"Cardboard Bale": -10
},
"disposal limit (tonne)": {
"Film Bale": null,
"Cardboard Bale": null
},
"capacities": [
{
"size (tonne)": 500,
"opening cost ($)": 100000,
"fixed operating cost ($)": 250000,
"variable operating cost ($/tonne)": 5
},
{
"size (tonne)": 1000,
"opening cost ($)": 2000000,
"fixed operating cost ($)": 500000,
"variable operating cost ($/tonne)": 5
}
],
"initial capacity (tonne)": 0,
"latitude (deg)": 37.338208,
"longitude (deg)": -121.886329
}
}
}

42
test/graph_test.jl Normal file
View File

@@ -0,0 +1,42 @@
# Copyright (C) 2020 Argonne National Laboratory
# Written by Alinson Santos Xavier <axavier@anl.gov>
using RELOG
@testset "Graph" begin
@testset "build_graph" begin
basedir = dirname(@__FILE__)
instance = RELOG.parsefile("$basedir/../instances/s1.json")
graph = RELOG.build_graph(instance)
process_node_by_location_name = Dict(n.location.location_name => n
for n in graph.process_nodes)
@test length(graph.plant_shipping_nodes) == 8
@test length(graph.collection_shipping_nodes) == 10
@test length(graph.process_nodes) == 6
node = graph.collection_shipping_nodes[1]
@test node.location.name == "C1"
@test length(node.incoming_arcs) == 0
@test length(node.outgoing_arcs) == 2
@test node.outgoing_arcs[1].source.location.name == "C1"
@test node.outgoing_arcs[1].dest.location.plant_name == "F1"
@test node.outgoing_arcs[1].dest.location.location_name == "L1"
@test node.outgoing_arcs[1].values["distance"] == 1095.62
node = process_node_by_location_name["L1"]
@test node.location.plant_name == "F1"
@test node.location.location_name == "L1"
@test length(node.incoming_arcs) == 10
@test length(node.outgoing_arcs) == 2
node = process_node_by_location_name["L3"]
@test node.location.plant_name == "F2"
@test node.location.location_name == "L3"
@test length(node.incoming_arcs) == 2
@test length(node.outgoing_arcs) == 2
@test length(graph.arcs) == 38
end
end

127
test/instance_test.jl Normal file
View File

@@ -0,0 +1,127 @@
# Copyright (C) 2020 Argonne National Laboratory
# Written by Alinson Santos Xavier <axavier@anl.gov>
using RELOG
@testset "Instance" begin
@testset "load" begin
basedir = dirname(@__FILE__)
instance = RELOG.parsefile("$basedir/../instances/s1.json")
centers = instance.collection_centers
plants = instance.plants
products = instance.products
location_name_to_plant = Dict(p.location_name => p for p in plants)
product_name_to_product = Dict(p.name => p for p in products)
@test length(centers) == 10
@test centers[1].name == "C1"
@test centers[1].latitude == 7
@test centers[1].latitude == 7
@test centers[1].longitude == 7
@test centers[1].amount == [934.56, 934.56]
@test centers[1].product.name == "P1"
@test length(plants) == 6
plant = location_name_to_plant["L1"]
@test plant.plant_name == "F1"
@test plant.location_name == "L1"
@test plant.input.name == "P1"
@test plant.latitude == 0
@test plant.longitude == 0
@test length(plant.sizes) == 2
@test plant.sizes[1].capacity == 250
@test plant.sizes[1].opening_cost == [500, 500]
@test plant.sizes[1].fixed_operating_cost == [30, 30]
@test plant.sizes[1].variable_operating_cost == [30, 30]
@test plant.sizes[2].capacity == 1000
@test plant.sizes[2].opening_cost == [1250, 1250]
@test plant.sizes[2].fixed_operating_cost == [30, 30]
@test plant.sizes[2].variable_operating_cost == [30, 30]
p2 = product_name_to_product["P2"]
p3 = product_name_to_product["P3"]
@test length(plant.output) == 2
@test plant.output[p2] == 0.2
@test plant.output[p3] == 0.5
@test plant.disposal_limit[p2] == [1, 1]
@test plant.disposal_limit[p3] == [1, 1]
@test plant.disposal_cost[p2] == [-10, -10]
@test plant.disposal_cost[p3] == [-10, -10]
plant = location_name_to_plant["L3"]
@test plant.location_name == "L3"
@test plant.input.name == "P2"
@test plant.latitude == 25
@test plant.longitude == 65
@test length(plant.sizes) == 2
@test plant.sizes[1].capacity == 1000.0
@test plant.sizes[1].opening_cost == [3000, 3000]
@test plant.sizes[1].fixed_operating_cost == [50, 50]
@test plant.sizes[1].variable_operating_cost == [50, 50]
@test plant.sizes[1] == plant.sizes[2]
p4 = product_name_to_product["P4"]
@test plant.output[p3] == 0.05
@test plant.output[p4] == 0.8
@test plant.disposal_limit[p3] == [1e8, 1e8]
@test plant.disposal_limit[p4] == [0, 0]
end
@testset "validate timeseries" begin
@test_throws String RELOG.parsefile("fixtures/s1-wrong-length.json")
end
@testset "compress" begin
basedir = dirname(@__FILE__)
instance = RELOG.parsefile("$basedir/../instances/s1.json")
compressed = RELOG._compress(instance)
product_name_to_product = Dict(p.name => p for p in compressed.products)
location_name_to_facility = Dict()
for p in compressed.plants
location_name_to_facility[p.location_name] = p
end
for c in compressed.collection_centers
location_name_to_facility[c.name] = c
end
p1 = product_name_to_product["P1"]
p2 = product_name_to_product["P2"]
p3 = product_name_to_product["P3"]
c1 = location_name_to_facility["C1"]
l1 = location_name_to_facility["L1"]
@test compressed.time == 1
@test compressed.building_period == [1]
@test p1.name == "P1"
@test p1.transportation_cost [0.015]
@test p1.transportation_energy [0.115]
@test p1.transportation_emissions["CO2"] [0.051]
@test p1.transportation_emissions["CH4"] [0.0025]
@test c1.name == "C1"
@test c1.amount [1869.12]
@test l1.plant_name == "F1"
@test l1.location_name == "L1"
@test l1.energy [0.115]
@test l1.emissions["CO2"] [0.051]
@test l1.emissions["CH4"] [0.0025]
@test l1.sizes[1].opening_cost [500]
@test l1.sizes[2].opening_cost [1250]
@test l1.sizes[1].fixed_operating_cost [60]
@test l1.sizes[2].fixed_operating_cost [60]
@test l1.sizes[1].variable_operating_cost [30]
@test l1.sizes[2].variable_operating_cost [30]
@test l1.disposal_limit[p2] [2.0]
@test l1.disposal_limit[p3] [2.0]
@test l1.disposal_cost[p2] [-10.0]
@test l1.disposal_cost[p3] [-10.0]
end
end

100
test/model_test.jl Normal file
View File

@@ -0,0 +1,100 @@
# Copyright (C) 2020 Argonne National Laboratory
# Written by Alinson Santos Xavier <axavier@anl.gov>
using RELOG, Cbc, JuMP, Printf, JSON, MathOptInterface.FileFormats
@testset "Model" begin
@testset "build" begin
basedir = dirname(@__FILE__)
instance = RELOG.parsefile("$basedir/../instances/s1.json")
graph = RELOG.build_graph(instance)
model = RELOG.build_model(instance, graph, Cbc.Optimizer)
set_optimizer_attribute(model.mip, "logLevel", 0)
process_node_by_location_name = Dict(n.location.location_name => n
for n in graph.process_nodes)
shipping_node_by_location_and_product_names = Dict((n.location.location_name, n.product.name) => n
for n in graph.plant_shipping_nodes)
@test length(model.vars.flow) == 76
@test length(model.vars.dispose) == 16
@test length(model.vars.open_plant) == 12
@test length(model.vars.capacity) == 12
@test length(model.vars.expansion) == 12
l1 = process_node_by_location_name["L1"]
v = model.vars.capacity[l1, 1]
@test lower_bound(v) == 0.0
@test upper_bound(v) == 1000.0
v = model.vars.expansion[l1, 1]
@test lower_bound(v) == 0.0
@test upper_bound(v) == 750.0
v = model.vars.dispose[shipping_node_by_location_and_product_names["L1", "P2"], 1]
@test lower_bound(v) == 0.0
@test upper_bound(v) == 1.0
# dest = FileFormats.Model(format = FileFormats.FORMAT_LP)
# MOI.copy_to(dest, model.mip)
# MOI.write_to_file(dest, "model.lp")
end
@testset "solve (exact)" begin
solution_filename_a = tempname()
solution_filename_b = tempname()
solution = RELOG.solve("$(pwd())/../instances/s1.json",
output=solution_filename_a)
@test isfile(solution_filename_a)
RELOG.write(solution, solution_filename_b)
@test isfile(solution_filename_b)
@test "Costs" in keys(solution)
@test "Fixed operating (\$)" in keys(solution["Costs"])
@test "Transportation (\$)" in keys(solution["Costs"])
@test "Variable operating (\$)" in keys(solution["Costs"])
@test "Total (\$)" in keys(solution["Costs"])
@test "Plants" in keys(solution)
@test "F1" in keys(solution["Plants"])
@test "F2" in keys(solution["Plants"])
@test "F3" in keys(solution["Plants"])
@test "F4" in keys(solution["Plants"])
end
@testset "solve (heuristic)" begin
# Should not crash
solution = RELOG.solve("$(pwd())/../instances/s1.json", heuristic=true)
end
@testset "infeasible solve" begin
json = JSON.parsefile("$(pwd())/../instances/s1.json")
for (location_name, location_dict) in json["products"]["P1"]["initial amounts"]
location_dict["amount (tonne)"] *= 1000
end
RELOG.solve(RELOG.parse(json))
end
@testset "storage" begin
basedir = dirname(@__FILE__)
filename = "$basedir/fixtures/storage.json"
instance = RELOG.parsefile(filename)
@test instance.plants[1].storage_limit == 50.0
@test instance.plants[1].storage_cost == [2.0, 1.5, 1.0]
solution = RELOG.solve(filename)
plant_dict = solution["Plants"]["mega plant"]["Chicago"]
@test plant_dict["Variable operating cost (\$)"] == [500.0, 0.0, 100.0]
@test plant_dict["Process (tonne)"] == [50.0, 0.0, 50.0]
@test plant_dict["Storage (tonne)"] == [50.0, 50.0, 0.0]
@test plant_dict["Storage cost (\$)"] == [100.0, 75.0, 0.0]
@test solution["Costs"]["Variable operating (\$)"] == [500.0, 0.0, 100.0]
@test solution["Costs"]["Storage (\$)"] == [100.0, 75.0, 0.0]
@test solution["Costs"]["Total (\$)"] == [600.0, 75.0, 100.0]
end
end

41
test/reports_test.jl Normal file
View File

@@ -0,0 +1,41 @@
# RELOG: Reverse Logistics Optimization
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
# Released under the modified BSD license. See COPYING.md for more details.
using RELOG, JSON, GZip
load_json_gz(filename) = JSON.parse(GZip.gzopen(filename))
# function check(func, expected_csv_filename::String)
# solution = load_json_gz("fixtures/nimh_solution.json.gz")
# actual_csv_filename = tempname()
# func(solution, actual_csv_filename)
# @test isfile(actual_csv_filename)
# if readlines(actual_csv_filename) != readlines(expected_csv_filename)
# out_filename = replace(expected_csv_filename, ".csv" => "_actual.csv")
# @error "$func: Unexpected CSV contents: $out_filename"
# write(out_filename, read(actual_csv_filename))
# @test false
# end
# end
@testset "Reports" begin
# @testset "from fixture" begin
# check(RELOG.write_plants_report, "fixtures/nimh_plants.csv")
# check(RELOG.write_plant_outputs_report, "fixtures/nimh_plant_outputs.csv")
# check(RELOG.write_plant_emissions_report, "fixtures/nimh_plant_emissions.csv")
# check(RELOG.write_transportation_report, "fixtures/nimh_transportation.csv")
# check(RELOG.write_transportation_emissions_report, "fixtures/nimh_transportation_emissions.csv")
# end
@testset "from solve" begin
solution = RELOG.solve("$(pwd())/../instances/s1.json")
tmp_filename = tempname()
# The following should not crash
RELOG.write_plants_report(solution, tmp_filename)
RELOG.write_plant_outputs_report(solution, tmp_filename)
RELOG.write_plant_emissions_report(solution, tmp_filename)
RELOG.write_transportation_report(solution, tmp_filename)
RELOG.write_transportation_emissions_report(solution, tmp_filename)
end
end

11
test/runtests.jl Normal file
View File

@@ -0,0 +1,11 @@
# Copyright (C) 2020 Argonne National Laboratory
# Written by Alinson Santos Xavier <axavier@anl.gov>
using Test
@testset "RELOG" begin
include("instance_test.jl")
include("graph_test.jl")
include("model_test.jl")
include("reports_test.jl")
end

View File

@@ -1,38 +0,0 @@
module RELOGT
using Test
using RELOG
using JuliaFormatter
include("instance/parse_test.jl")
include("model/build_test.jl")
include("model/dist_test.jl")
include("reports_test.jl")
include("../fixtures/boat_example.jl")
basedir = dirname(@__FILE__)
function fixture(path::String)::String
return "$basedir/../fixtures/$path"
end
function runtests()
@testset "RELOG" begin
instance_parse_test_1()
instance_parse_test_2()
model_build_test()
model_dist_test()
report_tests()
end
end
function format()
JuliaFormatter.format(basedir, verbose = true)
JuliaFormatter.format("$basedir/../../src", verbose = true)
JuliaFormatter.format("$basedir/../fixtures", verbose = true)
return
end
export format, runtests
end # module RELOGT

View File

@@ -1,77 +0,0 @@
using RELOG
using Test
using OrderedCollections
function instance_parse_test_1()
instance = RELOG.parsefile(fixture("simple.json"))
# Parameters
@test instance.time_horizon == 4
@test instance.building_period == [1]
@test instance.distance_metric == "driving"
# Products
@test length(instance.products) == 4
p1 = instance.products[1]
@test p1.name == "P1"
@test p1.tr_cost == [0.015, 0.015, 0.015, 0.015]
@test p1.tr_energy == [0.12, 0.12, 0.12, 0.12]
@test p1.tr_emissions ==
Dict("CO2" => [0.052, 0.052, 0.052, 0.052], "CH4" => [0.003, 0.003, 0.003, 0.003])
@test p1.components == ["1", "2"]
@test instance.products_by_name["P1"] === p1
p2 = instance.products[2]
p3 = instance.products[3]
p4 = instance.products[4]
# Centers
@test length(instance.centers) == 3
c1 = instance.centers[1]
@test c1.latitude == 41.881
@test c1.longitude == -87.623
@test c1.input === p1
@test c1.outputs == [p2, p3]
@test c1.fixed_output == Dict(p2 => [100; 50; 0; 0;;], p3 => [20; 10; 0; 0;;])
@test c1.var_output == Dict(p2 => [0.2, 0.25, 0.12], p3 => [0.25, 0.25, 0.25])
@test c1.revenue == [12.0, 12.0, 12.0, 12.0]
@test c1.operating_cost == [150.0, 150.0, 150.0, 150.0]
@test c1.disposal_limit == Dict(p2 => [0, 0, 0, 0], p3 => [Inf, Inf, Inf, Inf])
@test c1.disposal_cost ==
Dict(p2 => [0.23, 0.23, 0.23, 0.23], p3 => [1.0, 1.0, 1.0, 1.0])
c2 = instance.centers[2]
@test c2.input === nothing
@test c2.revenue == [0, 0, 0, 0]
# Plants
@test length(instance.plants) == 1
l1 = instance.plants[1]
@test l1.latitude == 44.881
@test l1.longitude == -87.623
@test l1.input_mix ==
Dict(p1 => [0.953, 0.953, 0.953, 0.953], p2 => [0.047, 0.047, 0.047, 0.047])
@test l1.output == Dict(p3 => [0.25, 0.25, 0.25, 0.25], p4 => [0.12, 0.12, 0.12, 0.12])
@test l1.emissions == Dict("CO2" => [0.1, 0.1, 0.1, 0.1])
@test l1.storage_cost == Dict(p1 => [0.1, 0.1, 0.1, 0.1], p2 => [0.1, 0.1, 0.1, 0.1])
@test l1.storage_limit == Dict(p1 => [100, 100, 100, 100], p2 => [Inf, Inf, Inf, Inf])
@test l1.disposal_cost == Dict(p3 => [0, 0, 0, 0], p4 => [0.86, 0.86, 0.86, 0.86])
@test l1.disposal_limit ==
Dict(p3 => [Inf, Inf, Inf, Inf], p4 => [1000.0, 1000.0, 1000.0, 1000.0])
@test l1.initial_capacity == 0
@test length(l1.capacities) == 2
c1 = l1.capacities[1]
@test c1.size == 100
@test c1.opening_cost == [300, 400, 450, 475]
@test c1.fix_operating_cost == [300, 300, 300, 300]
@test c1.var_operating_cost == [5, 5, 5, 5]
c2 = l1.capacities[2]
@test c2.size == 500
@test c2.opening_cost == [1000, 1000, 1000, 1000]
@test c2.fix_operating_cost == [400, 400, 400, 400]
@test c2.var_operating_cost == [5, 5, 5, 5]
end
function instance_parse_test_2()
# Should not crash
RELOG.parsefile(fixture("boat_example.json"))
end

View File

@@ -1,112 +0,0 @@
using RELOG
using Test
using HiGHS
using JuMP
function model_build_test()
instance = RELOG.parsefile(fixture("simple.json"))
model = RELOG.build_model(instance, optimizer = HiGHS.Optimizer, variable_names = true)
y = model[:y]
z_disp = model[:z_disp]
z_input = model[:z_input]
x = model[:x]
obj = objective_function(model)
@test obj.terms[y["L1", "C3", "P4", 1]] == (
111.118 * 0.015 # transportation
- 12.0 # revenue
)
@test obj.terms[y["C1", "L1", "P2", 4]] == (
333.262 * 0.015 + # transportation
0.25 + # center collection cost
5.0 # plant operating cost
)
@test obj.terms[z_disp["C1", "P2", 1]] == 0.23
@test obj.constant == (
150 * 4 * 3 # center operating cost
)
@test obj.terms[z_disp["L1", "P4", 2]] == 0.86
@test obj.terms[x["L1", 1]] == (
-100.0 + # opening cost
300 # fixed operating cost
)
@test obj.terms[x["L1", 2]] == (
-50.0 + # opening cost
300 # fixed operating cost
)
@test obj.terms[x["L1", 3]] == (
-25.0 + # opening cost
300 # fixed operating cost
)
@test obj.terms[x["L1", 4]] == (
475.0 + # opening cost
300 # fixed operating cost
)
# Plants: Definition of total plant input
@test repr(model[:eq_z_input]["L1", 1]) ==
"eq_z_input[L1,1] : -y[C2,L1,P1,1] - y[C1,L1,P2,1] + z_input[L1,1] = 0"
# Plants: Must meet input mix
@test repr(model[:eq_input_mix]["L1", "P1", 1]) ==
"eq_input_mix[L1,P1,1] : y[C2,L1,P1,1] - 0.953 z_input[L1,1] = 0"
@test repr(model[:eq_input_mix]["L1", "P2", 1]) ==
"eq_input_mix[L1,P2,1] : y[C1,L1,P2,1] - 0.047 z_input[L1,1] = 0"
# Plants: Calculate amount produced
@test repr(model[:eq_z_prod]["L1", "P3", 1]) ==
"eq_z_prod[L1,P3,1] : z_prod[L1,P3,1] - 0.25 z_input[L1,1] = 0"
@test repr(model[:eq_z_prod]["L1", "P4", 1]) ==
"eq_z_prod[L1,P4,1] : z_prod[L1,P4,1] - 0.12 z_input[L1,1] = 0"
# Plants: Produced material must be sent or disposed
@test repr(model[:eq_balance]["L1", "P3", 1]) ==
"eq_balance[L1,P3,1] : z_prod[L1,P3,1] - z_disp[L1,P3,1] = 0"
@test repr(model[:eq_balance]["L1", "P4", 1]) ==
"eq_balance[L1,P4,1] : -y[L1,C3,P4,1] + z_prod[L1,P4,1] - z_disp[L1,P4,1] = 0"
# Plants: Capacity limit
@test repr(model[:eq_capacity]["L1", 1]) ==
"eq_capacity[L1,1] : -100 x[L1,1] + z_input[L1,1] ≤ 0"
# Plants: Disposal limit
@test repr(model[:eq_disposal_limit]["L1", "P4", 1]) ==
"eq_disposal_limit[L1,P4,1] : z_disp[L1,P4,1] ≤ 1000"
@test ("L1", "P3", 1) keys(model[:eq_disposal_limit])
# Plants: Plant remains open
@test repr(model[:eq_keep_open]["L1", 4]) ==
"eq_keep_open[L1,4] : -x[L1,3] + x[L1,4] ≥ 0"
@test repr(model[:eq_keep_open]["L1", 1]) == "eq_keep_open[L1,1] : x[L1,1] ≥ 0"
# Plants: Building period
@test ("L1", 1) keys(model[:eq_building_period])
@test repr(model[:eq_building_period]["L1", 2]) ==
"eq_building_period[L1,2] : -x[L1,1] + x[L1,2] ≤ 0"
# Centers: Definition of total center input
@test repr(model[:eq_z_input]["C1", 1]) ==
"eq_z_input[C1,1] : -y[C2,C1,P1,1] + z_input[C1,1] = 0"
# Centers: Calculate amount collected
@test repr(model[:eq_z_collected]["C1", "P2", 1]) ==
"eq_z_collected[C1,P2,1] : -0.2 z_input[C1,1] + z_collected[C1,P2,1] = 100"
@test repr(model[:eq_z_collected]["C1", "P2", 2]) ==
"eq_z_collected[C1,P2,2] : -0.25 z_input[C1,1] - 0.2 z_input[C1,2] + z_collected[C1,P2,2] = 50"
@test repr(model[:eq_z_collected]["C1", "P2", 3]) ==
"eq_z_collected[C1,P2,3] : -0.12 z_input[C1,1] - 0.25 z_input[C1,2] - 0.2 z_input[C1,3] + z_collected[C1,P2,3] = 0"
@test repr(model[:eq_z_collected]["C1", "P2", 4]) ==
"eq_z_collected[C1,P2,4] : -0.12 z_input[C1,2] - 0.25 z_input[C1,3] - 0.2 z_input[C1,4] + z_collected[C1,P2,4] = 0"
@test repr(model[:eq_z_collected]["C2", "P1", 1]) == "eq_z_collected[C2,P1,1] : z_collected[C2,P1,1] = 55"
# Centers: Collected products must be disposed or sent
@test repr(model[:eq_balance]["C1", "P2", 1]) ==
"eq_balance[C1,P2,1] : -y[C1,L1,P2,1] - z_disp[C1,P2,1] + z_collected[C1,P2,1] = 0"
@test repr(model[:eq_balance]["C1", "P3", 1]) ==
"eq_balance[C1,P3,1] : -z_disp[C1,P3,1] + z_collected[C1,P3,1] = 0"
# Centers: Disposal limit
@test repr(model[:eq_disposal_limit]["C1", "P2", 1]) ==
"eq_disposal_limit[C1,P2,1] : z_disp[C1,P2,1] ≤ 0"
@test ("C1", "P3", 1) keys(model[:eq_disposal_limit])
end

View File

@@ -1,10 +0,0 @@
# RELOG: Reverse Logistics Optimization
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
# Released under the modified BSD license. See COPYING.md for more details.
using RELOG
function model_dist_test()
# Euclidean distance between Chicago and Indianapolis
@test RELOG._calculate_distance(41.866, -87.656, 39.764, -86.148) == 265.818
end

View File

@@ -1,12 +0,0 @@
function report_tests()
# Load and solve the boat example
instance = RELOG.parsefile(fixture("boat_example.json"))
model = RELOG.build_model(instance, optimizer = HiGHS.Optimizer, variable_names = true)
optimize!(model)
write_to_file(model, "tmp/model.lp")
RELOG.write_plants_report(model, "tmp/plants.csv")
RELOG.write_plant_outputs_report(model, "tmp/plant_outputs.csv")
RELOG.write_centers_report(model, "tmp/centers.csv")
RELOG.write_center_outputs_report(model, "tmp/center_outputs.csv")
RELOG.write_transportation_report(model, "tmp/transportation.csv")
end