## 4 The ISFLA for Solving the Simultaneous DCBAP
### The Two Stage Procedure
#### 4.6.2 The Second Stage  
The second stage focuses on developing a feasible DCBAP solution after resolving overlaps of ships. This process contains three steps: place ships one by one into a berth plan, identify each overlap of ships, and resolve the overlap. These three tasks are repeated until all ships have been placed into the berth plan without any overlap.  
Step 1: Place ships one by one into the berth plan  
From the objective function, we know that if every ship is assigned its best position (\(ETA_{j},d_{j}\)), this will lead to the optimal berth plan (i.e., \(Z=0\)) due to there being no increased waiting or handling costs for the ships. However, if there are too many ships calling a container terminal at the same time, then this ideal arrangement becomes impossible due to the limited available resources in terms of both space and time. Repositioning overlapped ships is necessary, and repositioning around the best position will lead to the generation of optimal/near-optimal solutions.  
Step 2: Identify overlapsFigure 7 shows a berth plan with two ships that are overlapping in the dimensions of \"space\" and \"time\". Given that \(a=(x_{0}^{j},\,y_{0}^{j})\) and \(c=(x_{1}^{j},\,y_{1}^{j})\) are the coordinates of the lower-lef and upper-right corners of the ship \(j\), while \(a^{\prime}=(x_{0}^{k},\,y_{0}^{k})\) and \(c^{\prime}=(x_{1}^{k},\,y_{1}^{k})\) are the coordinates of the lower-left and upper-right corners of the ship \(k\), respectively, then Equation (29) is used to check whether the two ships are overlapping. If the following coordinate relationships hold simultaneously, then the two ships are concluded to be overlapping.  
\[x_{0}^{j}\textless x_{1}^{k},\,\,y_{0}^{j}\textless y_{1}^{k},\,\,x_{0}^{k} \textless x_{1}^{j},\,\,y_{0}^{k}\textless y_{1}^{j} \tag{29}\]  
Step 3: Resolve the overlap  
Resolving all overlaps of ships is necessary in order to make a feasible plan. In this research, a target ship is permitted to move in one of the following three directions: +Y, -Y, and +X, in order to resolve an overlap. However, while moving towards the +Y/-Y direction, handling times will be increased for the target ship due to the longer moving distances that trucks will have to move containers (Figure 8). When moving towards the +X direction, waiting time (cost) will be increased for the target ship (Figure 9). The lower the moving cost, the higher the priority.  
For a target ship \(j\) moving toward the +Y/-Y direction, Equation (30) is used for estimating the increased distance \(\Delta Y_{j}\).  
\[\Delta Y_{j}=\left\{\begin{array}{cl}l_{j}+\left|y_{1}^{k}-y_{0}^{j}\right|& \text{if moving towards}+Y\\ -\left|y_{1}^{j}-y_{0}^{k}\right|&\text{if moving towards}\,\,-Y\end{array}\right. \tag{30}\]  
Equation (31) is the cost of increased handling times, where \(c_{2}\) is the cost rate of handling time, \(\beta=2/\left(100*60\right)\), and \(\Delta b_{j}=\left|\Delta Y_{j}\right|\).  
\[\Delta\text{C}_{\text{Y}}(j)=\beta\textless\Delta b_{j}c_{2}=\frac{2\left| \Delta Y_{j}\right|}{100*60}\times c_{2} \tag{31}\]  
After repositioning, the coordinates of the lower-left and upper-right corners of the target ship \(j\) become \(a=(x_{0}^{j},\,y_{0}^{j}+\Delta Y_{j})\) and \(c=(x_{1}^{j},\,y_{1}^{j}+\Delta Y_{j})\), respectively.  
Figure 7: The coordinates of the corner points of ships \(j\) and \(k\).  
For a target ship \(j\) moving towards the +X direction, Equation (32) is available for estimating the increased waiting time.  
\[\Delta X_{j}=\left|x_{0}^{j}-x_{1}^{k}\right| \tag{32}\]  
Equation (33) is the increased waiting cost, where \(c_{1}\) is the cost rate of waiting time.  
\[\Delta C_{\rm x}(j)=\Delta X_{j}\times c_{1} \tag{33}\]  
After repositioning, the coordinates of the lower-left and upper-right corners of the target ship \(j\) become \(a=(x_{0}^{j}+\Delta X_{j},\,y_{0}^{j})\) and \(c=(x_{1}^{j}+\Delta X_{j},\,y_{1}^{j})\), respectively.