# Bike-Sharing Fleet Allocation Optimization Based on Demand Gap and Cycle Rebalancing Strategies

Authors: Jianhua Cao; Weixiang Xu; Wenzheng Wang
Journal: Scientific Programming
 (2022)

---

## Abstract

In Bike-Sharing System (BSS), the initial number of bikes at station will affect the time interval and the amount of rebalancing, which is usually empirically determined and does not reflect the characteristics of consumer demand in finer time granularity, thus possibly leading to biased conclusions. In this paper, a fleet allocation method considering demand gap is first proposed to calculate the initial number of bikes at each station. Then, taking the number of demand gap periods as the decision variable, an optimization model is built to minimize the total rebalancing amount. Furthermore, the research periods are divided into multiple subcycles, the single-cycle and multicycle rebalancing strategies are presented, and the additional subcycle rebalancing method is introduced to amend the number of bikes between subcycles to decrease the rebalancing amount of the next subcycle. Finally, our methods are verified in effectively decreasing the rebalancing amount in a long-term rebalancing problem.


---

## Body

## 1. Introduction

In recent years, the rapid expansion of motorized transportation system in cities has made the urban environment deteriorate rapidly and traffic congestion seriously, posing a serious threat to the health and travel convenience of urban residents [1]. Today’s petroleum-based mobility system is making transportation systems face unprecedented pressure. Especially in the past decades, with the accelerated pace of globalization, urbanization, and motorization in the world, energy shortage and environmental pollution are common problems faced by many developed and developing countries [2]. According to official statistics, traffic jams caused urban Americans to travel an extra 8.8 billion hours and purchase an extra 3.3 billion gallons of fuel for a congestion cost of $166 billion. In particular, we can see many cities all over the world sunk in heavy smokes in the winter threatening the health of citizens. Consequently, the search for low-consumption and low-emission transports has become an urgent issue that many researchers and practitioners are willing to challenge. To our relief, many exciting advancements in transportation appear, such as the station-base bike-sharing which is not only a green and healthy way to travel, but also a traffic mode of energy saving and emission reduction. After the first Bike-Sharing System (BSS) appeared in Amsterdam, the Netherlands, the system quickly spread around the world because of its flexibility, economy, and convenience [3]. Compared to motorized transport, BSS provides an alternative to short distance travel, effectively addresses the last mile travel problem, significantly reduces traffic accidents and congestion [4].In BSS, bikes and empty docks are arranged at fixed stations available for users to ride when and where they require. The station has capacity limitations, representing the maximum number of bikes or empty docks at a station. When people require, they rent from the nearest station and, after a short ride, return them to the station closest to their destination. However, when BSS runs, people usually start and finish their riding at two different stations, which often lead to the imbalance of system. The imbalance here means that the bikes or empty docks of a station cannot meet its customer demand, which not only increases economic losses of operators, but also decreases the service quality, thus affecting the normal operation and sustainable development of BSS. An effective solution to this issue is the operators using vehicles to transfer bikes from excessive stations to deficient ones, which is called a bike-sharing rebalancing problem or bike-sharing repositioning problem (BRP).In parallel with the explosion of BSS worldwide, in addition to BRP, experts and scholars have been concerned about the fleet allocation optimization of BSS, such as how many bikes are required for each station during BSS planning stage and how many bikes are configured for each station during rebalancing responding to customer demand for renting and returning bikes, in addition to the extent to which the fleet allocation affects the rebalancing operation and so on.Martinez et al. [5] designed a mixed integer linear program, while Saharidis et al. [6] introduced a pure integer linear program, both of which optimize the station locations, fleet size, and bicycle relocation activities in daily operations. With the deepening of research, Yan et al. [7] developed four planning models for leisure-oriented public bicycle rental systems under deterministic and stochastic demands, respectively. Chen et al. [8] formulated two mathematical programming models to determine the number of bikes maximizing the time interval between repositioning events and the satisfaction of demands. formulated two-stage and multistage stochastic optimization models to determine the optimal number of bikes to assign to each station at the beginning of the service. Vishkaei et al. [9] determined the station capacity and fleet size, taking into account a constraint for the fleet size of the system, then formulated a model using the Jackson network, and developed a genetic algorithm to obtain the proper amounts of variables to balance the inventory of the system.Once station configuration has been determined, the capacity of each station, i.e., the maximum number of bikes and empty docks, is difficult to change in the short term, but the consumer demand for renting and returning bikes is constantly changing over time. Rebalancing is the best option to solve this problem, which is more efficient and economical than replacing the facilities.The vast majority of BRP studies belong to the operator-based BRP, and the objectives of BRP considered in the existing literature are diverse. Most of them are intended to minimize the total rebalancing cost or time from the operator’ s point of view to improve the effectiveness and efficiency of BSS [10, 11]. In addition to these objectives, many of the literature also target customer satisfaction or service level [12]. In recent years, the user-based BRP has received some attention and several incentive strategies have been proposed to encourage users to relocate the bikes among stations [13].The fleet size of the station has a great influence on the rebalancing amount, but only a few scholars have explored their comprehensive optimization; for example, Yuan et al. [14] proposed a unified mixed integer linear programming (MILP) model to provide an integrated solution for the number, location, capacity of bicycle stations, total fleet size design, depot location design, and rebalancing and maintenance plans. Sayarshad et al. [15] proposed a mathematical model which attempted to optimize a BSS by determining the minimum required bike fleet size in order to minimize unmet demand, unutilized bikes, and the need to transport empty bikes between rental stations. Frade and Ribeiro [16] formulated maximal covering models and took the available budget as a constraint to determine the location of new stations, station capacity, number of bikes, and rebalancing quantity. Chen et al. [8] studied how to determine the number of bikes that need to be deployed at stations to maximize the time interval or the satisfaction of demands within a fixed time interval during rebalancing. modeled the evolution of the number of vehicles at each station as a stochastic process and proposed a rebalancing strategy iteratively to solve a chance-constrained optimization problem in order to find a rebalancing schedule ensuring no service failures in the future with a given level of confidence. Being different from previous studies, proposed a framework to obtain the optimal bike fleet size and rebalancing strategy from the life cycle’s perspective.We study how to achieve guaranteed service availability in such systems. Specifically, we are interested in determining (a) the fleet size and (b) a vehicle rebalancing policy that guarantees that (a) every customer will find an available vehicle at the origin station and (b) the customer will find a free parking spot at the destination station. We model the evolution of the number of vehicles at each station as a stochastic process. The proposed rebalancing strategy iteratively solves a chance-constrained optimization problem to find a rebalancing schedule that ensures that no service failures will occur in the future with a given level of confidence. We show that such a chance-constrained optimization problem can be converted into a linear program and efficiently solved.This article seeks answers to two major questions:(i)
How can the fleet allocation (i.e., the initial number of bikes at each station) be determined?(ii)
Are the research periods considered as a cycle (single cycle) or divided into multiple subcycles (multicycle) to rebalance?Then, a series of questions are derived from them, such as whether and to what extent does the initial number of bikes of stations influence the rebalancing interval and amount? Which is better, the single-cycle rebalancing or the multicycle rebalancing? At the same time, if the research periods are divided into subcycles, how is the initial number of bikes of each subcycle determined?Aiming at the above problems, this paper focuses on the fleet allocation and cycle rebalancing of BSS. First, considering the demand gap, a fleet allocation method is proposed to determine the initial number of bikes. Secondly, an optimization model with the objective of minimizing the total rebalancing amount is established. Then, the research periods are divided into subcycles, and a multicycle rebalancing strategy (MCRS) is presented, in which the single-cycle rebalancing strategy (SCRS) is introduced to rebalance in each subcycle and an additional subcycle rebalancing method (ACRM) is proposed to decrease the rebalancing amount of the latter subcycle. Thirdly, a fleet allocation optimization algorithm embedded in the fleet allocation and cycle rebalancing strategy is designed to solve the problem. Finally, the effectiveness of our methods is verified by a large number of experiments.The key contributions of this article are as follows:(i)
A fleet allocation method for determining the initial number of bikes is proposed, which considers the demand gap in finer time granularity.(ii)
A mathematical model is formulated, which takes the number of demand gap periods as decision variables and aims at the objective of minimizing the total rebalancing amount.(iii)
Based on cycle division, a multicycle rebalancing strategy (MCRS) is presented, including a sing-cycle rebalancing strategy (SCRS) and an additional subcycle rebalancing method (ACRM). The cycle division method can give full play to the effect of the fleet allocation method in reducing the rebalancing amount.


## 2. Problem Description and Model Formulation

### 2.1. Problem Description

In order to reveal the effect of the initial number of bikes on the rebalancing interval and amount, we set up two scenarios which have the same daily customer demands, choosing two stations 1 and 2 with different initial number of bikes in the two scenarios, and a datum period of one day, as shown in the table in the upper left of Figure1.Figure 1
The influences of setting different number of bikes at the initial moment on rebalancing.In scenario 1, more bikes were rented from station 1 than were returned on days 1 and 2, resulting in a steady decline in the number of bikes, so that no bikes were available for renting the third day. Similarly, there will be no empty docks at station 2 for customers to return their bikes on that day. Therefore, a rebalancing is required. Furthermore, customers cycle 18 times from station 1 to station 2 and 12 times from station 2 to station 1, resulting in a demand gap of 18−12 = 6 at station 1, meaning that station 1 needs at least 6 bikes to meet the customer demands. Instead, the demand gap at station 2 is −6, standing that station 2 requires 6 empty docks to meet the customer demands of that day. Therefore, at the end of the second day, 6 bikes had to be transported from station 2 to station 1 to meet the customer demands on the third day.During the study periods, more bikes are rented from station 1 than returned each day, so at the beginning of scenario 2, 25 bikes are placed at station 1. In contrast to scenario 1, the rebalancing is delayed by one day to the third day and the rebalancing amount is only 1. Therefore, the use of the demand gap to determine the initial number of bikes at a station can extend the time interval until the next rebalancing and reduce the rebalancing amount. However, existing studies determining the initial number of bikes at stations tend to base on station capacity percentage [17] or the ratio of rental demand to returning demand [18], ignoring the demand gap, which is often subjective and arbitrary.When the initial number of bikes or empty docks of a station plus the demand gap is within its station capacity, this means that the station can meet its customer demand and is defined in this paper as a normal station without having to rebalance. Otherwise, the station is called a problem station and needs to be rebalanced. If the initial number of bikes or empty docks of a station plus multiperiod demand gaps remains within its station capacity, it stands that the station can meet its customer demand for all these periods without having to rebalance. Here the multiperiod demand gaps are defined as a cumulative demand gap value based on how many periods are used to determine the initial number of bikes, called demand gap periods. Problem stations can be further divided into loading and unloading stations. As the name implies, the loading station is a station without enough bikes to meet the rental demand, while the unloading station means that its empty docks are not sufficient to cover the returning demand.In addition, effective rebalancing strategies should also be developed, including the stations that need to be rebalanced, the rebalancing amount of each station, and the route of rebalancing, all of which have a profound impact on the rebalancing.Here is an example, assume that there are four stations in BSS, as can be seen in Figure2. The three figures above a station represent the capacity, the initial number of bikes, and the demand gap of the station, respectively. For instance, at station 1, its capacity and initial number of bikes are 30 and 25, respectively. The demand gap −10 means 10 empty docks are needed to meet its customer demand for the next day, while there are only 5 empty docks currently; thus, 5 bikes are needed to be loaded from station 1. Similarly, stations 2 and 3 can meet their customer demand, while station 4 is required to unload 10 bikes to meet its customer demand the following day. According to the definition of station, stations 1 and 4 are problem stations, further station 1 is loading station and station 4 is unloading station, and stations 2 and 3 are normal stations.Figure 2
Comparison of different rebalancing strategies on rebalancing amount.The two rebalancing strategies are then compared, one of which is the traditional strategy of selecting the closest station to participate in the rebalancing and then extending it from the near to the far stations, regardless of whether they are normal or problem stations. Another is to give priority to rebalance between problem stations, more specifically, between the loading and unloading stations; when one of these types of station disappears, problem stations still exist; then the rebalancing will continue between problem stations and normal stations. The processes of these two rebalancing strategies are shown in Figure2. Obviously, the rebalancing amounts in two strategies are 15 and 10, respectively, indicating that strategy 2 can greatly reduce the rebalancing amount.From the analysis and discussion above, the preliminary conclusions can be easily drawn: (i) setting the appropriate initial number of bikes at stations can reduce the rebalancing amount and increase the interval between rebalances and (ii) effective rebalancing strategy can reduce the rebalancing amount and the workload of operators, while improving customer satisfaction.


### 2.2. Mathematical Model

As mentioned above, demand gap can reflect the customer demand over periods. Considering multiperiod demand gaps to determine the initial number of bikes can effectively extend the time interval of rebalancing and reduce the rebalancing amount. Therefore, the number of demand gap periods needs to be first determined, and the cumulative demand gap value of these periods should be calculated; then rebalancing is performed. In this section, an optimization model is proposed which takes the number of demand gap periods as decision variables and aims at minimizing the total rebalancing amount, which calculates the optimization objective value based on the cumulative rebalancing amount of all periods. The main reason for this is that BRP is a multiple periods problem, if taking a day as found and reducing the total rebalancing amount in multiple periods is of great significance to reduce the rebalancing amount and cost of rebalancing and improve the overall operating efficiency of BSS.


#### 2.2.1. Assumptions

(1)
Take one day as a basic period and perform rebalancing at 24 : 00 every night(2)
The daily demand of each station is known


#### 2.2.2. Sets

S is the set of stations, indexed by i and j where i, j = {1, 2, …, n}T is the set of time periods, indexed by t where t = {1, 2, …, m}


#### 2.2.3. Decision Variables

bit is the number of bikes at station i (i ∈ S) at the beginning of period t (t ∈ T)rijt is the number of bikes rebalanced from station i (i ∈ S) to station j (j ∈ S) at the ending of period t (t ∈ T)zi is the number of demand gap periods of station i (i ∈ S)


#### 2.2.4. Parameters

ci is the capacity of station i (i ∈ S)α is the initial bike availability ratesfit is the rental demand of station i (i ∈ S) during period tgit is the returning demand of station i (i ∈ S) during period tM is the number of periodsBased on the above notations, the following mathematical model can be formulated:(1)min∑t∈T∑i∈S∑j∈Srijt.S.t.(2)bi1=α×ci+∑t=1zifit−git∀i∈S,(3)bi1=0,ifbi1<0ci,ifbi1>ci∀i∈S,(4)bit=bit−1+git−1−fit−1+∑j∈Srjit−1−∑j∈Srijt−1∀i∈S,j∈S,t∈T,(5)0≤bit≤ci∀i∈S,t∈T,(6)1≤zi≤M∀i∈S,(7)bit≥fit−git∀i∈S,t∈T,(8)ci−bit≥git−fit∀i∈S,t∈T,(9)∑j∈Srijt≤bi∀i∈S,t∈T,(10)∑j∈Srjit≤ci−bit∀i∈S,t∈T,(11)bit,rijt∈N∀i∈S,∀j∈S,∀t∈T.The objective function (1) minimizes the total accumulative rebalancing amount of BSS. Constraint (2) is to determine initial number of bikes at station i. Constraint (3) modifies the initial number of bikes at station i. Constraint (4) defines the number of bikes of station i at the beginning of period t, which is the number of bikes at the beginning of period t−1 plus the customer demand of period t−1 plus the rebalancing amount of period t−1. Constraint (5) defines that the number of bikes of station i at the beginning of period t is within the station capacity ci. Constraint (6) defines the demand gap within the longest period. Constraint (7) defines that station i must have enough bikes to meet the rental demand at period t. Constraint (8) defines that station i must have enough empty docks to meet the returning demand at period t. Constraint (9) defines that the number of bikes rebalance from station i is within the station capacity bit. Constraint (10) defines that the number of bikes rebalance to station i is within the station capacity ci-bit. Constraint (11) restricts the domain of the decision variables.


## 2.1. Problem Description

In order to reveal the effect of the initial number of bikes on the rebalancing interval and amount, we set up two scenarios which have the same daily customer demands, choosing two stations 1 and 2 with different initial number of bikes in the two scenarios, and a datum period of one day, as shown in the table in the upper left of Figure1.Figure 1
The influences of setting different number of bikes at the initial moment on rebalancing.In scenario 1, more bikes were rented from station 1 than were returned on days 1 and 2, resulting in a steady decline in the number of bikes, so that no bikes were available for renting the third day. Similarly, there will be no empty docks at station 2 for customers to return their bikes on that day. Therefore, a rebalancing is required. Furthermore, customers cycle 18 times from station 1 to station 2 and 12 times from station 2 to station 1, resulting in a demand gap of 18−12 = 6 at station 1, meaning that station 1 needs at least 6 bikes to meet the customer demands. Instead, the demand gap at station 2 is −6, standing that station 2 requires 6 empty docks to meet the customer demands of that day. Therefore, at the end of the second day, 6 bikes had to be transported from station 2 to station 1 to meet the customer demands on the third day.During the study periods, more bikes are rented from station 1 than returned each day, so at the beginning of scenario 2, 25 bikes are placed at station 1. In contrast to scenario 1, the rebalancing is delayed by one day to the third day and the rebalancing amount is only 1. Therefore, the use of the demand gap to determine the initial number of bikes at a station can extend the time interval until the next rebalancing and reduce the rebalancing amount. However, existing studies determining the initial number of bikes at stations tend to base on station capacity percentage [17] or the ratio of rental demand to returning demand [18], ignoring the demand gap, which is often subjective and arbitrary.When the initial number of bikes or empty docks of a station plus the demand gap is within its station capacity, this means that the station can meet its customer demand and is defined in this paper as a normal station without having to rebalance. Otherwise, the station is called a problem station and needs to be rebalanced. If the initial number of bikes or empty docks of a station plus multiperiod demand gaps remains within its station capacity, it stands that the station can meet its customer demand for all these periods without having to rebalance. Here the multiperiod demand gaps are defined as a cumulative demand gap value based on how many periods are used to determine the initial number of bikes, called demand gap periods. Problem stations can be further divided into loading and unloading stations. As the name implies, the loading station is a station without enough bikes to meet the rental demand, while the unloading station means that its empty docks are not sufficient to cover the returning demand.In addition, effective rebalancing strategies should also be developed, including the stations that need to be rebalanced, the rebalancing amount of each station, and the route of rebalancing, all of which have a profound impact on the rebalancing.Here is an example, assume that there are four stations in BSS, as can be seen in Figure2. The three figures above a station represent the capacity, the initial number of bikes, and the demand gap of the station, respectively. For instance, at station 1, its capacity and initial number of bikes are 30 and 25, respectively. The demand gap −10 means 10 empty docks are needed to meet its customer demand for the next day, while there are only 5 empty docks currently; thus, 5 bikes are needed to be loaded from station 1. Similarly, stations 2 and 3 can meet their customer demand, while station 4 is required to unload 10 bikes to meet its customer demand the following day. According to the definition of station, stations 1 and 4 are problem stations, further station 1 is loading station and station 4 is unloading station, and stations 2 and 3 are normal stations.Figure 2
Comparison of different rebalancing strategies on rebalancing amount.The two rebalancing strategies are then compared, one of which is the traditional strategy of selecting the closest station to participate in the rebalancing and then extending it from the near to the far stations, regardless of whether they are normal or problem stations. Another is to give priority to rebalance between problem stations, more specifically, between the loading and unloading stations; when one of these types of station disappears, problem stations still exist; then the rebalancing will continue between problem stations and normal stations. The processes of these two rebalancing strategies are shown in Figure2. Obviously, the rebalancing amounts in two strategies are 15 and 10, respectively, indicating that strategy 2 can greatly reduce the rebalancing amount.From the analysis and discussion above, the preliminary conclusions can be easily drawn: (i) setting the appropriate initial number of bikes at stations can reduce the rebalancing amount and increase the interval between rebalances and (ii) effective rebalancing strategy can reduce the rebalancing amount and the workload of operators, while improving customer satisfaction.


## 2.2. Mathematical Model

As mentioned above, demand gap can reflect the customer demand over periods. Considering multiperiod demand gaps to determine the initial number of bikes can effectively extend the time interval of rebalancing and reduce the rebalancing amount. Therefore, the number of demand gap periods needs to be first determined, and the cumulative demand gap value of these periods should be calculated; then rebalancing is performed. In this section, an optimization model is proposed which takes the number of demand gap periods as decision variables and aims at minimizing the total rebalancing amount, which calculates the optimization objective value based on the cumulative rebalancing amount of all periods. The main reason for this is that BRP is a multiple periods problem, if taking a day as found and reducing the total rebalancing amount in multiple periods is of great significance to reduce the rebalancing amount and cost of rebalancing and improve the overall operating efficiency of BSS.


### 2.2.1. Assumptions

(1)
Take one day as a basic period and perform rebalancing at 24 : 00 every night(2)
The daily demand of each station is known


### 2.2.2. Sets

S is the set of stations, indexed by i and j where i, j = {1, 2, …, n}T is the set of time periods, indexed by t where t = {1, 2, …, m}


### 2.2.3. Decision Variables

bit is the number of bikes at station i (i ∈ S) at the beginning of period t (t ∈ T)rijt is the number of bikes rebalanced from station i (i ∈ S) to station j (j ∈ S) at the ending of period t (t ∈ T)zi is the number of demand gap periods of station i (i ∈ S)


### 2.2.4. Parameters

ci is the capacity of station i (i ∈ S)α is the initial bike availability ratesfit is the rental demand of station i (i ∈ S) during period tgit is the returning demand of station i (i ∈ S) during period tM is the number of periodsBased on the above notations, the following mathematical model can be formulated:(1)min∑t∈T∑i∈S∑j∈Srijt.S.t.(2)bi1=α×ci+∑t=1zifit−git∀i∈S,(3)bi1=0,ifbi1<0ci,ifbi1>ci∀i∈S,(4)bit=bit−1+git−1−fit−1+∑j∈Srjit−1−∑j∈Srijt−1∀i∈S,j∈S,t∈T,(5)0≤bit≤ci∀i∈S,t∈T,(6)1≤zi≤M∀i∈S,(7)bit≥fit−git∀i∈S,t∈T,(8)ci−bit≥git−fit∀i∈S,t∈T,(9)∑j∈Srijt≤bi∀i∈S,t∈T,(10)∑j∈Srjit≤ci−bit∀i∈S,t∈T,(11)bit,rijt∈N∀i∈S,∀j∈S,∀t∈T.The objective function (1) minimizes the total accumulative rebalancing amount of BSS. Constraint (2) is to determine initial number of bikes at station i. Constraint (3) modifies the initial number of bikes at station i. Constraint (4) defines the number of bikes of station i at the beginning of period t, which is the number of bikes at the beginning of period t−1 plus the customer demand of period t−1 plus the rebalancing amount of period t−1. Constraint (5) defines that the number of bikes of station i at the beginning of period t is within the station capacity ci. Constraint (6) defines the demand gap within the longest period. Constraint (7) defines that station i must have enough bikes to meet the rental demand at period t. Constraint (8) defines that station i must have enough empty docks to meet the returning demand at period t. Constraint (9) defines that the number of bikes rebalance from station i is within the station capacity bit. Constraint (10) defines that the number of bikes rebalance to station i is within the station capacity ci-bit. Constraint (11) restricts the domain of the decision variables.


## 2.2.1. Assumptions

(1)
Take one day as a basic period and perform rebalancing at 24 : 00 every night(2)
The daily demand of each station is known


## 2.2.2. Sets

S is the set of stations, indexed by i and j where i, j = {1, 2, …, n}T is the set of time periods, indexed by t where t = {1, 2, …, m}


## 2.2.3. Decision Variables

bit is the number of bikes at station i (i ∈ S) at the beginning of period t (t ∈ T)rijt is the number of bikes rebalanced from station i (i ∈ S) to station j (j ∈ S) at the ending of period t (t ∈ T)zi is the number of demand gap periods of station i (i ∈ S)


## 2.2.4. Parameters

ci is the capacity of station i (i ∈ S)α is the initial bike availability ratesfit is the rental demand of station i (i ∈ S) during period tgit is the returning demand of station i (i ∈ S) during period tM is the number of periodsBased on the above notations, the following mathematical model can be formulated:(1)min∑t∈T∑i∈S∑j∈Srijt.S.t.(2)bi1=α×ci+∑t=1zifit−git∀i∈S,(3)bi1=0,ifbi1<0ci,ifbi1>ci∀i∈S,(4)bit=bit−1+git−1−fit−1+∑j∈Srjit−1−∑j∈Srijt−1∀i∈S,j∈S,t∈T,(5)0≤bit≤ci∀i∈S,t∈T,(6)1≤zi≤M∀i∈S,(7)bit≥fit−git∀i∈S,t∈T,(8)ci−bit≥git−fit∀i∈S,t∈T,(9)∑j∈Srijt≤bi∀i∈S,t∈T,(10)∑j∈Srjit≤ci−bit∀i∈S,t∈T,(11)bit,rijt∈N∀i∈S,∀j∈S,∀t∈T.The objective function (1) minimizes the total accumulative rebalancing amount of BSS. Constraint (2) is to determine initial number of bikes at station i. Constraint (3) modifies the initial number of bikes at station i. Constraint (4) defines the number of bikes of station i at the beginning of period t, which is the number of bikes at the beginning of period t−1 plus the customer demand of period t−1 plus the rebalancing amount of period t−1. Constraint (5) defines that the number of bikes of station i at the beginning of period t is within the station capacity ci. Constraint (6) defines the demand gap within the longest period. Constraint (7) defines that station i must have enough bikes to meet the rental demand at period t. Constraint (8) defines that station i must have enough empty docks to meet the returning demand at period t. Constraint (9) defines that the number of bikes rebalance from station i is within the station capacity bit. Constraint (10) defines that the number of bikes rebalance to station i is within the station capacity ci-bit. Constraint (11) restricts the domain of the decision variables.


## 3. A Fleet Allocation Optimization Algorithm Based on Demand Gap and Cycle Rebalancing Strategy

In this paper, a day is taken as a basic period instead of an hour, mainly because hourly user demand is constantly changing; in particular, there are morning and evening rush hours during the working day that are difficult to track. Furthermore, rebalance is usually carried out at night when the number of bike-sharing used is very low, so that the impact of changes in user demand on the rebalancing can be largely ignored.Based on demand gap periods, an optimization method determining the initial number of bikes for each station is first proposed in this section. Then, the research periods are divided into multiple subcycles and a multicycle rebalancing strategy (MCRS) is presented, in which a single-cycle rebalancing strategy (SCRS) is introduced to rebalance in each subcycle and an additional subcycle rebalancing method (ACRM) is also developed to amend the rebalancing amount between subcycles.


### 3.1. A Fleet Allocation Method considering Demand Gap (FAMDG)

We propose a method to determine the initial number of bikes at each station using demand gap periods, referred to as FAMDG, which can reflect changes in customer demand of each station in future periods. Start with determining the basic number of bikes at stationi referring to the percentage capacity [17]; α is the percentage of capacity ci, as shown in the following equation: (12)bi1=α×ci.The demand gap of stationi is the difference between the rental amount and returning amount, as shown in the following equation: (13)Git=fit−git.Then, the initial number of bikes at stationi in the first period bi1 is calculated by the basic number of bikes at station i plus the demand gap of station i in the first period, as shown in (14). If bi1 is still within the capacity of station i, it means that bi1 determined in this way can meet the customer demand and station i without requiring rebalancing.(14)bi1=α×ci+fi1−gi1.By the same token, the initial number of bikes of stationi in multiple periods is still within the station capacity, that denotes bi1 determined in this way can meet the multiperiod customer demands without having to rebalance, as seen in equation (2). However, the multiperiod demand gaps at a station change over time and they either exceed the station capacity or are negative. So, it is not the more the demand gap periods, the more optimal the initial number of bikes. Therefore, the number of demand gap periods should be optimized. At the same time, in order to prevent the initial number of bikes from exceeding the station capacity, equation (3) is used to correct it, i.e., if the initial number of bikes obtained by equation (2) exceeds the station capacity, it will be set to the station capacity, and if it is less than 0, to zero.


### 3.2. Cycle Rebalancing Strategy

#### 3.2.1. The Single-Cycle Rebalancing Strategy

We treat the research periods as one cycle and propose the single-cycle rebalancing strategy (SCRS). In SCRS, the rebalancing is conducted at the end of each period except for the last, and the number of rebalancing operations is the periods minus 1.Now letbit’ represent the number of bikes at the end of period t, which equals the number of bikes bit at the beginning of period t plus the demand gap Git of period t, seen in equation (15), and Gi(t + 1) represents the demand gap of period t + 1; then Zit represents station classification value which equals bit’ plus Gi(t + 1), as can be seen in equation (16). According to Zit, all stations can be divided into problem stations and normal stations, and problem stations can also be further divided into loading and unloading stations. If Zit < 0, it means that bikes need to be loaded to station i in period t to meet its customer rental demand, which is defined as loading station, and the number of bikes to be loaded is referred to as loading amount; if 0 <Zit < ci, it means that bikes or empty docks of station i in period t can meet its customer rental and returning demand, which is defined as normal station; if Zit > ci, it means that station i does not have enough empty docks to meet its customer returning demand; thus, bikes need to be unloaded from it, which is referred to as unloading station and the number of bikes to be unloaded is defined as unloading amount, as shown in the following equation:(15)bit′=bit+Git,(16)Zit=bit′+Git+1,(17)ifZit<0,then stationi∈the set of loading stationsI,ifZit>ci,then stationi∈the set of unloading stationsE,if0<Zit<ci,then stationi∈the set of normal stationsN.Then calculate the rebalancing amounteit of problem station i in period t. If station i is a loading station, its rebalancing amount is 0 minus Zit, and if station i is an unloading station, its rebalancing amount is Zit minus Ci, seen in (18). Moreover, according to eit of each station, the rebalancing between loading and unloading stations is carried out in order from near to far, mainly according to the actual distance to judge.(18)eit=0−Zit,ifi∈I,Zit−ci,ifi∈E.At the end of the rebalancing between problem stations, once thebi(t + 1) of problem station i is within its capacity, it becomes a normal station. If there still are problem stations, rebalancing is done between problem stations and normal stations until all stations become normal stations.The pseudocode of SCRS during periodt is shown as Algorithm 1.Algorithm 1: The single-cycle rebalancing strategy.
Input: The number of bikes at the end of period t of station ibit′i=1n, Demand gap of period t+1 of station iGit+1i=1n, Station capacity cii=1nOutput: Rebalancing amount ∑i∈S∑j∈Srijtfori=1 to ndostation classificationZit=bit′+Git+1ifZit>cithenthe unloading amount at stationi is eit=Zit−ci, station i belongs to the set of unloading stations Eelse ifZit<0thenthe loading amount at stationi is eit=0−Zit, station i belongs to the set of loading stations Ielsestationi belongs to the set of normal stations NendConduct rebalancing amountrijt between problem stations in sequence from near to far;fori=1 to ndoif0≤Zit+∑j∈Irjit−∑j∈Erijt≤cithenstationi belongs to the set of normal stations NendwhileEorIisnotemptysetdoConduct rebalancing amountrijt between problem stations and normal stations in sequence from near to farendreturn∑i∈S∑j∈Srijt


#### 3.2.2. The Multicycle Rebalancing Strategy

In this section, the research periods are divided into multiple subcycles and a multicycle rebalancing strategy (MCRS) is proposed. Note that, in each subcycle, the initial number of bikes is calculated by FAMDG and SCRS is conducted. The main purpose of dividing subcycle is to make full use of FAMDG in each subcycle. However, the initial number of bikes at stations in each subcycle is determined based on the cumulative demand gaps of all periods in the subcycle, and the number of bikes at the end of the subcycle is obtained through SCRS. Obviously, the numbers of bikes at the end of one subcycle and the beginning of the next are determined in different ways, so the two numbers are usually not equal. If the former is adjusted to the latter between the two subcycles, the effect of the fleet allocation on rebalancing can be applied to each subcycle. Therefore, this paper proposes an additional subcycle rebalancing method (ACRM) to rebalance between subcycles.The ACRM begins with the loading and unloading stations being redefined at the end of each subcycle. If the number of bikes of a station at the end of a subcycle is less than the number of bikes calculated based on demand gap periods for the next subcycle, it is redefined as an unloading station; otherwise, it is redefined as a loading station. The number of bikes calculated based on demand gap periods in the next subcycle is then used as a reference value, and then rebalancing is conducted between loading and unloading stations in order to bring the number of bikes at the end of the previous subcycle close to the reference value until one of the sets of loading and unloading stations is empty.Algorithm2 is a pseudocode flowchart of MCRS.Algorithm 2: The multicycle rebalancing strategy.
Input: Number of data periods l, Number of bikes at station i at the beginning of a cycle cbic8i=1n, Rental demand of period tfiti=1n, Returning demand of period tgiti=1n, Station capacity cii=1nOutput: Rebalancing amount ∑t=1m∑i=1n∑j=1nrijt+∑c=1q−1∑i=1n∑j=1nrijce Divide l periods into q subcycles, each cycle has z=l/q periods;forc=1 to qdoford=1 to zdoImplement SCRSendifc≠qthenget the number of bikes of stationi at the end of cycle cbice;ifbice>bic+18thenthe unloading amount at the stationi is eic=bice−bic+18; station i belongs to the set of unloading stations Eelse ifbice<bic+18thenthe unloading amount at stationi is eic=bic+18−bice; station i belong to the set of normal stations Ielsestationi belongs to the set of normal stations NConduct rebalancing amountrijte between problem stations in sequence from near to far;ifbice+∑j∈Irjice−∑j∈Erijce=bic+18thenstationi belongs to the set of normal stations NendwhileEorIisnotemptysetdoConduct rebalancing amountrijc between problem stations and normal stations in sequence fron near to farendendendreturn∑t=1m∑i=1n∑j=1nrijt+∑c=1q−1∑i=1n∑j=1nrijce


### 3.3. Algorithm Flow

Compared with traditional optimization algorithms, genetic algorithm starts from the string set of the solution rather than from a single solution, which has a large coverage and is advantageous to global optimization. In order to reduce the complexity of the problem, a single-cycle rebalancing strategy and a multicycle rebalancing strategy are embedded in the single-cycle and multicycle rebalancing problem, and a fleet allocation method taking into account demand gap is proposed that can further improve the search speed of the algorithm and find better solutions.


#### 3.3.1. Encoding

In this paper, each cell on a chromosome represents the cumulative demand gap periods at a station. Figure3 is an example of a chromosome structure consisting of six stations, each location representing a station and the figure denoting the cumulative demand gap periods at the station. Therefore, the cumulative demand gap periods of the six stations are 3, 4, 2, 7, 5, and 3, respectively. For instance, 3 is the cumulative demand gap periods of the first station, similarly as 4, 2, 7, 5, and 3.Figure 3
An example of a chromosome structure.


#### 3.3.2. Initialization

Initialization is the first step in genetic algorithm [19] and the first population is generated during initialization. The value of each cell in the chromosome is randomly generated within the range [1, m], of which m is the maximum value of periods. When M chromosomes are generated, the initialization ends.


#### 3.3.3. Function Fitness

According to equations (2) and (3), the initial number of bikes is calculated by the demand gap periods optimization (DGPO). Then, perform rebalancing by SCRS or MCRS. Once the SCRS or MCRS is executed, the total cumulative rebalance amount can be obtained. At the same time, the minimum rebalancing amount is regarded as the objective function; see equation (1); therefore, the reciprocal of the objective function is selected as the adaptive evaluation function fi.


#### 3.3.4. Selection

This section uses roulette wheel strategy for selection, and the general steps of the strategy are as follows:(1)
The fitness valuefi of an individual in population is superimposed to obtain the total fitness value F=∑i=1Nfi, where N is the number of individuals in the population.(2)
The fitness value of each individual is divided by the total fitness value to determine the probability of the individual being selectedpi = fi/F.(3)
Calculate the cumulative probability of individuals to construct a roulette wheel.(4)
Roulette selection: generate a random number at intervals of [0,1]. If the random number is less than or equal to the cumulative probability of an individuali and is greater than the cumulative probability of individual i-1, the individual is selected to enter the next offspring population.


#### 3.3.5. Crossover

This section uses a unified crossover strategy which exchanges the intersection point on the patrilineal individual based on probability to generate two new individuals. The general steps of this strategy are as follows:(1)
Two individuals are randomly chosen from parents(2)
Crossover points are swapped according to probabilityThe process of unified crossover is shown in Figure4.Figure 4
The process of uniform crossing.


#### 3.3.6. Mutation

The strategy has two purposes: one is to make the genetic algorithm have the ability of local stochastic searching and the other is to make the genetic algorithm maintain the diversity of the population to prevent immature convergence. In this paper, a unified variation method is used to replace each gene value in an individual with a lower probability of random numbers within the range of [1,m].


## 3.1. A Fleet Allocation Method considering Demand Gap (FAMDG)

We propose a method to determine the initial number of bikes at each station using demand gap periods, referred to as FAMDG, which can reflect changes in customer demand of each station in future periods. Start with determining the basic number of bikes at stationi referring to the percentage capacity [17]; α is the percentage of capacity ci, as shown in the following equation: (12)bi1=α×ci.The demand gap of stationi is the difference between the rental amount and returning amount, as shown in the following equation: (13)Git=fit−git.Then, the initial number of bikes at stationi in the first period bi1 is calculated by the basic number of bikes at station i plus the demand gap of station i in the first period, as shown in (14). If bi1 is still within the capacity of station i, it means that bi1 determined in this way can meet the customer demand and station i without requiring rebalancing.(14)bi1=α×ci+fi1−gi1.By the same token, the initial number of bikes of stationi in multiple periods is still within the station capacity, that denotes bi1 determined in this way can meet the multiperiod customer demands without having to rebalance, as seen in equation (2). However, the multiperiod demand gaps at a station change over time and they either exceed the station capacity or are negative. So, it is not the more the demand gap periods, the more optimal the initial number of bikes. Therefore, the number of demand gap periods should be optimized. At the same time, in order to prevent the initial number of bikes from exceeding the station capacity, equation (3) is used to correct it, i.e., if the initial number of bikes obtained by equation (2) exceeds the station capacity, it will be set to the station capacity, and if it is less than 0, to zero.


## 3.2. Cycle Rebalancing Strategy

### 3.2.1. The Single-Cycle Rebalancing Strategy

We treat the research periods as one cycle and propose the single-cycle rebalancing strategy (SCRS). In SCRS, the rebalancing is conducted at the end of each period except for the last, and the number of rebalancing operations is the periods minus 1.Now letbit’ represent the number of bikes at the end of period t, which equals the number of bikes bit at the beginning of period t plus the demand gap Git of period t, seen in equation (15), and Gi(t + 1) represents the demand gap of period t + 1; then Zit represents station classification value which equals bit’ plus Gi(t + 1), as can be seen in equation (16). According to Zit, all stations can be divided into problem stations and normal stations, and problem stations can also be further divided into loading and unloading stations. If Zit < 0, it means that bikes need to be loaded to station i in period t to meet its customer rental demand, which is defined as loading station, and the number of bikes to be loaded is referred to as loading amount; if 0 <Zit < ci, it means that bikes or empty docks of station i in period t can meet its customer rental and returning demand, which is defined as normal station; if Zit > ci, it means that station i does not have enough empty docks to meet its customer returning demand; thus, bikes need to be unloaded from it, which is referred to as unloading station and the number of bikes to be unloaded is defined as unloading amount, as shown in the following equation:(15)bit′=bit+Git,(16)Zit=bit′+Git+1,(17)ifZit<0,then stationi∈the set of loading stationsI,ifZit>ci,then stationi∈the set of unloading stationsE,if0<Zit<ci,then stationi∈the set of normal stationsN.Then calculate the rebalancing amounteit of problem station i in period t. If station i is a loading station, its rebalancing amount is 0 minus Zit, and if station i is an unloading station, its rebalancing amount is Zit minus Ci, seen in (18). Moreover, according to eit of each station, the rebalancing between loading and unloading stations is carried out in order from near to far, mainly according to the actual distance to judge.(18)eit=0−Zit,ifi∈I,Zit−ci,ifi∈E.At the end of the rebalancing between problem stations, once thebi(t + 1) of problem station i is within its capacity, it becomes a normal station. If there still are problem stations, rebalancing is done between problem stations and normal stations until all stations become normal stations.The pseudocode of SCRS during periodt is shown as Algorithm 1.Algorithm 1: The single-cycle rebalancing strategy.
Input: The number of bikes at the end of period t of station ibit′i=1n, Demand gap of period t+1 of station iGit+1i=1n, Station capacity cii=1nOutput: Rebalancing amount ∑i∈S∑j∈Srijtfori=1 to ndostation classificationZit=bit′+Git+1ifZit>cithenthe unloading amount at stationi is eit=Zit−ci, station i belongs to the set of unloading stations Eelse ifZit<0thenthe loading amount at stationi is eit=0−Zit, station i belongs to the set of loading stations Ielsestationi belongs to the set of normal stations NendConduct rebalancing amountrijt between problem stations in sequence from near to far;fori=1 to ndoif0≤Zit+∑j∈Irjit−∑j∈Erijt≤cithenstationi belongs to the set of normal stations NendwhileEorIisnotemptysetdoConduct rebalancing amountrijt between problem stations and normal stations in sequence from near to farendreturn∑i∈S∑j∈Srijt


### 3.2.2. The Multicycle Rebalancing Strategy

In this section, the research periods are divided into multiple subcycles and a multicycle rebalancing strategy (MCRS) is proposed. Note that, in each subcycle, the initial number of bikes is calculated by FAMDG and SCRS is conducted. The main purpose of dividing subcycle is to make full use of FAMDG in each subcycle. However, the initial number of bikes at stations in each subcycle is determined based on the cumulative demand gaps of all periods in the subcycle, and the number of bikes at the end of the subcycle is obtained through SCRS. Obviously, the numbers of bikes at the end of one subcycle and the beginning of the next are determined in different ways, so the two numbers are usually not equal. If the former is adjusted to the latter between the two subcycles, the effect of the fleet allocation on rebalancing can be applied to each subcycle. Therefore, this paper proposes an additional subcycle rebalancing method (ACRM) to rebalance between subcycles.The ACRM begins with the loading and unloading stations being redefined at the end of each subcycle. If the number of bikes of a station at the end of a subcycle is less than the number of bikes calculated based on demand gap periods for the next subcycle, it is redefined as an unloading station; otherwise, it is redefined as a loading station. The number of bikes calculated based on demand gap periods in the next subcycle is then used as a reference value, and then rebalancing is conducted between loading and unloading stations in order to bring the number of bikes at the end of the previous subcycle close to the reference value until one of the sets of loading and unloading stations is empty.Algorithm2 is a pseudocode flowchart of MCRS.Algorithm 2: The multicycle rebalancing strategy.
Input: Number of data periods l, Number of bikes at station i at the beginning of a cycle cbic8i=1n, Rental demand of period tfiti=1n, Returning demand of period tgiti=1n, Station capacity cii=1nOutput: Rebalancing amount ∑t=1m∑i=1n∑j=1nrijt+∑c=1q−1∑i=1n∑j=1nrijce Divide l periods into q subcycles, each cycle has z=l/q periods;forc=1 to qdoford=1 to zdoImplement SCRSendifc≠qthenget the number of bikes of stationi at the end of cycle cbice;ifbice>bic+18thenthe unloading amount at the stationi is eic=bice−bic+18; station i belongs to the set of unloading stations Eelse ifbice<bic+18thenthe unloading amount at stationi is eic=bic+18−bice; station i belong to the set of normal stations Ielsestationi belongs to the set of normal stations NConduct rebalancing amountrijte between problem stations in sequence from near to far;ifbice+∑j∈Irjice−∑j∈Erijce=bic+18thenstationi belongs to the set of normal stations NendwhileEorIisnotemptysetdoConduct rebalancing amountrijc between problem stations and normal stations in sequence fron near to farendendendreturn∑t=1m∑i=1n∑j=1nrijt+∑c=1q−1∑i=1n∑j=1nrijce


## 3.2.1. The Single-Cycle Rebalancing Strategy

We treat the research periods as one cycle and propose the single-cycle rebalancing strategy (SCRS). In SCRS, the rebalancing is conducted at the end of each period except for the last, and the number of rebalancing operations is the periods minus 1.Now letbit’ represent the number of bikes at the end of period t, which equals the number of bikes bit at the beginning of period t plus the demand gap Git of period t, seen in equation (15), and Gi(t + 1) represents the demand gap of period t + 1; then Zit represents station classification value which equals bit’ plus Gi(t + 1), as can be seen in equation (16). According to Zit, all stations can be divided into problem stations and normal stations, and problem stations can also be further divided into loading and unloading stations. If Zit < 0, it means that bikes need to be loaded to station i in period t to meet its customer rental demand, which is defined as loading station, and the number of bikes to be loaded is referred to as loading amount; if 0 <Zit < ci, it means that bikes or empty docks of station i in period t can meet its customer rental and returning demand, which is defined as normal station; if Zit > ci, it means that station i does not have enough empty docks to meet its customer returning demand; thus, bikes need to be unloaded from it, which is referred to as unloading station and the number of bikes to be unloaded is defined as unloading amount, as shown in the following equation:(15)bit′=bit+Git,(16)Zit=bit′+Git+1,(17)ifZit<0,then stationi∈the set of loading stationsI,ifZit>ci,then stationi∈the set of unloading stationsE,if0<Zit<ci,then stationi∈the set of normal stationsN.Then calculate the rebalancing amounteit of problem station i in period t. If station i is a loading station, its rebalancing amount is 0 minus Zit, and if station i is an unloading station, its rebalancing amount is Zit minus Ci, seen in (18). Moreover, according to eit of each station, the rebalancing between loading and unloading stations is carried out in order from near to far, mainly according to the actual distance to judge.(18)eit=0−Zit,ifi∈I,Zit−ci,ifi∈E.At the end of the rebalancing between problem stations, once thebi(t + 1) of problem station i is within its capacity, it becomes a normal station. If there still are problem stations, rebalancing is done between problem stations and normal stations until all stations become normal stations.The pseudocode of SCRS during periodt is shown as Algorithm 1.Algorithm 1: The single-cycle rebalancing strategy.
Input: The number of bikes at the end of period t of station ibit′i=1n, Demand gap of period t+1 of station iGit+1i=1n, Station capacity cii=1nOutput: Rebalancing amount ∑i∈S∑j∈Srijtfori=1 to ndostation classificationZit=bit′+Git+1ifZit>cithenthe unloading amount at stationi is eit=Zit−ci, station i belongs to the set of unloading stations Eelse ifZit<0thenthe loading amount at stationi is eit=0−Zit, station i belongs to the set of loading stations Ielsestationi belongs to the set of normal stations NendConduct rebalancing amountrijt between problem stations in sequence from near to far;fori=1 to ndoif0≤Zit+∑j∈Irjit−∑j∈Erijt≤cithenstationi belongs to the set of normal stations NendwhileEorIisnotemptysetdoConduct rebalancing amountrijt between problem stations and normal stations in sequence from near to farendreturn∑i∈S∑j∈Srijt


## 3.2.2. The Multicycle Rebalancing Strategy

In this section, the research periods are divided into multiple subcycles and a multicycle rebalancing strategy (MCRS) is proposed. Note that, in each subcycle, the initial number of bikes is calculated by FAMDG and SCRS is conducted. The main purpose of dividing subcycle is to make full use of FAMDG in each subcycle. However, the initial number of bikes at stations in each subcycle is determined based on the cumulative demand gaps of all periods in the subcycle, and the number of bikes at the end of the subcycle is obtained through SCRS. Obviously, the numbers of bikes at the end of one subcycle and the beginning of the next are determined in different ways, so the two numbers are usually not equal. If the former is adjusted to the latter between the two subcycles, the effect of the fleet allocation on rebalancing can be applied to each subcycle. Therefore, this paper proposes an additional subcycle rebalancing method (ACRM) to rebalance between subcycles.The ACRM begins with the loading and unloading stations being redefined at the end of each subcycle. If the number of bikes of a station at the end of a subcycle is less than the number of bikes calculated based on demand gap periods for the next subcycle, it is redefined as an unloading station; otherwise, it is redefined as a loading station. The number of bikes calculated based on demand gap periods in the next subcycle is then used as a reference value, and then rebalancing is conducted between loading and unloading stations in order to bring the number of bikes at the end of the previous subcycle close to the reference value until one of the sets of loading and unloading stations is empty.Algorithm2 is a pseudocode flowchart of MCRS.Algorithm 2: The multicycle rebalancing strategy.
Input: Number of data periods l, Number of bikes at station i at the beginning of a cycle cbic8i=1n, Rental demand of period tfiti=1n, Returning demand of period tgiti=1n, Station capacity cii=1nOutput: Rebalancing amount ∑t=1m∑i=1n∑j=1nrijt+∑c=1q−1∑i=1n∑j=1nrijce Divide l periods into q subcycles, each cycle has z=l/q periods;forc=1 to qdoford=1 to zdoImplement SCRSendifc≠qthenget the number of bikes of stationi at the end of cycle cbice;ifbice>bic+18thenthe unloading amount at the stationi is eic=bice−bic+18; station i belongs to the set of unloading stations Eelse ifbice<bic+18thenthe unloading amount at stationi is eic=bic+18−bice; station i belong to the set of normal stations Ielsestationi belongs to the set of normal stations NConduct rebalancing amountrijte between problem stations in sequence from near to far;ifbice+∑j∈Irjice−∑j∈Erijce=bic+18thenstationi belongs to the set of normal stations NendwhileEorIisnotemptysetdoConduct rebalancing amountrijc between problem stations and normal stations in sequence fron near to farendendendreturn∑t=1m∑i=1n∑j=1nrijt+∑c=1q−1∑i=1n∑j=1nrijce


## 3.3. Algorithm Flow

Compared with traditional optimization algorithms, genetic algorithm starts from the string set of the solution rather than from a single solution, which has a large coverage and is advantageous to global optimization. In order to reduce the complexity of the problem, a single-cycle rebalancing strategy and a multicycle rebalancing strategy are embedded in the single-cycle and multicycle rebalancing problem, and a fleet allocation method taking into account demand gap is proposed that can further improve the search speed of the algorithm and find better solutions.


### 3.3.1. Encoding

In this paper, each cell on a chromosome represents the cumulative demand gap periods at a station. Figure3 is an example of a chromosome structure consisting of six stations, each location representing a station and the figure denoting the cumulative demand gap periods at the station. Therefore, the cumulative demand gap periods of the six stations are 3, 4, 2, 7, 5, and 3, respectively. For instance, 3 is the cumulative demand gap periods of the first station, similarly as 4, 2, 7, 5, and 3.Figure 3
An example of a chromosome structure.


### 3.3.2. Initialization

Initialization is the first step in genetic algorithm [19] and the first population is generated during initialization. The value of each cell in the chromosome is randomly generated within the range [1, m], of which m is the maximum value of periods. When M chromosomes are generated, the initialization ends.


### 3.3.3. Function Fitness

According to equations (2) and (3), the initial number of bikes is calculated by the demand gap periods optimization (DGPO). Then, perform rebalancing by SCRS or MCRS. Once the SCRS or MCRS is executed, the total cumulative rebalance amount can be obtained. At the same time, the minimum rebalancing amount is regarded as the objective function; see equation (1); therefore, the reciprocal of the objective function is selected as the adaptive evaluation function fi.


### 3.3.4. Selection

This section uses roulette wheel strategy for selection, and the general steps of the strategy are as follows:(1)
The fitness valuefi of an individual in population is superimposed to obtain the total fitness value F=∑i=1Nfi, where N is the number of individuals in the population.(2)
The fitness value of each individual is divided by the total fitness value to determine the probability of the individual being selectedpi = fi/F.(3)
Calculate the cumulative probability of individuals to construct a roulette wheel.(4)
Roulette selection: generate a random number at intervals of [0,1]. If the random number is less than or equal to the cumulative probability of an individuali and is greater than the cumulative probability of individual i-1, the individual is selected to enter the next offspring population.


### 3.3.5. Crossover

This section uses a unified crossover strategy which exchanges the intersection point on the patrilineal individual based on probability to generate two new individuals. The general steps of this strategy are as follows:(1)
Two individuals are randomly chosen from parents(2)
Crossover points are swapped according to probabilityThe process of unified crossover is shown in Figure4.Figure 4
The process of uniform crossing.


### 3.3.6. Mutation

The strategy has two purposes: one is to make the genetic algorithm have the ability of local stochastic searching and the other is to make the genetic algorithm maintain the diversity of the population to prevent immature convergence. In this paper, a unified variation method is used to replace each gene value in an individual with a lower probability of random numbers within the range of [1,m].


## 3.3.1. Encoding

In this paper, each cell on a chromosome represents the cumulative demand gap periods at a station. Figure3 is an example of a chromosome structure consisting of six stations, each location representing a station and the figure denoting the cumulative demand gap periods at the station. Therefore, the cumulative demand gap periods of the six stations are 3, 4, 2, 7, 5, and 3, respectively. For instance, 3 is the cumulative demand gap periods of the first station, similarly as 4, 2, 7, 5, and 3.Figure 3
An example of a chromosome structure.


## 3.3.2. Initialization

Initialization is the first step in genetic algorithm [19] and the first population is generated during initialization. The value of each cell in the chromosome is randomly generated within the range [1, m], of which m is the maximum value of periods. When M chromosomes are generated, the initialization ends.


## 3.3.3. Function Fitness

According to equations (2) and (3), the initial number of bikes is calculated by the demand gap periods optimization (DGPO). Then, perform rebalancing by SCRS or MCRS. Once the SCRS or MCRS is executed, the total cumulative rebalance amount can be obtained. At the same time, the minimum rebalancing amount is regarded as the objective function; see equation (1); therefore, the reciprocal of the objective function is selected as the adaptive evaluation function fi.


## 3.3.4. Selection

This section uses roulette wheel strategy for selection, and the general steps of the strategy are as follows:(1)
The fitness valuefi of an individual in population is superimposed to obtain the total fitness value F=∑i=1Nfi, where N is the number of individuals in the population.(2)
The fitness value of each individual is divided by the total fitness value to determine the probability of the individual being selectedpi = fi/F.(3)
Calculate the cumulative probability of individuals to construct a roulette wheel.(4)
Roulette selection: generate a random number at intervals of [0,1]. If the random number is less than or equal to the cumulative probability of an individuali and is greater than the cumulative probability of individual i-1, the individual is selected to enter the next offspring population.


## 3.3.5. Crossover

This section uses a unified crossover strategy which exchanges the intersection point on the patrilineal individual based on probability to generate two new individuals. The general steps of this strategy are as follows:(1)
Two individuals are randomly chosen from parents(2)
Crossover points are swapped according to probabilityThe process of unified crossover is shown in Figure4.Figure 4
The process of uniform crossing.


## 3.3.6. Mutation

The strategy has two purposes: one is to make the genetic algorithm have the ability of local stochastic searching and the other is to make the genetic algorithm maintain the diversity of the population to prevent immature convergence. In this paper, a unified variation method is used to replace each gene value in an individual with a lower probability of random numbers within the range of [1,m].


## 4. Computational Experiment and Analysis

### 4.1. Data Source and Data Setting

The case data used in this paper are obtained fromhttps://s3.amazonaws.com/tripdata/201903-citibike-tripdata.csv.zip, which is the Citi Bike System data in March 2019, and the system is the first bike-sharing project in New York, USA. Due to its low data missing and good universality after preprocessing, the system data is favored by many experts and scholars and used in the research of bike-sharing. Citi Bike System adopts the mode of docking stations, with an initial launch of 6,000 bikes and 300 stations. It then expanded rapidly, with 12,000 bikes and 770 stations by March 2019. All experiments are performed with Python 3.6 and implemented on an Intel(R) Core(TM) i7-7700HQ CPU @2.80 GHz, 8 GB computer equipped with Windows10 system.To visually describe data, we used ArcGIS 12.0 to visualize station information, as shown in Figure5, which shows the distribution of Cite Bike stations in New York, with each blue triangle indicating the location of a station. At the same time, we obtain partial travel data of Citi Bike System, each row of which is a piece of customer travel data including the time, the id, latitude, and longitude of departure and terminal stations, as shown in Table 1. Based on these data, it is possible to calculate the rental and returning amount of each station at any given period.Figure 5
The distribution of Cite Bike stations in New York City.Table 1
The partial travel data of Citi Bike System.
Start timeEnd timeStart station idStart station latitudeStart station longitudeEnd station idEnd station latitudeEnd station longitude2019/3/1 0:002019/3/1 0:2431940.711066−74.00944734740.728846−74.0085912019/3/1 0:002019/3/1 0:0543940.726280−73.98978015040.720873−73.9808572019/3/1 0:002019/3/1 0:1252640.747659−73.984907347440.725255−74.004120The experimental data are the travel data of Citi Bike in March 2019 with a total of 1,327,960 travel records, of which 769 stations are processed for travel data. To further clarify the format and structure of the data, we choose the station ofid 72 and give its rental and returning amount of March 1 to 7, as shown in Table 2.Table 2
The rental and returning amount of station id 72 from March 1 to 7.
Station idDateRental amountReturning amount723.15662723.23432723.32932723.46441723.56866723.694116723.7107109Note that, under different parameters, convergence of genetic algorithm is different, as shown in Figure6. Under the conditions of the crossover rate pr=0.8, mutation rate pm=0.01, a relatively best result can be obtained, which may be used in experiments of this paper.Figure 6
The convergence of genetic algorithm with different parameters.


### 4.2. Single-Cycle Experiment Results

The validities of DGPO and SCRS in the 7-day cycle are verified by comparing with the methods commonly used in existing literatures. First, the initial number of bikes calculated based on DGPO is compared with the other three methods, namely, station capacity percentage, ratio of rental demand to returning demand, and uniform demand gap period which is defined as using the same demand gap periods. Secondly, SCRS is compared with traditional strategies, which tends to rebalance between problem stations preferentially, while the latter tends to rebalance station to station depending on the distance.The experimental results show the total accumulative rebalancing amounts from March 1 to 7, which are obtained through eight experiments using four methods determining the initial number of bikes and two rebalancing strategies, as shown in Table3.Table 3
The experiment results of single cycle from March 1 to 7.
The traditional strategySCRSThe station capacity percentage (50%)26461468Ratio of rental demand to returning demand24871346Uniform demand gap period (6 days)996520ODGP980470Start with the traditional strategies, the initial numbers of bikes are calculated using the four methods, and the corresponding total accumulative rebalancing amounts are 2646, 2487, 996, and 980, respectively. Clearly, with an approach considering the demand gap, either the uniform demand gap period or DGPO is preferable to the other methods, and the latter is superior. Then, SCRS still uses four methods to determine the initial number of bikes, with a cumulative rebalancing of 1,468, 1,346, 520, and 470. Obviously, SCRS has done better than the traditional strategy in decreasing the total accumulative rebalancing amount. The effectiveness of the proposed DGPO and SCRS has been fully demonstrated and they are highly competitive compared with other methods.To further illustrate this point, a comparative experiment is conducted, in which 7 periods are selected as a cycle and SCRS is used to calculate the total cumulative rebalancing amount under the four different methods to determine the initial number of bikes, as shown in Table4. Note that the figure in brackets is the number of stations participating in rebalancing. Obviously, both the uniform demand gap period and DGPO have been effective in reducing rebalancing amount, as well as the number of stations involved in rebalancing, especially as periods increase, compared to the other two methods. In particular, DGPO is more superior to the uniform demand gap period.Table 4
Daily cumulative rebalancing amount and station number of participating in rebalancing under different methods.
PeriodsThe station capacity percentage (50%)The ratio of rental demand to returning demandThe uniform demand gap period (6 days)ODGPDay 132 (6)23 (5)24 (11)19 (6)Day 269 (15)55 (11)41 (21)30 (16)Day 3148 (46)122 (30)70 (29)60 (26)Day 4291 (124)240 (98)102 (35)92 (32)Day 5590 (247)513 (191)172 (45)162 (42)Day 6969 (464)869 (392)303 (75)292 (70)Day 71468 (686)1346 (625)520 (129)492 (125)


### 4.3. Multicycle Experiment Results

Select the data from March 1 to 28 for multicycle experiment, and the distribution of problem and normal stations at the end of the 20th period is shown in Figure7.Figure 7
Distribution of problem and normal stations at the end of the 20th day.Assuming 7 or 14 days as a subcycle, 28 days can be correspondingly divided into four or two subcycles to execute MCRS, and in particular 28 days are also regarded as a single cycle to execute SCRS. The initial number of bikes of each cycle is still determined based on DGPO. The Citi Bike official data comes from Citibank Monthly Bike Report of March 2019, with a rebalancing amount of 22280. Then, comparative experiments in the four cases mentioned above are carried out, and the results are shown in Table5.Table 5
Comparison of experimental results of different rebalancing strategies.
Rebalancing strategyTotal rebalancing amountCiti Bike official data22280SCRS, 28 days as single cycle16743MCRS, 7 days as subcycle16732MCRS, 14 days as subcycle15463Obviously, compared with Citi Bike official data, the rebalancing strategies we have proposed are very helpful in reducing the total rebalancing amount. Of these results, regarding 14 days as a subcycle and performing MCRS yield the best result. Notably, both SCRS and MCRS have significantly reduced the rebalancing amount and the latter is superior in situation of excessive periods.Another issue deserving special attention is that ACRM is modified to rebalance targeting only those stations with a rebalancing amount greater than the threshold value 40, namely, MMCRS. The validity of MMCRS and MCRS is also verified by experiments. The data of 28 days are still selected as experiment data, which is divided into four cycles with 7 days for each subcycle, and the initial number of bikes of each subcycle is calculated based on DGPO. The compared experiment results are shown in Table6 and Figure 8.Table 6
The results of MMCRS, MCRS and SCRS.
CyclePeriodMMCRSMCRSSCRSCumulative rebalancing amountDaily rebalancing amountCumulative rebalancing amountDaily rebalancing amountCumulative rebalancing amountDaily rebalancing amountFirst subcycleDay 119191919211211Day 230113011371160Day 360306030513142Day 492329232642129Day 51627016270743101Day 6292130292130930187Day 74922004922001171241ACRM2358186643263834Second subcycleDay 824691114350241580409Day 926752064437871954374Day 102765904454172120166Day 11294417945601062447327Day 12323829447662062956509Day 13357533749782123522566Day 144078503538010544309787ACRM6947286995954215Third subcycleDay 1572252789660655223914Day 16761138697539362971074Day 1778832729813607016719Day 18809821599461337739723Day 198439341102142688473734Day 209031592106504369381908Day 2195345031103638610191810ACRM122662732151474111Fourth subcycleDay 22124812151524910210870679Day 2312688207152914211705835Day 2412953265153627112534829Day 2513175222154619913504970Day 26135053301568822714317813Day 271404554016109421154731156Day 281480075516732623167431270Figure 8
The results of MMCRS, MCRS, and SCRS.The experimental results show that MMCRS is superior to MCRS in reducing the rebalancing amount. At the end of the first subcycle, the cumulative rebalancing amount using the two methods is the same as 492, as ACRM has not yet been applied. Starting with the second cycle, the cumulative repositioning amount of each subcycle calculated by MMCRS is lower than that calculated by MCRS in subsequent subcycles, as only problem stations with reposition amount greater than 40 need rebalancing in MMCRS, unlike the case of MCRS, in which all problem stations require rebalancing.In addition, compared with SCRS, since ACRM is first carried out between the first and second subcycles, MMCRS and MCRS generate more cumulative rebalancing amount than SCRS at the end of the first subcycle; however, both of them declined significantly the daily rebalancing amount within subcycles. As periods increase, the advantages of MRCS and ACRM become more apparent, especially for MMCRS, where the rebalancing amount of each period is lower than that of the SCRS.


## 4.1. Data Source and Data Setting

The case data used in this paper are obtained fromhttps://s3.amazonaws.com/tripdata/201903-citibike-tripdata.csv.zip, which is the Citi Bike System data in March 2019, and the system is the first bike-sharing project in New York, USA. Due to its low data missing and good universality after preprocessing, the system data is favored by many experts and scholars and used in the research of bike-sharing. Citi Bike System adopts the mode of docking stations, with an initial launch of 6,000 bikes and 300 stations. It then expanded rapidly, with 12,000 bikes and 770 stations by March 2019. All experiments are performed with Python 3.6 and implemented on an Intel(R) Core(TM) i7-7700HQ CPU @2.80 GHz, 8 GB computer equipped with Windows10 system.To visually describe data, we used ArcGIS 12.0 to visualize station information, as shown in Figure5, which shows the distribution of Cite Bike stations in New York, with each blue triangle indicating the location of a station. At the same time, we obtain partial travel data of Citi Bike System, each row of which is a piece of customer travel data including the time, the id, latitude, and longitude of departure and terminal stations, as shown in Table 1. Based on these data, it is possible to calculate the rental and returning amount of each station at any given period.Figure 5
The distribution of Cite Bike stations in New York City.Table 1
The partial travel data of Citi Bike System.
Start timeEnd timeStart station idStart station latitudeStart station longitudeEnd station idEnd station latitudeEnd station longitude2019/3/1 0:002019/3/1 0:2431940.711066−74.00944734740.728846−74.0085912019/3/1 0:002019/3/1 0:0543940.726280−73.98978015040.720873−73.9808572019/3/1 0:002019/3/1 0:1252640.747659−73.984907347440.725255−74.004120The experimental data are the travel data of Citi Bike in March 2019 with a total of 1,327,960 travel records, of which 769 stations are processed for travel data. To further clarify the format and structure of the data, we choose the station ofid 72 and give its rental and returning amount of March 1 to 7, as shown in Table 2.Table 2
The rental and returning amount of station id 72 from March 1 to 7.
Station idDateRental amountReturning amount723.15662723.23432723.32932723.46441723.56866723.694116723.7107109Note that, under different parameters, convergence of genetic algorithm is different, as shown in Figure6. Under the conditions of the crossover rate pr=0.8, mutation rate pm=0.01, a relatively best result can be obtained, which may be used in experiments of this paper.Figure 6
The convergence of genetic algorithm with different parameters.


## 4.2. Single-Cycle Experiment Results

The validities of DGPO and SCRS in the 7-day cycle are verified by comparing with the methods commonly used in existing literatures. First, the initial number of bikes calculated based on DGPO is compared with the other three methods, namely, station capacity percentage, ratio of rental demand to returning demand, and uniform demand gap period which is defined as using the same demand gap periods. Secondly, SCRS is compared with traditional strategies, which tends to rebalance between problem stations preferentially, while the latter tends to rebalance station to station depending on the distance.The experimental results show the total accumulative rebalancing amounts from March 1 to 7, which are obtained through eight experiments using four methods determining the initial number of bikes and two rebalancing strategies, as shown in Table3.Table 3
The experiment results of single cycle from March 1 to 7.
The traditional strategySCRSThe station capacity percentage (50%)26461468Ratio of rental demand to returning demand24871346Uniform demand gap period (6 days)996520ODGP980470Start with the traditional strategies, the initial numbers of bikes are calculated using the four methods, and the corresponding total accumulative rebalancing amounts are 2646, 2487, 996, and 980, respectively. Clearly, with an approach considering the demand gap, either the uniform demand gap period or DGPO is preferable to the other methods, and the latter is superior. Then, SCRS still uses four methods to determine the initial number of bikes, with a cumulative rebalancing of 1,468, 1,346, 520, and 470. Obviously, SCRS has done better than the traditional strategy in decreasing the total accumulative rebalancing amount. The effectiveness of the proposed DGPO and SCRS has been fully demonstrated and they are highly competitive compared with other methods.To further illustrate this point, a comparative experiment is conducted, in which 7 periods are selected as a cycle and SCRS is used to calculate the total cumulative rebalancing amount under the four different methods to determine the initial number of bikes, as shown in Table4. Note that the figure in brackets is the number of stations participating in rebalancing. Obviously, both the uniform demand gap period and DGPO have been effective in reducing rebalancing amount, as well as the number of stations involved in rebalancing, especially as periods increase, compared to the other two methods. In particular, DGPO is more superior to the uniform demand gap period.Table 4
Daily cumulative rebalancing amount and station number of participating in rebalancing under different methods.
PeriodsThe station capacity percentage (50%)The ratio of rental demand to returning demandThe uniform demand gap period (6 days)ODGPDay 132 (6)23 (5)24 (11)19 (6)Day 269 (15)55 (11)41 (21)30 (16)Day 3148 (46)122 (30)70 (29)60 (26)Day 4291 (124)240 (98)102 (35)92 (32)Day 5590 (247)513 (191)172 (45)162 (42)Day 6969 (464)869 (392)303 (75)292 (70)Day 71468 (686)1346 (625)520 (129)492 (125)


## 4.3. Multicycle Experiment Results

Select the data from March 1 to 28 for multicycle experiment, and the distribution of problem and normal stations at the end of the 20th period is shown in Figure7.Figure 7
Distribution of problem and normal stations at the end of the 20th day.Assuming 7 or 14 days as a subcycle, 28 days can be correspondingly divided into four or two subcycles to execute MCRS, and in particular 28 days are also regarded as a single cycle to execute SCRS. The initial number of bikes of each cycle is still determined based on DGPO. The Citi Bike official data comes from Citibank Monthly Bike Report of March 2019, with a rebalancing amount of 22280. Then, comparative experiments in the four cases mentioned above are carried out, and the results are shown in Table5.Table 5
Comparison of experimental results of different rebalancing strategies.
Rebalancing strategyTotal rebalancing amountCiti Bike official data22280SCRS, 28 days as single cycle16743MCRS, 7 days as subcycle16732MCRS, 14 days as subcycle15463Obviously, compared with Citi Bike official data, the rebalancing strategies we have proposed are very helpful in reducing the total rebalancing amount. Of these results, regarding 14 days as a subcycle and performing MCRS yield the best result. Notably, both SCRS and MCRS have significantly reduced the rebalancing amount and the latter is superior in situation of excessive periods.Another issue deserving special attention is that ACRM is modified to rebalance targeting only those stations with a rebalancing amount greater than the threshold value 40, namely, MMCRS. The validity of MMCRS and MCRS is also verified by experiments. The data of 28 days are still selected as experiment data, which is divided into four cycles with 7 days for each subcycle, and the initial number of bikes of each subcycle is calculated based on DGPO. The compared experiment results are shown in Table6 and Figure 8.Table 6
The results of MMCRS, MCRS and SCRS.
CyclePeriodMMCRSMCRSSCRSCumulative rebalancing amountDaily rebalancing amountCumulative rebalancing amountDaily rebalancing amountCumulative rebalancing amountDaily rebalancing amountFirst subcycleDay 119191919211211Day 230113011371160Day 360306030513142Day 492329232642129Day 51627016270743101Day 6292130292130930187Day 74922004922001171241ACRM2358186643263834Second subcycleDay 824691114350241580409Day 926752064437871954374Day 102765904454172120166Day 11294417945601062447327Day 12323829447662062956509Day 13357533749782123522566Day 144078503538010544309787ACRM6947286995954215Third subcycleDay 1572252789660655223914Day 16761138697539362971074Day 1778832729813607016719Day 18809821599461337739723Day 198439341102142688473734Day 209031592106504369381908Day 2195345031103638610191810ACRM122662732151474111Fourth subcycleDay 22124812151524910210870679Day 2312688207152914211705835Day 2412953265153627112534829Day 2513175222154619913504970Day 26135053301568822714317813Day 271404554016109421154731156Day 281480075516732623167431270Figure 8
The results of MMCRS, MCRS, and SCRS.The experimental results show that MMCRS is superior to MCRS in reducing the rebalancing amount. At the end of the first subcycle, the cumulative rebalancing amount using the two methods is the same as 492, as ACRM has not yet been applied. Starting with the second cycle, the cumulative repositioning amount of each subcycle calculated by MMCRS is lower than that calculated by MCRS in subsequent subcycles, as only problem stations with reposition amount greater than 40 need rebalancing in MMCRS, unlike the case of MCRS, in which all problem stations require rebalancing.In addition, compared with SCRS, since ACRM is first carried out between the first and second subcycles, MMCRS and MCRS generate more cumulative rebalancing amount than SCRS at the end of the first subcycle; however, both of them declined significantly the daily rebalancing amount within subcycles. As periods increase, the advantages of MRCS and ACRM become more apparent, especially for MMCRS, where the rebalancing amount of each period is lower than that of the SCRS.


## 5. Conclusions and Future Work

Aiming at the problems of the fleet allocation determining and the research periods division, this paper proposes a fleet allocation method based on demand gap and a cycle division method which can give full play to the effect of the fleet allocation method in reducing the rebalancing amount. The initial number of bikes is calculated by the demand gap periods optimization (DGPO). Based on cycle division, a multicycle rebalancing strategy (MCRS) is presented, including a sing-cycle rebalancing strategy (SCRS) and an additional subcycle rebalancing method (ACRM). The fleet allocation optimization algorithm embedded in demand gap and cycle rebalance strategy is designed to solve the problem. The effectiveness of DGPO and SCRS has been fully demonstrated and they are highly competitive compared with other methods. Both of MCRS and ACRM decline significantly the daily rebalancing amount within subcycles, and with periods increasing, the advantages of MRCS and ACRM become more apparent.The proposed methods are available for the planning and configuration at stations and the repositioning problem of BSS for operators, meanwhile enriching the literature and providing references for researchers in related field. However, this paper assumes that customer demand is known and, in fact, tends to fluctuate over time, so we will reasonably predict the future customer demand with more accurate time granularity. In addition, the rebalancing objective in this paper is only one, but the multiobjective model is more adaptable. Therefore, we can establish the multiobjective function to further research.



---

*Source: 1892836-2022-01-13.xml*