{'fraction_non_alphanumeric': 0.02903910470800103, 'fraction_numerical': 0.005627733470542835, 'mean_word_length': 4.710062431142123, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Hybrid Dispatch Strategy Based on the Demand Prediction of Shared Bicycles

: With the advent of pile-less shared bicycles, the techniques initially used for public bicycle dispatching were unable to fulﬁll the routine dispatch tasks, resulting in constant bicycle crowding. In this paper, to alleviate the mess of shared bicycles, we propose a hybrid dispatching algorithm based on bicycle demand data. We take the bicycle stations’ imbalance as an optimization index and use greedy ideas to ensure that after each dispatch all stations get the smallest imbalance. In addition, it is suggested that two assessment metrics evaluate the efﬁciency of the dispatching technique from the users and operators’ perspectives. It is shown that the proposed dispatching algorithm performs better in terms of user satisfaction and operator revenue, and is less affected by bicycle distribution compared with the traditional manual scheduling algorithm.


Introduction
With the development and application of advanced technologies such as communication and microelectronics, the concept of smart city arises at the right moment. Smart city has a much broader definition, which includes almost every aspect in human beings' life, e.g., smart medical, smart energy, smart traffic, and smart home. As a form of intelligent transport, the shared bicycle, also known in some references as bicycle-sharing [1][2][3][4], is about 55 years old and has four generations. The shared bicycle is thriving in smart cities especially in recent years and most of them have been successful. There are three clear benefits on the shared bicycle [5], as follows: • It is an utter green path that can reduce environmental effects, regulate air pollution, and effectively save money. There are no exhaust emissions that are dangerous for the atmosphere without fossil fuel consumption. Since cycling is a form of physical practice, both the community and users benefit from the shared bicycle. • For the last mile journey, it provides the perfect solution. Actually, on long-distance journeys, many citizens do not prefer cycling today. However, given that, in most instances, the range of metro or bus stations and commercial or residential communities is not that long, shared bicycles are most cost-efficient and suitable for people for short distances.

•
The urban market is a typical example of public resource-shared operation, capable of improving the cycling usage rate. Today, increasing numbers of people favor shared bicycles than their conventional private bicycles. The traffic pressure will, therefore, be helpful.
IoSB [10]. However, its modules' cost and energy consumption are too high to be applied in IoSB. The Low-Power Wide-Area Network (LPWA) has strong penetration and is designed for applications in complex urban environments with long communication distances [11]. Compared to existing LTE networks, NB-IoT, as a kind of LPWA technique, has the advantages of wide coverage, low power consumption, low module costs, and a large connection [12], and has been used in applications such as water quality monitoring [13], smart parking [14], smart hospital [15], and shared bicycles. Shared bicycle dispatching is crucial to rebalancing bicycles and can be separated into static dispatch and dynamic dispatching. Static dispatching is to research the cumulative mutual bicycle dispatch distance as a measure of optimization. In comparison, dynamic dispatching is based on operator revenue or user riding satisfaction optimization. The dispatching route problem between static leasing sites, which belongs to static dispatching, is studied in [16]. In conclusion, the problem of shared bicycles' static dispatching can be considered as a problem of path optimization, which can generally be modeled using linear integer programming [17][18][19] and found using heuristic algorithms such as Genetic Algorithm (GA) [20], Particle Swarm Optimization (PSO) [21], Ant Colony Optimization (ACO) [22], Simulated Annealing Algorithm (SAA) [23], and so on. Dynamic dispatching pays more attention to the current state or possible future state of the dispatching area and the surrounding region compared with static dispatching and then makes better, more effective and far-sighted scheduling decisions based on the current time and future state data on the map. There are a lot of cases on the demand forecasting of the shared bicycle. For example, in [24], the author proposed a moment-based hybrid prediction method. In that work, a fuzzy mean genetic algorithm and backpropagation network was used to predict the future demand of a certain region of the shared bicycle. Finally, the proposed model was verified by using the actual trip data of well-known foreign public bicycle operators. Bicycle demand in a certain area is related to many factors, such as the distribution of infrastructure in the region to be forecasted [25,26], ambient temperature, and sunny/rainy conditions [27], unexpected large events like holidays or strikes [28,29], time period [30], etc.
On the other hand, the mining of data on the bicycle track supports urban design and planning. In [31], MSRA suggested an estimated greedy-based solution to suggest the bike lane planning system, based on Mobike's monitor big data. In [32], the All-Pair Network Trajectory Similarity (APNTS) is studied to identify major routes of the bicycle for public transport. Additionally, a shared bicycle can be used to complement and connect with other public transport tools. In [33], the author used the mutual bicycle journey track data to refine the city's metro operating strategy.

System Models
Unlike other public transport carriers, there are no fixed stations for shared bicycles and their location is influenced by the tidal movement of users. Because of the complexity and mass of cycling, the distribution of shared bicycles is unbalanced and is difficult to rebalance, particularly for the shared bicycle with no piles. The importance of a high-efficiency strategy for bicycle dispatching is as follows:

•
Reduce scheduling work and time; • Alleviate cycling mess; • Boost users' satisfaction with using shared bicycles.
Consider a scenario of shared bicycle system, as shown in Figure 1. With no fixed pile for parking, we conducted a cluster analysis on all cycling travel points, and extracted the central point of the cluster as the travel station that was illustrated by dots in Figure 1.  Figure 1 are modeled as the vertexes in an undirected graph G = (V, E), where V and E represent all vertex sets and edge sets in undirected Graph G, respectively (|E| ≥ 1). The E in graph G represents the paths between the shared bicycle stations, and the weight of E represents the relationship between the two shared bicycle points connected with them.
In addition, a two-tuple S i (t) = (num i (t), pred i (t)) is used to describe the status of station i at time t(i ∈ [0, |V| − 1]). The station status S includes two parts: • The number of bicycles initially in station i at time t is defined as num i (t); • The Demand of station i in next period predicted at time t is defined as pred i (t).
To further describe the imbalance of station i at time t, we introduce a new parameter imb i (t) = pred i (t) − num i (t). The unbalanced station in G are divided into two types: overflow station (imb i (t) < 0) and underflow station (imb i (t) > 0). Next, in order to alleviate unbalanced stations, we assign the dispatching task to operator and users via hybrid dispatching scheme proposed in Section 4 to allocate the excess bicycles in overflow station to other stations that are underflow.
Firstly, we delegated some overcrowded dispatching tasks that needed to be dispatched to the operator immediately, which are called manual dispatching. Manual dispatching is direct and fast, which belongs to a macro level of dispatching scheme. Here, we introduce a parameter Max to describe the overflow threshold of the station, which means when num i (t) ≥ Max, the station i needs to be dispatched immediately by the operator. More details about manual dispatching are shown in Section 4.
Secondly, we give users a small number of less urgent dispatching tasks and pay them back rewards recognizing user flexibility and confusion, which are called user incentive dispatching and is a microscopic dispatch. Whether the user recognizes the tasks of dispatching is linked to the circumstance, time, environment, and other conditions of the user. After accepting the dispatch task, the user can choose a midpoint near his destination to park the bicycle, whose midpoint is here called detour_node. Taking into account the distance of the user walks, we select detour_node from the adjacent node set of the user's final destination. The adjacent node set of station i is defined as adj (i) . Node set adj_low (i) (t) represents the node set in the adjacent nodes of station i where imb i (t) > 0, and is defined as adj_low (i) (t) = {n|num n (t) ≤ pred n (t), n ∈ adj (i) }.
Finally, we create a discrete-time simulation system to analyze the above hybrid dispatching strategy. In our simulation system, trip record data work as the input data and are formed as a quad Items = {t, depart, arrive, i f _detour}, where t is the moment when the trip record occurred, depart and arrive respectively represent the beginning and end of the trip record (depart = arrive). i f _detour refers to whether user in the trip record is willing to detour to station a around the end station i for a constant reward cost u , where a ∈ adj_low (i) (t).

Main Idea
We then work out our strategy for dispatching task allocation after model definition and develop the corresponding performance evaluation method. First, some assumptions are given as follows regarding the dispatching model: • It ignores the time gap between arrival and departure of a bicycle at time t, and assumes that the departure time of a bicycle at a travel station is unified at the beginning of time t, and then reach the destination at the end of time t, during which the bicycle is independent of all the stations.

•
It assumes that, during manual dispatching, the bicycle leaves the travel point at the beginning of time t, and then arrives at the destination at the next moment.

•
It assumes that the revenue and cost of the operator only come from three parts: the charge for bicycle riding, the cost for manual dispatching, and the cost for user incentive dispatching.

•
It assumes that the dispatching of shared bicycles is only carried out within the research region, and will not involve places outside the research region.
The main idea of this paper is to use a reasonable dispatching task allocation strategy to rebalance as many stations as possible. In order to achieve the above goal, we introduce the concept of overall station imbalance I MB, which indicates the gap of bicycle's supply and demand within all stations and the smaller value represents the more balanced bicycle distribution in IoSB. The specific definition is as Formula (1): For optimizing the I MB, the most important one is the prediction of the demand at the next moment. Trip record is a piece of data that records the starting point, ending point, time and other information of a trip. In our model, a quad Items is utilized to represent each trip record. The truth is that the trip record is a type of time series, which is an important branch of statistics. In this paper, we decided to use the ARMA model to predict the demand at the station for its prediction efficiency and the stability of time series. In the ARMA model, time series Y t is a linear function of random error term of its current and early period and its early period value, which can be expressed as: Finally, in order to evaluate the performance of the final dispatching model, two indicators are defined, which are total revenue for operators B and Users' satisfaction α. The indicator B is defined as Formula (3), which represents the operator's net income: where c 1 is total number of cycling orders within the observation period [0, T − 1]; c 2 is the total number of manual dispatching; c 3 is the total number of user incentive dispatching. cost t is the revenue of operator for single trip; cost m is the total cost of manual dispatching; cost u is the total cost of user incentive dispatching. Users' satisfaction α is used to describe the extent which cycling needs are met in IoSB. In our work, we calculate the users' satisfaction α via the value of the percent of successful rental in all trip records. When there is no bicycle at the station where the lease order occurs, the trip order is deemed to be failed.

Manual Dispatching Scheme
In this work, manual dispatching is a macro dispatching method and can be applied primarily to the situation where the number of bicycles in a travel station num i (t) ≥ Max. The number of bicycles in manual dispatching can be defined as k = num i (t)−Max k 0 , where k 0 refers to the most bicycles each manual dispatching can handle. When k > k 0 , k k 0 times dispatching is needed. There are two difficulties in manual dispatching: • The first is to select a better dispatching endpoint in the dispatching region; • The second is to choose the optimal route between the start and end of dispatching.
We transform the manual dispatching scenario into the following mathematical problem as shown in Figure 2. The weight w ij between station i and j which represented by edges in Figure 2 is defined as Formula (4): where l ij is the distance between station i and j(i = j); imb i or imb j is respectively the imbalance of station i or j, which has been defined in the previous Section 3. The parameter β is set to a constant value to ensure that the weight w ij is always greater than 0. In Figure 2, when the manual dispatching starts to work, the system will firstly scan the global trip station and select the optimal dispatching destination according to the strategy proposed in this paper. Then, the path with the minimum cost is selected based on the weight w ij between the start and end of dispatching. In the dispatching process, according to the disequilibrium and other parameters of the station, the allocation of bicycles to each station in the route is carried out. (1) The selection of dispatching endpoint: As mentioned earlier in our work, we use greedy idea to ensure that the total imbalance of station at the next moment in the future within IoSB is minimized. Therefore, when selecting the endpoint in each manual dispatching, we can select the station with the most imbalance in IoSB, in order to achieve a rebalancing of the station. However, there is still a problem that needs to be considered in which bicycles in a single station will randomly move in the R field of the station, which makes it difficult to select the endpoint for manual dispatching. In the paper, we choose the sum of the imbalances of all stations in the range of R at time t from a station as the basis for selecting the endpoint of manual dispatching, which is imb R i (t) and its definition is shown in Formula (5): (2) The determination of dispatching path: After solving the problem of dispatching endpoints, we need to figure out the route within manual dispatching. The truth is that the cost of manual dispatching is mainly related to the dispatching distance and the farther dispatching distance bring higher dispatching cost. Therefore, when seeking the optimal path, we give priority to the imbalance and distance of the stations. The weight w ij in the undirected graph that is related to distance and imbalance of station is defined as the basis for route optimization. Finally, the Dijkstra algorithm is used to figure out the optimal path of manual dispatching. The details of manual dispatching are shown in Algorithm 1.

Algorithm 1 Man_dispatch(start_station, S(t n ))
Input: The state information of all nodes in STG right moment S(t), the station number to be dispatched start_station, the number of bicycles to be dispatched k. Output: Dispatching path Path, bicycles assignment Alloca.

User Incentive Scheme
The user incentive dispatching algorithm proposed in this paper is based on the idea of Crowdsourcing, which assigns the task of bicycle dispatching to various users of the shared bicycle, so as to achieve the goal of bicycle dispatching. The user incentive dispatching is a kind of micro-cycle dispatching with low cost and wide range, which is suitable for situation with a few bicycles and small dispatching scale. There are two difficulties in user incentive dispatching:

•
The first is how to devise effective incentive strategy to encourage users to accept the Crowdsourcing dispatching task; • The second is how to choose the target station of the detour to make the distribution of bicycle more balanced and reasonable.
For the first question, we do not consider it in the paper due to some complicated inducements like the personal condition, rental moment of bicycle, and the weather. The user incentive dispatching proposed in the paper is to make appropriate strategies to enable users to pay back their bicycles for a better choice and maximize the operator's revenue.
As shown in Section 4.2, we transformed user incentive dispatching into the following mathematical problems: A trip record shows the user going from start_station to end_station. In path1, the user travels directly from start_station to end_station. In path2, the user selects the detour station d 1 and then goes to end_station. In path3, the user selects the detour station d 2 and then goes to end_station. When the user chooses to detour, he will get a incentive cost u (cost u is assumed to be fixed here for the sake of system simplification). In Figure 3, we select all bicycle stations in the r field of the end_station in STG as the candidate detour station set d = {i | i − end_station ≤ r}, where r is the maximum distance a user can walk when detouring. Then, we select the station which has maximum pred i (t) in the detour station set d as the detour node. The details of user incentive dispatching are shown in Algorithm 2.

Algorithm 2 Man_dispatch(end_station, S(t n ))
Input: The state information of all nodes in STG right moment S(t), the destination of the current user end_station. Output: Recommended detour node for user.
Initialize t = t n , end_node = end_station, detour_node = {end_station}, r for each vertex i in G do if i − end_station ≤ r && i = end_station then detour_node {i}; end if end for candidate = end_station; if max i∈detour_node imb i > 0 then candidate = max i∈detour_node imb i ; end if Return candidate.

Experiment Preparation
In this section, we will evaluate our model in simulation to analyze the hybrid dispatching scheme. We first choose the trip data generated by Mobike's operation as source data which is given in an algorithm contest held by Mobike in 2017 [34]. In this paper, we only study and analyze the trip record data in the working day.
It is the procedure of discrete simulation system in Figure 4, where the function Man_dispatch() and User_incented() are respectively the manual dispatching algorithm and user incentive dispatching algorithm proposed in Section 4, and the function Update_mapInfo() is used to update the map status information after dispatching. Before the simulation, we need to filter the source data and preprocess its result. At the same time, we also need to initialize the station state S. When the simulation begins, the system first uses the ARMA model to predict the station demand to update the station status S; then, the system implement dispatching strategy proposed in Section 4. More details are explained below.
Some preparations need to be done before the simulation as follows. The source data are formed as the Table 1 below. Firstly, we utilize the k-means algorithm to cluster all travel data according to its geographical location. Before that, some necessary work needs to be done, such as the conversion of coordinate coded via Geohash, data normalization, and data de-duplication. Then, we perform regional clustering via k-means, whose result is shown in Figure 5.   We calculate the Sum of Squared Error (SSE) of the cluster operation for a better number of clusters. As shown in Figure 5a, we set the number of clusters in the k-means algorithm to 10. The results of the clustering operation on the initial data are shown in Figure 5b. Then, we count the number of trip records in each region which are shown in Figure 5c. From the result, we can see that Zone 5 has the most trip records, which can be seen as a hot spot of trips and selected as the research area. In addition, we select 100 stations in Zone 5 and construct the undirected graph G, which is shown in Figure 5d.
Based on the filtered data in Zone 5, we remove some useless labels and resample it as the format like Table 2, where t is the current moment of simulation, s_type and e_type are the start and end of the trip record, and if_detour describes whether the user in trip record accepts detour for dispatching. In addition to the trip record data, we also need to determine the status S of the station at the initial time, including the number of bicycles in all stations at the initial moment and the demand data at the next moment of all the stations, which can defined as S i (0) = (num i (0), pred i (0)). Several data sets of bicycle distribution conforming to Gaussian distribution are generated by Python to initial the num i (0). The initial distribution of bicycles has a great impact on the performance of system dispatching, which usually acts like bicycles are concentrated in a few stations. In the paper, for a more comprehensive analysis of dispatching strategy, we generate multiple initial distribution data sets and utilize the standard deviation of 100 stations' initial distribution of bicycles σ to describe the concentration of bicycle distribution, which defined as Formula (6): Next, we need to predict the bicycle demand at each station in each time period. Based on the trip record shown in Table 2, we should first build the ARMA model for demand forecasting, which can be divided into three steps and illustrated as follows: (1) Stationary correction of the trip data: The premise of ARMA is that the series are stationary, which means that the statistical characteristics (mean, variance, correlation, etc.) will not change with different time Windows, and the mathematical expression is the same joint distribution. As shown in Figure 6a, we can determine that the trip record is a stationary sequence. (2) Test of white noise: Next, we will judge whether the original sequence is white noise or not. If it is white noise, then the sequence is random disturbance, which cannot be predicted and used. The sequence {e 0 , e 1 , e 2 , ..., e t , ...} is white noise in three conditions as follows: Cov(e t , e t+h ) = 0, h = 0.
We utilize the Ljung-Box test to judge the white noise.
By calculation, we get that p = 1.47620 × 10 −17 when values are up to the lag of h. As a result, we can reject the original hypothesis and assume that the sequence is not a white noise sequence.
(3) Determination of time series lag: Auto-Correlation Factor (ACF) and Partial Auto-Correlation Factor (PACF) are utilized to determine the order of the model. As shown in Figure 6b,c, the appropriate lags of p and q in ARMA model both are 2.
Finally, we build a discrete time dispatching simulation system via Python. As shown in Figure 4, dispatching system enters a state of cycle monitoring after the initializing of simulation. Next, the system perform manual dispatching and user incentive dispatching based on the status S and i f _detour. After the timing is over, the system will collect the number of successful rental orders and the total revenue within the dispatching time. The following Table 3 provides specific simulation parameter settings.

Results and Discussion
The results of the experiment will be analyzed in this section. Before simulation, we need to build a better ARMA model as described above. Below, we first analyze the results of the ARMA model.
We use the previously established ARMA model to perform curve fitting on the original data. As shown in Figure 7a, Residual Sum of Squares (RSS) is used to describe the performance of curve fitting, and our model has achieved good results. As an example, we select any period in the experimental data to predict the demand. After prediction and comparison with the original data, we got the results as shown in Figure 7b. We can see from the prediction results that the overall trends of the forecast curve and the true curve are similar, but the forecast is not accurate sometimes due to the small fluctuation of the bicycle rental, which can be ignored in subsequent dispatching schemes.
Next, we will perform an error analysis on the experimental results. In summary, the final results of the experiment will be affected by two factors which are the initial distribution of bicycles and the trip record. The following is a brief introduction.
Firstly, the initial distribution of bicycles on the map has a greater impact on experimental results. As shown in Formula (6), we generate two maps with different bicycle distributions, which can be indicated by parameter σ. In the traditional public bicycle system, a common dispatching mode is to dispatch excess bicycles at overflow stations directly to an underflow station, where the dispatching distance is taken as the optimization goal. We can call this type of dispatching scheme Commonly Used Manual Dispatching (CUMD). In addition, we refer to the manual dispatching strategy and the hybrid dispatching scheme including manual dispatching and user incentive dispatching proposed in this paper respectively as Manual Dispatching Proposed (MDP) and Hybrid Dispatching Proposed (HDP).  Secondly, the HDP proposed in this paper is also influenced by the proportion of riders in the travel record who are willing to accept user incentive dispatching. We set the step to 0.2 to constantly change the proportion of users in the trip record who are willing to accept dispatching tasks from 0 to 1, so as to conduct multiple sets of experiments.
Finally, the simulation results are as follows, which are listed to five significant digits. In Table 4, we can see the experimental results of user satisfaction for three dispatching methods. From the experimental results, we can see that CUMD is relatively behind HDP and MDP in terms of user satisfaction for almost 0.02. Since our experiment has more than 40,000 trip records, the improvement of user satisfaction exceeding 0.02 is a considerable improvement for the bicycle dispatching system. Furthermore, the MDP and HDP proposed in this paper are roughly the same in terms of user satisfaction. However, the value of HDP is going to change a little bit more due to the integration of user incentive dispatching and experimental results also prove it. As shown in Figure 8, the curves of the operator's total revenue B over time are shown. Firstly, the HDP and MDP schemes have almost the same performance in terms of operator revenue. Then, HDP is consistent with the other two strategies in the early stage of scheduling, but, after a period of scheduling, its performance in terms of operator revenue is better than the other two strategies. From the above simulation results, it shows that the dispatching scheme which combines professional dispatchers and ordinary users proposed in this paper is better than traditional manual dispatching to a certain extent. The manual dispatching strategy proposed in this article can accurately dispatch bicycles to some stations with greater demand according to the prediction results, so that more users can find a bicycle to rent. However, due to the higher cost of manual dispatching, we need to supplement it with a certain amount of user incentive dispatching, which combines the idea of crowdsourcing and assigns dispatching characters to ordinary users at a relatively small cost.

Conclusions
In this paper, we suggest the idea of station imbalance imb i (t) to explain the difference at a time in the future between station demand and the actual number of bicycles at the station. Next, based on greedy ideas, using the sum of the imbalances of all stations as the objective function, we propose a hybrid scheduling strategy that includes manual scheduling and a user incentive schedule. This paper proposed a hybrid dispatching strategy based on bicycle demand data to improve user riding satisfaction while reducing dispatching costs and improving overall revenue for bicycle operators. From the analysis of real-world traffic data in Shanghai from Mobike, it has been shown that the overall trend of daily bicycle trips during the week is cyclical, with a few peaks. Therefore, we clustered the bicycle records according to their starting point to extract bicycle trip stations, and then based on the historical data of bicycle trips, we built an ARMA model to predict the demand at potential stations in the short term. Then, we propose the concept of station imbalance imb i (t) to describe the gap between the demand for the station and the actual number of bicycles at the station at a moment in the future. Next, based on greedy ideas, using the sum of the imbalances of all stations as the objective function, we propose a hybrid dispatching strategy that includes manual dispatching and user incentive dispatching. Finally, we propose two indicators for evaluating dispatching strategies: user satisfaction and the total revenue of bicycle operators, and construct a discrete-time simulation model to simulate and analyze the hybrid scheduling strategy. The simulation experiment results show that the performance of the hybrid dispatching strategy proposed in this paper is better than the traditional bicycle dispatching strategy on both indicators, and it is less affected by the bicycle distribution in map, and can be adjusted to most dispatching scenarios.
For our future research, the forecast of bicycle demand is to be explored in depth with a balance of prediction speed and accuracy. The real-time dispatching strategy requires higher forecasting speed of the station demand forecasting method. Due to the irregular fluctuation of cycling trips caused by the emergency, the real-time scheduling strategy requires higher forecasting speed of the site demand forecasting method, and then improves the accuracy of the forecasting. Second, the incentive strategy in user incentive scheduling needs to be studied in depth, including the reasons that influence whether users accept crowdsourcing tasks, the formulation of appropriate incentive schemes, and the feasibility of user incentive strategies based on starting points. Last but not least, a better combination between manual dispatching and user incentive dispatching should be studied, which can further reduce dispatching costs and improve users' satisfaction.