# A Multi-Agent Optimization Approach for Multimodal Collaboration in Marine Terminals
## 3 Model Formulation
### Berth Allocation Agent  
The berth allocation agent is responsible for vessel-related operations. All sets, parameters and variables necessary to describe this agent are listed in Table 1. Allocation of berths to each vessel \(v\) is defined by variable \(x_{v}\), while priority of vessels per berth \(y_{b}\) is an ordered set consisting of all vessel indices assigned to that berth, from higher to lower priority. A vessel \(v\) is granted access for mooring at time unit \(m_{v}\), and based on allocated berth \(x_{v}\), the processing time \(p_{v}\) for loading/unloading operations can be defined. Within the interval \([m_{v},m_{v}+p_{v}]\), the berth is considered occupied, with \(m_{v}+p_{v}\) representing the exit time of the vessel from the berth. The processing and mooring times for each vessel are measured in time-units (e.g., one minute) within the considered planning period. With respect to the berth compatibility, each vessel \(v\) is characterized by a vessel length \(L_{v}\). Similarly, each berth \(b\) is assigned a maximum vessel length \(M_{b}\) that it can service. Smaller vessels can use berths designed for larger vessels, but the reverse is not possible. Assignment of a larger vessel to an incompatible berth will result in an arbitrarily large processing time \(p_{v}\). Finally, the existence of priorities as established by \(y_{b}\) asserts that no vessel with higher priority for the same berth should experience delays due to a vessel with lower priority. Let \(y_{A}=[v_{0},v_{1},\ldots,v_{n}]\) be the ordered list of vessels assigned to berth \(A\), where \(n=|y_{A}|-1\). For each \(i\in\{0,\ldots,n-1\}\), the following condition must hold:  
\[m_{y_{A}^{i}}<m_{y_{A}^{i+1}}\quad\vee\quad m_{y_{A}^{i}}>m_{y_{A}^{i+1}}+p_{ y_{A}^{i+1}} \tag{1}\]  
where \(m_{y_{A}^{i}}\) denotes the mooring (start) time of vessel \(y_{A}^{i}\), and \(p_{y_{A}^{i}}\) is its processing time. This essentially ensures that a vessel with higher priority will never be delayed by a lower  
Figure 2: Representation of agent interactions. priority vessel, although a lower-priority vessel may still be served earlier if it does not interfere with the higher-priority vessel's schedule (as shown on the right hand side of Condition (1)). The relationship between priority \(y\) and mooring time \(m\) is further explained with an example in Figure 3.  
Processing time of cargo is the main determinant of the vessels' exit time from the terminal. For this particular problem, a vessel is considered to carry only cargo in the form of Twenty-foot Equivalent Units (TEUs). Cargo is either designated for exports (\(E_{v}\)) and must be loaded onto vessel \(v\), or it is designated for imports (\(l_{v}\)) and must be unloaded from vessel \(v\). The amount of TEUs to be processed evidently affects the processing time but so does the productivity of the assigned berth, as each berth has a specific number of available quay cranes \(C_{b}\), and TEUs that can be processed per time-period based on mode \(S^{S}\) and \(S^{B}\). When in single mode (\(S^{S}\)), cranes will exclusively load or unload cargo with