## 3 Time and Energy Optimization by Multi-Weighted Dynamic Programming
\(P_{max}\) and \(P_{min}\) are, respectively, determined by checking the maximum and minimum values of each P\({}_{h}\) value determined between each node using Equation (13) in the node-data-setting stage before optimization. Similarly, \(T_{max}\) and \(T_{min}\) are, respectively, determined by checking the maximum and minimum values of the \(T_{i}\) values calculated using Equation (12). Table 3 presents the parameters of the cost function used in this study (Equation (13)). For an optimization problem with a total of \(N_{d}\) stages, we aim to find the path with the smallest cumulative sum of the stage energy costs \(E_{k}\), as shown in Equation (17). \[\textit{min}\ \sum_{\textbf{1}}^{N_{d}}\textbf{{E}}_{k} \tag{17}\]  
(3) Generate the minimum cost and optimal path at each node in the reverse direction  
Now, if the cost is determined for all edges in the network connecting each node in the two-dimensional plane for distance and speed, to apply dynamic programming, \begin{table}
\begin{tabular}{c c c c} \hline \(P_{max}\) **(0)** & \(P_{min}\) **(0)** & \(T_{max}\) **(s)** & \(T_{min}\) **(s)** \\ \hline \(5\times 10^{6}\) & 11,027 & 80 & 0.4 \\ \hline \end{tabular}
\end{table} 
Table 3: Parameters of the cost function. Equation (18) represents the structure of a typical DP algorithm. It is a mechanism that reduces the computation time by preventing duplicate calculation of cost at each edge. To do this, the calculation is performed starting from the final stage and going backward to the minimum-cost calculation. At each stage, the minimum cost and optimal node are stored, and the optimization is performed until the starting stage. By proceeding with this procedure, the final optimal path can be obtained from the starting stage. In Equation (18), \(E_{k,:}\) is the cost matrix calculated using Equation (14) at the \(k\)-th stage, and \(J_{k+1,:}\) is the optimal cost matrix cumulatively calculated from the \(k\)+1-th stage to the final stage using Equation (18). \[[J_{k},\ I_{k}]=min_{col}[E_{k,:}+J_{k+1,:}(x_{k+1})]. \tag{18}\]  
Here, \(J_{k}\) is the minimum cost from the \(k\) stage to the final stage, and it is composed of an array with N+1 values that are calculated according to each weight, as shown in Equation (19). Here, \(I_{k}\) consists of an array with N+1 position indexes of the minimum value for each weight, and \(min_{col}\) defines the minimum value for each column in a matrix. \[J_{k}=[j_{a0}\ j_{a1}\ \ldots\ j_{aN}] \tag{19}\]  
\[I_{k}=[i_{a0}\ i_{a1}\ \ldots\ i_{aN}] \tag{20}\]  
\[E_{k,:}=\Big{[}\varepsilon_{a0}^{s\times 1}\ e_{a1}^{s\times 1}\ \ldots\ e_{aN}^{s\times 1} \Big{]} \tag{21}\]  
\[J_{k+1,:}=\Big{[}\tilde{\varepsilon}_{a0}^{s\times 1}\ \tilde{\varepsilon}_{a1}^{s \times 1}\ \ldots\ \tilde{\varepsilon}_{aN}^{s\times 1}\Big{]}. \tag{22}\]  
Here, \(P_{n}\) is the minimum-cost path at stage \(k\)+1 for each weight, and the optimal path in step \(k\) is generated by adding the stage \(k\)+1 optimal path (\(P_{n}\)) to the stage \(k\) optimal node (\(l_{k}\)), as shown in Equation (26). This process is repeated in the direction of the starting node. \[P_{k,s}=\big{[}I_{k}^{T}\ P_{n}\big{]} \tag{26}\]  
Therefore, in the last stage, stage 1, the cost and the optimal path in Equation (27) are constructed. \[P_{1,1}:Optimal\ path. \tag{27}\]  
Then, the optimal path for all weights considering the starting node is completed using Equation (28). \[P_{0,0}=\Big{[}1^{(N+1)\times 1}\ P_{1,1}^{(N+1)\times dK}\Big{]}. \tag{28}\]  
(4) Speed-profile creation using optimal node  
The optimal speed profile using the final node information of Equation (28) is arranged when \(d_{v}\) is applied, as shown in Equation (29). \[V=[P_{0,0}\times d_{v}-d_{v}]=[v_{0}^{(N+1)\times 1}v_{1}^{(N+1)\times 1}\cdots v _{dK}^{(N+1)\times 1}], \tag{29}\]  
where \(d_{v}=v_{k+1}-v_{k}\) is the interval of discrete speed.