Ryan O'Neil - Build on-demand logistics apps with Python, OR-Tools, and DecisionOps | PyData Global

Learn how to build on-demand logistics apps using Python and OR-Tools, covering demand forecasting, shift scheduling, and route optimization with DecisionOps.

Key takeaways
  • ORTools is a versatile optimization library that can handle forecasting, scheduling, and routing problems through different approaches (linear programming, mixed integer programming, constraint programming)

  • Three core models for on-demand logistics:

    • Demand forecasting using LAD (Least Absolute Deviations) regression
    • Shift scheduling using mixed integer programming
    • Route planning using constraint programming/local search
  • LAD regression is preferable to least squares for forecasting because it’s more robust to outliers and can be customized with additional constraints

  • Scheduling optimization typically involves:

    • Balancing oversupply vs undersupply of workers
    • Different penalties for understaffing vs overstaffing
    • Worker availability constraints
    • Economic targets and service levels
  • Vehicle routing optimization focuses on:

    • Minimizing drive time and costs
    • Vehicle capacity constraints
    • Start/end location requirements
    • Sequencing of deliveries
    • Driver assignments
  • Python has become the de facto language for optimization modeling, with growing adoption in data science and operations research

  • Optimization underlies many decision-making tools in logistics, even when hidden behind APIs

  • Different business cases require different cadences (daily, weekly, monthly) and customization of models

  • Moving from siloed spreadsheets to integrated optimization platforms can improve operational efficiency

  • The combination of forecasting, scheduling, and routing models creates a complete system for managing on-demand logistics operations