13 Commits

19 changed files with 1108 additions and 722 deletions

5
.gitignore vendored
View File

@@ -1,7 +1,10 @@
.ipynb* .ipynb*
*.ipynb *.ipynb
instances/Manifest.toml
instances/Project.toml
instances/Makefile instances/Makefile
instances/run.jl instances/*.jl
instances/*.py
notebooks notebooks
.idea .idea
*.lp *.lp

6
CHANGELOG.md Normal file
View File

@@ -0,0 +1,6 @@
# Version 0.3 (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 "output (tonne/tonne)"

View File

@@ -1,11 +1,15 @@
VERSION := 0.3
JULIA := julia --color=yes --project=. JULIA := julia --color=yes --project=.
all: docs all: docs
test:
$(JULIA) -e 'using Pkg; Pkg.test("RELOG")'
docs: docs:
mkdocs build mkdocs build
docs-push: docs-push:
rsync -avP docs/ andromeda:/www/axavier.org/projects/RELOG/ rsync -avP docs/ isoron@axavier.org:/www/axavier.org/projects/RELOG/$(VERSION)/
.PHONY: docs .PHONY: docs test

View File

@@ -1,7 +1,7 @@
name = "RELOG" name = "RELOG"
uuid = "a2afcdf7-cf04-4913-85f9-c0d81ddf2008" uuid = "a2afcdf7-cf04-4913-85f9-c0d81ddf2008"
authors = ["Alinson S Xavier <axavier@anl.gov>"] authors = ["Alinson S Xavier <axavier@anl.gov>"]
version = "0.2.0" version = "0.3.0"
[deps] [deps]
Cbc = "9961bab8-2fa3-5c5a-9d89-47fab24efd76" Cbc = "9961bab8-2fa3-5c5a-9d89-47fab24efd76"

View File

@@ -5,7 +5,7 @@ RELOG: Reverse Logistics Optimization
### Documentation ### Documentation
* [https://axavier.org/projects/RELOG](https://axavier.org/projects/RELOG) * [https://anl-ceeesa.github.io/RELOG/](https://anl-ceeesa.github.io/RELOG/)
### Authors ### Authors

View File

@@ -148,7 +148,7 @@
</ul> </ul>
<h3 id="source-code">Source Code</h3> <h3 id="source-code">Source Code</h3>
<ul> <ul>
<li><a href="https://github.com/iSoron/RELOG">https://github.com/iSoron/RELOG</a></li> <li><a href="https://anl-ceeesa.github.io/RELOG/">https://anl-ceeesa.github.io/RELOG/</a></li>
</ul> </ul>
<h3 id="authors">Authors</h3> <h3 id="authors">Authors</h3>
<ul> <ul>
@@ -276,5 +276,5 @@ POSSIBILITY OF SUCH DAMAGE.
<!-- <!--
MkDocs version : 1.0.4 MkDocs version : 1.0.4
Build Date UTC : 2020-06-05 20:38:00 Build Date UTC : 2020-06-25 20:50:07
--> -->

View File

@@ -154,15 +154,15 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td align="left"><code>Time horizon (years)</code></td> <td align="left"><code>time horizon (years)</code></td>
<td>Number of years in the simulation.</td> <td>Number of years in the simulation.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h3 id="example">Example</h3> <h3 id="example">Example</h3>
<pre><code class="json">{ <pre><code class="json">{
&quot;Parameters&quot;: { &quot;parameters&quot;: {
&quot;Time horizon (years)&quot;: 2 &quot;time horizon (years)&quot;: 2,
} }
} }
</code></pre> </code></pre>
@@ -178,11 +178,19 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td align="left"><code>Transportation cost ($/km/tonne)</code></td> <td align="left"><code>transportation cost ($/km/tonne)</code></td>
<td>The cost to transport this product. Must be a timeseries.</td> <td>The cost to transport this product. Must be a timeseries.</td>
</tr> </tr>
<tr> <tr>
<td align="left"><code>Initial amounts</code></td> <td align="left"><code>transportation energy (J/km/tonne)</code></td>
<td>The energy required to transport this product. Must be a timeseries. Optional.</td>
</tr>
<tr>
<td align="left"><code>transportation emissions (tonne/km/tonne)</code></td>
<td>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 timeseries. Optional.</td>
</tr>
<tr>
<td align="left"><code>initial amounts</code></td>
<td>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 timeseries.</td> <td>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 timeseries.</td>
</tr> </tr>
</tbody> </tbody>
@@ -197,50 +205,55 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td align="left"><code>Latitude (deg)</code></td> <td align="left"><code>latitude (deg)</code></td>
<td>The latitude of the location.</td> <td>The latitude of the location.</td>
</tr> </tr>
<tr> <tr>
<td align="left"><code>Longitude (deg)</code></td> <td align="left"><code>longitude (deg)</code></td>
<td>The longitude of the location.</td> <td>The longitude of the location.</td>
</tr> </tr>
<tr> <tr>
<td align="left"><code>Amount (tonne)</code></td> <td align="left"><code>amount (tonne)</code></td>
<td>The amount of the product initially available at the location. Must be a timeseries.</td> <td>The amount of the product initially available at the location. Must be a timeseries.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h3 id="example_1">Example</h3> <h3 id="example_1">Example</h3>
<pre><code class="json">{ <pre><code class="json">{
&quot;Products&quot;: { &quot;products&quot;: {
&quot;P1&quot;: { &quot;P1&quot;: {
&quot;Transportation cost ($/km/tonne)&quot;: [0.015, 0.015], &quot;initial amounts&quot;: {
&quot;Initial amounts&quot;: {
&quot;C1&quot;: { &quot;C1&quot;: {
&quot;Latitude (deg)&quot;: 7.0, &quot;latitude (deg)&quot;: 7.0,
&quot;Longitude (deg)&quot;: 7.0, &quot;longitude (deg)&quot;: 7.0,
&quot;Amount (tonne)&quot;: [934.56, 934.56] &quot;amount (tonne)&quot;: [934.56, 934.56]
}, },
&quot;C2&quot;: { &quot;C2&quot;: {
&quot;Latitude (deg)&quot;: 7.0, &quot;latitude (deg)&quot;: 7.0,
&quot;Longitude (deg)&quot;: 19.0, &quot;longitude (deg)&quot;: 19.0,
&quot;Amount (tonne)&quot;: [198.95, 198.95] &quot;amount (tonne)&quot;: [198.95, 198.95]
}, },
&quot;C3&quot;: { &quot;C3&quot;: {
&quot;Latitude (deg)&quot;: 84.0, &quot;latitude (deg)&quot;: 84.0,
&quot;Longitude (deg)&quot;: 76.0, &quot;longitude (deg)&quot;: 76.0,
&quot;Amount (tonne)&quot;: [212.97, 212.97] &quot;amount (tonne)&quot;: [212.97, 212.97]
} }
},
&quot;transportation cost ($/km/tonne)&quot;: [0.015, 0.015],
&quot;transportation energy (J/km/tonne)&quot;: [0.12, 0.11],
&quot;transportation emissions (tonne/km/tonne)&quot;: {
&quot;CO2&quot;: [0.052, 0.050],
&quot;CH4&quot;: [0.003, 0.002]
} }
}, },
&quot;P2&quot;: { &quot;P2&quot;: {
&quot;Transportation cost ($/km/tonne)&quot;: [0.02, 0.02] &quot;transportation cost ($/km/tonne)&quot;: [0.022, 0.020]
}, },
&quot;P3&quot;: { &quot;P3&quot;: {
&quot;Transportation cost ($/km/tonne)&quot;: [0.0125, 0.0125] &quot;transportation cost ($/km/tonne)&quot;: [0.0125, 0.0125]
}, },
&quot;P4&quot;: { &quot;P4&quot;: {
&quot;Transportation cost ($/km/tonne)&quot;: [0.0175, 0.0175] &quot;transportation cost ($/km/tonne)&quot;: [0.0175, 0.0175]
} }
} }
} }
@@ -257,15 +270,23 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td align="left"><code>Input</code></td> <td align="left"><code>input</code></td>
<td>The name of the product that this plant takes as input. Only one input is accepted per plant.</td> <td>The name of the product that this plant takes as input. Only one input is accepted per plant.</td>
</tr> </tr>
<tr> <tr>
<td align="left"><code>Outputs (tonne)</code></td> <td align="left"><code>outputs (tonne/tonne)</code></td>
<td>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 <code>{"P2": 0.5, "P3": 0.25}</code>. If the plant does not output anything, this key may be omitted.</td> <td>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 <code>{"P2": 0.5, "P3": 0.25}</code>. If the plant does not output anything, this key may be omitted.</td>
</tr> </tr>
<tr> <tr>
<td align="left"><code>Locations</code></td> <td align="left"><code>energy (GJ/tonne)</code></td>
<td>The energy required to process 1 tonne of the input. Must be a timeseries. Optional.</td>
</tr>
<tr>
<td align="left"><code>emissions (tonne/tonne)</code></td>
<td>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 timeseries. Optional.</td>
</tr>
<tr>
<td align="left"><code>locations</code></td>
<td>A dictionary mapping the name of the location to a dictionary which describes the site characteristics (see below).</td> <td>A dictionary mapping the name of the location to a dictionary which describes the site characteristics (see below).</td>
</tr> </tr>
</tbody> </tbody>
@@ -280,19 +301,19 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td align="left"><code>Latitude (deg)</code></td> <td align="left"><code>latitude (deg)</code></td>
<td>The latitude of the location, in degrees.</td> <td>The latitude of the location, in degrees.</td>
</tr> </tr>
<tr> <tr>
<td align="left"><code>Longitude (deg)</code></td> <td align="left"><code>longitude (deg)</code></td>
<td>The longitude of the location, in degrees.</td> <td>The longitude of the location, in degrees.</td>
</tr> </tr>
<tr> <tr>
<td align="left"><code>Disposal</code></td> <td align="left"><code>disposal</code></td>
<td>A dictionary describing what products can be disposed locally at the plant.</td> <td>A dictionary describing what products can be disposed locally at the plant.</td>
</tr> </tr>
<tr> <tr>
<td align="left"><code>Capacities (tonne)</code></td> <td align="left"><code>capacities (tonne)</code></td>
<td>A dictionary describing what plant sizes are allowed, and their characteristics.</td> <td>A dictionary describing what plant sizes are allowed, and their characteristics.</td>
</tr> </tr>
</tbody> </tbody>
@@ -307,16 +328,16 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td align="left"><code>Cost ($/tonne)</code></td> <td align="left"><code>cost ($/tonne)</code></td>
<td>The cost to dispose of the product. Must be a timeseries.</td> <td>The cost to dispose of the product. Must be a timeseries.</td>
</tr> </tr>
<tr> <tr>
<td align="left"><code>Limit (tonne)</code></td> <td align="left"><code>limit (tonne)</code></td>
<td>The maximum amount that can be disposed of. If an unlimited amount can be disposed, this key may be omitted. Must be a timeseries.</td> <td>The maximum amount that can be disposed of. If an unlimited amount can be disposed, this key may be omitted. Must be a timeseries.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>The keys in the <code>capacities</code> dictionary should be the amounts (in tonnes). The values are dictionaries with the following keys:</p> <p>The keys in the <code>capacities (tonne)</code> dictionary should be the amounts (in tonnes). The values are dictionaries with the following keys:</p>
<table> <table>
<thead> <thead>
<tr> <tr>
@@ -326,48 +347,53 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td align="left"><code>Opening cost ($)</code></td> <td align="left"><code>opening cost ($)</code></td>
<td>The cost to open a plant of this size.</td> <td>The cost to open a plant of this size.</td>
</tr> </tr>
<tr> <tr>
<td align="left"><code>Fixed operating cost ($)</code></td> <td align="left"><code>fixed operating cost ($)</code></td>
<td>The cost to keep the plant open, even if the plant doesn't process anything. Must be a timeseries.</td> <td>The cost to keep the plant open, even if the plant doesn't process anything. Must be a timeseries.</td>
</tr> </tr>
<tr> <tr>
<td align="left"><code>Variable operating cost ($/tonne)</code></td> <td align="left"><code>variable operating cost ($/tonne)</code></td>
<td>The cost that the plant incurs to process each tonne of input. Must be a timeseries.</td> <td>The cost that the plant incurs to process each tonne of input. Must be a timeseries.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h3 id="example_2">Example</h3> <h3 id="example_2">Example</h3>
<pre><code class="json">{ <pre><code class="json">{
&quot;Plants&quot;: { &quot;plants&quot;: {
&quot;F1&quot;: { &quot;F1&quot;: {
&quot;Input&quot;: &quot;P1&quot;, &quot;input&quot;: &quot;P1&quot;,
&quot;Outputs (tonne)&quot;: { &quot;outputs (tonne/tonne)&quot;: {
&quot;P2&quot;: 0.2, &quot;P2&quot;: 0.2,
&quot;P3&quot;: 0.5 &quot;P3&quot;: 0.5
}, },
&quot;Locations&quot;: { &quot;energy (GJ/tonne)&quot;: [0.12, 0.11],
&quot;emissions (tonne/tonne)&quot;: {
&quot;CO2&quot;: [0.052, 0.050],
&quot;CH4&quot;: [0.003, 0.002]
},
&quot;locations&quot;: {
&quot;L1&quot;: { &quot;L1&quot;: {
&quot;Latitude (deg)&quot;: 0.0, &quot;latitude (deg)&quot;: 0.0,
&quot;Longitude (deg)&quot;: 0.0, &quot;longitude (deg)&quot;: 0.0,
&quot;Disposal&quot;: { &quot;disposal&quot;: {
&quot;P2&quot;: { &quot;P2&quot;: {
&quot;Cost ($/tonne)&quot;: [-10.0, -12.0], &quot;cost ($/tonne)&quot;: [-10.0, -12.0],
&quot;Limit (tonne)&quot;: [1.0, 1.0] &quot;limit (tonne)&quot;: [1.0, 1.0]
} }
}, },
&quot;Capacities (tonne)&quot;: { &quot;capacities (tonne)&quot;: {
&quot;100&quot;: { &quot;100&quot;: {
&quot;Opening cost ($)&quot;: [500, 530], &quot;opening cost ($)&quot;: [500, 530],
&quot;Fixed operating cost ($)&quot;: [300.0, 310.0], &quot;fixed operating cost ($)&quot;: [300.0, 310.0],
&quot;Variable operating cost ($/tonne)&quot;: [5.0, 5.2] &quot;variable operating cost ($/tonne)&quot;: [5.0, 5.2]
}, },
&quot;500&quot;: { &quot;500&quot;: {
&quot;Opening cost ($)&quot;: [750, 760], &quot;opening cost ($)&quot;: [750, 760],
&quot;Fixed operating cost ($)&quot;: [400.0, 450.0], &quot;fixed operating cost ($)&quot;: [400.0, 450.0],
&quot;Variable operating cost ($/tonne)&quot;: [5.0, 5.2] &quot;variable operating cost ($/tonne)&quot;: [5.0, 5.2]
} }
} }
} }

File diff suppressed because one or more lines are too long

View File

@@ -2,22 +2,22 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url> <url>
<loc>None</loc> <loc>None</loc>
<lastmod>2020-06-05</lastmod> <lastmod>2020-06-25</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None</loc> <loc>None</loc>
<lastmod>2020-06-05</lastmod> <lastmod>2020-06-25</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None</loc> <loc>None</loc>
<lastmod>2020-06-05</lastmod> <lastmod>2020-06-25</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>None</loc> <loc>None</loc>
<lastmod>2020-06-05</lastmod> <lastmod>2020-06-25</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
</urlset> </urlset>

Binary file not shown.

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,53 +1,50 @@
Welcome to the CBC MILP Solver Gurobi Optimizer version 9.0.0 build v9.0.0rc2 (linux64)
Version: 2.10.3 Optimize a model with 124 rows, 141 columns and 400 nonzeros
Build Date: Oct 7 2019 Model fingerprint: 0x46af87f0
Variable types: 117 continuous, 24 integer (24 binary)
Coefficient statistics:
Matrix range [5e-02, 2e+04]
Objective range [9e-01, 3e+03]
Bounds range [1e+00, 1e+08]
RHS range [3e+01, 2e+04]
Presolve removed 98 rows and 107 columns
Presolve time: 0.00s
Presolved: 26 rows, 34 columns, 74 nonzeros
Variable types: 28 continuous, 6 integer (6 binary)
command line - Cbc_C_Interface -solve -quit (default strategy 1) Root relaxation: objective 1.870636e+06, 10 iterations, 0.00 seconds
Continuous objective value is 1.86768e+06 - 0.00 seconds
Cgl0003I 7 fixed, 0 tightened bounds, 9 strengthened rows, 0 substitutions
Cgl0003I 0 fixed, 0 tightened bounds, 2 strengthened rows, 0 substitutions
Cgl0003I 0 fixed, 0 tightened bounds, 1 strengthened rows, 0 substitutions
Cgl0004I processed model has 35 rows, 55 columns (9 integer (9 of which binary)) and 211 elements
Cbc0012I Integer solution of 1871179 found by DiveCoefficient after 0 iterations and 0 nodes (0.00 seconds)
Cbc0038I Full problem 35 rows 55 columns, reduced to 18 rows 37 columns
Cbc0006I The LP relaxation is infeasible or too expensive
Cbc0013I At root node, 0 cuts changed objective from 1869627.3 to 1871179 in 1 passes
Cbc0014I Cut generator 0 (Probing) - 0 row cuts average 0.0 elements, 1 column cuts (1 active) in 0.000 seconds - new frequency is 1
Cbc0014I Cut generator 1 (Gomory) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0014I Cut generator 2 (Knapsack) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0014I Cut generator 3 (Clique) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0014I Cut generator 4 (MixedIntegerRounding2) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0014I Cut generator 5 (FlowCover) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0014I Cut generator 6 (TwoMirCuts) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0014I Cut generator 7 (ZeroHalf) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.000 seconds - new frequency is -100
Cbc0001I Search completed - best objective 1871178.961662621, took 2 iterations and 0 nodes (0.00 seconds)
Cbc0035I Maximum depth 0, 5 variables fixed on reduced cost
Cuts at root node changed objective from 1.86963e+06 to 1.87118e+06
Probing was tried 1 times and created 1 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
ZeroHalf was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Result - Optimal solution found Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
Objective value: 1871178.96166262 0 0 1870636.06 0 2 - 1870636.06 - - 0s
Enumerated nodes: 0 H 0 0 1871178.9617 1870636.06 0.03% - 0s
Total iterations: 2
Time (CPU seconds): 0.01
Time (Wallclock seconds): 0.01
Total time (CPU seconds): 0.01 (Wallclock seconds): 0.01 Explored 1 nodes (10 simplex iterations) in 0.00 seconds
Thread count was 8 (of 80 available processors)
Coin0506I Presolve 24 (-100) rows, 38 (-103) columns and 164 (-236) elements Solution count 1: 1.87118e+06
Clp0006I 0 Obj 1590708.5 Primal inf 13041.309 (4) Dual inf 429.24088 (24)
Clp0006I 16 Obj 1871179 Optimal solution found (tolerance 1.00e-02)
Clp0000I Optimal - objective value 1871179 Best objective 1.871178961663e+06, best bound 1.870636062997e+06, gap 0.0290%
Coin0511I After Postsolve, objective 1871179, infeasibilities - dual 0 (0), primal 0 (0) Gurobi Optimizer version 9.0.0 build v9.0.0rc2 (linux64)
Clp0032I Optimal objective 1871178.962 - 16 iterations time 0.002, Presolve 0.00 Optimize a model with 124 rows, 141 columns and 400 nonzeros
Model fingerprint: 0x133a97e7
Coefficient statistics:
Matrix range [5e-02, 2e+04]
Objective range [9e-01, 3e+03]
Bounds range [1e+00, 1e+08]
RHS range [3e+01, 2e+04]
Presolve removed 115 rows and 110 columns
Presolve time: 0.00s
Presolved: 9 rows, 31 columns, 94 nonzeros
Iteration Objective Primal Inf. Dual Inf. Time
0 1.0296026e+06 1.950922e+03 0.000000e+00 0s
7 1.8711790e+06 0.000000e+00 0.000000e+00 0s
Solved in 7 iterations and 0.00 seconds
Optimal objective 1.871178962e+06
Reading s1.json... Reading s1.json...
Building graph... Building graph...
Building optimization model... Building optimization model...

View File

@@ -11,7 +11,7 @@
### Source Code ### Source Code
* [https://github.com/iSoron/RELOG](https://github.com/iSoron/RELOG) * [https://anl-ceeesa.github.io/RELOG/](https://anl-ceeesa.github.io/RELOG/)
### Authors ### Authors
* **Alinson S. Xavier,** Argonne National Laboratory <<axavier@anl.gov>> * **Alinson S. Xavier,** Argonne National Laboratory <<axavier@anl.gov>>

View File

@@ -8,14 +8,14 @@ The **parameters** section describes details about the simulation itself.
| Key | Description | Key | Description
|:------------------------|---------------| |:------------------------|---------------|
|`Time horizon (years)` | Number of years in the simulation. |`time horizon (years)` | Number of years in the simulation.
### Example ### Example
```json ```json
{ {
"Parameters": { "parameters": {
"Time horizon (years)": 2 "time horizon (years)": 2,
} }
} }
``` ```
@@ -26,50 +26,57 @@ The **products** section describes all products and subproducts in the simulatio
| Key | Description | Key | Description
|:--------------------------------------|---------------| |:--------------------------------------|---------------|
|`Transportation cost ($/km/tonne)` | The cost to transport this product. Must be a timeseries. |`transportation cost ($/km/tonne)` | The cost to transport this product. Must be a timeseries.
|`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 timeseries. |`transportation energy (J/km/tonne)` | The energy required to transport this product. Must be a timeseries. 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 timeseries. 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 timeseries.
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: 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 | Key | Description
|:------------------------|---------------| |:------------------------|---------------|
| `Latitude (deg)` | The latitude of the location. | `latitude (deg)` | The latitude of the location.
| `Longitude (deg)` | The longitude 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 timeseries. | `amount (tonne)` | The amount of the product initially available at the location. Must be a timeseries.
### Example ### Example
```json ```json
{ {
"Products": { "products": {
"P1": { "P1": {
"Transportation cost ($/km/tonne)": [0.015, 0.015], "initial amounts": {
"Initial amounts": {
"C1": { "C1": {
"Latitude (deg)": 7.0, "latitude (deg)": 7.0,
"Longitude (deg)": 7.0, "longitude (deg)": 7.0,
"Amount (tonne)": [934.56, 934.56] "amount (tonne)": [934.56, 934.56]
}, },
"C2": { "C2": {
"Latitude (deg)": 7.0, "latitude (deg)": 7.0,
"Longitude (deg)": 19.0, "longitude (deg)": 19.0,
"Amount (tonne)": [198.95, 198.95] "amount (tonne)": [198.95, 198.95]
}, },
"C3": { "C3": {
"Latitude (deg)": 84.0, "latitude (deg)": 84.0,
"Longitude (deg)": 76.0, "longitude (deg)": 76.0,
"Amount (tonne)": [212.97, 212.97] "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": { "P2": {
"Transportation cost ($/km/tonne)": [0.02, 0.02] "transportation cost ($/km/tonne)": [0.022, 0.020]
}, },
"P3": { "P3": {
"Transportation cost ($/km/tonne)": [0.0125, 0.0125] "transportation cost ($/km/tonne)": [0.0125, 0.0125]
}, },
"P4": { "P4": {
"Transportation cost ($/km/tonne)": [0.0175, 0.0175] "transportation cost ($/km/tonne)": [0.0175, 0.0175]
} }
} }
} }
@@ -81,66 +88,73 @@ The **plants** section describes the available types of reverse manufacturing pl
| Key | Description | Key | Description
|:------------------------|---------------| |:------------------------|---------------|
| `Input` | The name of the product that this plant takes as input. Only one input is accepted per plant. | `input` | The name of the product that this plant takes as input. Only one input is accepted per plant.
| `Outputs (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. | `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.
| `Locations` | A dictionary mapping the name of the location to a dictionary which describes the site characteristics (see below). |`energy (GJ/tonne)` | The energy required to process 1 tonne of the input. Must be a timeseries. 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 timeseries. 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: 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 | Key | Description
|:------------------------------|---------------| |:------------------------------|---------------|
| `Latitude (deg)` | The latitude of the location, in degrees. | `latitude (deg)` | The latitude of the location, in degrees.
| `Longitude (deg)` | The longitude 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. | `disposal` | A dictionary describing what products can be disposed locally at the plant.
| `Capacities (tonne)` | A dictionary describing what plant sizes are allowed, and their characteristics. | `capacities (tonne)` | A dictionary describing what plant sizes are allowed, and their characteristics.
The keys in the `disposal` dictionary should be the names of the products. The values are dictionaries with the following keys: The keys in the `disposal` dictionary should be the names of the products. The values are dictionaries with the following keys:
| Key | Description | Key | Description
|:------------------------|---------------| |:------------------------|---------------|
| `Cost ($/tonne)` | The cost to dispose of the product. Must be a timeseries. | `cost ($/tonne)` | The cost to dispose of the product. Must be a timeseries.
| `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 timeseries. | `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 timeseries.
The keys in the `capacities` dictionary should be the amounts (in tonnes). The values are dictionaries with the following keys: The keys in the `capacities (tonne)` dictionary should be the amounts (in tonnes). The values are dictionaries with the following keys:
| Key | Description | Key | Description
|:--------------------------------------|---------------| |:--------------------------------------|---------------|
| `Opening cost ($)` | The cost to open a plant of this size. | `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 timeseries. | `fixed operating cost ($)` | The cost to keep the plant open, even if the plant doesn't process anything. Must be a timeseries.
| `Variable operating cost ($/tonne)` | The cost that the plant incurs to process each tonne of input. Must be a timeseries. | `variable operating cost ($/tonne)` | The cost that the plant incurs to process each tonne of input. Must be a timeseries.
### Example ### Example
```json ```json
{ {
"Plants": { "plants": {
"F1": { "F1": {
"Input": "P1", "input": "P1",
"Outputs (tonne)": { "outputs (tonne/tonne)": {
"P2": 0.2, "P2": 0.2,
"P3": 0.5 "P3": 0.5
}, },
"Locations": { "energy (GJ/tonne)": [0.12, 0.11],
"emissions (tonne/tonne)": {
"CO2": [0.052, 0.050],
"CH4": [0.003, 0.002]
},
"locations": {
"L1": { "L1": {
"Latitude (deg)": 0.0, "latitude (deg)": 0.0,
"Longitude (deg)": 0.0, "longitude (deg)": 0.0,
"Disposal": { "disposal": {
"P2": { "P2": {
"Cost ($/tonne)": [-10.0, -12.0], "cost ($/tonne)": [-10.0, -12.0],
"Limit (tonne)": [1.0, 1.0] "limit (tonne)": [1.0, 1.0]
} }
}, },
"Capacities (tonne)": { "capacities (tonne)": {
"100": { "100": {
"Opening cost ($)": [500, 530], "opening cost ($)": [500, 530],
"Fixed operating cost ($)": [300.0, 310.0], "fixed operating cost ($)": [300.0, 310.0],
"Variable operating cost ($/tonne)": [5.0, 5.2] "variable operating cost ($/tonne)": [5.0, 5.2]
}, },
"500": { "500": {
"Opening cost ($)": [750, 760], "opening cost ($)": [750, 760],
"Fixed operating cost ($)": [400.0, 450.0], "fixed operating cost ($)": [400.0, 450.0],
"Variable operating cost ($/tonne)": [5.0, 5.2] "variable operating cost ($/tonne)": [5.0, 5.2]
} }
} }
} }

View File

@@ -8,6 +8,8 @@ using JSON, JSONSchema
mutable struct Product mutable struct Product
name::String name::String
transportation_cost::Array{Float64} transportation_cost::Array{Float64}
transportation_energy::Array{Float64}
transportation_emissions::Dict{String, Array{Float64}}
end end
@@ -40,6 +42,8 @@ mutable struct Plant
disposal_limit::Dict{Product, Array{Float64}} disposal_limit::Dict{Product, Array{Float64}}
disposal_cost::Dict{Product, Array{Float64}} disposal_cost::Dict{Product, Array{Float64}}
sizes::Array{PlantSize} sizes::Array{PlantSize}
energy::Array{Float64}
emissions::Dict{String, Array{Float64}}
end end
@@ -70,67 +74,90 @@ function load(path::String)::Instance
throw(msg) throw(msg)
end end
T = json["Parameters"]["Time horizon (years)"] T = json["parameters"]["time horizon (years)"]
plants = Plant[] plants = Plant[]
products = Product[] products = Product[]
collection_centers = CollectionCenter[] collection_centers = CollectionCenter[]
prod_name_to_product = Dict{String, Product}() prod_name_to_product = Dict{String, Product}()
# Create products # Create products
for (product_name, product_dict) in json["Products"] for (product_name, product_dict) in json["products"]
product = Product(product_name, product_dict["Transportation cost (\$/km/tonne)"]) 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) push!(products, product)
prod_name_to_product[product_name] = product prod_name_to_product[product_name] = product
# Create collection centers # Create collection centers
if "Initial amounts" in keys(product_dict) if "initial amounts" in keys(product_dict)
for (center_name, center_dict) in product_dict["Initial amounts"] for (center_name, center_dict) in product_dict["initial amounts"]
center = CollectionCenter(length(collection_centers) + 1, center = CollectionCenter(length(collection_centers) + 1,
center_name, center_name,
center_dict["Latitude (deg)"], center_dict["latitude (deg)"],
center_dict["Longitude (deg)"], center_dict["longitude (deg)"],
product, product,
center_dict["Amount (tonne)"]) center_dict["amount (tonne)"])
push!(collection_centers, center) push!(collection_centers, center)
end end
end end
end end
# Create plants # Create plants
for (plant_name, plant_dict) in json["Plants"] for (plant_name, plant_dict) in json["plants"]
input = prod_name_to_product[plant_dict["Input"]] input = prod_name_to_product[plant_dict["input"]]
output = Dict() output = Dict()
# Plant outputs # Plant outputs
if "Outputs (tonne)" in keys(plant_dict) if "outputs (tonne/tonne)" in keys(plant_dict)
output = Dict(prod_name_to_product[key] => value output = Dict(prod_name_to_product[key] => value
for (key, value) in plant_dict["Outputs (tonne)"] for (key, value) in plant_dict["outputs (tonne/tonne)"]
if value > 0) if value > 0)
end end
for (location_name, location_dict) in plant_dict["Locations"] 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[] sizes = PlantSize[]
disposal_limit = Dict(p => [0.0 for t in 1:T] for p in keys(output)) 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_cost = Dict(p => [0.0 for t in 1:T] for p in keys(output))
# Disposal # Disposal
if "Disposal" in keys(location_dict) if "disposal" in keys(location_dict)
for (product_name, disposal_dict) in location_dict["Disposal"] for (product_name, disposal_dict) in location_dict["disposal"]
limit = [1e8 for t in 1:T] limit = [1e8 for t in 1:T]
if "Limit (tonne)" in keys(disposal_dict) if "limit (tonne)" in keys(disposal_dict)
limit = disposal_dict["Limit (tonne)"] limit = disposal_dict["limit (tonne)"]
end end
disposal_limit[prod_name_to_product[product_name]] = limit disposal_limit[prod_name_to_product[product_name]] = limit
disposal_cost[prod_name_to_product[product_name]] = disposal_dict["Cost (\$/tonne)"] disposal_cost[prod_name_to_product[product_name]] = disposal_dict["cost (\$/tonne)"]
end end
end end
# Capacities # Capacities
for (capacity_name, capacity_dict) in location_dict["Capacities (tonne)"] for (capacity_name, capacity_dict) in location_dict["capacities (tonne)"]
push!(sizes, PlantSize(parse(Float64, capacity_name), push!(sizes, PlantSize(parse(Float64, capacity_name),
capacity_dict["Variable operating cost (\$/tonne)"], capacity_dict["variable operating cost (\$/tonne)"],
capacity_dict["Fixed operating cost (\$)"], capacity_dict["fixed operating cost (\$)"],
capacity_dict["Opening cost (\$)"])) capacity_dict["opening cost (\$)"]))
end end
length(sizes) > 1 || push!(sizes, sizes[1]) length(sizes) > 1 || push!(sizes, sizes[1])
sort!(sizes, by = x -> x.capacity) sort!(sizes, by = x -> x.capacity)
@@ -148,11 +175,13 @@ function load(path::String)::Instance
location_name, location_name,
input, input,
output, output,
location_dict["Latitude (deg)"], location_dict["latitude (deg)"],
location_dict["Longitude (deg)"], location_dict["longitude (deg)"],
disposal_limit, disposal_limit,
disposal_cost, disposal_cost,
sizes) sizes,
energy,
emissions)
push!(plants, plant) push!(plants, plant)
end end

View File

@@ -20,7 +20,6 @@ function build_model(instance::Instance, graph::Graph, optimizer)::Manufacturing
create_objective_function!(model) create_objective_function!(model)
create_shipping_node_constraints!(model) create_shipping_node_constraints!(model)
create_process_node_constraints!(model) create_process_node_constraints!(model)
JuMP.write_to_file(model.mip, "model.lp")
return model return model
end end
@@ -194,7 +193,7 @@ function create_process_node_constraints!(model::ManufacturingModel)
end end
end end
function solve(filename::String; optimizer=Cbc.Optimizer, lp_optimizer=Clp.Optimizer) function solve(filename::String; milp_optimizer=Cbc.Optimizer, lp_optimizer=Clp.Optimizer)
println("Reading $filename...") println("Reading $filename...")
instance = RELOG.load(filename) instance = RELOG.load(filename)
@@ -202,7 +201,7 @@ function solve(filename::String; optimizer=Cbc.Optimizer, lp_optimizer=Clp.Optim
graph = RELOG.build_graph(instance) graph = RELOG.build_graph(instance)
println("Building optimization model...") println("Building optimization model...")
model = RELOG.build_model(instance, graph, optimizer) model = RELOG.build_model(instance, graph, milp_optimizer)
println("Optimizing MILP...") println("Optimizing MILP...")
JuMP.optimize!(model.mip) JuMP.optimize!(model.mip)
@@ -238,7 +237,15 @@ function get_solution(model::ManufacturingModel)
"Disposal (\$)" => zeros(T), "Disposal (\$)" => zeros(T),
"Expansion (\$)" => zeros(T), "Expansion (\$)" => zeros(T),
"Total (\$)" => zeros(T), "Total (\$)" => zeros(T),
) ),
"Energy" => Dict(
"Plants (GJ)" => zeros(T),
"Transportation (GJ)" => zeros(T),
),
"Emissions" => Dict(
"Plants (tonne)" => Dict(),
"Transportation (tonne)" => Dict(),
),
) )
plant_to_process_node = Dict(n.location => n for n in graph.process_nodes) plant_to_process_node = Dict(n.location => n for n in graph.process_nodes)
@@ -310,13 +317,19 @@ function get_solution(model::ManufacturingModel)
"Distance (km)" => a.values["distance"], "Distance (km)" => a.values["distance"],
"Latitude (deg)" => a.source.location.latitude, "Latitude (deg)" => a.source.location.latitude,
"Longitude (deg)" => a.source.location.longitude, "Longitude (deg)" => a.source.location.longitude,
"Transportation cost (\$)" => [a.source.product.transportation_cost[t] * "Transportation cost (\$)" => a.source.product.transportation_cost .* vals .* a.values["distance"],
vals[t] * "Variable operating cost (\$)" => plant.sizes[1].variable_operating_cost .* vals,
a.values["distance"] "Transportation energy (J)" => vals .* a.values["distance"] .* a.source.product.transportation_energy,
for t in 1:T], "Emissions (tonne)" => Dict(),
"Variable operating cost (\$)" => [plant.sizes[1].variable_operating_cost[t] * vals[t]
for t in 1:T],
) )
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)"]
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 if a.source.location isa CollectionCenter
plant_name = "Origin" plant_name = "Origin"
location_name = a.source.location.name location_name = a.source.location.name
@@ -332,6 +345,20 @@ function get_solution(model::ManufacturingModel)
plant_dict["Total input (tonne)"] += vals plant_dict["Total input (tonne)"] += vals
output["Costs"]["Transportation (\$)"] += dict["Transportation cost (\$)"] output["Costs"]["Transportation (\$)"] += dict["Transportation cost (\$)"]
output["Costs"]["Variable operating (\$)"] += dict["Variable operating cost (\$)"] output["Costs"]["Variable operating (\$)"] += dict["Variable operating cost (\$)"]
output["Energy"]["Transportation (GJ)"] += dict["Transportation energy (J)"] / 1e6
end
plant_dict["Energy (GJ)"] = plant_dict["Total input (tonne)"] .* plant.energy
output["Energy"]["Plants (GJ)"] += plant_dict["Energy (GJ)"]
plant_dict["Emissions (tonne)"] = Dict()
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 end
# Outputs # Outputs
@@ -344,7 +371,8 @@ function get_solution(model::ManufacturingModel)
if sum(disposal_amount) > 1e-5 if sum(disposal_amount) > 1e-5
skip_plant = false skip_plant = false
plant_dict["Output"]["Dispose"][product_name] = disposal_dict = Dict() plant_dict["Output"]["Dispose"][product_name] = disposal_dict = Dict()
disposal_dict["Amount (tonne)"] = [JuMP.value(model.vars.dispose[shipping_node, t]) for t in 1:T] 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] * disposal_dict["Cost (\$)"] = [disposal_dict["Amount (tonne)"][t] *
plant.disposal_cost[shipping_node.product][t] plant.disposal_cost[shipping_node.product][t]
for t in 1:T] for t in 1:T]

View File

@@ -12,10 +12,10 @@
"Parameters": { "Parameters": {
"type": "object", "type": "object",
"properties": { "properties": {
"Time horizon (years)": { "type": "number" } "time horizon (years)": { "type": "number" }
}, },
"required": [ "required": [
"Time horizon (years)" "time horizon (years)"
] ]
}, },
"Plant": { "Plant": {
@@ -23,16 +23,21 @@
"additionalProperties": { "additionalProperties": {
"type": "object", "type": "object",
"properties": { "properties": {
"Input": { "type": "string" }, "input": { "type": "string" },
"Outputs (tonne)": { "outputs (tonne/tonne)": {
"type": "object", "type": "object",
"additionalProperties": { "type": "number" } "additionalProperties": { "type": "number" }
}, },
"Locations": { "$ref": "#/definitions/PlantLocation" } "energy (GJ/tonne)": { "$ref": "#/definitions/TimeSeries" },
"emissions (tonne/tonne)": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/TimeSeries" }
},
"locations": { "$ref": "#/definitions/PlantLocation" }
}, },
"required": [ "required": [
"Input", "input",
"Locations" "locations"
] ]
} }
}, },
@@ -41,42 +46,42 @@
"additionalProperties": { "additionalProperties": {
"type": "object", "type": "object",
"properties": { "properties": {
"Latitude (deg)": { "type": "number" }, "latitude (deg)": { "type": "number" },
"Longitude (deg)": { "type": "number" }, "longitude (deg)": { "type": "number" },
"Disposal": { "disposal": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"type": "object", "type": "object",
"properties": { "properties": {
"Cost ($/tonne)": { "$ref": "#/definitions/TimeSeries" }, "cost ($/tonne)": { "$ref": "#/definitions/TimeSeries" },
"Limit (tonne)": { "$ref": "#/definitions/TimeSeries" } "limit (tonne)": { "$ref": "#/definitions/TimeSeries" }
}, },
"required": [ "required": [
"Cost ($/tonne)" "cost ($/tonne)"
] ]
} }
}, },
"Capacities (tonne)": { "capacities (tonne)": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"type": "object", "type": "object",
"properties": { "properties": {
"Variable operating cost ($/tonne)": { "$ref": "#/definitions/TimeSeries" }, "variable operating cost ($/tonne)": { "$ref": "#/definitions/TimeSeries" },
"Fixed operating cost ($)": { "$ref": "#/definitions/TimeSeries" }, "fixed operating cost ($)": { "$ref": "#/definitions/TimeSeries" },
"Opening cost ($)": { "$ref": "#/definitions/TimeSeries" } "opening cost ($)": { "$ref": "#/definitions/TimeSeries" }
}, },
"required": [ "required": [
"Variable operating cost ($/tonne)", "variable operating cost ($/tonne)",
"Fixed operating cost ($)", "fixed operating cost ($)",
"Opening cost ($)" "opening cost ($)"
] ]
} }
} }
}, },
"required": [ "required": [
"Latitude (deg)", "latitude (deg)",
"Longitude (deg)", "longitude (deg)",
"Capacities (tonne)" "capacities (tonne)"
] ]
} }
}, },
@@ -85,14 +90,14 @@
"additionalProperties": { "additionalProperties": {
"type": "object", "type": "object",
"properties": { "properties": {
"Latitude (deg)": { "type": "number" }, "latitude (deg)": { "type": "number" },
"Longitude (deg)": { "type": "number" }, "longitude (deg)": { "type": "number" },
"Amount (tonne)": { "$ref": "#/definitions/TimeSeries" } "amount (tonne)": { "$ref": "#/definitions/TimeSeries" }
}, },
"required": [ "required": [
"Latitude (deg)", "latitude (deg)",
"Longitude (deg)", "longitude (deg)",
"Amount (tonne)" "amount (tonne)"
] ]
} }
}, },
@@ -101,24 +106,29 @@
"additionalProperties": { "additionalProperties": {
"type": "object", "type": "object",
"properties": { "properties": {
"Transportation cost ($/km/tonne)": { "$ref": "#/definitions/TimeSeries" }, "transportation cost ($/km/tonne)": { "$ref": "#/definitions/TimeSeries" },
"Initial amounts": { "$ref": "#/definitions/InitialAmount" } "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": [ "required": [
"Transportation cost ($/km/tonne)" "transportation cost ($/km/tonne)"
] ]
} }
} }
}, },
"type": "object", "type": "object",
"properties": { "properties": {
"Parameters": { "$ref": "#/definitions/Parameters" }, "parameters": { "$ref": "#/definitions/Parameters" },
"Plants": { "$ref": "#/definitions/Plant" }, "plants": { "$ref": "#/definitions/Plant" },
"Products": { "$ref": "#/definitions/Product" } "products": { "$ref": "#/definitions/Product" }
}, },
"required": [ "required": [
"Parameters", "parameters",
"Plants", "plants",
"Products" "products"
] ]
} }

View File

@@ -36,9 +36,9 @@ using RELOG, Cbc, JuMP, Printf, JSON, MathOptInterface.FileFormats
@test lower_bound(v) == 0.0 @test lower_bound(v) == 0.0
@test upper_bound(v) == 1.0 @test upper_bound(v) == 1.0
dest = FileFormats.Model(format = FileFormats.FORMAT_LP) #dest = FileFormats.Model(format = FileFormats.FORMAT_LP)
MOI.copy_to(dest, model.mip) #MOI.copy_to(dest, model.mip)
MOI.write_to_file(dest, "model.lp") #MOI.write_to_file(dest, "model.lp")
end end
@testset "solve" begin @testset "solve" begin