-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from rolling-stock-scheduling/feature/enable-ju…
…pyter-notebooks Feature/enable jupyter notebooks
- Loading branch information
Showing
11 changed files
with
1,486 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Depot Vehicle Analysis\n", | ||
"\n", | ||
"This notebooks illustrates the usage of the **rssched-analysis** package to read rolling stock scheduling responses from the solver.\n", | ||
"\n", | ||
"Run `poetry install` first, and set the ipykernel from the workspace `.venv`." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from rssched.io.reader import import_response\n", | ||
"from rssched.io.reader import import_request\n", | ||
"\n", | ||
"import pandas as pd\n", | ||
"\n", | ||
"SOLVER_REQUEST_FILE = \"../rssched/data/small_test_request.json\"\n", | ||
"SOLVER_RESPONSE_FILE = \"../rssched/data/small_test_response.json\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"request = import_request(SOLVER_REQUEST_FILE)\n", | ||
"response = import_response(SOLVER_RESPONSE_FILE)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Vehicles per depot" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"data = []\n", | ||
"\n", | ||
"for depot_load in response.schedule.depot_loads:\n", | ||
" depot = depot_load.depot\n", | ||
" for load in depot_load.load:\n", | ||
" vehicle_type = load.vehicle_type\n", | ||
" spawn_count = load.spawn_count\n", | ||
" data.append({\"location\": depot, \"type\": vehicle_type, \"count\": spawn_count})\n", | ||
"\n", | ||
"depots = pd.DataFrame(data)\n", | ||
"depots.head()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Total vehicle demand" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"vehicles = depots.groupby(\"type\")[\"count\"].sum().reset_index()\n", | ||
"vehicles.head()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": ".venv", | ||
"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.11.0" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.