Fleet Routing and Dispatch Optimizer
Purpose
Fleet Routing and Dispatch Optimizer solves practical vehicle routing and dispatch scheduling under real operational constraints.
It supports:
- Multi-vehicle route planning
- Capacity-constrained dispatch
- Time-window-aware service sequencing
- Trade-off optimization (distance, time, fleet size)
Use this tool when dispatch decisions must be reproducible, explainable, and cost-accountable.
Typical Questions This Tool Helps Answer
- What is the lowest-cost dispatch plan that still respects capacity and time-window constraints?
- How many vehicles are actually required to meet today's service commitments?
- Which stops are most at risk of lateness or unmet demand under current fleet assumptions?
Problem Class
This tool addresses variants of VRP (Vehicle Routing Problem):
- CVRP: capacitated VRP
- VRPTW: VRP with time windows
- Multi-depot routing
- Soft-constraint scenarios with penalty costs
Background
Fleet routing and dispatch optimization solves a constrained vehicle-routing problem (VRP) where objective quality and operational feasibility must be balanced. A common scalarized form is:
$$\min\left(w_d D + w_t T + w_v V + w_p P\right)$$
Where $D$ is total distance, $T$ is total travel/service time, $V$ is vehicles used, and $P$ aggregates violation penalties (late arrivals, overtime, unmet demand).
Constraint System
Operational feasibility is defined by interacting constraints:
- Vehicle capacity and compatibility.
- Depot start/end and shift limits.
- Time-window feasibility at each stop.
- Service-time inclusion and break rules.
Small data-quality errors in any constraint dimension can invalidate apparently strong objective scores.
Solver Strategy and Trade-Offs
Practical pipelines often use fast constructive seeds (for example Clarke-Wright/sweep), then local or metaheuristic improvement (2-opt, relocate/swap, tabu, GA, annealing). The key trade-off is solve time versus marginal quality gain and scenario throughput.
Robustness and Scenario Use
Dispatch recommendations should be stress-tested under demand variance, closure events, and travel-time inflation. Robust plans maintain acceptable KPI behavior across perturbations, not only in a nominal run.
Methodological Considerations
- Validate constraint completeness before objective tuning.
- Compare alternative weight vectors to expose Pareto-like trade-offs.
- Report both objective values and violation diagnostics for governance.
Practical Interpretation Pitfalls
A lower objective score is not automatically operationally superior if it relies on brittle assumptions or pushes service equity below acceptable policy thresholds.
Inputs
| Parameter | Type | Required | Description |
|---|---|---|---|
| network | Vector (Line or MultiLine) | Yes | Street/transit network used to build routing graph |
| depots | Vector (Point or MultiPoint) | Yes | Depot/warehouse features used as vehicle origins |
| stops | Vector (Point or MultiPoint) | Yes | Demand/service stop features |
| vehicles_csv | CSV | Yes | Vehicle specification table (6 required columns) |
| restrictions | CSV | No | Optional edge penalty/closure table |
Critical Input Hygiene
- Ensure network connectivity (no disconnected critical subgraphs)
- Use projected CRS for network/depots/stops (tool enforces projected CRS when known)
- Ensure demand and capacity units match (weight, volume, pallets, etc.)
- Ensure stop demand values are non-negative and realistic for fleet capacity
Vector Attribute Expectations
depotsattribute lookup priority for depot id:depot_id,DEPOT_ID,id,ID.stopsattribute lookup priority for stop id:stop_id,STOP_ID,id,ID.stopsdemand field lookup:demand,DEMAND(default when missing:1.0).stopsservice time field lookup:service_time_minutes,SERVICE_TIME_MINUTES,service_time,SERVICE_TIME(default when missing:10.0).
vehicles_csv Schema (Authoritative)
Header (recommended):
vehicle_id,capacity,available_time_minutes,cost_per_minute,cost_per_km,depot_id
- Exactly 6 columns are required per non-empty row.
- Header row is optional but, if present, must include
vehicle_idon row 1 to be auto-detected as header. capacity,available_time_minutes,cost_per_minute, andcost_per_kmmust parse as numeric values.
Example:
vehicle_id,capacity,available_time_minutes,cost_per_minute,cost_per_km,depot_id
truck_01,1200,540,0.65,1.20,depot_west
truck_02,800,480,0.58,1.05,depot_east
restrictions Schema (Optional)
Required columns:
from_x,from_y,to_x,to_y
Optional columns:
penalty_factor(alias:penalty) default1.0closed(alias:is_closed) defaultfalse
Accepted truthy values for closure: 1, true, yes, y (case-insensitive).
Example:
from_x,from_y,to_x,to_y,closed,penalty_factor
500120.0,4820030.0,500240.0,4820035.0,true,1.0
500300.0,4820100.0,500410.0,4820108.0,false,1.8
Parameters
| Parameter | Type | Default | Notes |
|---|---|---|---|
| objective | Enum | minimize_distance | One of: minimize_distance, minimize_time, minimize_cost, balanced |
| edge_cost_field | String | — | Optional numeric line field used as impedance multiplier on each edge. When omitted, Euclidean arc length is used. Typically set to a travel-time or friction field (e.g. MINUTES). |
| one_way_field | String | — | Optional line field marking one-way digitized edges; accepts FT/TF/B codes and legacy boolean values. |
| network_speed_kmph | Number | 80.0 | Network travel speed in km/h used for time conversion when edge_cost_field is not set. Has no effect when edge_cost_field is provided. |
| html_report | String path | Not set | Optional HTML summary report output |
| routes_output | String path | None (required) | Output vector for routes |
| assignment_csv_output | String path | None (required) | Output CSV for stop assignments |
| route_kpis_csv_output | String path | None (required) | Output CSV for route/fleet KPIs |
| exceptions_csv_output | String path | None (required) | Output CSV for infeasible stops |
objective
minimize_distance: fuel and mileage focusminimize_time: SLA/response-time focusminimize_cost: direct optimization of(distance_km * cost_per_km) + (time_minutes * cost_per_minute)balanced: compromise score across distance, time, and cost
Output Path Parameters (Required)
routes_output: path extension controls vector format (for example.shp,.geojson,.gpkg).assignment_csv_output: written as CSV with assignment rows.route_kpis_csv_output: written as CSV with per-route rows and aFLEET_TOTALsummary row.exceptions_csv_output: written as CSV with one row per failed stop assignment.
html_report
- If provided, an HTML summary file is generated in addition to CSV/vector outputs.
- HTML report includes run summary counts and key output paths for packaging.
Outputs
Output artifact keys below are runtime outputs, not input parameters.
| Artifact | Runtime Output Key | Type | Description |
|---|---|---|---|
| Routes vector | routes | Vector (LineString) | Route geometry per vehicle with route-level attributes (written to routes_output path). |
| Assignment CSV | assignment_csv | CSV | Stop-to-route assignment timeline (written to assignment_csv_output path). |
| Route KPIs CSV | route_kpis_csv | CSV | Per-route and fleet-level KPIs (written to route_kpis_csv_output path). |
| Exceptions CSV | exceptions_csv | CSV | Stops that could not be assigned and reasons (written to exceptions_csv_output path). |
| Objective used | objective | String | Objective used in optimization run. |
| Route count | routes_count | Integer | Number of generated routes. |
| Stops assigned | stops_assigned | Integer | Number of assigned stops. |
| Stops failed | stops_failed | Integer | Number of unassigned stops. |
| Status flag | status | String | Run status string. |
| Summary payload | summary | JSON (result payload) | Run counts and output locations. |
| Optional report | html_report | String path | Returned only when html_report parameter is supplied. |
Output File Schemas
routes_output attributes:
ROUTE_IDVEHICLE_IDDEPOT_IDSTOP_COUNTDIST_KMTIME_MINCOST
assignment_csv_output columns:
stop_id,route_id,vehicle_id,sequence_order,arrival_time_minutes,departure_time_minutes
route_kpis_csv_output columns:
vehicle_id,route_id,capacity_utilization_pct,distance_km,time_minutes,cost_units,stop_count
Notes:
- Includes a final fleet aggregate row with
vehicle_id=FLEET_TOTALandroute_id=FLEET_TOTAL.
exceptions_csv_output columns:
stop_id,reason
Common reason values:
demand_exceeds_max_vehicle_capacityno_feasible_route
Result Payload Keys
In addition to output files, the run result contains keys for orchestration and auditing:
statusroutes_countstops_assignedstops_failedobjectiveroutesassignment_csvroute_kpis_csvexceptions_csvsummaryhtml_report(only when requested)
Interpreting KPIs in route_kpis_csv_output
capacity_utilization_pct: percentage of route capacity consumed by assigned stop demand.distance_km: full loop distance including return to depot.time_minutes: travel plus service time, including return leg travel time.cost_units: computed from distance and time using per-vehicle coefficients.
Validation Workflow
Before Operational Use
- Run baseline scenario with historical dispatch data
- Compare against known outcomes (distance, overtime, late stops)
- Validate stop sequence plausibility with dispatch team
Sensitivity Testing
- Vary demand by +/-10%
- Remove one vehicle and compare service impact
- Tighten time windows and inspect infeasibility growth
Field Validation
- Pilot with one depot/day
- Capture driver deviations and ground truth constraints
- Feed corrections back into network and timing assumptions
Troubleshooting
| Symptom | Likely Cause | Corrective Action |
|---|---|---|
| Many late arrivals | Time windows too strict or travel times underestimated | Recalibrate edge impedance and service duration |
| High unassigned-stop count | Capacity/time budgets are insufficient for demand | Increase fleet capacity, increase available time, or split workload by depot |
| Long detours | Network gaps or turn restrictions missing | Repair topology; include turn penalties and restrictions |
| Unexpectedly high route cost | Cost coefficients or objective selection mismatch operations policy | Re-check cost_per_minute, cost_per_km, and set objective intentionally |
Example: Daily Last-Mile Dispatch
import whitebox_workflows as wbw
wbe = wbw.WbEnvironment()
wbe.working_directory = "/data/logistics_daily"
wbe.fleet_routing_and_dispatch_optimizer(
network="metro_network.shp",
depots="depots.shp",
stops="orders_2026_05_14.shp",
vehicles_csv="fleet_profile.csv",
objective="balanced",
restrictions="road_restrictions.csv",
edge_cost_field="MINUTES",
routes_output="out/routes_2026_05_14.geojson",
assignment_csv_output="out/assignment_2026_05_14.csv",
route_kpis_csv_output="out/kpis_2026_05_14.csv",
exceptions_csv_output="out/exceptions_2026_05_14.csv",
html_report="out/fleet_dispatch_2026_05_14.html"
)
Any WbEnvironment instance name is valid (wbe above is only an example).
Example: Emergency Utility Service Calls
wbe.fleet_routing_and_dispatch_optimizer(
network="utility_response_network.shp",
depots="service_crews.shp",
stops="incident_calls.shp",
vehicles_csv="crew_truck_capabilities.csv",
objective="minimize_time",
edge_cost_field="MINUTES",
routes_output="out/utility_routes.geojson",
assignment_csv_output="out/utility_assignments.csv",
route_kpis_csv_output="out/utility_kpis.csv",
exceptions_csv_output="out/utility_exceptions.csv"
)
Implementation Practices
- Store each run with a scenario ID and immutable input snapshot
- Publish only routes that pass dispatch sanity checks
- Maintain separate tactical (fast) and strategic (deep) optimization profiles
Related Tools
network_readiness_and_diagnostics_intelligenceservice_area_planning_and_coverage_optimizationemergency_scenario_routing_and_accessibility_simulator
References
- Toth, P., & Vigo, D. (2014). Vehicle Routing: Problems, Methods, and Applications (2nd ed.). SIAM.
- Laporte, G. (2009). Fifty years of vehicle routing. Transportation Science, 43(4), 408-416.
Parameter Interaction Notes
For Fleet Routing and Dispatch Optimizer, output quality is most sensitive to parameter combinations rather than single values in isolation.
objectiveand vehicle cost coefficients interact strongly: -minimize_costonly behaves as expected whencost_per_minuteandcost_per_kmare calibrated to real economics. -balancedcan reduce extreme route shapes but may not minimize any single KPI.available_time_minutesandservice_time_minutesjointly control assignment feasibility; high service durations can dominate travel-time improvements.- Restriction closures (
closed=true) can rapidly increase infeasibility; inspectexceptions_csv_outputafter each closure scenario.
QA and Acceptance Criteria
Use a staged acceptance approach for Fleet Routing and Dispatch Optimizer:
- Input integrity: validate projected CRS, network connectivity, depot-stop coverage, and CSV schema correctness.
- Method validity: run a pilot dispatch day and compare route order against dispatch-team expectation.
- Output plausibility: verify route loops return to depot and KPI magnitudes are operationally realistic.
- Reproducibility: rerun with identical inputs and confirm stable assignment/KPI outputs.
Recommended acceptance checks:
- Every output artifact exists at the requested path.
assignment_csv_outputrows are consistent with route stop counts.route_kpis_csv_outputcontains the finalFLEET_TOTALrow.exceptions_csv_outputreasons are explainable and actionable.
Advanced Operational Guidance
For production deployment of Fleet Routing and Dispatch Optimizer:
- Maintain a versioned parameter profile (e.g., exploratory, standard, compliance).
- Store run metadata with input hashes, parameter JSON, and timestamp for auditability.
- Lock route output format by extension (for example,
.gpkgfor enterprise geodatabases,.geojsonfor interoperability). - Use scenario-specific
restrictionsfiles rather than editing network geometry for temporary closures.
Implementation Patterns
Common implementation patterns with Fleet Routing and Dispatch Optimizer:
- Baseline run: produce first-pass outputs with balanced defaults.
- Sensitivity run: vary 1-2 high-impact parameters to assess stability.
- Production run: lock accepted profile and generate deliverables.
- Monitoring run: repeat with identical profile on new data for change tracking.
Related Tools
Use Fleet Routing and Dispatch Optimizer together with upstream conditioning and downstream validation tools in the same bundle to ensure end-to-end consistency and stronger decision confidence.
When To Use This Workflow
Fleet Routing and Dispatch Optimizer is most valuable when teams need measurable service-level improvements (coverage, response time, cost-to-serve) with governance-ready transparency.
What this workflow helps you achieve:
- Translates network complexity into decision-ready options.
- Supports defensible operational planning with explicit constraints.
- Creates repeatable workflows for quarterly and annual optimization cycles.
Results Delivery Checklist
Before sharing results with stakeholders:
- Validate network topology and impedance attributes for all served areas.
- Confirm objective function matches business KPI priorities.
- Document constraints (capacity, time windows, exclusions) in deliverable notes.
- Provide baseline-vs-optimized comparison metrics.
- Include at least one scenario stress test (demand spike, outage, or route closure).
Common Questions
Q: Which result should I review first? A: Start with baseline-vs-optimized KPI changes for coverage, response time, and cost-to-serve.
Q: What is a common interpretation mistake? A: Assuming a better objective score means the plan is deployable without verifying all constraints are respected.
Q: Which settings most affect recommended routes? A: Demand assumptions, enabled constraints, and objective weighting usually have the largest effect on dispatch outcomes.
Q: How should teams use these outputs operationally? A: Pilot the optimized schedule in a controlled service window, compare realized KPIs to baseline, then scale rollout if performance holds.