# A Multi-Agent Optimization Approach for Multimodal Collaboration in Marine Terminals
## 3 Model Formulation
### Berth Allocation Agent
\begin{table}
\begin{tabular}{l l} \hline \hline
**Sets** & \\ \hline \(B\) & Set of berths, indexed by \(b\) \\ \(\mathcal{I}\) & Set of time-periods, indexed by \(i\) \\ \(\mathcal{V}\) & Set of vessels, indexed by \(v\) \\ \hline
**Parameters** & \\ \hline \(A_{v}\) & Expected arrival time of vessel \(v\), measured in time-units \\ \(C_{b}\) & Number of quay cranes in berth \(b\) \\ \(E_{v}\) & Amount of export cargo for vessel \(v\), measured in TEUs \\ \(l_{v}\) & Amount of import cargo for vessel \(v\), measured in TEUs \\ \(L_{v}\) & Length of vessel \(v\), measured in meters \\ \(M_{b}\) & Maximum vessel length a berth \(b\) can service, measured in meters \\ \(S^{B}\) & Amount of processed cargo by a crane in double mode during a single time-unit, \\  & measured in TEUs per time-unit \\ \(S^{S}\) & Amount of processed cargo by a crane in single mode during a single time-unit, \\  & measured in TEUs per time-unit \\ \(W\) & Number of time-units in a single time-period \\ \hline
**Variables** & \\ \hline \(d_{v}^{S}\) & Amount of processed cargo in single mode for vessel \(v\), measured in TEUs \\ \(d_{v}^{B}\) & Amount of processed cargo in double mode for vessel \(v\), measured in TEUs \\ \(m_{v}\) & Mooring time of vessel \(v\), measured in time-units \\ \(p_{v}\) & Processing time of vessel \(v\), measured in time-units \\ \(p_{v}^{S}\) & Processing time of vessel \(v\) in double mode, measured in time-units \\ \(p_{vD}^{S}\) & Processing time of vessel \(v\) in single mode, measured in time-units \\ \(w_{v}^{D}\) & Set of time-periods \(i\in\mathcal{I}\) during which cargo deliveries for vessel \(v\) can occur \\ \(w_{v}^{D}\) & Set of time-periods \(i\in\mathcal{I}\) during which cargo pickups for vessel \(v\) can occur \\ \(x_{v}\) & Assigned berth for vessel \(v\), taking values \(b\in\mathcal{B}\) \\ \(y_{b}\) & Ordered set designating vessel priority for berth \(b\), taking values \(v\in\mathcal{V}\) \\ \hline \hline \end{tabular}
\begin{tabular}{|c|c|} \hline \multicolumn{1}{|c|}{V1} \\ \hline Arrival (\(A_{v}\)) & 5.00 \\ \hline Enter (\(m_{v}\)) & 5.00 \\ \hline Exit (\(m_{v}+p_{v}\)) & 7.00 \\ \hline \hline \multicolumn{1}{|c|}{V2} \\ \hline Arrival (\(A_{v}\)) & 4.30 \\ \hline Enter (\(m_{v}\)) & 7.00 \\ \hline Exit (\(m_{v}+p_{v}\)) & 8.00 \\ \hline \end{tabular}
\end{table} 
Table 1: Sets, parameters and variables used by the berth allocation agent. Figure 3: Two cases of execution of vessel schedules approaching the same berth with V1 having priority over V2. V1 has a 2-hour processing time, while V2 has a 1-hour processing time. In Case 1, V2 arrives 30 min before V1 but must wait due to VI’s priority. In Case 2, V2 arrives an hour earlier and can be served by 5:00, when V1 arrives, despite the lower priority. no overlap. When in double mode (\(S^{B}\)), loading of containers can take place in parallel to unloading and vice-versa. Derivation of processing times for vessels follows a process similar to [18] as follows:  
\[d^{B}_{v} =\min(I_{v},E_{v}) \forall v\in\mathcal{V} \tag{2}\] \[d^{S}_{v} =|I_{v}-E_{v}| \forall v\in\mathcal{V}\] (3) \[p_{v} =p^{S}_{v}+p^{B}_{v} \forall v\in\mathcal{V}\] (4) \[p^{S}_{v} =\frac{d^{S}_{v}}{S^{S}\cdot\mathsf{C}_{x_{v}}} \forall v\in\mathcal{V}\] (5) \[p^{B}_{v} =\frac{2d^{B}_{v}}{S^{B}\cdot\mathsf{C}_{x_{v}}} \forall v\in\mathcal{V} \tag{6}\]  
where \(d^{S}_{v}\) is the amount of TEUs to be processed in single mode and \(d^{B}_{v}\) the amount of cargo to be processed in double mode. Processed cargo in a specific mode is calculated in Equations (2) and (3), asserting that as many TEUs as possible will be processed in double mode and the rest in single mode. Then, the processing time is defined in Equation (4), contingent on the individual processing times per crane mode as defined in Equations (5) and (6). Depending on whether a vessel has more TEUs to load than unload, double mode processing will occur before or prior to single mode. When there are more TEUs to be loaded to the vessel than unloaded, the vessel will first be processed in double mode.