Route Optimization
Interactive connector map showing shortest-path delivery routes across your active fleet — colour-coded by transport mode.
Overview
Route Optimization provides an interactive AnyChart connector map that visualises every active fleet unit's computed delivery route. It is a planning and monitoring companion to Fleet Manager and Dispatcher Console — you can see at a glance how your entire fleet is distributed across the territory, what the total planned distance is, and which vehicles are carrying the heaviest loads.
Planning Companion, Not Turn-by-Turn Navigation
Route Optimization shows computed shortest-path routes between your fleet's registered delivery stops. It is an operational planning view, not a GPS navigation tool. Drivers use the stop order shown here as their planned sequence, but their physical routing follows road maps.
Quick Start
- Switch the app into Transport mode from the top-right mode switcher.
- Open Route Optimization from the sidebar — it sits inside the Logistics group, just below Fleet Manager.
- The screen boots in three stages: AnyChart scripts load → live fleet is fetched → routes are computed via greedy nearest-neighbor over haversine distance.
- The Turkey map renders with one connector line per active vehicle, colour-coded by mode (sky-blue truck, indigo maritime/rail, amber air).
- Hover any connector line to read the route tooltip: vehicle id, stop count, distance, cargo weight, ETA, and the ordered route trail.
- Read the four metric tiles at the top of the screen to get the at-a-glance dispatch picture.
- Click Recompute in the toolbar to re-fetch the live fleet and re-solve every route from scratch.
Transport Modes
Fleet units are grouped by dispatch mode, and each group is rendered as a separate connector series on the map with a distinct colour. This makes it immediately clear which type of transport is serving which region.
| Mode | Colour | Hex | Use Case |
|---|---|---|---|
| Truck Dispatch | Sky Blue | #38bdf8 | Road delivery vehicles serving land routes between cities. |
| Maritime / Rail | Indigo | #818cf8 | Sea ports and rail corridor connections for freight. |
| Air Dispatch | Amber | #f59e0b | Cargo aircraft routes serving major airports. |
Route Algorithm
Routes are computed using a greedy nearest-neighbour algorithm over haversine distance. Starting from the vehicle's current origin, the algorithm repeatedly picks the closest unvisited stop until all stops are ordered into a single chain. This produces a near-optimal route quickly without the exponential cost of exact TSP solvers.
Routes are computed in two situations:
- On page load — all routes for the current active fleet are computed automatically from the latest fleet data.
- On Recompute click — re-fetches live fleet via
fleetService.getLiveFleet()and re-solves every route from scratch. Use this after a new vehicle is added, stops change, or a vehicle is taken offline.
Implementation Reference
Each mode (truck / maritime / air) has a fixed set of demo destinations — these are the waypoints the planner orders. Routes are grouped by dispatch mode and each mode is drawn on the map as its own coloured series.
Greedy nearest-neighbor is O(n²) per route and is fine up to ~20 stops — the planner is designed for the 2–8 stop dispatches typical of an in-day fleet view, not a full vehicle-routing-problem (VRP) solve. There is no plan to scale the in-browser routing further; larger fleets should move planning server-side to an OR-tools-style solver.
Metric Tiles
Four summary tiles above the map give a snapshot of the current fleet's operational state.
| Tile | What It Shows |
|---|---|
| Active Units | Count of vehicles currently in active status — the same set shown on the connector map. |
| Planned Stops | Total number of delivery waypoints across all active routes combined. |
| Total Distance | Sum of all haversine-computed route distances in kilometres. |
| Capacity Load | Weighted average load percentage across all active vehicles (cargoWeight / structuralCapacity × 100). |
Connector Map
The main map canvas uses a Turkey base map rendered in dark charcoal. Each route appears as a series of connector lines between city markers.
Hover — Connector Line
Hover over any connector line to see a tooltip with full route details:
- Vehicle ID and plate number
- Stop count on this route
- Total route distance (km)
- Total cargo weight (kg)
- Estimated ETA for the final stop
- Ordered route trail (origin → stop 1 → stop 2 → … → destination)
Hover — City Marker
Hover over a city marker to display the city name label. Markers that serve as stops for multiple vehicles are slightly enlarged.
Map Controls
Standard AnyChart zoom controls are available in the bottom-right corner of the map: zoom in, zoom out, and fit-to-extent. You can also scroll-zoom with a mouse wheel.
Right Rail — Dispatch List
The right rail shows per-vehicle summary cards, one for each active fleet unit. Each card shows:
- Vehicle plate and driver name
- Dispatch mode badge (Truck / Maritime / Air) with its colour
- Stop count for this vehicle's route
- Route distance in km
- Load percentage progress bar
- Ordered route trail — city chain shown as a compact text list (e.g. Istanbul → Ankara → Konya)
The dispatch list scrolls independently of the map. Cards lift on hover (hover:shadow-lg, hover:-translate-y-px) — the standard TotalApp card hover pattern; hovering a card does not currently cross-highlight the corresponding line on the map.
Loading States
The map and the dispatch list both show placeholder UI while scripts load or the fleet refreshes, so the screen never renders a jarring blank canvas:
- The map area shows a centered spinner with the message "Loading dispatch network..." until both the AnyChart CDN scripts have loaded and the live fleet has resolved.
- The right rail renders three skeleton placeholder cards during the initial fleet fetch.
- If no active vehicles are returned, the right rail shows the empty-state message "No active dispatches."
Recompute Button
Click Recompute in the toolbar to re-fetch the live fleet state and re-solve all routes. Use this when:
- A new vehicle has been added to the active fleet since the page loaded.
- Delivery stops have been modified for a vehicle.
- A vehicle's status changed to or from active (affecting whether it appears on the map).
- A new manifest was loaded via Warehouse Link, adding cargo stops to a vehicle.
Recompute vs. Refresh
Refreshing the browser page will also reload routes, but it resets any map zoom and pan position. The Recompute button re-solves routes without disturbing your current map view.
Settings
Route Optimization has no dedicated settings panel of its own. It inherits the global toggles relevant to its surface:
- Settings → Appearance → Theme — the map's dark-mode chrome (deep charcoal regions, near-black background, dark strokes) is hardcoded for visual consistency with the rest of the Logistics module. Theme changes affect only the surrounding panel chrome, not the map canvas itself.
- Settings → Notifications → In-app notifications — no notifications are emitted from this screen yet; routing is synchronous and does not stream.
- Add Record Mode / Project Tab Style — not applicable. Routes are computed, not authored, so there is no add-record modal, and this screen has no tabbed navigation.
Examples
Reviewing today's dispatch network
- Switch to Transport mode → open Route Optimization.
- Read the four metric tiles to get the picture: how many vehicles are out (Active Units), how many waypoints are queued (Planned Stops), how far the fleet is travelling in total (Total Distance), and how full the fleet is on average (Capacity Load).
- Scan the map: confirm every active mode is represented and that no route crosses water unexpectedly — a truck route drawn through open sea is a signal the origin hub is misconfigured.
- Hover the longest-looking connector and verify the tooltip's total distance against your expectations.
Acting on a stale-looking route
- A plate in the right rail shows the same trail and same distance after multiple visits.
- Click Recompute to force a re-fetch of the live fleet and re-run the nearest-neighbor solver.
- If the route is still identical, the underlying vehicle's location has not changed in the fleet store — open Fleet Manager, find that plate, and update its location so the origin hub re-keys to the correct hub.
Reading a route tooltip at a glance
Hovering a connector line surfaces a tooltip with, in order: Vehicle (the vehicle id), Stops (destination count), Distance (total km across haversine legs), Cargo (total kg — only shown if cargo weight was set on any stop), ETA (the final stop's ETA, formatted for the current locale — only shown if set), and Route (the ordered name trail, origin → stop₁ → stop₂ → … → stopₙ). This is the canonical place to read planning detail without leaving the map view.
AI Assistant
Click the AI Assistant tab anchored to the right edge of the screen to open a chat panel with full context on the optimized route plan currently drawn on the map — per vehicle: plate, driver, dispatch mode, stop count, total distance, cargo load vs. capacity, and the ordered stop sequence. As an analytics assistant it narrates the plan, flags efficiency and cargo-balance outliers by vehicle, and proposes concrete rebalancing using the real distance and cargo numbers.
Example Prompts
- "Which route is the least efficient by distance per stop?"
- "Summarize total cargo load across all routes"
- "Which route has the longest duration and why?"
- "Are cargo loads balanced across the fleet?"
Save as Report & Add Knowledge
After the assistant replies, a Save as Report button stores the response in My Reports with an auto-generated title. Use Add Knowledge in the input dock to attach documents from your knowledge library so the assistant can factor in your own dispatch rules and service-level targets.
Analytics, not row editing
This is a dashboard assistant — it explains and recommends against the computed plan. It does not move stops for you; apply its suggestions on the board itself.