You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RELOG/test/fixtures/boat_example.ipynb

239 lines
7.9 KiB

{
"cells": [
{
"cell_type": "code",
"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",
"}\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)\": 5,\n",
" \"building period (years)\": [1],\n",
" \"distance metric\": \"Euclidean\",\n",
"}\n",
"\n",
"nail_factory = {\n",
" \"input\": None,\n",
" \"outputs\": [\"Nail\"],\n",
" \"fixed output (tonne)\": {\"Nail\": 5},\n",
" \"variable output (tonne/tonne)\": {\"Nail\": 0},\n",
" \"revenue ($/tonne)\": None,\n",
" \"collection cost ($/tonne)\": {\"Nail\": 1000},\n",
" \"operating cost ($)\": 0,\n",
" \"disposal limit (tonne)\": {\"Nail\": None},\n",
" \"disposal cost ($/tonne)\": {\"Nail\": 0},\n",
"}\n",
"\n",
"forest = {\n",
" \"input\": None,\n",
" \"outputs\": [\"Wood\"],\n",
" \"fixed output (tonne)\": {\"Wood\": 95},\n",
" \"variable output (tonne/tonne)\": {\"Wood\": 0},\n",
" \"revenue ($/tonne)\": None,\n",
" \"collection cost ($/tonne)\": {\"Wood\": 250},\n",
" \"operating cost ($)\": 0,\n",
" \"disposal limit (tonne)\": {\"Wood\": None},\n",
" \"disposal cost ($/tonne)\": {\"Wood\": 0},\n",
"}\n",
"\n",
"retail = {\n",
" \"input\": \"NewBoat\",\n",
" \"outputs\": [\"UsedBoat\"],\n",
" \"fixed output (tonne)\": {\"UsedBoat\": 0},\n",
" \"variable output (tonne/tonne)\": {\"UsedBoat\": [0.10, 0.25, 0.10]},\n",
" \"revenue ($/tonne)\": 12_000,\n",
" \"collection cost ($/tonne)\": {\"UsedBoat\": 100},\n",
" \"operating cost ($)\": 125_000,\n",
" \"disposal limit (tonne)\": {\"UsedBoat\": None},\n",
" \"disposal cost ($/tonne)\": {\"UsedBoat\": 0},\n",
"}\n",
"\n",
"prod = {\n",
" \"transportation cost ($/km/tonne)\": 0.30,\n",
" \"transportation energy (J/km/tonne)\": 7_500,\n",
" \"transportation emissions (tonne/km/tonne)\": {\n",
" \"CO2\": 2.68,\n",
" },\n",
"}\n",
"\n",
"boat_factory = {\n",
" \"input mix (%)\": {\n",
" \"Wood\": 95,\n",
" \"Nail\": 5,\n",
" },\n",
" \"output (tonne)\": {\"NewBoat\": 1.0},\n",
" \"processing emissions (tonne)\": {\"CO2\": 5},\n",
" \"storage cost ($/tonne)\": {\n",
" \"Wood\": 500,\n",
" \"Nail\": 200,\n",
" },\n",
" \"storage limit (tonne)\": {\"Wood\": 5, \"Nail\": 1},\n",
" \"disposal cost ($/tonne)\": {\n",
" \"NewBoat\": 0,\n",
" },\n",
" \"disposal limit (tonne)\": {\n",
" \"NewBoat\": 0,\n",
" },\n",
" \"capacities\": [\n",
" {\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)\": 1000,\n",
" \"opening cost ($)\": 2_000_000,\n",
" \"fixed operating cost ($)\": 500_000,\n",
" \"variable operating cost ($/tonne)\": 5,\n",
" },\n",
" ],\n",
" \"initial capacity (tonne)\": 0,\n",
"}\n",
"\n",
"recycling_plant = {\n",
" \"input mix (%)\": {\n",
" \"UsedBoat\": 100,\n",
" },\n",
" \"output (tonne)\": {\"Nail\": 0.025, \"Wood\": 0.475},\n",
" \"processing emissions (tonne)\": {\"CO2\": 5},\n",
" \"storage cost ($/tonne)\": {\n",
" \"UsedBoat\": 0,\n",
" },\n",
" \"storage limit (tonne)\": {\"UsedBoat\": 0},\n",
" \"disposal cost ($/tonne)\": {\n",
" \"Nail\": 0,\n",
" \"Wood\": 0,\n",
" },\n",
" \"disposal limit (tonne)\": {\"Nail\": 0, \"Wood\": 0},\n",
" \"capacities\": [\n",
" {\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)\": 1000,\n",
" \"opening cost ($)\": 1_000_000,\n",
" \"fixed operating cost ($)\": 250_000,\n",
" \"variable operating cost ($/tonne)\": 2.5,\n",
" },\n",
" ],\n",
" \"initial capacity (tonne)\": 0,\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 116,
"metadata": {},
"outputs": [],
"source": [
"data = {\n",
" \"parameters\": parameters,\n",
" \"products\": {\n",
" \"Nail\": prod,\n",
" \"Wood\": prod,\n",
" \"NewBoat\": prod,\n",
" \"UsedBoat\": prod,\n",
" },\n",
" \"centers\": {\n",
" f\"NailFactory ({city_name})\": {\n",
" **nail_factory,\n",
" \"latitude (deg)\": city_location[0],\n",
" \"longitude (deg)\": city_location[1],\n",
" }\n",
" for (city_name, city_location) in cities_b.items()\n",
" } | {\n",
" f\"Forest ({city_name})\": {\n",
" **forest,\n",
" \"latitude (deg)\": city_location[0],\n",
" \"longitude (deg)\": city_location[1],\n",
" }\n",
" for (city_name, city_location) in cities_b.items()\n",
" }\n",
" | {\n",
" f\"Retail ({city_name})\": {\n",
" **retail,\n",
" \"latitude (deg)\": city_location[0],\n",
" \"longitude (deg)\": city_location[1],\n",
" }\n",
" for (city_name, city_location) in cities_a.items()\n",
" }\n",
" ,\n",
" \"plants\":\n",
" {\n",
" f\"BoatFactory ({city_name})\": {\n",
" **boat_factory,\n",
" \"latitude (deg)\": city_location[0],\n",
" \"longitude (deg)\": city_location[1],\n",
" }\n",
" for (city_name, city_location) in cities_a.items()\n",
" }\n",
" | {\n",
" f\"RecyclingPlant ({city_name})\": {\n",
" **recycling_plant,\n",
" \"latitude (deg)\": city_location[0],\n",
" \"longitude (deg)\": city_location[1],\n",
" }\n",
" for (city_name, city_location) in cities_a.items()\n",
" }\n",
"}\n",
"\n",
"with open(\"boat_example.json\", \"w\") as file:\n",
" json.dump(data, file, indent=2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}