Cyclic Weighted k -means Method with Application to Time-of-Day Interval Partition

: Time-of-day interval partition (TIP) at a signalized intersection is of great importance in trafﬁc control. There are two shortcomings of the traditional clustering algorithms based on traditional distance deﬁnitions (such as Euclidean distance) of trafﬁc ﬂows. First, some continuous time intervals are usually divided into small segments. Second, 0 o’clock (24 o’clock) is usually selected as the breakpoint. It follows that the relationship between TIP and trafﬁc signal control is neglected. To this end, a novel cyclic distance of trafﬁc ﬂows is deﬁned, which can make the end of the last cycle (24 o’clock of the last day) and the beginning of the current cycle (0 o’clock of the current day) cluster into one group. Next, a cyclic weighted k -means method is proposed, with centroid initialization, cluster number selection, and breakpoint adjustment. Lastly, the proposed method is applied to a real intersection to evaluate the beneﬁts of trafﬁc signal control. The conclusion of the empirical study conﬁrms the feasibility and effectiveness of the method.


Introduction
In an urban road network, the traffic signal control at intersections has a great impact on traffic flow. A reasonable traffic signal control scheme can improve the efficiency of traffic flow and relieve traffic congestion. On the contrary, traffic congestion will be worse if an inappropriate scheme is implemented.
Traffic signal control can be divided into three categories according to the range of control: isolated intersection control, arterial coordination control [1,2], and area coordination control [3,4]. Among them, isolated intersection control is the most universally applied. Most schemes of isolated intersection control are fixed-time control mode. First, it can make efficient use of historical data in urban transportation networks [5] and behave well no matter whether under low-medium saturation degree [6] or certain oversaturated conditions [7][8][9][10]. Second, it is a substitute when the malfunction of detectors or data loss occurs. Furthermore, it can behave as a kind of supplement in those intersections without traffic flow detectors.
There are two main tasks for fixed-time control mode. One is called the time-of-day interval partition (TIP) problem that traffic managers usually need to divide the whole day into different time intervals, e.g., peak hours, off-peak hours, etc. The other is the determination of signal control scheme for each time interval. An appropriate TIP plan is the precondition for the optimization of traffic signal control schemes at the isolated intersection [11]. Moreover, a reasonable traffic signal control scheme is able to improve the efficiency of traffic flow operations and relieve traffic congestion.
In recent decades, a large proportion of researches takes TIP as a clustering problem, determining the optimal breakpoints of time intervals [12,13]. Clustering is an unsupervised learning technique which can discover potential structures of data. It is also an important tool for exploratory data analysis, especially when the volume of data is quite 2 of 13 large. Clustering algorithms are aimed at automatically classifying data points into groups based on their similarity and distribution. In the field of machine learning, distance-based clustering (or similarity-based) is the most popular paradigm for clustering, including k-means, k-medoids, hierarchical clustering, and spectral clustering [14]. In the field of statistics, model-based clustering attracts more attention, such as the EM algorithm of a Gaussian mixture model [15][16][17]. However, no matter what kinds of methods are used, a common problem is to determine the number of clusters. Most clustering methods require a given number of clusters. However, in recent years, clustering methods that do not require the number of classes in advance have been developed, such as affinity propagation [18], density peaks-based clustering [19], time-variant clustering [20], and robust continuous clustering [21]. These methods can automatically output the number of clusters as well as the cluster assignments.
In the existing literature, inspired by [22], k-means clustering is the prevailing method of TIP, and some refinements, such as pretreatment or transformation of data, are stepwisely added to the basic k-means clustering framework [23][24][25][26][27][28]. However, the main problem of k-means is that the sampling units with similar traffic flows are more easily assigned into one cluster, ignoring the continuity of time. It means some noncontinuous sampling units could be assigned into one cluster. For example, two sampling units 7:00-7:05 and 17:00-17:50 should not be clustered together even though their traffic flows are similar. In other words, the partition results of traffic volumes are not continuous in time, so manual adjustment is necessary. If the traffic flow changes dramatically, the partition results may be unsatisfactory due to the subjective and lagging adjustment. From this point of view, TIP should take both the continuity of time and the similarity of traffic flows into account to meet the complex traffic situations.
Some researchers have noted that the order of the partition result matters. Many sequential clustering methods, such as times series partitioning [29], genetic algorithm [30][31][32], Kohonen neural network [33], artificial immune clustering [34], etc., are applied in TIP, and have been successfully employed in the daily scheme of traffic systems. One drawback in these studies is that 0 o'clock (24 o'clock) must be set as a breakpoint of daily data in clustering algorithms, which is unreasonable in practice. Moreover, the distance measurements used in these algorithms, such as Euclidean distance [26,27,29,33,34] in each cycle (each day), are also inappropriate to some degree. According to the definition of Euclidean distance, the distance between 0 and 24 o'clock is the largest among all time points. In fact, 0 and 24 o'clock are identical, and the distance between them should be 0. As a result, these methods cannot connect the end point of the previous cycle and the start point of the current cycle in their clustering results. For example, 23:55 and 0:05 could not be assigned into the same cluster. This does not meet the principles of traffic flow. Since there are few vehicles at 23:55 and 0:05, they both belong to low-peak hour. For this purpose, the cyclic property of flow data should be considered when using clustering algorithms in TIP.
In fact, none of the foregoing methods can be directly applied to the clustering of cyclic data due to the following two reasons. (1) In different cycles, the division of intervals should be the same; (2) Usually, the critical point of two adjacent cycles should be clustered into one interval unless the critical point is a jump point. According to these two requirements, a novel clustering algorithm based on cyclic distance is proposed, called the cyclic weighted k-means method.
In practical applications, it is difficult to obtain the exact moment of vehicles passing through an intersection. Instead, one can only roughly count the traffic flow in each sampling unit. Therefore, the middle point of each sampling unit is taken as the representative time point, while the traffic flow in the sampling unit is regarded as the frequency of traffic transit (i.e., the weight of the traffic transit moment). Then, the TIP problem could be effectively solved based on such data.
In this study, a type of flow data is defined as cyclic data, which is collected from N cycles in succession with T sampling units in each cycle. Next, a cyclic weighted k-means clustering method is proposed for this type of data. This method provides a new idea for directly programming timeline of time intervals with multiple cycles of data via defining a cyclic distance between any two time points. In this method, the traffic flow is used as weights for time points. Similar to k-means clustering, the proposed method is sensitive to the initial values. To this end, an initialization method of centroids was developed, considering the practical traffic background.
In addition, for the sake of evaluation, some existing criteria can be used [35], but the relationship between TIP and traffic signal control is hard to express. In the traffic engineering field, the purpose of TIP is to serve the traffic signal control. More specifically, TIP influences vehicle delays, cycle length, split and offset [7,10,36], queue length [37], saturation degree [1], intersection capacity, etc. Furthermore, TIP also influences urban transportation network design [38], vehicle routing [39,40], bus scheduling [41,42], freighttransportation systems [43] in the practical applications. Thus, TIP is the prerequisite for traffic signal control, which directly improves the effect of traffic control and affects implicitly urban transportation planning. Accordingly, a cost function is adopted according to specific urban traffic problems, and one evaluation criterion is calculated on the partition results of the proposed clustering method [30].
The rest of this article is organized as follows. Section 2 describes the problem of this study. Next, Section 3 introduces the cyclic distance and the cyclic weighted k-means method with some details. In addition, the outstanding performance of the proposed method is numerically confirmed on an empirical dataset of traffic flows in Section 4. Lastly, some concluding remarks are given in Section 5.

Problem Description
The TIP problem of traffic signal control is to optimally determine the breakpoint along the timeline of one day, then an optimal signal timing plan for each time interval will be set according to the results of TIP. Traditional methods to solve this problem are to sample the traffic flow of one or more lanes in a w minute (usually 5 min) sampling unit at a traffic intersection. Then, we get the traffic flows (i.e., the numbers of vehicles passing a lane at a traffic intersection) of T sampling units per day (usually T = 288) and use some kinds of clustering algorithms to divide time intervals. However, the result of TIP based on only one-day traffic flow data are not robust. In order to make up for this, the traffic flow data are collected for several days in order to improve the stability of TIP. In the rest of the article, one day is called one cycle because the change in daily traffic flows with time is similar.
In this study, the traffic flow data were collected in a signalized traffic intersection for N consecutive days (also called N cycles), taking w minutes as a sampling unit. Let X = (x 1 , . . . , x N ) IeR T×N be a N-cycle traffic flow matrix where T is the number of sampling units in one cycle, x n = (x 1n , . . . , x Tn ) is the traffic flow vector on the n-th (1 ≤ n ≤ N) cycle with T units, x tn is the traffic flow of the t-th (1 ≤ t ≤ T) sampling unit on the n-th cycle. Note that the summation of the t-th row of X (i.e., ∑ N n=1 x tn ) is the total traffic flow of the t-th sampling unit over N cycles, and the summation of n-th column of X (i.e., ∑ T t=1 x tn ) is the total traffic flow of the n-th day. Further, let B = (B 1 , . . . , B T ) be a timescale vector where B t = (t − 1) w/1440 is the start point of the t-th sampling unit in one cycle because there are 1440 min per day. Obviously, the timescale vector B is an ordered measure of cyclic data X, According to the above definitions, the TIP problem can be described as finding K breakpoints 0 ≤ A 1 < . . . < A K < 1 based on cyclic data X and timescale B. Then, one cycle can be divided into K time intervals 1). Note that the time interval D K crosses 0 o'clock. Driven by this formulation of the TIP problem, the cyclic weighted k-means algorithm will be derived, and the optimal breakpoints A 1 , . . . , A K will be obtained based on cyclic data X and timescale B in the following section.

Cyclic Distance
The definition of distance will greatly affect the results of distance-based clustering algorithms (such as k-means). For the TIP problem, 0 and 24 o'clock refer to the same time, which means that the distance between them should be 0. In order to make the end of the last cycle (i.e., 24 o'clock of the last day) and the beginning of the current cycle (i.e., 0 o'clock of the current day) cluster into one group, a cyclic distance is defined between any two different timescales B i and B j as The cyclic distance describes the cyclic characteristic of data on the interval [0, 1), which treats 0 and 1 as the same point. If the Euclidean distance of timescales B i and B j is not greater than 0.5 in one cycle (i.e., one day), then their cyclic distance is the squared Euclidean distance. Otherwise, if the Euclidean distance of timescales B i and B j is greater than 0.5 in one cycle, then the cyclic distance of them can be viewed as the squared Euclidean distance in two adjacent cycles. In other words, if one point is close to 0 and another point is close to 1, then they should be close in the sense of cyclic distance.

Cyclic Weighted k-means Method
The classical k-means clustering algorithm can be redefined according to the definition of cyclic distance. In this subsection, the cyclic weighted k-means algorithm will be derived based on cyclic traffic flow data X and timescale B. The objective is to segment B 1 , . . . , B T into K (i.e., the cluster number) time intervals D 1 , . . . , D K by breakpoints A 1 , . . . , A K . The objective function of the cyclic weighted k-means algorithmcan be represented as In Equation (2), y t = ∑ N n=1 x tn is the total traffic flow of the t-th sampling unit over N cycles, centroid µ k is the weighted mean of timescales in the k-th time interval D k with traffic flows as the weights, which can be calculated by where I(·) is the indicator function that is equal to 1 if the condition in the parentheses is satisfied and equal to 0 otherwise. Equation (4) can ensure that the centroid µ k lies in the interval [0, 1], and avoid falling on the right side of 1 or the left side of 0. The cyclic weighted k-means algorithm solves the minimum of objective function (2) by iterative steps. It can find the K centroids minimizing the cyclic distances within clusters (also called intra-class distance); that is, the summation of the cyclic distance from each data point to its own centroid. Then, the breakpoints of time intervals are determined. Since the objective function (2) is non-convex, the solution obtained by the iterative steps is often locally optimal.
The cyclic weighted k-means algorithm is given in Algorithm 1.

Algorithm 1. The cyclic weighted k-means algorithm
Require: iterations I = 100, number of sampling units T, cluster number K. Ensure: Determine the centroids µ i 1 , . . . , µ i K and breakpoints A 1 , . . . , A K in i-th iteration. 1: Initialize the iterative number i = 0 and centroids µ i k (see Algorithm 2). 2: , assign a centroid to timescale B t in i-th iteration.

5:
End for 6: for k ← 1 to K do 7: Update the centroids: 13: Ranking from small to large, the final breakpoints A 1 , . . . , A K are obtained. 14: Break 15: End if 16: End for Remark 1. In line 4, we can see that the algorithm determines the centroids of B t s according to the distance in time domain. Obviously, the timescales divided by the algorithm must be continuous.

Remark 2.
In line 7, the weighted mean of all B t s in k-th cluster is calculated with traffic flow as the weights to update the centroids. Note that, the second item in square bracket is to ensure that the updated centroids lie on the interval [0, 1].

Remark 3.
If the medoids instead of centroids are updated in Step 3, it is converted into the cyclic weighted k-medoids algorithm. As one can see, the minimum of objective function J(S) = ∑ T t=1 ∑ c t ∈S y t d(B t , B c t ) can be obtained approximately by iteration, and the class labels of data points are accordingly obtained where S ⊂ {1, . . . , T} is the set of class labels. The cardinality of S (i.e., K = |S|) is the number of clusters. c t is the class label of the t-th timescale; that is, B t belongs to the cluster with medoid B c t . Note that, the cyclic weighted k-medoids algorithm will not be introduced here because it is similar to the cyclic weighted k-means algorithm in thinking.

Initialization of Centroids
The result of TIP will affect the traffic control scheme. Theoretically speaking, the time interval of traffic signal control can be very short. However, in practice, the setting of traffic lights cannot be switched too frequently. Thus, the initial values of centroids should be selected appropriately. In other words, the initial values of centroids should not be too crowded in Algorithm 1. Otherwise, it could cause some time intervals to be too short to operate in reality. On the other side, setting appropriate initial values of centroids will further improve the efficiency of the clustering algorithm. In this subsection, a novel initialization method of centroids for cyclic weighted k-means algorithm will be developed.
Let y max be the local maximum of sequence y 1 , . . . , y T , and the corresponding timescale be B max . For a fixed K, there exists some function δ(K) > 0, then the cyclic δ(K) neighborhood of B max is defined as where function δ(K) represents the radius of this neighborhood, which is inversely proportional to K. In Equation (6), α is a hyperparameter used to control the radius of neighborhood. We can see that when the number of clusters K is smaller, the radius of neighborhood δ(K) should be larger. Next, based on the concept of cyclic neighborhood, the following algorithm is established to initialize the centroids under a given K. Initialize the set of centroids G to empty set, i.e., G = ∅.

2:
Find the maximum y (1) from y 1 , . . . , y T , whose corresponding timescale is B (1) . 3: Add End for 8: Sort the K elements of set G in ascending order and obtain the initialized centroids µ 0 k .

Remark 4.
The neighborhood radius δ(K) ≤ 1/(2K), which ensures that the maximum value in each repeat of line 5 always exists. Therefore, the initialization algorithm of centroids is feasible. (2), it is shown that for any given K, the value of loss function can be calculated, which represents the intra-class error. The "elbow point" of loss function J(K) is usually used as the optimal number of clusters in literature. The traditional methods treat the maximum point of the second-order difference of J(K) (i.e., J(K − 1) − 2J(K) + J(K + 1), which describes the absolute variation of first-order difference as the "elbow point". The minimum point of the ratio of first-order difference (which describes the relative variation of first-order difference) is considered as the "elbow point"; that is,

Sections 3.2 and 3.3 both depend on the given K. From objective function
where K min and K max are the minimum and maximum of K according to expertise. Equation (7) shows that the optimal number of clusters K * can minimize the relative descent rate of intra-class distance J(K). Generally speaking, the timescales of one day should be divided into at least four intervals: morning, noon, afternoon, and evening periods; that is, K min ≥ 4. Additionally, it should never exceed 12 intervals in reality; that is, K max ≤ 12.

Adjustment of Breakpoints
For the purpose of TIP for traffic signal control, the breakpoints A 1 , . . . , A K from clustering results could not be optimal. To fix this, the breakpoints between clusters are updated repeatedly, until convergence, according to the following formulas.
∑ T j=1 I c i j = k y j represents the average traffic flow of the k-th cluster, y [A k ] = y j j : A k = B j represents the traffic flow at breakpoint A k .
More specifically, if the traffic flow at breakpoint A k is less than the average traffic flow of its left cluster y (k−1) and also less than the average traffic flow of its right cluster y (k) , and y (k−1) < y (k) , then A k should belong to the left cluster. Then, the breakpoint between these two adjacent clusters should move toward right. On the contrary, if the traffic flow at breakpoint A k is greater than y (k−1) and y (k) , and y (k−1) < y (k) , then A k+1 should belong to the right cluster, and the breakpoint should move toward left.

Empirical Data
The empirical data were collected at the signalized intersection of Wuyi Road and Jintai Street in Fuzhou city, China. There are five lanes in each entrance (lanes 1 and 2 dedicated to left turn vehicles, lanes 3 and 4 for through vehicles, and lane 5 shared by through and right-turning vehicles) and three signal phases at the intersection (phase 1: left turn on north and south entrances; phase 2: through on north and south entrances; phase 3: left turn and through on east and west entrances). Figure 1  ̄( ) , and ̄( ) < ̄( ) , then should belong to the left cluster. Then, the breakpoint between these two adjacent clusters should move toward right. On the contrary, if the traffic flow at breakpoint is greater than ̄( ) and ̄( ) , and ̄( ) < ̄( ) , then should belong to the right cluster, and the breakpoint should move toward left.

Empirical Data
The empirical data were collected at the signalized intersection of Wuyi Road and Jintai Street in Fuzhou city, China. There are five lanes in each entrance (lanes 1 and 2 dedicated to left turn vehicles, lanes 3 and 4 for through vehicles, and lane 5 shared by through and right-turning vehicles) and three signal phases at the intersection (phase 1: left turn on north and south entrances; phase 2: through on north and south entrances; phase 3: left turn and through on east and west entrances). Figure 1

Results of Clustering
Above all, the proposed "elbow point" method is applied to determine the number of clusters . In Formula (5) and (6), we set ( ) = 1 (3 ) ⁄ , = 4 and = 12. Figure 2a shows the intra-class distances of different numbers of clusters, and Figure 2b shows the relative descent rates of intra-class distance as increasing.

Results of Clustering
Above all, the proposed "elbow point" method is applied to determine the number of clusters K. In Formulas (5) and (6), we set δ(K) = 1/(3K), K min = 4 and K max = 12. Figure 2a shows the intra-class distances of different numbers of clusters, and Figure 2b shows the relative descent rates of intra-class distance as K increasing.
In Figure 2a, the intra-class distance decreases gradually as K increases and the relative descent rates of intra-class distance are relatively small when K = 6 or K = 10 in Figure 2b. In traffic engineering, frequent signal control scheme changes will bring management costs to the transportation department. A smaller K means less overhead, so 6 is chosen as the number of clusters.
Next, the proposed cyclic weighted k-means method is applied, and the breakpoints between time intervals are adjusted according to (8) and (9). Figure 3 demonstrates the clustering results. In Figure 2a, the intra-class distance decreases gradually as increases and the relative descent rates of intra-class distance are relatively small when = 6 or = 10 in Figure 2b. In traffic engineering, frequent signal control scheme changes will bring management costs to the transportation department. A smaller means less overhead, so 6 is chosen as the number of clusters.
Next, the proposed cyclic weighted k-means method is applied, and the breakpoints between time intervals are adjusted according to (8) and (9). Figure 3 demonstrates the clustering results. The curve in Figure 3 shows the average traffic volume per five minutes (i.e., average traffic flow rate, ATFR; basic unit: pcu/h, passenger car unit per hour) of the intersection in five days, and the ladder shape curve shows the mean of the ATFR in each cluster. These clusters are the morning peak hour (6:55-9:30), forenoon hour (   In Figure 2a, the intra-class distance decreases gradually as increases and the relative descent rates of intra-class distance are relatively small when = 6 or = 10 in Figure 2b. In traffic engineering, frequent signal control scheme changes will bring management costs to the transportation department. A smaller means less overhead, so 6 is chosen as the number of clusters.
Next, the proposed cyclic weighted k-means method is applied, and the breakpoints between time intervals are adjusted according to (8) and (9). Figure 3 demonstrates the clustering results. The curve in Figure 3 shows the average traffic volume per five minutes (i.e., average traffic flow rate, ATFR; basic unit: pcu/h, passenger car unit per hour) of the intersection in five days, and the ladder shape curve shows the mean of the ATFR in each cluster. These clusters are the morning peak hour (6:55-9:30), forenoon hour (  The curve in Figure 3 shows the average traffic volume per five minutes (i.e., average traffic flow rate, ATFR; basic unit: pcu/h, passenger car unit per hour) of the intersection in five days, and the ladder shape curve shows the mean of the ATFR in each cluster. These clusters are the morning peak hour (6:55-9:30), forenoon hour (

Evaluation of Methods
To evaluate different TIP methods, a common evaluation index, the average vehicle delay (AVD), was adopted in this study. Details of the AVD method are given in [44,45] and Appendix A.
Two TIP plans are compared, i.e., Plan A (the proposed method) and Plan B (the TIP plan currently used by the local transportation department according to practical experience) via AVD. The whole day is divided into four periods by Plan B as follows, the morning peak hour (7:00-11:00), off-peak hour in the noon (11:00-14:30), the afternoon Sustainability 2021, 13, 4796 9 of 13 to the evening peak hour (14:30-20:00), off-peak hour in the night (20:00-7:00). Figure 4a shows the ATFR of these two plans.
According to Webster's signal control method [46], we partly calculate AVD for each time interval of both two plans, then get AVD of the whole day (see Figure 4b). Note that the ATFR of Plan B in Figure 4a during the second (7:00-11:00) and third (11:00-14:30) periods is in a line, and it is hard to intuitively distinguish (1243 and 1240 pcu/h, respectively). It is the same situation for the third (11:00-14:30) and fourth (14:30-20: Figure 4 displays that Plan A is better than Plan B because the AVD of Plan A is always lower than that of Plan B, except from 20:00 to 22:55. However, the ATFR of this period still maintains 1176 pcu/h, an average of about 100 pcu per five minutes. Thus, it is not reasonable for Plan B to regard this period as the night. By further calculation, the AVD for the whole day of the two plans is 35 and 39 s, respectively. It follows that the AVD of Plan A decreases by 10.25% than one of Plan B. We can say that the regular pattern of the traffic flow is accurately captured by Plan A, and the time interval is frequently divided. This brings more benefit for traffic than Plan B, which is designed mainly from engineering experience with a lack of theoretical basis and analysis.

Conclusion
For cyclic data, such as traffic flows, a clustering method is proposed, called cyclic weighted k-means, based on cyclic distance. Several conclusions are as follows. i.
The cyclic distance is the key for the cyclic weighted k-means algorithm, which makes it possible that the end point of the previous cycle and the start point of the current cycle are connected in the clustering result, and a complete cycle of data has been considered rather than separation from tail to head. According to Webster's signal control method [46], we partly calculate AVD for each time interval of both two plans, then get AVD of the whole day (see Figure 4b). Note that the ATFR of Plan B in Figure 4a during the second (7:00-11:00) and third (11:00-14:30) periods is in a line, and it is hard to intuitively distinguish (1243 and 1240 pcu/h, respectively). It is the same situation for the third (11:00-14:30) and fourth (14:30-20:00) periods of Plan B in Figure 4b, with AVD 52.2 and 52.1 s. Figure 4 displays that Plan A is better than Plan B because the AVD of Plan A is always lower than that of Plan B, except from 20:00 to 22:55. However, the ATFR of this period still maintains 1176 pcu/h, an average of about 100 pcu per five minutes. Thus, it is not reasonable for Plan B to regard this period as the night. By further calculation, the AVD for the whole day of the two plans is 35 and 39 s, respectively. It follows that the AVD of Plan A decreases by 10.25% than one of Plan B. We can say that the regular pattern of the traffic flow is accurately captured by Plan A, and the time interval is frequently divided. This brings more benefit for traffic than Plan B, which is designed mainly from engineering experience with a lack of theoretical basis and analysis.

Conclusions
For cyclic data, such as traffic flows, a clustering method is proposed, called cyclic weighted k-means, based on cyclic distance. Several conclusions are as follows. i.
The cyclic distance is the key for the cyclic weighted k-means algorithm, which makes it possible that the end point of the previous cycle and the start point of the current cycle are connected in the clustering result, and a complete cycle of data has been considered rather than separation from tail to head. ii. Some attached algorithms, i.e., centroid initialization, cluster number selection, and breakpoint adjustment, are helpful for further improvement of the cyclic weighted k-means algorithm to solve the TIP problem. iii. The feasibility of the proposed method is confirmed by empirical study. It is noted that the practical evaluation criteria (such as the average vehicle delay in benefits of traffic signal control) should serve the practice. From the perspective of application, the proposed method can also be applied to other scenes. For example, it can be applied to the inventory adjustment of e-commerce according to the daily sales, and the seat optimization of a call center according to the volume of calls.
From the perspective of application, a novel TIP algorithm (i.e., cyclic weighted kmeans) for traffic signal control was developed according to the periodic change of the traffic flow at the signalized intersection. The purpose of the algorithm is to improve the benefits of traffic signal control. On the one hand, traffic flow data can only be obtained by the detectors (such as loop detector or video detector) at intersections. In reality, missing data or sensor damage often occur. Hence, developing a filling method for missing traffic flow data is an important task in future work. On the other hand, traffic flows at intersections show different periodic changes on weekdays, weekends, and holidays, which requires different TIP schemes. The current traffic signal control system can store different TIP schemes for different days and set the optimal signal timing plans for each time interval, which is of great significance to improve the benefits of traffic signal control.  where S is the saturation flow rate and [47] can be used to estimate S = 1549 pcu/h in this study.
Step 4: Calculate q kp (unit: pcu/h), the average traffic flow rate critical traffic lane at the k-th time interval in the p-th signal phase.
Step 5: Calculate L k (unit: hour, h), the total lost time of the k-th time interval where we often set L kp = 3/3600 as amber time and L k = 3P/3600.
Step 6: Calculate C k (unit: h), the optimal cycle length of the k-th time interval [46] C k = (1.
Note that there are some constraints on cycle length C k in the intersection. When the cycle length is small, the green time allocated to each phase would be not enough for pedestrians crossing the road. When the cycle length is large, the red time for each phase is long and results in the anxiety of drivers. Thus, C k needs to satisfy C min ≤ C k ≤ C max , i.e., if C k ≤ C min , then set C k = C min , and if C k ≥ C max , then set C k = C max . In this paper, we set C min = 50 s and C max = 140 s, respectively.
Step 7: Calculate g kp (unit: h), the best green time at the k-th time interval in the p-th signal phase, g kp = (C k − L k )q kp / P ∑ p=1 q kp (A8) Step 8: Calculate r kp (unit: h), the best red time at the k-th time interval in the p-th signal phase r kp = C k − g kp − 3/3600 (A9) where the constant 3/3600 stands for amber time.
Step 9: Calculate d kp (unit: h), the average vehicle delay at the k-th time interval in the p-th signal phase [48] d kp = 0.5C k (1 − λ kp ) 2 1 − min(1, z kp λ kp ] + 900H z kp − 1 + (z kp − 1) 2 + 8ρz kp R kp H (A10) where λ kp = g kp /C k is the green ratio at the k-th time interval in the p-th signal phase; z kp = q kp /R kp is the degree of saturation at the k-th time interval in the p-th signal phase; R kp = Sλ kp is the capacity of the critical traffic lane at the k-th time interval in the p-th signal phase (unit: pcu/h); H is length of the k-th time interval (unit: h); ρ is a correction factor with the default value 0.5.
Step 10: Calculate d k (unit: h), the average vehicle delay of the k-th time interval d k = P ∑ p=1 d kp q kp q k (A11) Step 11: Calculate d (unit: h), the average vehicle delay of all K time intervals