## 6 Dynamic Path Optimization with Charging Selection
### Problem Formulation  
We aim to minimize the total cost of AEV from the starting node to the destination. The total cost consists of two parts: travel cost and charging cost. The travel cost of AEV \(k\) can be expressed as  
\[f_{1}^{k}=\sum_{ \begin{subarray}{c}i=s\\ j\in O(i)\end{subarray} }^{j=d}\Big{(}p_{t}\tau_{ij}^{k,r}(t)+p_{e}E_{ij}^{k}(t )\Big{)}x_{ij}^{k}(t), \tag{18}\]  
where \(p_{t}\) and \(p_{e}\) are the monetary value of time and energy for AEV, \(\tau_{ij}^{r,k}(t)\) and \(E_{ij}^{k}(t)\) are estimated travel time and consumption of charge cost on the road segment \((i,j)\) according to the real-time traffic information, respectively. \(x_{ij}^{k}(t)\) is a variable to indicate if AEV \(k\) selects segment \((i,j)\). AEV selects segment \((i,j)\), \(x_{ij}^{k}(t)=1\); otherwise \(x_{ij}^{k}(t)=0\), and the starting node and destination must have a selected road segment to leave and arrive. \[\sum_{ \begin{subarray}{c}i,j\in V\\ j\in O(i)\end{subarray} }x_{ij}^{k}(t)= \begin{cases}1,&i=s\text{ or }j=d\text{ or }\text{AEV }k\text{ select segment }(i,j),\\ 0,&\text{AEV }k\text{ does not select segment }(i,j).\end{cases}  \tag{19}\]  
The current SoC is greater than the total consumption of charge of the selected road segment. \[\sum_{ \begin{subarray}{c}i=s\\ j\in O(i)\end{subarray} }^{j=d}E_{ij}^{k}x_{ij}^{k}(t)\leq C_{s}^{k}. \tag{20}\]  
Traffic congestion has always been the biggest headache for drivers, which increases the travel cost of vehicles [44]. For an AEV, traffic congestion directly increases its consumption of charge and travel time. Therefore, the balanced use of road resources and the reduction of road congestion can improve travel efficiency and reduce travel costs. \[\eta_{ij}(t_{i}^{k})\leq\delta, \tag{21}\]  
where \(\delta\) is a parameter to control the size of TFD, which can be adjusted according to the historical traffic conditions of different segments in different time periods. When the AEV SoC cannot support it to reach the travel destination and is below the charging threshold \(\Omega\), AEV \(k\) needs to select charging infrastructure to complete the charging. The charging cost can be expressed as  
\[f_{2}^{k}=\sum_{ \begin{subarray}{c}\alpha_{s}\in V_{cs}\\ (i,j)\in\Theta_{e}\end{subarray} }\bigg{(}\Big{(}p_{t}\Big{(}\tau_{cs_{i}}^{k, m}(t)+\tau_{cs_{i}}^{k,c}(t)\Big{)}+p_{cs}\mathcal{C}_{a}^{k}\Big{)}y_{cs_{i}}^{ks }(t)+p_{r}\tau_{ij}^{k,c}\lambda y_{ij}^{ks}(t)\bigg{)}, \tag{22}\]  
where \(\tau_{cs_{i}}^{k,m}(t)\), \(\tau_{cs_{i}}^{k,c}(t)\) is the estimated queuing time cost and charging time cost. \(\lambda\) is the charging efficiency per unit of time on ES. \(p_{cs}\) and \(p_{r}\) are the unit electricity prices of the CS and ES, respectively; and \(p_{cs}<p_{r}\). \(y_{cs_{i}}^{k,cs}(t)\) and \(y_{ij}^{ks}(t)\) are variable that describes which charging infrastructure the AEV chooses,  
\[y_{cs_{i}}^{k,cs}(t)= \begin{cases}0,&\text{AEV $k$ does not select $cs_{i}$ },\\ 1,&\text{AEV $k$ select $cs_{i}$}.\end{cases}  \tag{23}\]  
\[y_{ij}^{k,cs}(t)= \begin{cases}0,&\text{AEV $k$ does not select $(i,j)$, $r_{ij}=1$ },\\ 1,&\text{AEV $k$ select $(i,j)$, $r_{ij}=1$}.\end{cases}  \tag{24}\]  
AEV \(k\) can only select one charging infrastructure at a time. \[\sum_{ \begin{subarray}{c}\alpha_{s}\in V_{cs}\\ (i,j)\in\Theta_{e}\end{subarray} }y_{cs_{i}}^{k,cs}(t)+y_{ij}^{k,cs}(t)= \begin{cases} 0,&\text{AEV $k$ is not charging },\\ 1,&\text{AEV $k$ select $cs_{i}$ or $(i,j)$}.\end{cases}  \tag{25}\]  
where \(r_{ij}=1\). To ensure that AEV \(k\) can successfully reach the selected CS,  
\[\bar{E}_{s,cs_{i}}^{k}y_{cs_{i}}^{k,cs}(t)\leq C_{s}^{k},\quad cs_{i}\in V_{cs}, \tag{26}\]  
where \(C_{s}^{k}\) represents the SoC of starting node, and \(\bar{E}_{s,cs_{i}}^{k}\) is the average value of the estimated consumption of charge under the path from starting node to \(cs_{i}\).