Generating UArk Bus Routes using Google OR Tools

Final Group Project

A heuristic optimization model that designs campus bus routes from real ridership data, built in Java with Google OR-Tools.
Optimization
Java
OR-Tools
Authors
Published

May 5, 2026

Overview

The UArk Bus Map is a Vaadin web application that displays a generated bus route network for the University of Arkansas transit system, lets users search for the nearest stop to any address in the Fayetteville area, and presents summary statistics for each route. Behind the Vaadin interface, we used Google OR-Tools VRP Solver fed by stop coordinates according to Passio’s GTFS-RT Feed recording the Razorback Tranis fleet. The solver produced seven close-looped routes anchored at the Union Station, which serves as the VRP’s “depot”.

Methodology

Route Generation

The Solver class formulates route generation as a Vehicle Routing Problem and solves it with Google OR-Tools. The model assigns 18 buses to closed-loop routes that begin and end at Union Station while collectively visiting all 111 stops, with a global span penalty discouraging unbalanced route lengths. We created a 111x111 rectilinear distance matrix, with the differences scaled by Fayetteville-specific meter-per-degree conversions. The RoutingIndexManager is initialized with Union Station as the depot, and transit callback returns the corresponding distance matrix entry. The “Distance” dimension contains a GlobalSpanCoefficient which penalizes for larger span on the generated routes and the search uses PATH_CHEAPEST_ARC in part because none of the other solvers would work within a 120 second time window. The solver was extremely fragile and would break when I attempted to add capacity or pickup-and-delivery constraints. We took the solver output and serialized the seven generated routes to CSV files which the application reads upon boot.

Marker Visualization

All 111 stops are rendered on the Vaadin map component as Icon color displaying MarkerFeatures: blue by default, green when their route is selected, and red for the user’s searched address and its nearest stop. Routes were originally intended to render as polylines, but Vaadin V24.9.7 does not support LineStringFeatures and the v25 upgrade introduced cascading dependency conflicts. Furthermore, when we tried to use the Leaflet add-on, we discovered that it lacks public documentation. Therefore, when you select a route they are encoded as the set of green stops belonging to it.

Geocoding

The address search accepts a street address or building name and returns the nearest bus stop with a distance estimate. This requires geocoding the text input into coordinates, performed by the OpenStreetMap Nominatim API. All HTTP logic is encapsulated in a GeocodingService class to isolate MainLayout from network concerns. Requests include a viewbox parameter bounding results to Northwest Arkansas so that building-name queries resolve to local matches, and a custom User-Agent header per Nominatim’s usage policy. JSON responses are parsed with Jackson’s JsonNode and returned as Optional<Coordinates>, where Coordinates is a Java record whose named fields prevent accidental latitude–longitude transposition. We used a ConcurrentHashMap to store already searched values (per API usage guidelines) and the ifPresentOrElse method to handle null values. Given valid coordinates return from the API call, our code iterates the list of stops and appliest the rectilinear distance formula to return the closest stop.