Methodology

Route Optimization Methodology

How priority scores and routes are calculated

System Overview

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

Visit Priority Score
How customers are ranked for visits

Each customer receives a visit priority score from 1-100, calculated as:

priority = (segment_weight × 40) + (recency_urgency × 30) + (monetary_value × 20) + (initiative_bonus × 10)
ComponentWeightDescription
Segment Weight40%Champions/Cannot Lose = high, Lost = low
Recency Urgency30%Days overdue vs typical purchase frequency
Monetary Value20%Historical revenue tier (quintile)
Initiative Bonus10%Part of Cannot Lose, At Risk, or Reactivation list
Segment Weights
SegmentBase WeightRationale
Cannot Lose1.0 (max)Urgent retention
Champions0.9Protect best customers
At Risk0.8Proactive retention
Loyal0.7Maintain relationship
New0.6Nurture early
Lost/Hibernating0.3Lower priority unless reactivation target
Route Generation Process

When a route is generated for a zone, the following steps occur:

1

Select Mandatory Stops

All Cannot Lose customers in the zone are included automatically

2

Fill Remaining Slots

Sort remaining customers by visit_priority, add top N to fill max_stops

3

Optimize Sequence (TSP)

Use OR-Tools to minimize total travel distance between stops

4

Attach Context

Add recommended actions, historical data, and contact info to each stop

TSP Optimization
Traveling Salesman Problem solver

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

Route Output Format

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

Limitations
  • 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