# The Electric Vehicle Routing Problem with Time Windows, Partial Readers, and Parcel Lockers
## 4 Solution Method
### Evaluation of Penalties
#### 4.2.3. Concatenation Operators  
By utilizing forward and backward variables, concatenation operators allow us to obtain the penalties in \(\mathscr{O}(1)\) time complexity for two cases: (1) when inserting a node into a route, and (2) when removing a node from a route. However, when route segments (i.e., at least two vertices) are inserted, either forward or backward penalties have to be updated for the route segment first before implementing the two above-mentioned cases. (1) Insert a node \(v\) into a route \(V\), expressed as \(V=\{0,\ldots,x,v,y,\ldots,0\}\). There are two partial routes partitioned by node \(v\); i.e., \(V^{1}=\{0,\ldots,x\}\) and \(V^{2}=\{y,\ldots,0\}\). Forward and backward variables at node \(v\) are calculated by Equations (22)-(28) and Equations (31)-(37), respectively. Time window violation (\(\lambda_{T}(V)\)) and battery violation (\(\lambda_{B}(V)\)) are then obtained as follows.  
\[\lambda_{T}(V)=\overrightarrow{\lambda}_{T}(V^{1})+ \overleftarrow{\lambda}_{T}(V^{2})+\max\{0,a_{v}^{min}-l_{v}-\max\{0,a_{v}^{ min}-a_{v}^{max}\}\}+ \tag{40}\] \[\max\{0,\min\{l_{v},\max\{e_{v},a_{v}^{min}\}\}-b_{v}^{min}-\max \{0,b_{v}^{max}-b_{v}^{min}\}\}\] \[\lambda_{B}(V)=\overrightarrow{\lambda}_{B}(V^{1})+ \overleftarrow{\lambda}_{B}(V^{2})+\max\{0,a_{v}^{min}-a_{v}^{max}\}+\max\{0, b_{v}^{max}-b_{v}^{min}\}+\Delta^{(i)} \tag{41}\]  
\[\text{where }\Delta^{(i)}=\begin{cases}\max\{0,a_{v}^{rt}+b_{v}^{rt}-H-\min\{a_{v}^{ rt},\max\{0,\max\{b_{v}^{max},b_{v}^{min}\}-\min\{a_{v}^{min},a_{v}^{max}\}\}\} \}\quad\text{if }v\in F\\ \max\{0,a_{v}^{rt}+b_{v}^{rt}-H-\min\{H,\max\{0,b_{v}^{min}-b_{v}^{max}\}+\max \{0,a_{v}^{max}-a_{v}^{min}\},\\ \max\{0,\min\{l_{v},\max\{b_{v}^{min},b_{v}^{max}\}\}\}-\min\{a_{v}^{min},a_{v} ^{max}\}\}\}\}\end{cases}\]  
(2) Removing a node \(v\) from a route \(V\), we obtain two partial routes \(V^{1}=\{0,\ldots,x\}\) and \(V^{2}=\{y,\ldots,0\}\). First, forward variables at node \(y\) are extended by Equations (22)-(28). Second, Equations (42) and (43) are derived to calculate the time windows and battery violations, respectively.  
\[\lambda_{T}(V)=\overrightarrow{\lambda}_{T}(V^{1})+ \overleftarrow{\lambda}_{T}(V^{2})+\max\{0,a_{y}^{min}-l_{y}-\max\{0,a_{y}^{ min}-a_{y}^{max}\}\} \tag{42}\] \[+\max\{0,\max\{e_{y},\min\{a_{y}^{min},a_{y}^{max},l_{y}\}\}-b_{y }^{min}\}\] \[\lambda_{B}(V)=\overrightarrow{\lambda}_{B}(V^{1})+ \overleftarrow{\lambda}_{B}(V^{2})+\max\{0,a_{y}^{min}-a_{y}^{max}\}+\Delta^{ (r)} \tag{43}\]  
\[\text{where }\Delta^{(r)}=\begin{cases}\max\{0,a_{y}^{rt}+b_{y}^{rt}-H-\min\{a_{y}^ {rt},\max\{0,b_{y}^{min}-\min\{a_{y}^{min},a_{y}^{max}\}\}\}\}\quad\text{if }y\in F\\ \max\{0,a_{y}^{rt}+b_{y}^{rt}-H-\min\{H,\max\{0,b_{y}^{min}-b_{y}^{max}\}+\max \{0,a_{y}^{max}-a_{y}^{min}\},\\ \max\{0,\min\{l_{y},\max\{b_{y}^{min},b_{y}^{max}\}\}-\min\{a_{y}^{min},a_{y} ^{max}\}\}\}\}\end{cases}\]  
These operators never underestimate the total time window and battery violations, although the equations do not provide exact penalty values for each component.