This directory contains scripts and modules for visualising the results as interactive maps.
The maps are generated using the Folium library and can display the chosen devices along with their paths and connections.
📂 map_builder/ — Scripts and modules for generating network maps
📁 map_modules/ — Core modules for map building
- 🐍
config.py— Configuration (colours, thresholds, dataset toggle)- 🐍
helper_functions.py— Utility functions shared by scripts- 🐍
build_map_legend.py— Generates a map legend with RU, DU, CU markers- 🐍
plot_results_graph.py— Plots results from graph-based models (Genetic, Local Search, CPLEX)- 🐍
plot_results_short.py— Plots results from shortest path models (Greedy, CPLEX)- 🐍
__init__.py— Makesmap_modulesimportable as a package📄
README.md— Documentation of scripts, usage, and customisation
File: plot_results_short.py
This script visualises the results of Greedy or CPLEX shortest path models. It highlights selected/unselected RUs and DUs and overlays the chosen shortest-path connections.
-
Populate the following variables at the top of the script with your results:
selected_rus,not_selected_russelected_dus,not_selected_dus
-
Set
datasetto either"small-dataset"or"full-dataset". -
Run the script. The output will be saved in the
maps/directory as:short_{dataset}.html
python plot_results_short.py- Update colour thresholds in
get_color_by_demand(insideconfig.py). - Switch dataset via the
datasetvariable. - Adjust map centre and zoom in
create_map_with_layersif working with a new region.
File: plot_results_graph.py
This script visualises results from Genetic Algorithm, Local Search, or CPLEX graph models. It draws full graph-based solutions with their selected network segments.
- Set
selected_rus,not_selected_rus,selected_dus,not_selected_dus. - Set
datasetto"small-dataset"or"full-dataset". - Provide the segments file (e.g.,
{run_id}_segments.json) generated during optimisation. - Run the script. The HTML map will be saved in the
maps/directory.
python plot_results_graph.py- Adjust colour thresholds in
get_color_by_demand. - Switch dataset with the
datasetvariable. - Update map centre/zoom if visualising a new region.
File: build_map_legend.py
This script builds a map legend to visually distinguish between different network components, including RUs, DUs, and CUs. It produces a stand-alone legend map for clarity.
- Set
datasetto"small-dataset"or"full-dataset". - Run the script. It generates a legend map HTML file in the
maps/directory.
python build_map_legend.py- Update
get_color_by_demandthresholds inconfig.py. - Switch dataset using the
datasetvariable. - Adjust map centre and zoom if using a different geographic region.
config.py– Configuration file for colour schemes, demand thresholds, and dataset selection.helper_functions.py– Shared utilities for processing JSON data, creating feature groups, and styling maps.
- All maps are generated as HTML files and saved in the
maps/directory. You can open them in any web browser. - The scripts assume a dataset structure consistent with
small-datasetandfull-dataset. If you build your own dataset, replicate this structure. - Always check the centre coordinates and zoom level for correct geographic alignment.
- For larger datasets, you may want to tune demand thresholds and colour mappings for clarity.