Share
Embed
From Addresses to Efficient Deliveries: Solving Vehicle Routing Problems with Python
Presented at XtremePython 2026.
This talk explores how Python can connect GIS, traffic data, mathematical optimization, driver constraints, and physical cargo packing into a practical delivery-planning workflow.
The demo combines OpenStreetMap, TomTom traffic data, Google OR-Tools, driver schedules and qualifications, customer delivery time windows, truck weight and volume limits, and 3D packing with py3dbp.
It also demonstrates an iterative approach in which routing is re-optimized when an assigned truck load fails the physical packing check, and compares the use of commercial traffic data with public/open transportation data from Irvine GIS and Caltrans.
XtremePython 2026:
https://xtremepython.dev/2026/speakers/
takeofuture
November 16, 2026
Transcript
13 slides
-
How Python connects geography, traffic, optimization, and physical packing into
one delivery-planning workflow. Takeo Shibata 0 -
- Born and raised in Aichi, Japan - Background in
Geophysics - 30 years of experience in software and information systems - Currently working on data science and AI-related projects - Based in Southern California Areas of Interest - Python for Data Science & Automation - Mathematical Optimization - GIS & Geospatial Analysis - AI / Machine Learning - Data Engineering & Business Intelligence - Remote Sensing Beyond Python - Robotics & Simulation - Electronics & Embedded Systems - Manufacturing Engineering - Product Design / Prototyping - Hiking, cycling & travel @takeofuture dev.to/takeofuture www.linkedin.com/in/takeofuture/ -
OUTLINE ▪ ▪ ▪ ▪ ▪ ▪ ▪ ▪ ▪
▪ ▪ ▪ ▪ Why Simple Route Planning Is Not Enough Beyond Routing: Additional Real-World Challenges Additional Constraints Depend on the Industry and Business Objective What This Demo Models — and What It Does Not From Navigation to Delivery Optimization Traffic Data Options: Commercial APIs vs. Public / Open Data Demo 1 — Base Scenario with TomTom Demo 2 — Higher-Demand Scenario with TomTom Demo 3 — Replace TomTom with Public / Open Data Future Work: Loading, Cost, Risk, and AI Takeaways References Appendix -
Why Simple Route Planning Is Not Enough? Example — Google
Maps Google Maps can already… • Find routes on the actual road network • Estimate travel time • Consider current traffic • Suggest alternative routes • Handle multiple stops • Avoid tolls / highways • Provide turn-by-turn navigation For everyday navigation, this works very well. But Delivery Is Different! what if we have… • n(n>1) customers? • M(m>1) different trucks? • Different driver shifts? • Customer delivery time windows? • Different cargo weights and volumes? The fastest route for one vehicle is not necessarily the best delivery plan for the whole fleet. -
Beyond Routing: Additional Real-World Challenges Fleet Utilization Load more cargo
onto fewer trucks Workforce Efficiency Use drivers efficiently and minimize overtime These goals can conflict with each other. Loading & Unloading Efficiency Reduce re-handling and unload in delivery order Route Efficiency Minimize travel time and distance -
What This Demo Models — and What It Does Not
Included in This Demo Routing & Traffic • Multiple customers and multiple trucks • Actual road network with OpenStreetMap • Current traffic conditions • Traffic-aware travel-time matrix • Customer assignment + visit-order optimization Drivers & Time • Customer delivery time windows • Driver working shifts • Driver / truck qualification • Soft overtime penalty • Fleet-wide overtime reduction Cargo & Trucks • Different truck sizes • Payload weight limits • Cargo volume limits • Actual package length × width × height • Rectangular 3D packing feasibility • Re-optimization when packing fails Main objective: minimize traffic-aware travel time while strongly penalizing driver overtime. Not Yet Modeled Loading Operations • Route-aware loading order • First delivery near the door • Last delivery deeper inside • Loading / unloading effort • Re-handling cost More Complex Cargo • Irregular-shaped products • Fragile-item rules • Stackability / orientation restrictions • Center of gravity / load balance Industry-Specific Constraints • Refrigerated / frozen / multi-zone trucks • Shelf life / expiration dates • Spoilage risk Full Business Optimization • Fuel / energy cost • Driver wages • Maintenance • Vehicle depreciation • Insurance / tolls • Product cost / delivery revenue • Profit and operational risk -
Traffic Data Options: Commercial APIs vs. Public / Open Data
Commercial / Broad International Coverage Public / Open Data Source: Google. (2026). Routes API documentation. Google Maps Platform. TomTom. (2026). Traffic API documentation. HERE Technologies. (2026). HERE Traffic API documentation. Mapbox. (2026). Traffic data documentation. OpenStreetMap Contributors. (2026). OpenStreetMap. California Department of Transportation. (2026). Caltrans CWWP2. California Department of Transportation. (2026). Performance Measurement System (PeMS). Ministry of Land, Infrastructure, Transport and Tourism. (2026). xROAD. Japan Road Traffic Information Center. (2026). Open traffic data. Tel Aviv-Yafo Municipality. (2026). OpenData portal. European Commission. (2026). DATEX II / National Access Point resources. Commercial APIs offer broader and more consistent global coverage, but they come with cost and pricing uncertainty. Public / open data is often cheaper, but highly regional, fragmented, and less standardized. -
Demos Demo 1 — Base Scenario with TomTom • TomTom
traffic • Base customer set • Base orders • Trucks, drivers, time windows, packing • Optimize and review the result Demo 2 — Higher-Demand Scenario with TomTom • Same optimization model • More customers / more visits • Larger order quantities • Observe how fleet utilization, routing, overtime, and packing change Demo 3 — Replace TomTom with Public / Open Data • Return to the base scenario • Replace TomTom with Irvine GIS + Caltrans • Keep the downstream optimization workflow essentially the same • Compare the commercial and public-data approaches -
Takeaways 1. Routing is more than finding the shortest path
Real delivery planning must consider traffic, multiple trucks, drivers, time windows, and cargo constraints. 2. Optimization connects many constraints Python can combine GIS, traffic data, OR-Tools, driver schedules, and 3D packing into one workflow. 3. Traffic data sources can be replaced TomTom and public/open data can feed the same downstream optimization workflow, although public data depends heavily on regional availability. 4. The “best” solution depends on the objective Travel time, overtime, fleet utilization, loading efficiency, cost, and risk can conflict with each other. The goal is not simply to find the shortest route — it is to make better operational decisions. GitHub: Colab-ready notebooks available publicly. https://github.com/takeofuture/delivery-vrp Slides: Available on Speaker Deck https://speakerdeck.com/takeofuture/delivery-vrp -
References California Department of Transportation. (2026). Commercial Wholesale Web Portal
2 (CWWP2). https://dot.ca.gov/programs/traffic-operations/traveler-information/cwwp California Department of Transportation. (2026). Performance Measurement System (PeMS) data source. https://dot.ca.gov/programs/traffic-operations/mpr/pems-source DATEX II. (2026). DATEX II: European standard for traffic and travel information. https://datex2.eu/ European Commission. (2026). National access points. Directorate-General for Mobility and Transport. https://transport.ec.europa.eu/transport-themes/smart-mobility/road/its-directive-and-action-plan/national-access-points_en Google. (2026). Routes API. Google Maps Platform. https://developers.google.com/maps/documentation/routes HERE Technologies. (2026). Introduction to HERE Traffic API v7. https://docs.here.com/traffic-api/docs/introduction-to-here-traffic-api-v7 Japan Road Traffic Information Center. (2026). Provision of various information: Open data. https://www.jartic.or.jp/service/opendata/ Mapbox. (2026). Mapbox Traffic Data. https://docs.mapbox.com/data/traffic/ Ministry of Land, Infrastructure, Transport and Tourism. (2026). xROAD: Road data platform. Government of Japan. https://www.xroad.mlit.go.jp/ OpenStreetMap contributors. (2026). OpenStreetMap. https://www.openstreetmap.org/ Tel Aviv-Yafo Municipality. (2026). TLV OpenData. https://opendatasource.tel-aviv.gov.il/en/Pages/home.aspx TomTom. (2026). Traffic Flow service: Traffic API. https://docs.tomtom.com/traffic-api/documentation/tomtom-orbis-maps/v2/traffic-flow/traffic-flow-service