Routing optimisation (explainable)

Trackely uses a propose → explain → confirm → apply workflow. The optimiser never auto-applies reordering.

Constraints

  • Time windows: per-stop earliest/latest arrival. Late arrivals are infeasible for hard windows and penalised for soft.
  • Service time: dwell time per stop (minutes), included in ETA/lateness.
  • Vehicle capacity: weight/volume limits (when provided). Overflow is flagged in warnings.

Scoring priorities

Candidate orders are ranked lexicographically:

  1. Hard constraint violations
  2. Total lateness minutes
  3. Cost estimate
  4. CO2 estimate
  5. Distance

Eco score

ecoScore is a relative 0–100 score within the evaluated candidates: 100 is lowest CO2 among candidates; 0 is highest; 50 means identical.

Google Routes configuration

Set one of:

  • GOOGLE_MAPS_SERVER_KEY (server: Geocoding + Routes API)
  • NEXT_PUBLIC_GOOGLE_MAPS_API_KEY (browser: Maps JS only)

If unavailable, Trackely uses a deterministic local fallback (Haversine + fixed speed) so optimisation works locally.

Common failure modes

  • Missing depot or stop coordinates → warnings; fallback travel times may be inaccurate.
  • Invalid windows (end before start) → warnings.
  • Hard windows infeasible → warnings plus per-stop lateness minutes.