#### Abstract

This paper proposes a matching degree to study dynamic spatiotemporal characteristics of urban taxi and offers a novel understanding of self-organization taxi dispatch in hotspots on top of the Fermi learning model. The proposed matching degree can not only reflect the overall spatiotemporal characteristics of urban taxi supply and demand but also show that the density of distribution and the distance between the taxis supply and the city center will affect the satisfaction of demand. Besides, it is interesting to note that supply always exceeds demand and they will self-organize into an equilibrium state in hotspots. To understand the phenomenon, we develop the Fermi learning model based on the prospect theory and compared the results with the popular reinforcement learning model. The results demonstrate that both models can account for self-organization behavior under different scenarios. We believe our work is crucial to explore taxis data and our indicator can provide a significant suggestion for urban taxis development.

#### 1. Introduction

Because of the flexibility and convenience, taxis become one of the most important ways to travel. In Guangzhou, taxis account for 7.7% of the transportation modes, and there are about 1,776,000 taxi trips per day [1].

In order to understand the characteristics and operation of urban taxis, three general measurements of taxis supply and demand indicators—the number of ownership, full-load ratios, and mileage utilization rate—have been widely used [2–4]. The number of ownership is an indicator defined from the quantitative point of view. The full-load ratios are to measure the use of taxis in a certain area by sampling. Mileage utilization refers to the ratio of passenger mileage to total mileage during operation time. These indicators can only reflect the urban taxis operations in a macroscope.

More works addressing data distribution characteristics of taxi trips have been done. The traveling displacements of urban taxis were found to follow an exponential distribution [5] while the traveling duration and interevent time distributions can be approximated by log-normal distributions [6]. Christoforou et al. find that user’s residence area which has high population density is related to longer journey durations and off-peak and nighttime traveling last longer than others [7]. However, those distribution characteristics can only present the static feature.

Thanks to the development of information technology, a number of companies established taxi services on top of the mobile network, such as Didi, Uber, and Lyft. There are three advantages using these services. (a) Realizing the information exchange between passengers and taxi drivers, reducing the mutual search cost between passengers and drivers: the drivers do not need roaming around the city vacantly, and the passengers can also enjoy instant services [8]. (b) Saving fuel costs and reducing environmental pollution: information exchange allows drivers to spend less time looking for passengers and saving fuel [9, 10]. (c) Relieving the heavy traffic flow: taxi can be allocated reasonably in a limited space according to passenger needs [11, 12]. The emerging taxi Global Positioning System (GPS) trip datasets of origin and destination of passengers and drivers provide the opportunity to extract spatiotemporal characteristics for a particular region [13].

The indicators and researches mentioned above are all static. They cannot reflect the dynamic characteristics of taxis supply and demand, especially after the intelligent dynamically dispatching systems by these taxis platforms. Thus, we need a dynamic indicator based on origin and destination GPS data to measure the characteristics of taxis supply and demand in the urban area.

Therefore, we proposed a matching degree using bipartite networks [14, 15] based dynamic allocation model to measure the characteristics of taxis supply and demand in the urban area. Based on the Hungarian method [16–18], we established the best match between taxis supply and demand under the conditions of meeting the minimum cost. That is to say, the matching degree is constructed on the assumption of the passengers waiting for the least time because taxis move more quickly and are more flexible than passengers. We then explore the spatiotemporal characteristics of supply and demand through data.

One of the main approaches to address both characteristics and taxi dispatch problems is agent-based modelling, where passengers and drivers are modeled as autonomous agents that are able to interact in a dynamic environment. A multiple trip negotiation model is introduced in [19], where flexible activity scheduling is considered between a small group of agents. Flexible trip departure times are also studied in theory and experiment [20, 21]. The multiagent model is also introduced in taxi-sharing [22], considering drivers’ multiple preferences and taxi dispatch [23] with reduction in customer waiting and empty taxi cruising times. Although some different aspects of taxi multiagent dispatching are studied in these approaches, none of them consider dynamic characteristics and multiple, often-conflicting interest for passenger and driver agents.

We propose a new multiagent model that models both passengers and drivers as autonomous agents and conduct multiagents simulations on top of reinforcement learning model [21, 24, 25] and prospect theory [26–30] based Fermi learning model [21, 31].

The remainder of this paper is organized as follows. In Section 2, we first review the basic knowledge of our bipartite networks based dynamic allocation model, such as the bipartite networks and Hungarian method. Then, we improved the method to be better applied to our model and proposed matching degree. In Section 3, we analyze the spatiotemporal characteristics through actual data from four cities. In Section 4, by the analysis of data, we find that taxi demand and supply in hotspots will form a balanced system just like a kind of double-role-like EI Farol Bar game. To better explain the phenomenon, we propose a multiagent model which models both passengers and drivers as autonomous agents and conducts simulations based on reinforcement learning model and a novel Fermi learning model. In the last section, we present our conclusion and discussion.

#### 2. Establish the Matching Degree

Table 1 shows the commonly used taxi operation indicators: the possession quantity of taxis per ten thousand persons and mileage utilization rate . Beijing is the capital of China with a large population. Shanghai and Guangzhou are modern cities. Xi’an is an old city in central China. They are lying in the north, east, south, and central part of China, respectively. Thus, we choose these four cities as representative examples in our paper.

According to the data, the possession quantity of taxis in Beijing and Shanghai are higher than those in Xi’an and Guangzhou while the mileage utilization rates are the opposite. These traditional indicators give a big picture of urban taxi operation status in the four cities in China. However, if people want to know the satisfaction of urban taxi demand spatially and temporally, a more specific indicator is needed. Thus, in this section, we will utilize the classical binary matching method—Hungarian algorithm to build the matching model. The obtained optimal matching degree can be seen as an indicator to measure spatiotemporal characteristics of urban taxi supply and demand.

In this section, the methods to acquire a matching degree will be elaborated. Since the time window of the data that we are going to use is hourly, it was decided that the best method to adopt for this investigation was to transform continuous matching into discretely distributed matching. The best match between the taxi distribution points and the demand points is solved under the condition that the cost of passengers allocated to taxis is minimized; that is, the waiting time of passengers is minimum. Next, we will first introduce the theoretical background of the model: bipartite matching and Hungarian method. And then, the algorithm steps of matching degree will be given.

##### 2.1. Bipartite Matching

When modelling relations between two different classes of objects, bipartite networks usually arise naturally. It is widely used in social network analysis [32–34], optimization problem [14, 15], and recommender systems [35–37]. Let be an undirected graph. If the vertex set can be divided into two mutually disjoint subsets , graph is a bipartite graph. The bipartite graph can also be recorded as . We propose a complete bipartite graph with passenger nodes and taxi nodes , and each edge has a nonnegative cost . We want to find a perfect matching with a minimum total cost. A simple bipartite matching is shown in Figure 1.

**(a)**

**(b)**

**(c)**

**(d)**

##### 2.2. Hungarian Method

The Hungarian method is a combinatorial optimization algorithm based on bipartite matching to solve the assignment problem [16, 17]. According to Berge’s lemma [18], a matching is maximum if and only if it does not have any augmenting path.

A maximum matching is a matching that contains as many edges as possible [38]. A perfect matching (complete matching) is a matching which matches all nodes of the graph. A perfect matching can only occur when the graph has an even number of nodes [39]. Since our goal is to measure whether passengers’ needs are met, the perfect matching in our paper describes a matching satisfying all passengers’ requirements, that is, maximum matching.

In general, we set a matching matrix . In each step, we find an augmenting path to get a bigger match than . Augmenting path is a path in graph that connects two unmatched vertices . If the matched and unmatched edges alternate on , then is an augmenting path relative to . The process is done if we cannot find a new augmenting path. The detailed algorithm of the Hungarian method is shown in Figure 2.

##### 2.3. Matching Degree

Since the demand and supply of taxis in each place are changing over time, the adjacency matrix of the bipartite network is also changing correspondingly. To solve this problem, we use the idea of discretization to simplify this complex problem. In our model, we deal with this continuity problem step by step. We can consider that there is only one person at each demand point, and each taxi supply point only supplies one taxi every time. We repeat the process until there is no passenger at the demand point.

The bipartite networks based dynamic allocation process consists of four steps: Step 1: establish the adjacency matrix : the element in the adjacency matrix is the spatial distance between passenger and taxi based on latitude and longitude, that is, the matching cost. Step 2: discretize the continuity problem: we assume that in each time window, only one passenger in each demand point participates in the matching. In each matching process, we use the Hungarian method to establish an optimal match. The matching process is just like the simple example in Figure 1. The goal is to match all passengers with a minimal matching cost. After each round of matching, all demand points should be reduced by one passenger. If supply points meet the matching, one taxi should also be reduced. Step 3: in a point, when all the passengers or taxis are matched, the cost of matching will be set to infinity, , which means this point is no longer involved in the next matching. Step 4: the above steps are performed continuously. When all the passengers have been matched, the match process is ended. In this case, the remaining number of the taxis at each taxi supply point can be obtained. Thus, the matching degree of each taxi supply point can be calculated by , where is the initial number of taxis.

#### 3. Spatiotemporal Characteristics

According to the algorithm steps of matching degree in the previous section, we will then substitute the datasets of four cities and use matching degree to explore spatiotemporal characteristics of urban taxis. The dataset is from Cangqiong Intelligent Travel Platform, which includes the location of the supply points of taxis and the location of the passengers in need at each moment.

Figure 3 shows the spatial distribution of taxi demand and supply at 8 a.m. in Beijing, Shanghai, Xi’an, and Guangzhou, respectively. An important finding is that the taxis supply is always higher than demand but taxis usually gather around hotspots. We then study the temporal characters of taxi demand and supply. Figure 4 shows the average matching degree of Shanghai, Beijing, Xi’an, and Guangzhou. On the whole, the four cities have three peak travel times, mainly around 8 a.m., 6 p.m., and 9 p.m., which is in line with reality.

**(a)**

**(b)**

**(c)**

**(d)**

**(e)**

**(f)**

**(g)**

**(h)**

When looking at the results of the four cities separately, we can find that the average matching degree of Beijing is the highest, followed by Shanghai. These two cities are two of the most developed cities in China. In addition, we find that even in Beijing, during the peak hours of commuting, the average matching degree is still less than 40%. We suspect that the urban taxi matching degree is related to taxi distribution density and urban spatial structure. As shown in Figure 5, in Beijing, Shanghai, and Xi’an, when the taxi density in the unit space becomes too large, the matching degree will be reduced. However, Guangzhou is the opposite. According to the number of ownership (Table 1), we think the overall taxi supply in Guangzhou is insufficient. In Beijing and Shanghai, the number of ownership per persons is more than 20; thus, they have relatively sufficient supply.

**(a)**

**(b)**

**(c)**

**(d)**

Next, we study the relationship between taxis supply density and matching degree. We find that the spatial distribution of taxi has a great influence on the matching degree, which reflects the importance of information exchange between passengers and taxi drivers.

Specific to each city, we analyze the impact of spatial distribution on the matching of taxi supply and demand. As shown in Figure 6, for Beijing, the area with the highest taxi utilization rate is about 15–20 km and 32 km away from the city center (Tiananmen Square). This result can be easily explained by the specific situation in Beijing. The existing urban area of Beijing is built on the old city; thus most of its commercial areas are about 10–20 kilometers away from the center of the city. So there will be a large matching degree in this distance range. With the expansion of urban areas, such as the Beijing Fourth Ring Road and the Fifth Ring Road, the development is also relatively rapid, which leads to the emergence of the second matching peak in the map. For the more emerging city Shanghai, it is quite different from Beijing. The largest matching area is mostly within 18 km from the city center. Therefore, the influence of the urban structure on the matching degree of supply and demand for taxis is also remarkable. Rationally dispatching taxis according to urban space layouts can make the allocation of taxi resources much reasonable.

**(a)**

**(b)**

#### 4. The Demand and Supply of Taxis and Dynamics Model Simulation

##### 4.1. The Demand and Supply of Taxis in Hotspots

Through Figure 3, we find that passenger demand is scattered, while the supply of taxis is denser in certain areas, hereinafter as hotspots. Taking Beijing as an example, we calculate the demand and supply around Beijing Railway Station (116.433547, 39.909462) and Beijing South Railway Station (116.385488, 39.87128). As shown in Figure 7, the blue line indicates the demand for taxis, and the orange line indicates the number of taxis that can be provided around the areas. We find that in hotspots, supply always exceeds demand.

**(a)**

**(b)**

This phenomenon is easy to understand. In hotspots, such as office buildings, tourist attractions, and stations, there will be a relatively stable demand. Taxi drivers do not need to search passengers if they wait around hotspots. In this way, the driver can reduce the fuel and time cost of empty cruising. However, if too many taxis crowed into popular areas, drivers may not receive orders due to oversupply.

This problem is similar to the El Farol Bar Problem proposed by Arthur in 1994 [40, 41]. The game is that, every weekend, a group of people, such as persons, have to decide whether to go to a bar or stay at home. The bar’s capacity is limited, assuming 60 persons. If someone predicts that more than 60 persons will go to the bar, would s/he go to the bar or not? Each participant or decision-maker only knows the number of people who went to the bar before. Thus, the strategy can only be summarized based on the information of the previous feedback. This is a typical dynamic game problem. Through computer simulation, we can get an interesting result. After a period of time, the number of people who went to the bar tends to be 60. The participants will self-organize into a balanced system.

However, unlike the El Farol Bar game, there are two roles in our problem. We need to consider not only the number of drivers but also the number of passengers. In a hotspot, passengers can choose to take a taxi, which is more comfortable and faster than other public transportation. However, if too many people take taxies at the same time, there will be a supply shortage and it will take more time for passengers to wait for vehicle dispatch. For this double-role-like bar game scenario, will it also form a stable equilibrium system? Based on the data shown in Figure 7, we think that demand and supply of taxis in hotspots will also form such an equilibrium state. Below, we construct a dynamic game model and verify this conjecture through a multiagent simulation.

##### 4.2. Demand and Supply Dynamics Model

We assume that the system consists of two types of agents: passengers, who can choose transportation method, taxi, or other public transportations and taxi drivers, who can decide to wait around the hotspot or cruise for searching potential passengers. The expected returns for these two types of agents are affected by the number of demand and supply of the same system.

If there are passengers choosing to take taxis and taxis are waiting around the hotspot, their payoffs are given bywhere denotes the average income per kilometre, denotes the average operating mileage, denotes the starting price, denotes the cost of searching time for drivers, denotes the cost of waiting time for passengers, and denotes the degree of comfort by taxis, compared with other transportation. When the demand is greater than supply, the passengers have to wait for taxis, the waiting time cost is , and the drivers can save the searching time . To make it easier, we assume in the following simulation. However, the passengers who worry that there are lots of people waiting for taxis and choose to take the bus or subway will have fixed income . Also, the taxi drivers who choose to supply the service out of hotspots have fixed income .

In order to get a deeper insight, we have conducted multiagents simulations based on two popular models: the reinforcement learning model and the Fermi learning model.

###### 4.2.1. The Reinforcement Learning Model

Reinforcement learning has been widely used to develop decision behavior models [21, 24, 25]. In reinforcement learning, the benefits of a strategy selected in the previous round will be used to reinforce the tendency to choose that strategy, and the tendency to choose a different strategy will be converted into the probability of that strategy.

We firstly examined the ability of the reinforcement learning model to simulate the multiagents system. Simulation processes of the model are shown as follows.(1)Initial propensity: we assume that all agents have the same initial propensity, which is set equal to the fixed income 50.(2)Update propensity: suppose an individual (passenger or driver) has chosen action in round , the propensities in round are updated by where is the propensity to choose action in the next round ; is the payoff corresponding to the action in round ; and is the learning rate.(3)Update probability: the probability of choosing action in round is determined bywhere is a parameter that determines reinforcement sensitivity. In our simulations with the reinforcement learning model, we set . The results are shown in Figure 8.

**(a)**

**(b)**

**(c)**

**(d)**

###### 4.2.2. The Fermi Learning Model

We then propose a new Fermi learning model based on the prospect theory and Fermi rule. Prospect theory: prospect theory is an economics theory developed by Tversky and Kahneman, which proposes an asymmetric form of risk aversion [26, 27]. According to the prospect theory, people make decisions based on the potential gains or losses relative to the reference point rather than in absolute terms [28]. The value function of prospect theory that passes through the reference point is s-shaped and asymmetrical. Faced with a risky choice leading to gains, individuals are risk-averse; while faced with a risky choice leading to losses, individuals are risk-seeking [29, 30]. Fermi rule: Fermi rule originated from condensed matter physics and is widely used in decision modelling in evolutionary games [21, 31]. Compared with the general reinforcement learning model, the number of adjustable parameters using Fermi rule is reduced by one. As far as we know, the Fermi rule combined with the prospect theory has not been employed to model individual choice behaviors in self-organization systems. Therefore, the Fermi learning model is based on the Fermi rule and prospect theory to offer a simpler characterization of individual choice behavior for the systems. In our Fermi learning model, passengers and drivers use the expected return as a reference point to measure gains or losses. That is, for passengers, they will use the fixed income of other transportation as a reference point. When , the passengers consider gains; when , the passengers consider incurring loss. The same goes for taxi drivers. Let and denote the gains or losses of the passengers and drivers’ expected decision, respectively. When the passengers choose to take taxis and drivers choose to serve in the hotspot area, . Agents in the system will update the probability of taking a taxi (passengers) or waiting around the hotspot (drivers) based on the potential gains or losses according to their historical experience:where denotes the memory length and denotes intensity of selection [31]. In our simulations with the Fermi learning model, we set . Here, is the sum of historical losses and is the sum of historical gains. The results are shown in Figure 9.

**(a)**

**(b)**

**(c)**

**(d)**

##### 4.3. Results

Figures 8 and 9 show the simulation results of the reinforcement learning model and Fermi learning model at different parameter settings. We set the initial number of passengers and taxi drivers as 1000 and 3000, respectively. We hypothesize that the average income per kilometre and the average operating mileage , starting price , and the fixed income . These results demonstrate that both models can account for self-organization behavior under different scenarios.

Furthermore, we set different memory lengths in the Fermi learning model. Figure 9 also shows the memory length will slightly inhibit the amount of supply and demand. However, the demand and supply in hotspots tend to be stable after a period of time. These results support that demand and supply of taxis in hotspots will self-organize into a balanced system over a period of time.

#### 5. Conclusion and Discussion

The research of urban transport is a complex system involving multidomain and multidisciplinary. With the development of the Internet and technology, taxi operation data are more detailed and specific. Therefore, we can better explore these data to provide useful suggestions for urban development. Traditional operation indicators of urban taxis pay more attention to the overall situation of taxi supply and operation. If urban planners want a more detailed description, especially spatiotemporal characteristics of urban taxis, the matching degree provides a novel perspective.

In this work, we study the dynamic spatiotemporal characteristics of the urban taxis. We propose the matching degree through bipartite networks based dynamic allocation model to measure supply and demand. The peak travel time shown in our results keeps in touch with reality. We find that matching degree can be influenced by taxi supply density and location. Rationally dispatching taxis according to urban space layouts can allocate the taxi resources much more reasonable. According to the analysis of data, taxi supply is always more than demand but taxis usually gather around hotspots. It is interesting to note that the demand and supply of taxis in hotspots tend to be stable after a while. Then, we establish a dynamic game model, which is a kind of double-role-like bar game, and simulate the multiagents system using two learning models, reinforcement learning and prospect theory based Fermi learning. The results of the two learning models both show that the amount of demand and supply in hotspot will self-organize into a balanced system finally.

Regardless of this, there is still some room for improvement. Firstly, our matching degree will be more optimistic than the actual situation because we ignore the fact that drivers will selectively accept orders in real life. Secondly, in our multiagents simulation, maybe we can consider diversity in individual behaviors to offer a better characterization of collective behaviors.

#### Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

#### Conflicts of Interest

The authors declare no conflicts of interest.

#### Acknowledgments

This work was supported by the National Natural Science Foundation of China (Grant nos. 61573065 and 71731002).