From 489b223db74f468032c1eeb6ca18ee6a4da3bc33 Mon Sep 17 00:00:00 2001 From: yctct Date: Wed, 25 Nov 2026 17:56:21 +0100 Subject: Add files, first commit --- src/main.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/main.py (limited to 'src/main.py') diff --git a/src/main.py b/src/main.py new file mode 100644 index 0000000..faa7e96 --- /dev/null +++ b/src/main.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +from graph import Graph +from parser import Parser +from pathfinder import Pathfinder +from scheduler import Scheduler +import sys +from visualiser import Visualiser + + +def main() -> None: + """Parse a map, + create a graph, + find the shortest path, + run the simulation through the scheduler + """ + if len(sys.argv) != 2: + print("Usage: './main.py ' or 'make run MAP=path/to/map'") + return + + try: + parser = Parser() + + drone_map = parser.parse_map() + + graph = Graph(drone_map) + + pathfinder = Pathfinder(graph) + + result = pathfinder.find_path( + drone_map.start.name, + drone_map.end.name, + ) + + if result is None: + print("No valid path found.") + return + + scheduler = Scheduler( + graph=graph, + path=result.path, + number_of_drones=drone_map.nb_drones, + ) + + scheduler.run() +# Visualiser(graph, drone_map, scheduler).run() + + except Exception as e: + print(e) + + +if __name__ == "__main__": + main() -- cgit v1.2.3