Real-time Dynamic Route Optimization Based on Predictive Control Principle

The principle of predictive control is applied to research on real-time dynamic route optimization of traffic travel, and a real-time dynamic route optimization model based on predictive control is proposed. Taking the driving time as the controlled variable, the driving speed as the manipulated variable, some traffic conditions as disturbance factors, the shortest driving time as the set value, the static shortest route as the reference route of the control system, and the objective function with the shortest driving time, which is defined as the control performance is established. According to the change in the road network state and the optimal solution result of the objective function, the real-time dynamic route selection based on the shortest driving time is realized by switching among different static shortest routes, and the rolling optimization and combination of dynamic and static routes are implemented in the process. A unique method is also used to obtain the optimal solution of the objective function in this study, which is scientific, reasonable, fast, and convenient. The optimization model overcomes the shortcomings of determining the dynamic shortest route by depending on traffic flow prediction and speed prediction. The simulation results and case study prove that the predictive control model algorithm of real-time dynamic route optimization is correct and better. The most important feature of the model algorithm is that it takes the static driving route and desired driving time as the control goals, and it can achieve the global optimal solution of the shortest path and shortest time. The proposed model algorithm has good innovation and practical applications.


I. INTRODUCTION
For the study of traffic travel planning, most experts and scholars focus on short-term traffic forecasting, mainly forecasting traffic flow, traffic speed, etc. [1]. The prediction models and algorithms involved can be divided into the following three categories: short-term traffic forecasting based on statistical theory [2][3][4][5][6][7], machine learning, and deep learning [8][9][10][11][12][13][14][15][16][17]. Short-term traffic forecasting is primarily used for the prediction of traffic congestion and traffic light control. There are relatively few research papers on the realtime dynamic shortest route optimization problem [18][19][20][21]. The purpose of research on the shortest route problem is to provide drivers with an effective route between departure and destination, so the driving cost is the least.
According to road network attributes, the shortest route selection problem can be divided into the following two types: static shortest route selection and dynamic shortest route selection [22][23][24][25]. The selection of the static shortest route generally does not consider time characteristics, and it takes the shortest route as the evaluation performance to determine the shortest driving route. The shortest static route is also the shortest driving distance. Research on the dynamic shortest route is difficult and is a hot research topic. According to the different research methods, dynamic shortest route selection can be roughly divided into two types: adaptive dynamic shortest route selection and deterministic dynamic shortest route selection [19].
The adaptive dynamic shortest route selection model undergoes multiple route searching processes, and the shortest route determined under the traffic states of the road network at the departure time is not the final driving route. The route changes with the driving of the vehicle and the change in the traffic states of the road network. Its disadvantages are as follows: (1) The shortest route to the endpoint is calculated based on the current speed of each road segment. Owing to the dynamic and real-time change in road conditions, the cumulative driving route to the endpoint is not necessarily the shortest, and the driving time is not necessarily the shortest. (2) Multiple route searching processes are required, route selection is not constrained, and the search route is not necessarily optimal. In deterministic dynamic shortest route selection, an optimal driving route is determined by the traffic states of the road network based on the shortest driving time at the initial time, and the route does not change during the driving process. One of these methods is based on speed prediction. A definite driving route is calculated using the predicted speed of the road network in the future at the departure time, and the evaluation performance of the dynamic shortest route is the driving time. The final shortest driving route has the shortest driving time among all feasible routes. Its disadvantages are as follows: (1) If the speed prediction model is not well established, the prediction accuracy is not better, which directly affects whether the obtained dynamic shortest route is the actual shortest route. Traditional statistical methods and deep learning algorithms inevitably use historical data for modeling. If the data is imperfect, the characteristics of the data are not obvious, and there is little historical training data, which will have an important impact on the accuracy of the prediction results. For the real-time dynamic route optimization problem, the existing methods are based on the prediction of traffic flow, traffic speed, and road state before departure and choosing the shortest route. Therefore, it is difficult to achieve real-time optimization in the driving process because the model algorithms are complex and the road state changes rapidly. Therefore, although many prediction models exist at present [22][23][24][25], they lack practicability. (2) Because speed prediction is discrete in time, it is predicted at regular intervals, which leads to different predicted speeds on the same road segment. Therefore, a road segment is divided into several subsections to calculate the driving time, which is very complex. Particularly for complex road networks, there are multiple driving routes and multiple road segments for each driving route, and it is more difficult to achieve real-time modeling and real-time calculation.
Theoretically, if there are no traffic jams or emergencies, the static shortest route must be the route with the shortest driving time. However, owing to traffic congestion, sudden traffic accidents, traffic control, bad weather, and other interference factors, it is necessary to choose the shortest driving route dynamically. As described above, current dynamic route optimization methods lack accuracy, and the static shortest route lacks time variability. Therefore, the best method is a combination of dynamic optimization and static determination. As long as we start to drive on a road segment, regardless of the condition of the road, the current road segment must be finished before we consider choosing the next road segment. The method of selecting routes according to road conditions and given driving performance is a type of rolling dynamic optimization idea, which is very similar to the predictive control method in control theory. The predictive control theory has been applied in different fields [26][27][28][29][30][31][32][33][34][35]. Therefore, we propose a real-time dynamic route optimization method based on the predictive control principle.
The basic principle of predictive control is as follows: At a certain time, the current state of a control system is taken as the initial input, and the model, constraint conditions, and objective function are combined to obtain the optimal solution in finite time (an optimal control problem in the finite time domain). After obtaining the optimal solution, only the first control output is used in the system, whereas the others are ignored. After control is applied to the system, the state of the system is obtained, and the optimal control output is solved again. There are three key elements in the implementation of predictive control: predictive models, rolling optimization, and feedback correction. The predictive model is the basis of model predictive control, and its main function is to predict the future output of the system according to the historical information and future input of the system. Rolling optimization means that the model predictive control determines the control effect based on the optimization of a certain performance, and the optimization is not carried out offline at once, but repeatedly online. This is the meaning of rolling optimization and is also the difference between traditional optimal control and predictive control. The purpose of feedback correction is to correct errors caused by model mismatches or environmental disturbances.
The basic principle of the real-time dynamic route optimization model based on predictive control is described as follows. The initial static driving reference route and given minimum driving time are set as the control goals, and the driving speed and static route are controlled to achieve the control goals. Driving time is the controlled variable, driving speed is the manipulated variable, and some traffic conditions are disturbance factors. The shortest driving time is the set value, the static shortest route is the reference route of the control system, and the objective function with the shortest driving time is established. According to the change in the road network state and the optimal solution result of the objective function, the real-time dynamic route solution based on the shortest time is obtained by switching among different static shortest routes, and the rolling optimization and combination of dynamic and static routes are realized. The advantages of the model are as follows. (1) It avoids predicting future road speeds or traffic flow. (2) Because the initial static driving reference route and given shortest driving time are designed as the control goals, the global optimal solution of the shortest route and shortest time can be achieved. (3) It makes up for the shortcomings of the adaptive dynamic shortest route selection model and the deterministic dynamic shortest route selection model.
The remainder of this paper is organized as follows: Section II introduces the mathematical description, conceptual definition of road networks, theorems, and lemma for the research. Section III introduces the predictive control model for real-time dynamic route optimization. Section IV shows the model simulation. Section V verifies the proposed model and discusses the results. Section VI provides a summary of this study.

A. MATHEMATICAL DESCRIPTION AND CONCEPTUAL DEFINITION OF ROAD NETWORK
In order To analyze the model, some of the concepts involved are defined as follows: The road network shown in Fig.1 includes five roads and seven road segments.
where 1 represents the starting point of the road network and n represents the endpoint of the road network. Because a road has two-way traffic, the above RS must be a symmetric matrix, and = 0(i=1, 2, …….. n). Compared with Fig.1 and 2, the road network structure matrix is an undirected graph matrix, and the route matrix of the driving road network is a directed graph matrix. Using RR, all drivable routes can be derived from the starting point to the end point. Definition 3 Road length matrix of driving road network, RL where i and j denote the starting and endpoints of a road segment, respectively, and Lij represents the distance of the road segment. As shown in Fig where i and j denote the starting and end points of a road segment, respectively, and c ij represents the congestion rate of the road segment with a value between 0 and 1. As shown in Fig.2, the RC is If c ≥ 0.6， st = 1. It means that the road segment is seriously congested and cannot be driven on the road.
If c < 0.6， st = 0. It means that the road segment is not congested and can be driven on the road.

Definition 8 Matrix dot division
If A and B have the same number of rows and columns, A is divided by B, and as the following formula shows, it is called the matrix dot division.
C=A//B，c ij= a ij /b ij Definition 9 Matrix dot multiplication If A and B have the same number of rows and columns, A is multiplied by B, as the following formula shows; this is called matrix dot multiplication. C=A**B，c ij= a ij * b ij According to the above definitions, the following matrix relationships can be derived.
If the driving speed is determined by an optimization calculation or experience, it is called the theoretical driving speed. Definition 11 Real driving speed, Vr.
The current driving speed of a vehicle is called the real driving speed. Definition 12 Enabled driving speed, Ve.
The speed of a road obtained using the Gaode or Baidu online map is called the enabled driving speed. The Gaode or Baidu online map can provide real-time driving speed and congestion rates of roads in a certain area, and it is also called the road traffic situation. Definition 13 Predicted driving speed, Vp.
According to the past driving data of the road network and the current road condition, at the next time the speed of a road is predicted by a certain algorithm or model, which is called the predicted driving speed.
The maximum driving speed on a road is called the limited driving speed. Usually, this speed is fixed.
Under normal driving conditions, the relationship among the above speeds is the following.
≤ ≤ ≤ ℎ Definition 15 Static shortest driving route Among all drivable routes from the starting point to the end point, the route with the shortest length is called the static shortest route.

Definition 16 Static shortest driving time
The time spent driving along the static shortest route is called the static shortest driving time.
In practical applications, the shortest static driving time can be determined by the route length and average driving speed, or by experience.

Definition 17 Static driving reference route
The static shortest driving rout is used as static driving reference route.

Definition 18 Dynamic driving reference route
According to the predicted driving speed of the road network, the route with the shortest driving time of all feasible routes is determined, which is called the dynamic driving reference route.

B. THEOREMS AND LEMMA
Theorem 1 For a given driving route, it is composed of different road segments (L1, L2….Ln), and there is a set of optimal road segment speeds (Vt1, Vt2…Vtn), that minimizes the driving time of the route. The optimal driving speed is defined as the theoretical driving speed.
where Li is the road segment length, which is constant.
Objective function T has a minimum value. Proof: Because Li is known to be constant, the objective function above can be simplified to Where >0, the Hessian matrix can be deduced as follows: It is obvious that H (X) is a positive definite symmetric matrix, and f(X) is a strictly convex function with a global minimization optimal solution and minimum value.
And then the sum ∑ =1 has the minimum value, which Proof: Based on the Cauchy inequality, the following formula holds.
So the conclusion is that the sum ∑ =1 has the minimum value, which is Lemma1 Based on Theorems 1 and 2, for the given driving route, if each road segment length of route Li is known and the average driving speed of route ⃗ is also defined, the optimal theoretical driving speed of each road segment can be solved by the following formula: where m = * ⃗ and n is the number of road segments, i=1,2,……n.
Taking the driving route composed of three road segments as an example.
Suppose It is obvious that as long as the actual driving speed of the road segment is greater than or equal to the theoretical driving speed, we can reach the destination at the desired time, which is also the minimum driving time.

C. EVALUATION PERFORMANCE INDEX
The evaluation performance index of the shortest route is the basis for drivers to choose the shortest route. The meaning of the shortest route also differs according to the different factors considered by drivers. The shortest route evaluation performance indices are as follows: the shortest driving distance and the shortest driving time.

1) THE SHORTEST DRIVING DISTANCE
The index of the shortest driving distance is used to select the shortest route among feasible routes from the departure to the destination, the length of which is equal to the sum of the lengths of each road segment. Because the length of the road segment is constant, it is easy to search for the shortest route using an algorithm. However, they are only suitable for static road networks. Because the actual road traffic state changes dynamically with time, the shortest route of the driving distance may consume more time when traffic conditions are poor.

2) THE SHORTEST DRIVING TIME
The shortest driving time is often the priority factor for drivers when they go to work or school, because they naturally do not want to spend too much time on the way to avoid being late. Therefore, the route with the shortest driving time is one that drivers expect to obtain.
For a static road network, the shortest driving route must also be that with the shortest driving time. For a dynamic road network, the shortest driving route is not necessarily the shortest driving time, and there is a certain contradiction between the shortest driving route and shortest driving time. Most drivers prefer the shortest driving time and want to have a high driving efficiency; therefore, we chose the shortest driving time as the dynamic route optimization evaluation performance index.

III. PREDICTIVE CONTROL MODEL OF REAL-TIME DYNAMIC ROUTE OPTIMIZATION
For the predictive control model, the driving time is the controlled variable, driving speed is the manipulated variable, and some traffic conditions are disturbance factors. The shortest static route is set as the reference route for the control system.

A. THE SET VALUE OF THE CONTROL SYSTEM
As a constant value control problem, the controlled variable is the driving time; therefore, the minimum driving time must be set as its set value, which is also called the desired time. The purpose of predictive control is to control the speed and select the route as far as possible to reach the destination at the desired time. We have | t -|≤δ where t is the actual driving time, is the set time or desired time, and δ is the maximum error. can be defined by the driving experience or by the following formula: where 0 is the length of the initial static shortest route and ̅ the estimated average speed of the route.
For the driving time control problem, as long as the actual driving time is less than the set or desired time, it is reasonable. However, the actual driving speed cannot exceed the value + . Driving speed control is different from general constant control.

B. REFERENCE TRAJECTORY (ROUTE)
A reference trajectory must be set for driving time control, which is similar to the predictive model in a model predictive control system. For real-time dynamic route optimization, the static shortest driving route is selected as the reference trajectory; however, it is changeable in the driving process. A new static driving route Sk+1 must satisfy the following conditions before it can be used as a reference route.
Suppose 0 is the length of the initial static shortest route, is the length of the current static shortest route, +1 is the length of the next static shortest route that will be used, and is the length that has been completed.
(a) Sk+1 < Sk (b) Sk+1≤ S0 -S p (c) Ve≥Vt Where k=0,1,2..n. Formula (c) means that the first road segment of the (k+1)th static shortest route should meet the following requirement at least, and it is that the enabled driving speed of the road segment is greater than or equal to the theoretical driving speed.
(d) The (k + 1)th static shortest route must have a cross node with the kth static shortest route, and the road segments from the intersection node to the end must be the road segments of the kth static shortest route (according to the Dijkstra shortest path algorithm [19]. Otherwise, it may be a miscalculation). .
(e) If Sk+1>S0-Sp , it must satisfy the following condition: where ̅ is the estimated average speed of the new reference route and is the remaining time to reach the destination.
The static shortest driving reference route can be determined by the road length matrix of the driving road network RL and Dijkstra's shortest path algorithm.

C. OBJECTIVE FUNCTION
For a driving time control problem, the purpose of control is to arrive at the destination at a given time; therefore, the objective function is defined as where, : length of road segment i, a constant. V : theoretical driving speed of the road segment, which will be solved. t 0 : previous driving time, which is known. t : desired time, which is the set value. i :1,2,3…………….n, number of remaining road segments in current driving route The objective function is a constrained optimization problem with a minimum value of 0. We denote C = − 0 , a constant, which represents the remaining driving time.
The objective function is equivalent to Because the objective function has a mini value of 0, we get ∂f = 0 Noting > 0, we obtain where i=1,2,3……n. N nonlinear equations are formed, and the problem is transformed to find the solution of the nonlinear equations. Suppose n=3, we have VOLUME XX, 2022 9 When n is very large, solving n for nonlinear equations is complicated.
From (17), theoretically, as long as the sum of the driving times of each road segment is equal to the remaining driving time, it can be guaranteed to arrive at the destination at the desired time.
We define ⃗ = ∑ =1 (18) This is the average speed for the driver to complete the remaining route with the remaining driving time. From (13) and (14), we obtain From Lemmas 1 and (11), the theoretical driving speed (or xi) can be solved.
is similar to the control output of a model predictive control system.

D. FEEDBACK CORRECTION
After one of the road segments is completed by the driver, the theoretical driving speed of the remaining road segments must be calculated again. If one of the following conditions is satisfied, we can continue driving along the current route.
(1) At least one of the road segments behind the current driving road segment of the route is not congested, and the driving speed of the road segments obtained from the online map is greater than or equal to the theoretical driving speed, ≥ .
(2) After the current road segment is completed, there is no switchable road segment.
(3) Another static reference route is severely congested. If the following conditions are satisfied, we can switch to another static reference route: (1) The actual driving speed of the current road segment is less than the theoretical speed ( < ), and traffic jams occur.
(2) The enabled driving speed of the next road segment (obtained online) of the route was less than the theoretical speed ( < ).
(3) The other reference route was not congested.
(4) After the current road segment is completed, a switchable road segment exists.

E. ROLLING OPTIMIZATION
Rolling optimization is an important feature of predictive control, which is performed repeatedly online to enhance the robustness of a control system.
Step 1: Drive on the initial static reference route and drive on the first road segment of the route.
Step 2: After the current road segment is completed, calculate the theoretical driving speed of the remaining road segments and judge whether we can continue driving on the current reference route. The method for determining the new static reference route is based on the above analysis.
Step 3: Step 2 and rolling optimization until the endpoint of the route. Fig.3 shows the main flow chart of the real-time dynamic route optimization.

IV. SIMULATION
NetLogo is a development platform for multi-agent model simulations that has a history of more than ten years. The platform is suitable for modeling and simulation of complex systems with time variation, and it can realize the functions of simulation operation, simulation output, experiment management, and so on. The latest version of NetLogo has four main types of agent: turtles, patches, observers, and links. Each type of agent has its own properties (parameters) and behaviors (instructions and functions), and we can also set new properties and functions for them. NetLogo's network extension function simulates and analyzes the network. To verify the accuracy of the model in a more complex road network, we use this platform to simulate the driving process. Fig.4, 5, 6, and 7 show the simulation results for the driving road network on the NetLogo platform. A road network with 20 nodes (intersections) are randomly produced. Each node is connected to neighboring nodes, and the link is representative of the road segment and is also an agent in NetLogo. A certain link has attributes, such as the length of the road segment, driving speed, and congestion rate. By selecting the starting node and the end node according to the predictive control model algorithm of real-time dynamic route optimization, it can simulate whether the driving route meets the control requirements. In Fig.4, 5, 6, and 7, the red node represents the static shortest driving route, and the red connection line represents the simulation of the actual driving route. Fig.4 and 5 show the simulation results under normal traffic conditions without congestion. As the figures show, the red line passes through all red nodes, and the initial static driving reference route is the actual driving route. Fig.6 and 7 show the simulation results in the case of congestion, and the red line connection is not completely consistent with the red node, but avoids congested road segments and finally returns to the initial static driving reference route. The simulation results prove that the predictive control model algorithm for real-time dynamic route optimization is correct and better.  Fig.8 shows the road network from the starting node to the end node, and it involves 9 roads, 13 intersections and 18 road segments. Fig. 9 is the abstract road network structure of Fig.8, and the starting point is node 1 and the end point is node 15. The route matrix of the driving road network RR and the road length matrix of the driving road network RL can be established.

V. CASE STUDY
The order of the conventional static route is obtained from a short route to a long route, which is calculated using the RL matrix and the Dijkstra shortest path algorithm.  Using the Baidu online map, the road-enabled driving speed matrix RV, road congestion rate matrix RC, and road state matrix RST can be obtained, and we can judge whether there are congested road segments. The set value or desired time from departure to destination is 6 min, and it can be divided into the following cases.

A. ANALYSIS OF NORMAL DRIVING CONDITION (NO CONGESTION ROAD SEGMENTS)
Step1: According to matrix RL, the Dijkstra algorithm is called to find the initial static shortest route, which is route1, and it is taken as the initial static driving reference route. The desired time is 6 min.
Step 2: starting to drive on the first road segment L12 .
Step 3: When road segment L12 is almost complete, the theoretical driving speed of the remaining road segments of the initial static reference route is calculated. While road segment L13-14 is finished, the remaining road segment L14-15 is the last road segment, which no longer needs to be calculated and judged. The actual driving time is 5.2 minutes, which is 0.8 minutes less than the set driving time or the desired time, and it meets the control requirements.
From the above analysis, if the road condition is good, it is not necessary to switch the route, and the initial static reference route can satisfy the control requirements. As the actual driving speed is greater than the theoretical driving speed under good road conditions, the driving time must be less than the set value.

B. ANALYSIS OF DRIVING IN CONGESTION
During the period of going to work and getting off work, the road from nodes 2 to 7 easily causes congestion. When we begin to drive along the route 1 and arrive at the node 3, the enabled driving speed of the remaining road segments is less than the theoretical driving speed and there is the switchable road segment L3-12, therefor, the new static shortest driving reference route (3-12-13-14-15) is determined. We can drive forward along the new reference route, and the method of calculating the theoretical driving speed and judging the switching route is the same as that in the above analysis. However, when the Dijkstra algorithm is used to calculate the new route, the length of road segment L34 should be set to the original route length to avoid including road segment L34 in the calculation process. Otherwise, the shortest route may be the previous route.

1) SERIOUS CONGESTION
The road from node 1 to node 4 is seriously congested, and the enabled driving speed of the road segments is less than the theoretical driving speed, the initial static shortest route 1 cannot be used. Therefore, the fourth static route (Route 4: 1-10-11-12-13-14-15) should be used for driving.

2) SPECIAL CONGESTION
If we drive along the initial static shortest route 1 until node 4, road segment L4-13 is congested and route 2 (4-5-14-15), which is the second static shortest route, is selected as the new driving reference route. When we drive to node 5 along route 2, road segment L5-14 is congested. Because L56+L69+L9-15>L5-14+L14-15, if one of the conditions is satisfied, the driving reference route can be switched to the new reference route (Route 5: 5-6-9-15).
where LT is the remaining driving time and is the enabled driving speed obtained from the Baidu online map.
Other special driving problems can be solved by referring to the above methods.

VI. CONCLUSION
The purpose of research on real-time dynamic route optimization is to provide drivers with an effective route between departure and destination, so that the cost of driving is the least. Generally, the shortest driving time is considered as the evaluation performance to optimize the route selection. At present, research on dynamic route selection is based on the prediction of future traffic flow or driving speed, and its deficiency is that the accuracy of prediction depends on the accuracy of modeling. When the model is established, it becomes a static model, which makes it difficult to follow realtime dynamic changes. At the same time, some modelling methods are complex, and the solutions of the models are complex and lack applicability.
The problem of dynamic driving route selection can be regarded as a special control problem, in which the driving time is regarded as the controlled variable, the shortest driving time is set as the control target (set value), and the driving speed is taken as the manipulated variable. Various road conditions are considered as the disturbance factors. According to an optimal control algorithm, the optimal driving route and speed are provided to overcome all types of disturbances and achieve the control goal. Therefore, the driver can arrive at the destination within the shortest time.
In the driving process, the road condition changes at any time, and all types of disturbance factors occur at any time. Therefore, driving, prediction, selection, and control are performed simultaneously. This control process is consistent with the principle of predictive control; thus, a real-time dynamic route optimization model algorithm based on predictive control is proposed. The model algorithm does not need to predict the future speed of roads or traffic flow. The route selection is based on the enabled driving speed which is obtained from Baidu online map and theoretical driving speed which is solved from the objective function of the remaining road segment, and the driving reference route is the static shortest route. The calculation of the method is convenient and simple, and the practical application and simulation results show that the algorithm achieves the best practical application and innovation.