mirror of
https://github.com/ANL-CEEESA/RELOG.git
synced 2025-12-05 23:38:52 -06:00
Debug model; improve reports
This commit is contained in:
93
test/fixtures/boat_example.ipynb
vendored
93
test/fixtures/boat_example.ipynb
vendored
@@ -2,59 +2,33 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 67,
|
||||
"execution_count": 115,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
"# cities_a = {\n",
|
||||
"# \"Chicago\": [41.881832, -87.623177],\n",
|
||||
"# \"New York City\": [40.712776, -74.005974],\n",
|
||||
"# \"Los Angeles\": [34.052235, -118.243683],\n",
|
||||
"# \"Houston\": [29.760427, -95.369804],\n",
|
||||
"# \"Phoenix\": [33.448376, -112.074036],\n",
|
||||
"# \"Philadelphia\": [39.952583, -75.165222],\n",
|
||||
"# \"San Antonio\": [29.424122, -98.493629],\n",
|
||||
"# \"San Diego\": [32.715736, -117.161087],\n",
|
||||
"# \"Dallas\": [32.776664, -96.796988],\n",
|
||||
"# \"San Jose\": [37.338208, -121.886329],\n",
|
||||
"# \"Austin\": [30.267153, -97.743061],\n",
|
||||
"# \"Jacksonville\": [30.332184, -81.655651],\n",
|
||||
"# \"Fort Worth\": [32.755488, -97.330766],\n",
|
||||
"# \"Columbus\": [39.961176, -82.998794],\n",
|
||||
"# \"Charlotte\": [35.227087, -80.843127],\n",
|
||||
"# \"Indianapolis\": [39.768403, -86.158068],\n",
|
||||
"# \"San Francisco\": [37.774929, -122.419416],\n",
|
||||
"# \"Seattle\": [47.606209, -122.332071],\n",
|
||||
"# \"Denver\": [39.739236, -104.990251],\n",
|
||||
"# \"Washington D.C.\": [38.907192, -77.036871],\n",
|
||||
"# \"Nashville\": [36.162664, -86.781602],\n",
|
||||
"# \"Detroit\": [42.331427, -83.045754],\n",
|
||||
"# \"Oklahoma City\": [35.467560, -97.516428],\n",
|
||||
"# \"Portland\": [45.505106, -122.675026],\n",
|
||||
"# \"Las Vegas\": [36.169941, -115.139830],\n",
|
||||
"# }\n",
|
||||
"\n",
|
||||
"# cities_b = {\n",
|
||||
"# \"Chicago\": [41.881832, -87.623177],\n",
|
||||
"# \"Phoenix\": [33.448376, -112.074036],\n",
|
||||
"# \"Dallas\": [32.776664, -96.796988],\n",
|
||||
"# \"San Jose\": [37.338208, -121.886329],\n",
|
||||
"# \"Seattle\": [47.606209, -122.332071],\n",
|
||||
"# \"Las Vegas\": [36.169941, -115.139830],\n",
|
||||
"# }\n",
|
||||
"\n",
|
||||
"cities_a = {\n",
|
||||
" \"Chicago\": [41.881832, -87.623177],\n",
|
||||
" \"New York City\": [40.712776, -74.005974],\n",
|
||||
" \"Los Angeles\": [34.052235, -118.243683],\n",
|
||||
" \"Houston\": [29.760427, -95.369804],\n",
|
||||
" \"Phoenix\": [33.448376, -112.074036],\n",
|
||||
" \"Philadelphia\": [39.952583, -75.165222],\n",
|
||||
" \"San Antonio\": [29.424122, -98.493629],\n",
|
||||
" \"San Diego\": [32.715736, -117.161087],\n",
|
||||
" \"Dallas\": [32.776664, -96.796988],\n",
|
||||
" \"San Jose\": [37.338208, -121.886329],\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"cities_b = {\n",
|
||||
" \"Chicago\": [41.881832, -87.623177],\n",
|
||||
" \"Phoenix\": [33.448376, -112.074036],\n",
|
||||
" \"Dallas\": [32.776664, -96.796988],\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"parameters = {\n",
|
||||
" \"time horizon (years)\": 1,\n",
|
||||
" \"time horizon (years)\": 5,\n",
|
||||
" \"building period (years)\": [1],\n",
|
||||
" \"distance metric\": \"Euclidean\",\n",
|
||||
"}\n",
|
||||
@@ -67,7 +41,7 @@
|
||||
" \"revenue ($/tonne)\": None,\n",
|
||||
" \"collection cost ($/tonne)\": {\"Nail\": 1000},\n",
|
||||
" \"operating cost ($)\": 0,\n",
|
||||
" \"disposal limit (tonne)\": {\"Nail\": 0},\n",
|
||||
" \"disposal limit (tonne)\": {\"Nail\": None},\n",
|
||||
" \"disposal cost ($/tonne)\": {\"Nail\": 0},\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
@@ -79,7 +53,7 @@
|
||||
" \"revenue ($/tonne)\": None,\n",
|
||||
" \"collection cost ($/tonne)\": {\"Wood\": 250},\n",
|
||||
" \"operating cost ($)\": 0,\n",
|
||||
" \"disposal limit (tonne)\": {\"Wood\": 0},\n",
|
||||
" \"disposal limit (tonne)\": {\"Wood\": None},\n",
|
||||
" \"disposal cost ($/tonne)\": {\"Wood\": 0},\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
@@ -88,10 +62,10 @@
|
||||
" \"outputs\": [\"UsedBoat\"],\n",
|
||||
" \"fixed output (tonne)\": {\"UsedBoat\": 0},\n",
|
||||
" \"variable output (tonne/tonne)\": {\"UsedBoat\": [0.10, 0.25, 0.10]},\n",
|
||||
" \"revenue ($/tonne)\": 300_000,\n",
|
||||
" \"revenue ($/tonne)\": 12_000,\n",
|
||||
" \"collection cost ($/tonne)\": {\"UsedBoat\": 100},\n",
|
||||
" \"operating cost ($)\": 125_000,\n",
|
||||
" \"disposal limit (tonne)\": {\"UsedBoat\": 0},\n",
|
||||
" \"disposal limit (tonne)\": {\"UsedBoat\": None},\n",
|
||||
" \"disposal cost ($/tonne)\": {\"UsedBoat\": 0},\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
@@ -123,15 +97,15 @@
|
||||
" },\n",
|
||||
" \"capacities\": [\n",
|
||||
" {\n",
|
||||
" \"size (tonne)\": 200,\n",
|
||||
" \"opening cost ($)\": 10_000,\n",
|
||||
" \"fixed operating cost ($)\": 1_000,\n",
|
||||
" \"size (tonne)\": 500,\n",
|
||||
" \"opening cost ($)\": 1_000_000,\n",
|
||||
" \"fixed operating cost ($)\": 250_000,\n",
|
||||
" \"variable operating cost ($/tonne)\": 5,\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"size (tonne)\": 500,\n",
|
||||
" \"opening cost ($)\": 20_000,\n",
|
||||
" \"fixed operating cost ($)\": 2_000,\n",
|
||||
" \"size (tonne)\": 1000,\n",
|
||||
" \"opening cost ($)\": 2_000_000,\n",
|
||||
" \"fixed operating cost ($)\": 500_000,\n",
|
||||
" \"variable operating cost ($/tonne)\": 5,\n",
|
||||
" },\n",
|
||||
" ],\n",
|
||||
@@ -155,16 +129,15 @@
|
||||
" \"disposal limit (tonne)\": {\"Nail\": 0, \"Wood\": 0},\n",
|
||||
" \"capacities\": [\n",
|
||||
" {\n",
|
||||
" \"size (tonne)\": 50,\n",
|
||||
" \"opening cost ($)\": 5_000,\n",
|
||||
" \"fixed operating cost ($)\": 500,\n",
|
||||
" \"size (tonne)\": 500,\n",
|
||||
" \"opening cost ($)\": 500_000,\n",
|
||||
" \"fixed operating cost ($)\": 125_000,\n",
|
||||
" \"variable operating cost ($/tonne)\": 2.5,\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" \"size (tonne)\": 500,\n",
|
||||
" \"opening cost ($)\": 10_000,\n",
|
||||
" \n",
|
||||
" \"fixed operating cost ($)\": 1_000,\n",
|
||||
" \"size (tonne)\": 1000,\n",
|
||||
" \"opening cost ($)\": 1_000_000,\n",
|
||||
" \"fixed operating cost ($)\": 250_000,\n",
|
||||
" \"variable operating cost ($/tonne)\": 2.5,\n",
|
||||
" },\n",
|
||||
" ],\n",
|
||||
@@ -174,7 +147,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 68,
|
||||
"execution_count": 116,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -200,7 +173,8 @@
|
||||
" \"longitude (deg)\": city_location[1],\n",
|
||||
" }\n",
|
||||
" for (city_name, city_location) in cities_b.items()\n",
|
||||
" } | {\n",
|
||||
" }\n",
|
||||
" | {\n",
|
||||
" f\"Retail ({city_name})\": {\n",
|
||||
" **retail,\n",
|
||||
" \"latitude (deg)\": city_location[0],\n",
|
||||
@@ -217,7 +191,8 @@
|
||||
" \"longitude (deg)\": city_location[1],\n",
|
||||
" }\n",
|
||||
" for (city_name, city_location) in cities_a.items()\n",
|
||||
" } | {\n",
|
||||
" }\n",
|
||||
" | {\n",
|
||||
" f\"RecyclingPlant ({city_name})\": {\n",
|
||||
" **recycling_plant,\n",
|
||||
" \"latitude (deg)\": city_location[0],\n",
|
||||
|
||||
1169
test/fixtures/boat_example.json
vendored
1169
test/fixtures/boat_example.json
vendored
File diff suppressed because it is too large
Load Diff
@@ -14,11 +14,11 @@ function model_build_test()
|
||||
# print(model)
|
||||
|
||||
@test obj.terms[y["L1", "C3", "P4", 1]] == (
|
||||
111.118 + # transportation
|
||||
12.0 # revenue
|
||||
111.118 * 0.015 # transportation
|
||||
- 12.0 # revenue
|
||||
)
|
||||
@test obj.terms[y["C1", "L1", "P2", 4]] == (
|
||||
333.262 + # transportation
|
||||
333.262 * 0.015 + # transportation
|
||||
0.25 + # center collection cost
|
||||
5.0 # plant operating cost
|
||||
)
|
||||
@@ -83,7 +83,7 @@ function model_build_test()
|
||||
# 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,2] = 0"
|
||||
"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]) ==
|
||||
|
||||
Reference in New Issue
Block a user