← Back to blog

How We Automated Dispatch Assignment Work (6 Hours per Day)

How We Automated Dispatch Assignment Work (6 Hours per Day)

Introduction

I am Takuma Kakinoue, an engineer at NearMe. I joined NearMe this April as a new graduate. My primary responsibilities include data science, MLOps, and proof-of-concept work for new features. In this article, I explain the automated dispatch assignment system I have been designing and implementing, along with our future plan to introduce deep reinforcement learning.

At NearMe, we collect pre-booked ride orders and use AI to automatically match orders that are close in time and distance (ride-sharing), maximizing passenger count per vehicle and overall travel efficiency. We call each matched set of orders a trip, and a single unmatched order is also treated as a trip. Vehicle assignment is performed at the trip level (linking a vehicle to a trip). The goal of the automated dispatch assignment system is to assign trips to the most appropriate vehicles and generate an efficient operation plan.

As an introduction to the automated dispatch assignment system, this article covers the system overview, assignment logic, monitoring approach, and our plan to introduce deep reinforcement learning.

Background: Why We Built the Automated Dispatch Assignment System

Conventional Operations and Challenges

Dispatch assignment refers to repeatedly assigning trips to vehicles in order to build an operation plan. During this process, we need to consider vehicle capacity, available operating time, and transfer time to trips that are already assigned nearby in time. Traditionally, dispatch assignment was handled manually. For example, for our Haneda Airport Shuttle service, assignment work was done three times per day (about two hours each time). Manual assignment is performed on a screen like the one below, which shows the current operation plan and newly added trips.

This manual operation had the following challenges:

  • It required significant labor (about six hours per day).
  • The quality of operation plans depended heavily on the individual operator’s skill. Highly skilled operators could rearrange trips across vehicles like a puzzle and build more efficient daily plans that cover more trips.

The horizontal axis represents time (0:00-23:00), and each row corresponds to one vehicle’s daily operation plan. Red trips in the unassigned area are new trips (trips to be processed).

Solving These Challenges with Automated Dispatch Assignment

To address these issues, we built an automated dispatch assignment system. It not only reduces assignment workload, but also prevents human errors that occurred in manual operations. In addition, by shortening response time until order confirmation, we can also improve the user experience.

To generate efficient operation plans, we also implemented a rule-based algorithm that scores trips using factors such as number of passengers and predicted ride-sharing likelihood, then assigns higher-scoring trips first. We are now advancing toward introducing an even better optimization algorithm based on deep reinforcement learning.

By automating dispatch assignment, we can eliminate high operator dependency in manual operations and reduce the effort required to design and build a dedicated assignment UI. More importantly, creating efficient operation plans can contribute directly to revenue improvement.

Overview of the Automated Dispatch Assignment System

High-Level Architecture

The automated dispatch assignment system is deployed on Kubernetes. It is developed independently from NearMe’s current main system. The system periodically executes the following batch workflow:

  1. Access the NearMe database and fetch vehicle and trip data.
  2. Run dispatch assignment validation and trip scoring (described in the next section), then determine the set of trip IDs and vehicle IDs to assign.
  3. Access the API that manages NearMe dispatch information and execute assignment processing (we use GraphQL for API communication).

Dispatch Assignment Validation Logic

In the current system, when new trips arrive, we automatically determine which vehicles are assignable by considering factors such as vehicle capacity, available operating time, and spacing between neighboring trips. We then call the dispatch management API to execute vehicle assignment and approval. There are many detailed constraints, but examples include:

  • Vehicle capacity (passenger seats and baggage capacity)
  • Vehicle operating availability
  • Whether another trip is already assigned in the same time slot
  • Transfer time from and to adjacent assigned trips

We can also configure which service’s trips are eligible for assignment on each vehicle. Specifically, we define mappings between vehicle IDs and service IDs.

Note: A service ID is a unique identifier for each service, such as Haneda Airport Shuttle or Naha Airport Shuttle.

Trip Scoring Logic

To create efficient operation plans, we also apply rule-based trip scoring. We score new trips based on a combination of the factors below, then assign trips in descending score order. The ride-sharing likelihood score is obtained from a machine learning prediction model already deployed to a cloud endpoint.

  • Number of passengers
  • Number of pieces of baggage
  • Interval from adjacent trips (if intervals are awkwardly long, plans become sparse and inefficient)
  • Predicted ride-sharing likelihood

Parameters for Automated Dispatch Assignment

Operators who manage dispatch assignment can control system behavior by setting and updating parameters via the admin UI. Examples of configurable parameters are shown below. Because requirements differ by service, our long-term goal is to make the system more flexible by incorporating tools such as JsonLogic.

  • Toggle to enable or disable automated dispatch assignment
  • Assignment execution interval (minutes)
  • How many days ahead trips should be included
  • Vehicle IDs targeted by automated assignment
  • Correction factor for travel time

Monitoring the Automated Dispatch Assignment System

Metrics We Monitor

We define several metrics as indicators of whether the system is running correctly. Metrics are labeled and monitored by combinations of date, service ID, and vehicle ID. We adopt an iterative approach to metric design, identifying necessary values while operating the system in practice. Examples include:

  • Timestamp of the last processing run
  • Processing duration
  • Number of internal errors during processing
  • Number of trips assigned successfully
  • Number of trips where assignment was attempted but the dispatch management API returned an error
  • Number of trips that could not be processed due to data issues

Monitoring Stack: Prometheus + Grafana

To monitor these metrics, we use Prometheus and Grafana. Prometheus is a pull-based monitoring system. Grafana is used to visualize metrics as graphs and dashboards. As a side note, we held an internal hands-on session for Prometheus and Grafana, so please also check the slides. Metrics are visualized as shown below. Once dashboards are prepared in advance, you can access Grafana from a browser and immediately view the latest metrics.

Future Outlook

Introducing Deep Reinforcement Learning

We are currently researching logic to optimize dispatch assignment using deep reinforcement learning. Prior studies suggest that deep reinforcement learning can outperform existing approaches in problems such as the Traveling Salesman Problem (TSP) and the Vehicle Routing Problem (VRP) (Paper 1, Paper 2). At present, I am extending the problem formulation and algorithms so they can be applied to automated dispatch assignment, and running training experiments.

Conclusion

In this article, I introduced our automated dispatch assignment system and our effort to incorporate machine learning for more efficient operation planning. On a personal note, through developing this system I have also been learning foundational cloud-native technologies such as Kubernetes and Prometheus, and I can feel my growth every day. At NearMe, we hold a weekly study session (materials) where engineers share and discuss what they have learned, helping each other improve continuously. Finally, NearMe is hiring engineers. If you are interested, please take a look below.

Author: Takuma Kakinoue

Author: Takuma Kakinoue