Route Optimization Methodology
How priority scores and routes are calculated
The route optimization system transforms raw sales data into actionable daily routes. The process has three stages:
1. Score
RFM scoring assigns each customer to a segment
2. Prioritize
Visit priority calculated from segment + urgency
3. Optimize
TSP algorithm sequences stops efficiently
Each customer receives a visit priority score from 1-100, calculated as:
| Component | Weight | Description |
|---|---|---|
| Segment Weight | 40% | Champions/Cannot Lose = high, Lost = low |
| Recency Urgency | 30% | Days overdue vs typical purchase frequency |
| Monetary Value | 20% | Historical revenue tier (quintile) |
| Initiative Bonus | 10% | Part of Cannot Lose, At Risk, or Reactivation list |
| Segment | Base Weight | Rationale |
|---|---|---|
| Cannot Lose | 1.0 (max) | Urgent retention |
| Champions | 0.9 | Protect best customers |
| At Risk | 0.8 | Proactive retention |
| Loyal | 0.7 | Maintain relationship |
| New | 0.6 | Nurture early |
| Lost/Hibernating | 0.3 | Lower priority unless reactivation target |
When a route is generated for a zone, the following steps occur:
Select Mandatory Stops
All Cannot Lose customers in the zone are included automatically
Fill Remaining Slots
Sort remaining customers by visit_priority, add top N to fill max_stops
Optimize Sequence (TSP)
Use OR-Tools to minimize total travel distance between stops
Attach Context
Add recommended actions, historical data, and contact info to each stop
The Traveling Salesman Problem (TSP) finds the shortest route visiting all stops exactly once. We use Google OR-Tools with the following configuration:
Distance Metric
Haversine (great-circle) distance between geocoded addresses
Solver Strategy
PATH_CHEAPEST_ARC with guided local search
Time Limit
30 seconds max solve time
Fallback
City centroid used when address geocoding fails
Each route stop includes the following context:
PARADA 1: TIENDA LA ECONOMIA (CANNOT LOSE)
- Ultimo pedido: 45 dias (Normal: cada 15 dias)
- Valor historico: $3.2MM
- Riesgo churn: 78%
- Accion: Visita de retencion, ofrecer descuento 5%
- Contacto: Juan Perez, 311-XXX-XXXX
- Geocoding accuracy depends on address quality in source data
- TSP assumes direct travel; doesn't account for road networks
- No time windows or capacity constraints currently modeled
- Churn risk is estimated from RFM scores, not a predictive ML model