## 3 Problem Definitions and Formulation
### A Three-Level Framework of Planning  
To solve the three problems together, a three-stage procedure is proposed as shown in Figure 1. At the first stage, each ship \(i\) is assigned to a specific berth \(j\) taking both constraints (2) and (3) into account. Such an assignment is denoted as (\(i\),\(j\)) so that the decision variable \(X_{ij}^{t}=1\). At the second stage, for a berth \(j\) a number of QCs are assigned to serve the ships berthing on it. For each task \(k\) of ship \(i\), a specific quay crane \(q\) is assigned to handle it with both constraints (5) and (6) taken into consideration. This assignment is denoted as (\(i\),\(q\),\(k\)) and it makes the decision variable \(Y_{iqk}^{t}=1\). At the third stage, it determines the beginning time (\(T1_{iqk}\)) and the end time (\(T2_{iqk}\)) for a task \(k\) of ship \(i\) with this schedule denoted as \(\left(T1_{iqk},T2_{iqk}\right)\) that is subject to constraints (7)-(9). In [PERSON] and [PERSON] (2010), the authors pointed out that one way to integrate the seaside operational problems is to feed back the beginning time and completion time of the tasks determined in the QCSP to the BAP. This approach is adopted in this framework. Each level in the framework is detailed as follows:  
1. this level deals with the BAP. In this stage, heuristic rules can be used to allocate ships to berths. For example, the least workload (LWL) rule always assigns a ship to a berth that currently has the least workload. As a result, the workload among berths are balanced. The algorithm of the LWL is detailed below. 2. Set the current workload of each berth to zero. Figure 1: The input and output of the three-level framework of heuristics for simulation. Data 1: the \(\{\bigcup_{i=1}^{i=m}(i,j)\}\); Data 2: \(\{\bigcup_{i=1}^{i=m}(i,q,k)\}\) ; Data 3: \(\{\bigcup_{i=1}^{i=m}\left(T1_{iqk},T2_{iqk}\right)\}\). * Sort the calling ships by their Estimated Time of Arrivals (ETAs) to an ascending list \(S\). * Sort the berths by their workloads to an ascending set \(B\). * If \(S\
eq\emptyset\) then Assign the first ship in \(S\) to the first berth in \(B\) Remove the first ship from \(S\) Go to Step 5 Else Go to Step 6 End if. * Update the current workload of the selected berth, and then go to Step 3. * End
* this level deals with QCAP and QCSP. In this level, heuristics rules are used to assign QCs to ships. For example, the Load Balance (LB) rule assigns QCs to berths according to the workloads of ships assigned to berths. After determining the number of QCs assigned to each berth, the QCs are sequentially assigned to berths according to the QC number (Assume that QC along the quayside are assigned with an increasing QC number). Then, each task of a ship can be assigned to an assigned QC to that ship by using a LB rule, subjecting to the non-crossing characteristic of QCs. The LB rule is detailed below. * Calculate the numbers of QCs (\(l_{j},j\in B\)) to be assigned to each berth \(j\) using Equation (13), in which the round operator rounds each \(l_{j}\) off to the nearest whole digit; \(N_{k}^{i}\) is the total number of containers to be handled for the task \(k\) of ship \(i\); \(n_{j}\) is the number of ships assigned to berth \(j\) at Level 1. \[l_{j}=round\left(\sum_{i=1}^{n_{j}}\sum_{k=1}^{K_{i}}N_{k}^{i}/\sum_{i=1}^{m} \sum_{k=1}^{K_{i}}N_{k}^{i}\right)\forall j\in B\] (13)
* Set the workload of each QC q to zero (i.e., \(W_{q}=0,q\in Q\)). And, set \(u=1\) and \(i=1\). * Sort all QCs into an ascending set \(Q=\{1,\ldots,l\}\) according to their QC numbers. * Allocate QCs one by one to each berth \(j\) according to the QC numbers until the amount \(l_{j}\) is reached. Then the QCs assigned to a same berth are a group and denoted as \(Q_{j}\), where \(j\in B\). * Sort the tasks of each ship \(i\) into an ascending task set \(T_{i}\) according to the task numbers.