# A Multi-Agent Optimization Approach for Multimodal Collaboration in Marine Terminals
## 4 Solution Methodology
### Prioritized Search
#### 4.2.2 Search Algorithm  
A search strategy is proposed that takes elements from neighborhood search to efficiently explore the solution space for different applied vessel priorities. Algorithm 4 is employed to search for non-dominated priorities by systematically refining the solution space through a combination of exploration and exploitation strategies. Below are the key steps of the search algorithm:```
1 ledger \(\leftarrow\left\{ \begin{array}{l}\text{BA}:\{\text{s}:\emptyset,\text{b}:\infty\}, \\ \text{TAM}:\{\text{s}:\emptyset,\text{b}:\infty\}\end{array} \right\}\)
2 swap \(\leftarrow[1\mid\forall\text{i}\in\mathcal{V}]\)\(front\), candidates \(\leftarrow\emptyset,\emptyset\)whileTruedo
3 sols, swap \(\leftarrow\) priority_tree(y, swap) non_dominated \(\leftarrow\emptyset\)addsols in candidates
4\(n\leftarrow\) [candidates] for\(i\in\) candidates \(\setminus\) {candidates[\(n\)]} do dominated \(\leftarrow\) False
5 for\(j\in\) candidates \(\setminus\) {candidates[\(0\)]} do if\(i\
eq j\)andis_dominated(i, j)then dominated \(\leftarrow\) True break if not dominatedthen add(i) in non_dominated
6 add non_dominated \(\rightarrow\)\(front\)for\(\text{f}\in\)\(front\)do ifledger[BA][b] \(>\) f[BA\({}^{\epsilon}\)] then ledger[BA] \(\leftarrow\) {s : f, b : f[BA\({}^{\epsilon}\)]} ifledger[TAM][b] \(>\) f[TAM\({}^{\epsilon}\)] then ledger[TAM] \(\leftarrow\) {s : f, b : f[TAM\({}^{\epsilon}\)]} Define \(u\sim\) Uniform(0, 1) if\(u<pb\)then selecty from ledger[BA][sol] apply destroy operator on y update y with a repair operator
7 elseif\(u<pt\)then selecty from ledger[TAM][sol] apply destroy operator on y update y with a repair operator
8 else selecty from current front update y with a random operator
9 if endthen break return\(front\)
```

**Algorithm 4**priority_search(y,end,pb,pt)

```
1. Initialization: The algorithm begins with an intuitively promising priority strategy. We utilize FCFS for the examined vessels and create the priority trees as previously explained in (Algorithm 3). Two termination criteria, collectively denoted as end, are considered:
2. A pre-specified maximum number of iterations. 3. Convergence to a certain Pareto front satisfying solution quality thresholds. 4. Updating the Pareto Front: At each iteration, dominated solutions derived from the priority trees are discarded to create the current best Pareto front (Algorithm 4, Lines 6-17). 5. Exploration and Exploitation: The algorithm uses exploration and exploitation to refine and diversify the solution space (Algorithm 4, Lines 18-34): * Exploitation: A ledger maintains the best feasible priorities and allocations for each decision-making agent (Algorithm 4, Lines 18-22). To intensify the search near high-quality solutions, we apply a destroy-and-repair strategy: part of a solution is perturbed and then heuristically reconstructed (Algorithm 4, Lines 23-33). The process is applied to the current best solution of either the TAM or BA agent, chosen at random from the ledger. A destroy operator is followed by a repair operator, both selected randomly. The available operators are:  
_Destroy operators_ apply targeted changes:  
* random_subsequence_removal: removes a contiguous block of \(n\) elements and then applies local reordering. * random_position_removal: removes \(k\) elements from random positions for broader variation. _Repair operators_ restore priority structure:  
* random_reinsertion: reinserts removed elements at random positions to promote diversity. * greedy_reinsertion: reinserts each element in a weighted manner influenced by the _swap_ archive. * Exploration: To diversify the search space and avoid local optima, we apply a set of local operators that modify candidate solutions. One operator is selected at random in each iteration. The following operators are used:  
* insert--Inserts a random vessel into a different position in the sequence. To guide the exploration, we use the _swap_ archive as a weight for vessel selection. * shuffle--Randomly shuffles a small segment of consecutive vessels.