A from-scratch fleet-dispatch simulation, a lightweight custom sim (plain Python/NumPy)
| Greedy matching | Hungarian matching |
|---|---|
![]() |
![]() |
Work in progress, built incrementally in a Socratic/learning-mode style — code is written by hand, not generated, for applied learning.
Done:
- Baseline matching — N vehicles, M requests on a grid; greedy nearest-vehicle assignment.
- Stochastic demand — Poisson-process request arrivals with spatial hot zones (per-region
rates), wrapped in a round-based timestep simulation loop (
Engine).
Planned:
- Optimal assignment — Hungarian algorithm (
scipy.optimize.linear_sum_assignment) as an alternative to greedy matching. - Repositioning under uncertainty — compare reactive vs. distribution-aware idle-vehicle repositioning policies via Monte Carlo evaluation (100+ randomized runs).
- Charging constraint (stretch) — battery/range threshold routes vehicles to charge instead of accepting requests.
sim_classes.py— entities (CarAgent,Requester).sim_functions.py— engine-level functions (distance computation, agent spawning, request generation, matching).sim_engine.py—Engine, the timestep orchestrator that owns simulation state and calls intosim_functionseach round.sim_data.py— toy region/demand configuration used to construct anEngine.sim_visual.py— live matplotlib view of a runningEngine.
python -m venv .venv
source .venv/bin/activate
pip install numpy scipy matplotlib
python sim_engine.py

