# A Multi-Agent Optimization Approach for Multimodal Collaboration in Marine Terminals
## 3 Model Formulation
### Terminal Processes Agent  
The terminal processes agent is responsible for operations related to the terminal and overall coordination of the system. All parameters and variables associated with the terminal are listed in Table 3.  
The terminal's decision-making is centered around managing requirements related to congestion, space, and available equipment. Four key metrics are considered: arrival rates, constrained by the maximum limit \(T_{max}\) (addressed in the previous section); queue length at the gate, limited by \(L_{max}\); cargo space in import and export areas, constrained by \(K_{max}\); and internal vehicles used, limited by \(V_{max}\). To model truck arrivals at the gate, a non-homogeneous Poisson distribution for the derived arrival rates \(r\) by the truck arrival management agent is used. Service times are treated as independent and identically distributed, consistent with the M/G/k queuing model, for \(k\) lanes as in existing literature [32; 33]. To handle cases when arrival rates exceed service rates, the stationary backlog-carryover method is used [34; 35], which allows queues to build up in overloaded periods, and waiting jobs can be transferred to a subsequent period. The queues effectively serve as constraints by determining the feasibility of a solution. If the queues become too long, the agent rejects the solution altogether. The derivation of equations to determine the queuing approximation for \(l\) can be found in Appendix A. Cargo quantities in the yard are updated based on the actual pickup and delivery rates \(r^{P}\) and \(r^{D}\), as provided by the truck arrival management agent, and are also contingent in the processing modes followed as explained in Section 3.1. For clarity of the formulations in Table 4, subsets relating to specific moments in the cargo handling process are formulated and measured in time periods. Essentially, the time-periods that a vessel will process cargo in, either in single or double mode, are isolated based on the mooring time and processing time derived by the berth-allocation agent. As previously discussed, based on whether there are more imports or exports, a different sequencing of cargo processing is performed. The total TEUs in import (\(z\)) and export areas (\(a\)) can then be computed based on Equations (11)-(18). For a specific vessel, cargo processing may begin after an associated time-period has started and conclude before a period ends. Equations (11)-(14) \begin{table}
\begin{tabular}{l l} \hline \hline
**Parameters** & \\ \hline \(G^{B}\) & Amount of processed cargo by an internal vehicle when a crane is in double mode \\  & in one period, measured in TEUs \\ \(G^{S}_{l}\) & Amount of processed cargo by an internal vehicle when a crane is in single mode \\  & and heading to import area in one period, measured in TEUs \\ \(G^{S}_{E}\) & Amount of processed cargo by an internal vehicle when a crane is in single mode \\  & and heading to export area in one period, measured in TEUs \\ \(K_{max}\) & Maximum cargo that can be stored in import/export areas, measured in TEUs \\ \(L_{max}\) & Maximum queue length in the gate area \\ \(V_{max}\) & Maximum number of internal vehicles that can be used to process cargo \\ \hline
**Variables** & \\ \hline \(a_{i}\) & Processed cargo in export area in time-period \(i\), measured in TEUs \\ \(e^{S}_{v}\) & Amount of internal vehicles to process cargo in single mode for vessel \(v\) \\ \(e^{B}_{v}\) & Amount of internal vehicles to process cargo in double mode for vessel \(v\) \\ \(f_{i}\) & Amount of internal vehicles needed to process cargo in time-period \(i\) \\ \(h^{S}_{v,i}\) & Processed cargo in single mode in time-period \(i\) related to vessel \(v\), measured in TEUs \\ \(h^{B}_{v,i}\) & Processed cargo in double mode in time-period \(i\) related to vessel \(v\), measured in TEUs \\ \(l_{i}\) & Queue length formed in time-period \(i\) \\ \(z_{i}\) & Processed cargo in import area in time-period \(i\), measured in TEUs \\ \hline \hline \end{tabular}
\end{table}