# A Two-Echelon Electric Vehicle Routing Problem with Time Windows and Battery Swapping Stations
## 3 Problem Formulation
### Model
Objective:  
\[\text{Min}f=f_{1}+f_{2}+f_{3}+f_{4}+f_{5} \tag{6}\]  
Subject to:  
\[\sum_{i\in V_{1}}x_{ijk}=\sum_{i\in V_{1}}x_{ijk}\ \ \forall j\in V_{1},i\
eq j,k\in K _{1} \tag{7}\]  
\[\sum_{k\in K_{1}}\sum_{i\in V_{1}}x_{ijk}\geq 1\ \ \forall j\in V_{5},i\
eq j \tag{8}\]  
\[\sum_{i\in V_{5}}u_{ik}\leq Q_{1}\ \ \forall k\in K_{1} \tag{9}\]  
\[t_{j}^{1}\geq t_{i}^{1}+t_{ij}-M(1-x_{ijk})\ \ \forall i\in V_{1},j\in V_{5},i \
eq j,k\in K_{1} \tag{10}\]  
\[t_{j}^{2}\leq t_{i}^{2}+t_{ij}+M(1-x_{ijk})\ \ \forall i\in V_{1},j\in V_{5},i \
eq j,k\in K_{1} \tag{11}\]  
\[t_{s}^{1}\leq t_{s}\ \ \forall s\in V_{5} \tag{12}\]  
\[f_{4}=c_{f}^{1}(\sum_{k\in K_{1}}\sum_{j\in V_{5}}x_{0 jk}) \tag{4}\]0  
\[f_{4}=c_{f}^{1}(\sum_{k\in K_{1}}\sum_{j\in V_{5}}x_{0 jk}) \tag{4}\]1  
\[f_{4}=c_{f}^{1}(\sum_{k\in K_{1}}\sum_{j\in V_{5}}x_{0 jk}) \tag{4}\]2  
\[f_{4}=c_{f}^{1}(\sum_{k\in K_{1}}\sum_{j\in V_{5}}x_{0 jk}) \tag{4}\]3  
\[f_{4}=c_{f}^{1}(\sum_{k\in K_{1}}\sum_{j\in V_{5}}x_{0 jk}) \tag{4}\]4  
\[f_{4}=c_{f}^{1}(\sum_{k\in K_{1}}\sum_{j\in V_{5}}x_{0 jk}) \tag{4}\]5  
\[f_{4}=c_{f}^{1}(\sum_{k\in K_{1}}\sum_{j\in V_{5}}x_{0 jk}) \tag{4}\]6  
\[f_{4}=c_{f}^{1}(\sum_{k\in K_{1}}\sum_{j\in V_{5}}x_{0 jk}) \tag{4}\]7  
\[f_{4}=c_{f}^{1}(\sum_{k\in K_{1}}\sum_{j\in V_{5}}x_{0 jk}) \tag{4}\]8  
\[f_{4}=c_{f}^{1}(\sum_{k\in K_{1}}\sum_{j\in V_{5}}x_{0 jk}) \tag{4}\]9  
\[f_{5}=c_{f}^{2}(\sum_{s\in V_{5}}\sum_{k\in K_{2}}\sum_{j\in V_{C}\cup V_{B}}z_{ sjk}) \tag{5}\]0  
\[f_{5}=c_{f}^{2}(\sum_{s\in V_{5}}\sum_{k\in K_{2}}\sum_{j\in V_{C}\cup V_{B}}z_{ sjk}) \tag{5}\]1  
\[f_{5}=c_{f}^{2}(\sum_{s\in V_{5}}\sum_{k\in K_{2}}\sum_{j\in V_{C}\cup V_{B}}z_{ sjk}) \tag{5}\]2  
\[f_{5}=c_{f}^{2}(\sum_{s\in V_{5}}\sum_{k\in K_{2}}\sum_{j\in V_{C}\cup V_{B}}z_{ sjk}) \tag{5}\]3  
\[f_{5}=c_{f}^{2}(\sum_{s\in V_{5}}\sum_{k\in K_{2}}\sum_{j\in V_{C}\cup V_{B}}z_{ sjk}) \tag{5}\]4  
\[f_{5}=c_{f}^{2}(\sum_{s\in V_{5}}\sum_{k\in K_{2}}\sum_{j\in V_{C}\cup V_{B}}z_{ sjk}) \tag{5}\]5  
The main constraints of the above model can be divided into three parts. The constraints of the first echelon and the second echelon are the Formulas (7)-(11) and (13)-(23),respectively, while the constraint (12) links the two echelons through the latest arrival time at each satellite. More specifically, constraints (7) and (13) ensure the flow conservation for ICVs and EVs, respectively. Constraint (8) implies that each satellite can be visited more than once by ICVs. Constraints (9) and (15) promise that the loading cannot exceed the capacities of ICV and EV, respectively. Constraints (10) and (18) give the upper bound of the arrival time of two echelons. Constraints (11) and (19) specify lower bounds of the arrival time of two echelons. Constraint (12) requires that the arrival time of ICV at each satellite s should be earlier than \(t_{s}\). Constraint (14) guarantees that each customer can be serviced by an EV only once. Constraint (16) ensures fully meeting the demands of each customer. Constraint (17) promises that each EV should arrive at each customer within the time window. Constraint (20) means that the EV does not consume battery power during the operation of a customer. Constraint (21) guarantees that the EV is fully charged when it starts from the satellite or a BSS. Constraints (22) and (23) keep track of the state of battery power of EVs starting from node \(i\) to node \(j\).