The application claims priority to Chinese patent application No. CN2023100464378, filed on May 10, 2023, the entire contents of which are incorporated herein by reference.
The present invention relates to the technical field of public transportation, and in particular, to a traffic light timing control method and system.
The duration of traffic lights in daily life is adjusted as per fixed duration, and as a result, citizens have to wait for a long time due to excessively long duration of red lights when traveling during low-traffic hours, and when traveling during rush hours, citizens experience a waste of time due to short duration of green lights, and even traffic congestion and traffic accidents are caused.
In view of the disadvantages of the prior art, an objective of the present invention is to provide a traffic light timing control method and system, which can dynamically adjust the duration of a green light at different periods and under different crowd conditions and also adjust the duration of a data collection gap for an actual road condition, so that a green light timing control solution obtained finally can better meet an actual traffic control requirement.
On the one hand, this application provides a traffic light timing control method, including the following steps:
On the other hand, a traffic light timing control system is further provided, including a data storage unit, configured to record and store traffic flow data of a specific road section in each of N data collection gaps;
This application has at least the following technical effects or advantages:
In the present invention, the duration of a green light can be dynamically adjusted at different periods and under different crowding conditions with reference to historical crowding conditions, and on this basis, a prediction model is obtained to ensure that a timing result of the green light better matches an actual condition; the duration of a data collection gap is also adjusted for an actual road condition, and a duration adjustment pace of the green light is further optimized, so that a green light timing control solution obtained finally can better meet the actual traffic control requirement.
To illustrate the technical solution in embodiments in the present invention more clearly, the following briefly introduces the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are some embodiments of the present invention. Ordinary technicians in the field may still derive other drawings from these accompanying drawings without creative efforts.
A principle and characteristic of the present invention are described below with reference to the accompanying drawings, and the described embodiments are only used to explain the present invention other than to limit the scope of the present invention.
As shown in
S1. Complete monitoring of traffic flow in a specific road section, and record and store traffic flow data in each of N data collection gaps (Gap) by using a device such as a camera, to obtain a historical dataset P including N traffic flow data samples {(Time1, Flow1, Crowd1), (Time2, Flow2, Crowd2), . . . , (TimeN, FlowN, CrowdN)}.
In this embodiment, the duration of each data collection gap in N gaps may be the same or different. For example, each of the N gaps is 5 minutes, and further, traffic flow data in each data collection gap includes recording start time (Time), traffic flow (Flow) in this gap and crowd (Crowd) or non-crowd.
Further, the recording start time (Time) is of a data type Datetime. For example, if each gap is 5 minutes, 2016 records (12 records per hour, a total of 12*24*7 records collected in a week) can be collected in a week (7 days), and the recording start time (Time) is denoted as an integer value from 1 to 2016, where “1” represents 0:00-0:05 Monday, “2” represents 0:06-0:10 Monday, . . . . By analogy, the crowd (Crowd) or non-crowd can be determined via the device such as the camera by collecting statistics of traffic flow. For example, if traffic flow in the predetermined gap is greater than a predetermined value, the crowd is determined; otherwise, the non-crowd is determined. The crowd (Crowd) or non-crowd can be Bool data (that is, 1 represents yes and 0 represents no).
S2. Divide the historical dataset P into a sample PA including M pieces of crowd data {(Time1, Flow1, Crowd1), (Time2, Flow2, Crowd2), . . . , (TimeM, FlowM, CrowdM)} and a sample PB including (N−M) pieces of non-crowd data {(Time1, Flow1, Crowd1), (Time2, Flow2, Crowd2), . . . , (TimeN-M, FlowN-M, CrowdN-M)} according to the crowd or non-crowd.
In addition, a crowding level (Level) is assigned to each piece of traffic flow data in the sample PA and the sample PB.
Specifically, assigning a crowding level (Level) to each piece of traffic flow data in the sample PA includes the following steps:
In this embodiment, the first threshold< the second threshold< the third threshold. For example, the first threshold is 0.8, the second threshold is 1.5, and the third threshold is 2.1, which can be determined according to historical traffic flow data of a corresponding road section.
In addition, a crowding level (Level) of “smooth” is assigned to each piece of traffic flow data in the sample PB.
S3. Obtain the duration of a green light of each piece of traffic flow data in the sample PA and the sample PB separately.
Specifically, step S3 includes the following steps:
S31. Obtain the optimal number Akpoint of clusters of the sample PA and the optimal number Bkpoint of clusters of the sample PB separately via the K-means algorithm.
S32. Obtain a cluster set CA
S33. Obtain an average traffic flow (Flow) value corresponding to each cluster in the cluster set CA
where pi is a traffic flow (Flow) value in the ith piece of traffic flow data in a corresponding cluster (that is, a specific cluster CA
S34. Assign different durations of the green light for the traffic flow according to a sorting result of the average traffic flow values, including the following steps:
represents the duration of the green light with respect to the traffic flow corresponding to the cluster i in the cluster set CA
represents the duration of the green light with respect to the traffic flow corresponding to the cluster i in CB
For example, in this embodiment, t1 is 30s, t2 is 15s, t3 is 20s, and t4 is 10s, which can be flexibly adjusted according to the historical traffic flow data of the corresponding road section.
During a holiday, assigning different durations of a green light denoted as equation (3-3) for traffic flow corresponding to each cluster in the cluster set CA
where
represents the duration of the green light with respect to the traffic flow corresponding to a cluster i in the cluster set CA
represents the duration of the green light with respect to the traffic flow corresponding to a cluster i in CB
For example, in this embodiment, t5 is 50s, t6 is 15s, t7 is 30s, and t8 is 15s, which can be flexibly adjusted according to the historical traffic flow data of the corresponding road section during a holiday.
S35. Add the crowding level (Level) and the duration (Dr) of the green light to the historical dataset, to update the historical dataset P to:
In the foregoing step, because traffic flow is greater on holidays than on working days, the duration of the green light on holidays is generally greater than that on working days. In addition, because the sample PA includes crowd data, the duration of the green light also needs to be prolonged for the sample PA, compared with the sample PB. Therefore, prolonging the duration of the green light (that is, prolonging the duration of the green light for the sample PA) can keep the traffic flow smooth during holidays and reduce crowding possibility, so that an actual traffic flow control requirement is better met, to achieve an optimal control effect.
S4. Generate a preliminary classification model Ai according to the duration of the green light. Specifically, step S4 includes:
S41. Use the traffic flow (Flow), the crowd (Crowd) or non-crowd and the crowding level (Level) in the updated historical dataset P as training characteristics.
S42. Calculate Gini values of each training characteristic under different division standards separately according to equation (4), and select the minimum Gini values and a corresponding division standard, to obtain the minimum Gini values a1, a2 and a3 corresponding to the traffic flow (Flow), the crowd (Crowd) or non-crowd and the crowding level (Level) in the gap separately;
where m is a category set of a specific training characteristic A, |m| is the number of elements in the set, mn is the nth element in the set, |Di| is the number of a specific category i with the training characteristic A, |Dm-i| is the total number of categories other than the category i with the training characteristic A, and |D| is the total number of categories with the training characteristic A.
For example, if discrete crowding levels (Level) are selected as the training characteristics A, the number of categories is 4, namely, “smooth”, “slow traffic”, “crowded”, and “severely crowded”, and the numbers of categories are 10, 30, 40 and 20 separately, A=Level, m={smooth, slow traffic, crowded, and severely crowded}, |m|=4, and |D|=100. Further, assuming that n=1, i={smooth}, and m-i={slow traffic ∪ crowded ∪ severely crowded}, a classification standard can be split1={smooth, slow traffic ∪ crowded ∪ severely crowded}(|Di|=10 and |Dm-i|=901). Similarly, split2={slow traffic, smooth ∪ crowded ∪ severely crowded} (|Di|=30 and |Dm-i|=701), split3={crowded, smooth ∪ slow traffic ∪ severely crowded} (|Di|=40 and |Dm-i|=601), and split4={severely crowded, smooth ∪ slow traffic U crowded} (|Di|=20 and |Dm-i|=801). A Gini value under each classification standard is calculated. Assuming that the Gini values under the four classification standards are Ginisplit1=0.3, Ginisplit2=0.4, Ginisplit3=0.45 and Ginisplit4=0.36, the minimum Gini value of the crowding levels (Level) is Ginisplit1=0.3, which is denoted as a1.
For another example, if continuous traffic flow (Flow) is selected as the training characteristic A, there are a total of 10 pieces of traffic flow data, values are a set B={80, 80, 60, 120, 60, 80, 60, 120, 80, 80}, and the amount of traffic flow included in value ranges [0, 70], [71, 100] and [101, +∞] are 3, 5, and 2 separately, and there are 3 unique values after a duplicate value is eliminated from the set B and the set B is sorted, namely, {60, 80, 120} separately. The median values of each two of the values are {70, 100}, that is, 70=(60+80)/2 and 100=(80+120)/2. A=Flow, m={70, 100}, |m|=2, and (|D|=10. Further, assuming that n=1, i={70}, and m-i={100}, classification standards can be split1={<70, >70} (|Di|=3 and |Dm-i|=7), split2={≤100, >100} (|Di|=8 and |Dm-i|=2), and a Gini value under each classification standard is calculated. Assuming that Ginisplit1=0.28 and Ginisplit2=0.44, the minimum Gini value of the traffic flow (Flow) is Ginisplit1=0.28, which is denoted as a2.
By analogy, in order to obtain the minimum Gini value of another training characteristic, it should be noted that a classification standard of each training characteristic can be a separate classification based on the characteristic.
S43. Compare the minimum Gini values a1, a2 and a3 corresponding to the traffic flow (Flow), the crowd (Crowd) or non-crowd and the crowding level (Level) separately in the gap to determine the global minimum Gini value min (that is, the minimum value in a1, a2 and a3).
S44. Determine the division standard corresponding to the global minimum Gini value min as a branch node of a current decision tree.
S45. Repeat the foregoing steps S42 to S44 to construct a multicategory decision tree shown in
Further, in
S5. Obtain traffic flow data at the current moment, predict the duration of a green light for traffic flow according to the preliminary classification model Ai or an optimized classification model Ai+1 of the preliminary classification model Ai, and predict the duration of a red light in traffic lights to which the green light belongs according to the predicted duration of the green light. In this embodiment, the predicted duration of the red light=the predicted duration of the green light+tg, where the unit of tg is seconds, for example, 10s to 20s.
For example, as shown in
and tg, where tg is set to 20s.
S6. Control timing of the green light and the red light on the same traffic lights according to the predicted duration of the green light and the red light.
In the prior art, a model for which training has been completed is usually used to adjust the traffic light timing solution. However, the timing of the traffic lights is only set to a fixed value, but the fixed value cannot be adjusted correspondingly based on a crowding condition in the current or historical traffic flow data. Therefore, if the current crowding level is not severe, the fixed value causes a waste of transportation time; if the current crowding is relatively severe (for example, during rush hours of National Day), the fixed value further aggravates the crowding.
However, in the present invention, a data sample of a historical crowding condition (namely, a historical dataset) is introduced. The duration of a green light can be dynamically adjusted at different periods (for example, working days and holidays) and under different crowding conditions (that is, the sample PA and the sample PB) with reference to historical crowding conditions, and on this basis, a prediction model is obtained to ensure that a timing result of the green light better matches an actual condition. For example, the duration of the green light is prolonged during crowding and holidays to optimize traffic control solutions and efficiency.
A difference between this embodiment and Embodiment 1 is that step S31 includes:
S311. Randomly select k pieces of traffic flow data from the sample PA or the sample PB, and use each piece of traffic flow data as a center point of the cluster, to form k initial clusters, where k=1 in this embodiment.
S312. Calculate the distance between each piece of traffic flow data in other traffic flow data and an average of each initial cluster separately, and sort current traffic flow data into the closest initial cluster, to obtain k update clusters with cluster changes.
S313. Recalculate an average of each update cluster and use the average as a center point of the update cluster.
S314. Repeat S312 and S313 until the center point of each cluster is no longer redistributed, thereby completing clustering.
S315. Obtain a clustering result for the current number k of clusters according to equation (5):
With the help of the Elbow method, a knee point kpoint (namely, the number of clusters) is found, that is, an SSE value suddenly decreases. However, as the number i of clusters increases, the decreasing rate of the value tends to be gentle. In the Elbow method, the knee point is mainly looked for through image observation, but the method is neither autonomous nor sufficiently accurate. Therefore, in consideration of front and back decreasing trends with different numbers of clusters, decreasing proportions with numbers i of different clusters are calculated according to equation (6), and the largest proportion is selected.
In this case, the optimal numbers kpoint of clusters of the samples PA and PB are correspondingly obtained, and are denoted as Akpoint and Bkpoint.
The only difference between this embodiment and Embodiment 1 or 2 is that the duration prediction of the green light is completed based on the traffic flow data collected in the fixed gap (Gap) in the preliminary classification model Ai in step S5, and the preliminary classification model Ai cannot sufficiently match an actual road condition at a specific moment. For example, if a road section is in a crowded condition with great traffic flow, traffic flow data needs to be collected more frequently and duration adjustment of the green light needs to be completed more quickly, to alleviate traffic pressure on the road. However, in the case of smooth traffic, the duration adjustment time of the green light can be prolonged, and there is no need to adjust the green light timing solution frequently.
Therefore, the preliminary classification model Ai needs to be optimized, to obtain the optimized classification model Ai+1, which includes the following steps:
This embodiment provides a traffic light timing control system for implementing the traffic light timing control method described in Embodiment 1 or 2. Specifically, as shown in
In conclusion, in the present invention, the duration of a green light can be dynamically adjusted at different periods (for example, working days and holidays) and under different crowding conditions (that is, the sample PA and the sample PB) with reference to historical crowding conditions, and on this basis, a prediction model is obtained to ensure that a timing result of the green light better matches an actual condition; the duration of a data collection gap is also adjusted for an actual road condition, and a duration adjustment pace of the green light is further optimized, so that a green light timing control solution obtained finally can better meet an actual traffic control requirement.
Obviously, technicians in the field can make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Therefore, the present invention is also intended to cover these modifications and variations provided that they fall within the scope of the claims of the present invention and their equivalent technologies.
Number | Date | Country | Kind |
---|---|---|---|
202310046437.8 | May 2023 | CN | national |