The Optimization Process for Seaside Operations at Medium-Sized Container Terminals with a Multi-Quay Layout

The optimization of seaside operations at container terminals includes solving standard berth and crane allocation problems. The question arises about the efficiency of such optimizations in small and medium-sized container terminals, with different quay designs or different terminal layouts. This paper focuses on developing an integrated model that would apply to medium-sized terminals with a multi-quay layout. The main objectives are determining the shortest possible vessel stay at the port and providing a high-reliability service to ship operators. The developed integrated model includes the optimization process in three stages: initiation, assignment, and adjustment. The model’s main feature is generating operational scenarios based on the cargo distribution onboard and integrated berth and crane allocation. The aim is to choose the most favorable option to optimize ships’ overall processing time in the planning horizon. The experiment was conducted to test the model’s functionality and justify the results by comparing the results obtained by the integrated model with the classical approach of berth and crane allocation in a multi-quay environment. The results show significant improvements in peak periods when ships’ arrivals are concentrated in smaller time intervals by applying the integrated model.


Introduction
The development of container shipping presents continuous challenges to ports not only for large but also for small and medium-size terminals (hereinafter: CT). The pressure becomes stronger as the vessel's size grows, and the shipping operators' requirements become higher concerning the quality of port services and service time. Many small and medium-sized ports have different terminal layouts than those of high-productivity port hubs or have displaced container handling facilities.
Instead of one long quay, a terminal with more discontinued quays may form different layouts. Quays may be constructed as a pier type, basin type, or natural type following the shoreline shape ( Figure 1). Different layouts imply distinct approaches to solving basic seaside tactical logistic problems: the berth allocation problem (BAP), the quay crane allocation problem (QCAP), and the quay crane scheduling problem (QCSP). Due to the seaside operations that are considered to be most important for shipping operators because of their high impact on vessels' service time in ports, the methods and models of optimization developed in the last few decades aim to improve and facilitate relevant decisions: namely, the decision of when the ship will be berthed, on which berth, how many quay cranes will be assigned to the vessel, and in which way the handling process will be shared between assigned cranes.
propose a three-stage optimization process to solve an integrated BAP and QCAP problem applicable to a multi-quay environment where discontinued quays exist either as a single terminal or as independent terminals located within the same port area.
From the port design point of view, it is interesting to compare those results with a what-if scenario, when the same demand and capacity would be achieved with a single-quay layout. The results of the experiments are presented in the following chapters.

General Problem Survey Papers
Many researchers have investigated these general problems, and different optimization models have been developed in the last two decades. Research projects were initiated because of their commercial implications, as well as the interest of shipowners and port operators in problem solving. Solutions may be adopted for the business environment and goals to achieve the best port performances. Vis and de Koster [1] described all subprocesses and types of material handling equipment and classified decision-making problems. The authors suggested the simplification of the problem complexity before using analytical models for solving them. Tactical decision-making problems on CT were classified by Steenken et al. [2] and defined as logistic problems or logistic processes on CT. These problems vary depending on the subsystem where they appear: the quay or seaside subsystem, the yard subsystem, and the inland or land-side subsystem. The three main tactical decision-making problems on the seaside are the berth allocation problem (BAP), the quay crane allocation problem (QCAP), and the quay crane scheduling problem (QCSP).
Detailed classification schemes for seaside operations planning and different types of problems according to optimizations goals and specific features of problem formulation were given by This paper proposes a new, tailor-made integrated model for solving seaside decision-making problems on terminals with a multi-quay layout or with existing quay discontinuity, applicable to smaller and medium-sized CTs where the central objective is to minimize vessels' service time and provide a high-reliability service to ship operators. The same can be applied for multi-terminal environments or linked port systems, like those in the Northern Adriatic region. When modeling seaside operations, the problems are the forward and backward interdependencies between three main decision-making problems and the complexity of optimizations required. Therefore, we propose a three-stage optimization process to solve an integrated BAP and QCAP problem applicable to a multi-quay environment where discontinued quays exist either as a single terminal or as independent terminals located within the same port area.
From the port design point of view, it is interesting to compare those results with a what-if scenario, when the same demand and capacity would be achieved with a single-quay layout. The results of the experiments are presented in the following chapters.

General Problem Survey Papers
Many researchers have investigated these general problems, and different optimization models have been developed in the last two decades. Research projects were initiated because of their commercial implications, as well as the interest of shipowners and port operators in problem solving. Solutions may be adopted for the business environment and goals to achieve the best port performances. Vis and de Koster [1] described all subprocesses and types of material handling equipment and classified decision-making problems. The authors suggested the simplification of the problem complexity before using analytical models for solving them. Tactical decision-making problems on CT were classified by Steenken et al. [2] and defined as logistic problems or logistic processes on CT. These problems vary depending on the subsystem where they appear: the quay or seaside subsystem, the yard subsystem, and the inland or land-side subsystem. The three main tactical decision-making problems on the seaside are the berth allocation problem (BAP), the quay crane allocation problem (QCAP), and the quay crane scheduling problem (QCSP).
Detailed classification schemes for seaside operations planning and different types of problems according to optimizations goals and specific features of problem formulation were given by Bierwirth and Meisel [3]. They recognized the interdependencies of problems and explained shortcomings when considering each problem separately. The main concern is how service time could be considered during berth and crane allocations to vessels. It depends on the cargo distribution onboard and the utilization of assigned cranes. The authors presented integration concepts classified into deep integration, problem preprocessed integration, and feedback loop integration. Deep integration requires developing complex models that are difficult to solve and regularly require post-solving adjustments or strategies to deal with variations in time caused by uncertainties in vessel arrival and handling. Novelization of the literature survey for the same topic was published by the same authors in [4]. They expanded the overview of CT problem research to problems related to liner shipping schedules and yard optimization. Some other papers also contributed to the literature survey, such as [5] with focus on operations research methods used for solving the operational problems at CTs, [6] with a review of scheduling decisions, formulation, and solutions, and [7] with a collection of operational decisions in a container terminal and supported tools.
Carlo et al. [8] proposed 19 avenues for future research. Among them are those with alternative layouts designed for non-traditional berths. The authors justify the need for new designs with the mooring and handling of high-capacity vessels.

Berth Allocation and Crane Allocation as Isolated Problems in Related Papers
The berth allocation problem is a well-known logistic problem in CT process optimization. Some of the first authors, to our knowledge, who published papers related to discrete berth allocation were Imai et al. [9] and Nishimura et al. [10]. At the same time, Lim [11] conducted his research with a continuous berth layout. Alternatively, in a basic problem formulation where there are no attributes other than those related to the vessel's dimension, time of arrival, and processing time, some authors put various attributes into the objective function, depending on their business or operational strategy and preferences. Such authors are Kim and Moon [12], who included the position reference attribute into the model, or Guan and Cheung [13], who included priority weights. Individual preferences of vessels belonging to a particular shipping operator are usually not accepted by public ports, so the authors of [14,15] developed a priority model that is not based on a particular shipping company suitable for public rather than private ports. Crane allocation is closely related to BAP problems because it depends on vessel berthing and vessel cargo handling demand. Crane to vessel assignment is elaborated in [3,16].
Recent papers focused on specific targets in BAP planning. Dulebenets [17] focused on modeling a problem in a multiuser environment where different liner shipping companies are to be served, such that terminal operators may consider the priority of vessels in the berth scheduling. The objective is to minimize the total cost of liner shipping companies assuming that larger ships with higher container volumes have a higher cost. The priority management of vessel berthing is also considered in [18], where the authors use a discrete event simulation method to support different berth allocation strategies for berth allocation operations.
Some studies focused on real-world problems caused by natural restrictions on water depth. The tidal restrictions are considered in [19,20], where channel scheduling caused by channel depth restrictions and time-varying water depths is integrated into BAP modeling. The research in [21] aimed to reduce additional fuel costs caused by ship waiting time for a free berth. The cost function considers the fuel cost incurred while waiting, fuel cost incurred while operating at the port, and the cost of hiring quay cranes.

Integrated Solutions
Integrated solutions described these three main logistic problems much better in a real-life environment. Park and Kim [22] developed the first integrated model for BAP and QCAP solutions, according to our knowledge. Problem preprocessing and feedback loop integration are elaborated in detail in [23]. In that paper, Meisel and Bierwirth divided the decision-making procedure into three phases: in the first phase, they consider stowage plans and crane production rates to solve crane scheduling; the next phase includes berthing decisions and crane allocation per vessel, while phase three is reserved for the calibration of crane scheduling considering time windows for handling. The paper provided an integration framework for problem solving.
Several new research papers provide integrated solutions like [24,25] or different approaches to solving integrated problems like [26], which take disruption into account when modeling BAP and QCAP, compare it to a basic schedule, and develop an objective function to minimize recovery costs. Recovery costs or deviations from previous solutions were also subject to the interest of researchers in [27], where a new functional integration of BAP and QCAP is provided with penalty costs, and in [28], where the recovery-based optimization approach is implemented with buffer times in order to absorb variations in time caused by uncertainties in vessel arrival and handling. The study in [29] extends the traditional berth and quay assignment to the yard storage assignment problem and considers the vessel arrivals' weekly pattern according to shipping liner schedules. The simulation approach for solving the integrated dynamic problem with stochastic handling times is proposed in [30]. The authors considered some uncertainties in handling times due to weather conditions, information availability, maintenance, and equipment reliability. The integrated solution involving the crane maintenance schedule was the research aim in [31], where QC (quay crane) maintenance activity constraints are introduced in the integrated model. Finally, in the most recent works, the focus has been shifted to terminal operations' consumption and pollution challenges. The general approach is to evaluate consumption through extra social costs. Karam et al. [32] considered energy consumption and its negative impacts in CT. They integrated the truck assignment problem into the optimization objective. Wang et al. in [33,34] studied integrated berth and quay crane assignment concerning different carbon emission taxation rates and included this tax as an additional operating cost. The proposed optimization model is a trade-off between service efficiency and operating costs, including carbon emission taxation.

Papers Where a Multi-Quay or Multi-Terminal Environment Is Considered
A multiuser CT usually operates as a common user terminal, offering service to any shipping lines without priorities. On the other hand, there are CTs dedicated to specific shipping lines where priority exists. A combination of those two operating principles within the context of berth allocation problem solving is studied in [35,36]. The idea is that when extensive traffic is present, a terminal operator of a multiuser CT can divert a vessel to an external (dedicated) container terminal. The proposed model minimizes the total vessel service cost from the perspective of terminal operators. Hendriks et al. [37] considered a single terminal operator who provides a terminal operation service at more than one CT located within the same port area. They set two objectives: to balance the QC workload over the terminals and over time and minimize inter-terminal container transport. However, unlike in [35], the model's implementation is not focused on the high-demand period but rather the costs associated with each operating quay crane and container transported from one terminal to another. This approach is interesting compared to recent research and models aiming to reduce the energy consumption and high workload of quay cranes.
New technologies, a new generation of container vessels, and a new generation of automated cranes with two trolleys capable of multi-container or multi-unit handling are considered in [38]. The authors examined the different layout of quays, with so-called indented berths, such that it is possible to serve a ship on both sides. A similar terminal layout concept with indented berths was applied in [39,40]. Frojan et al. considered BAP as a single problem with multiple quays in [41]. A mixed-integer linear model has been developed; however, the model deals with a fixed estimated handling time and assumes each vessel has different relative importance. The practical problem is that baseline optimization is hardly dependent on handling time variations and reversible dependency, as mentioned earlier, and elaborated well in [3,23]. The BAP with irregular layouts concerning various restrictions is presented in [42]. Those restrictions involve the berths' geometrical disposition along the quay, including adjacency, as well as oppositional, and blocking restrictions between berths. Restrictions may be caused by availability, i.e., maintenance of berths, or structural shortcomings like draft restrictions. Similarly, the authors in [43] considered weather conditions and crane maintenance as restrictions, but the paper focus is on bulk terminals.
Tactical logistic decision-making problems in a multi-terminal environment where the berth allocation problem and the yard allocation problem are joined together to minimize container transshipments' overall cost were the subject of research in [44,45], and in [46], where the authors considered the discontinued quays layout. Multi-terminal BAP formulation in [47] is based on the cooperation between shipowners and terminal operators to minimize the total cost incurred due to vessel speed and fuel consumption. Considering multi-terminal choice in the broader context, the authors in [48] impose vessel and train schedules on a multi-terminal environment. The model's key decisions are a logistic choice of the CT that vessels, inland waterway barges, or trains will visit in time.

Problem Description
Ships arriving at seaport container terminals report their estimated time of arrival in advance and submit container stowage plans to the terminal operator. Based on the arrival and cargo data, the terminal operator must allocate their berthing position and time of mooring, assign a proper number of quay cranes to the ship, and set up a cargo handling plan.
The problem of berths allocation is to find the optimal arrangement of vessels at a single quay where berths are located, to achieve maximum utilization of the quay, on the one hand, and the minimum total service time, or time of the ship's stay in the port, on the other. The minimum total time of a ship's stay in the port is achieved by minimizing the waiting for a free berth and cargo handling time. The main challenge for BAP solving is determining the required time for loading/unloading operations of the vessel or berth processing time.
Time for loading/unloading operations is a primarily important factor, and it depends on the following features: • The availability of quay cranes (number of QCs to be assigned); • Transport demand (number of containers); • The distribution of containers across the ships' holds/bays, or stowage plan; • Crane production and utilization factor.
Many BAP models' main weakness is predicting the processing time and the implication of that assumption for the problem solution. This assumption is closely connected to the availability of resources. The schedule of vessels' arrivals is dynamic with variations in regular service operations, and it is not always possible to guarantee the crane's availability at an assigned time window. If a delay occurs for one vessel, it will probably impact the terminal handling process, including crane time window assignment for other vessels. In that case, the optimization function is not applicable, and it is necessary to re-engineer the process, which was explained by Meisel and Bierwirth [23] in detail.
The berths assignment takes place in such a way that each ship, depending on the estimated time of arrival at the port, is assigned a place on the quay, or such that an appropriate number of berth positions join it ( Figure 2). To do that, it is necessary to know the ship's length, the estimated time of arrival (ETA), the duration of the cargo handling operations, and the estimated time of departure (ETD) of the ship.

detail.
The berths assignment takes place in such a way that each ship, depending on the estimated time of arrival at the port, is assigned a place on the quay, or such that an appropriate number of berth positions join it ( Figure 2). To do that, it is necessary to know the ship's length, the estimated time of arrival (ETA), the duration of the cargo handling operations, and the estimated time of departure (ETD) of the ship. The problem can be illustrated by the coordinate system where the x-axis represents the planning horizon in time windows and the y-axis represents the length of the quay. Each square represents the position of the ship in space-time. The solution to the problem is an optimal arrangement of ships along the dock in the planned time horizon (Figure 3), resulting from the objective function that minimizes the total service time of ships in the port. The problem can be illustrated by the coordinate system where the x-axis represents the planning horizon in time windows and the y-axis represents the length of the quay. Each square represents the position of the ship in space-time. The solution to the problem is an optimal arrangement of ships along the dock in the planned time horizon (Figure 3), resulting from the objective function that minimizes the total service time of ships in the port. Since we consider the problem with a multi-quay layout, Figure 3 shows a ship-to-berth assignment solution for two quays/terminals where each quay has an equal chance of selecting. Therefore, no preference has been set. In this example, 20 ships were candidates for berth assignment in a period of more than 140 time windows (let us say that 1 time window equals 1 h). Since we are considering small and medium-sized terminals, a total of 15 berth segments (or simple berths) were placed on each quay where each berth segment occupies approximately 50 m. In the real world, the safety distance between adjacent ships must be considered, but it has no bearing on the problem's solution since it is a constant value. Therefore, each quay has a length of 750 m or a total of 1500 m.
Quay cranes are a key resource at the terminal, and their number is limited. They are assigned to ships based on their availability and depending on their actual performance according to the ship's cargo distribution onboard. Quay cranes can differ in technical characteristics and performance (i.e., panamax, post-panamax, super-panamax), and each quay may have a different type of crane installed. This does not affect the allocation as long as the same kind exists at the one quay. However, the cranes' performance affects the QCSP solution and has an impact on ship processing time. Since we consider the problem with a multi-quay layout, Figure 3 shows a ship-to-berth assignment solution for two quays/terminals where each quay has an equal chance of selecting. Therefore, no preference has been set. In this example, 20 ships were candidates for berth assignment in a period of more than 140 time windows (let us say that 1 time window equals 1 h). Since we are considering small and medium-sized terminals, a total of 15 berth segments (or simple berths) were placed on each quay where each berth segment occupies approximately 50 m. In the real world, the safety distance between adjacent ships must be considered, but it has no bearing on the problem's solution since it is a constant value. Therefore, each quay has a length of 750 m or a total of 1500 m.
Quay cranes are a key resource at the terminal, and their number is limited. They are assigned to ships based on their availability and depending on their actual performance according to the ship's cargo distribution onboard. Quay cranes can differ in technical characteristics and performance (i.e., panamax, post-panamax, super-panamax), and each quay may have a different type of crane installed. This does not affect the allocation as long as the same kind exists at the one quay. However, the cranes' performance affects the QCSP solution and has an impact on ship processing time.
When quay discontinuities exist, or there are two independent quays, the number of cranes is fixed for the quay and cannot be transferred to another quay. The number of cranes assigned to a particular ship is shown in the lower-left corner of the rectangle representing the ship (Figure 3). That number shall not exceed 5 for each time window because that is the maximum number of cranes available for each quay.

Methodology
The prediction calculation of the processing time during the handling process is the main challenge for berth-to-vessel and crane-to-vessel assignments. Following the philosophy of the integrated problem solution proposed in [22,23], we developed a methodology for the complete solution for BAP, QCAP, and QCSP enabled by an optimization process. This optimization process consists of three main stages: initiation, assignment, and adjustment ( Figure 4). It is acceptable for most small and medium-sized ports where resource availability and handling performances are most important to liner shipping operators.

Methodology
The prediction calculation of the processing time during the handling process is the main challenge for berth-to-vessel and crane-to-vessel assignments. Following the philosophy of the integrated problem solution proposed in [22,23], we developed a methodology for the complete solution for BAP, QCAP, and QCSP enabled by an optimization process. This optimization process consists of three main stages: initiation, assignment, and adjustment ( Figure 4). It is acceptable for most small and medium-sized ports where resource availability and handling performances are most important to liner shipping operators.  S(q,p), where q indicates the number of reserved quay cranes, and p describes the processing time required for cargo loading/discharging (1).

=
(1) It is necessary to define the number of cranes q before each QCSP solving. The minimum number of quay cranes qi min for each ship is usually subject to a contract between the terminal operator and   S(q,p), where q indicates the number of reserved quay cranes, and p describes the processing time required for cargo loading/discharging (1). (1) It is necessary to define the number of cranes q before each QCSP solving. The minimum number of quay cranes q i min for each ship is usually subject to a contract between the terminal operator and the shipping company, and it is requested by the latter. The maximum number of quay cranes q i max depends on the container stowage plan. In cases where q = 1, the problem is limited to solving a single sequence of tasks. In other cases, the QCSP output is a task-to-crane assignment and the total makespan, or processing time p i is required for the completion of handling operations. The inputs for the model include a set of individual tasks during the cargo loading and discharging, marked with A, and sets of task sequences, marked with R, R ( Figure 5) according to Kim and Park [49].  The QCSP solution model is outside the scope of this paper; however, it has been developed for two types of quay crane movement, namely QCSP with a full task algorithm and QCSP with a tasksharing algorithm [50]. Such an approach's benefit is the balanced utilization of cranes deployed and the simplification of the overall optimization process. On the other hand, there is a fixed number of cranes during the whole handling process. This feature is much more acceptable among shipping operators because it provides more reliable planning of loading and unloading operations, as well as more reliable prediction of total port service time.
The assignment stage is the core of the optimization problem solution. It consists of solving BAPs and QCAPs together for the multi-quay layout by selecting one of the possible options offered, depending on ship dimensions and estimated arrival time. There is a possibility that liner shipping companies prefer one quay or terminal over another, but in that case, additional parameters affecting their choice should be specified. In practice, shipping operators may have preferences over the quay choice. Containers are stacked and relocated into yard blocks closest to potential berths before vessel arrival. If there is a change in berth assignment, it will more likely result in more resource engagement for the repositioning of containers and, consequently, will generate additional logistic costs. To satisfy the requirements of the preference-based selection of quay, it is necessary to penalize a berth at the quay that is less favorable for the vessel or increase the logistic cost for the container reposition.
If the cost of reposition is marked with cp and the unit cost per time unit of the ship waiting for the free berth is marked with cw, then the ratio cp/cw is "quay logistic cost coefficient" marked with ωik. Its value depends on the ship's preferences, and is determined by the expression where i is the index from the set of vessels V and k is the index from the set of quays W. The quay cost coefficient is a relative dimension indicating the ratio of ship repositioning costs and waiting costs. The integrated model for BAP and QCAP optimization for the multi-quay layout is presented in the next chapter.
When a solution for the best option choice is achieved, it may be tested for improvement, depending on the terminal operator policy. At this stage, it is possible to adjust the ship's arrival time and examine the possibility of earlier arrival of the ship. If empty time windows exist and the possibility of an earlier arrival results in a better optimal solution, the planner may report to the shipping company, who may ask the shipmaster to adjust the ship's arrival, if applicable. A trade-off is also possible between the waiting cost, early arrival cost, and the repositioning cost for the selected The QCSP solution model is outside the scope of this paper; however, it has been developed for two types of quay crane movement, namely QCSP with a full task algorithm and QCSP with a task-sharing algorithm [50]. Such an approach's benefit is the balanced utilization of cranes deployed and the simplification of the overall optimization process. On the other hand, there is a fixed number of cranes during the whole handling process. This feature is much more acceptable among shipping operators because it provides more reliable planning of loading and unloading operations, as well as more reliable prediction of total port service time.
The assignment stage is the core of the optimization problem solution. It consists of solving BAPs and QCAPs together for the multi-quay layout by selecting one of the possible options offered, depending on ship dimensions and estimated arrival time. There is a possibility that liner shipping companies prefer one quay or terminal over another, but in that case, additional parameters affecting their choice should be specified. In practice, shipping operators may have preferences over the quay choice. Containers are stacked and relocated into yard blocks closest to potential berths before vessel arrival. If there is a change in berth assignment, it will more likely result in more resource engagement for the repositioning of containers and, consequently, will generate additional logistic costs. To satisfy the requirements of the preference-based selection of quay, it is necessary to penalize a berth at the quay that is less favorable for the vessel or increase the logistic cost for the container reposition.
If the cost of reposition is marked with cp and the unit cost per time unit of the ship waiting for the free berth is marked with cw, then the ratio cp/cw is "quay logistic cost coefficient" marked with ω ik . Its value depends on the ship's preferences, and is determined by the expression where i is the index from the set of vessels V and k is the index from the set of quays W. The quay cost coefficient is a relative dimension indicating the ratio of ship repositioning costs and waiting costs. The integrated model for BAP and QCAP optimization for the multi-quay layout is presented in the next chapter.
When a solution for the best option choice is achieved, it may be tested for improvement, depending on the terminal operator policy. At this stage, it is possible to adjust the ship's arrival time and examine the possibility of earlier arrival of the ship. If empty time windows exist and the possibility of an earlier arrival results in a better optimal solution, the planner may report to the shipping company, who may ask the shipmaster to adjust the ship's arrival, if applicable. A trade-off is also possible between the waiting cost, early arrival cost, and the repositioning cost for the selected quay or terminal within the adjustment process. This could be done by putting a higher value of the logistic cost coefficient on the respective quay or terminal. After a re-run of the model, a final solution is obtained for the planning horizon. Alternatively, if the adjustment policy does not require recalculation but only a manual adjustment of the vessel arrival time (i.e., ship speed reduction to arrive in required time windows instead of waiting on anchorage), then the final solution has been confirmed.

Assumptions
The assumptions on which the model was developed are as follows: • Berths are divided into segments and marked from the outer to the inner side of the quay; The number of assigned cranes is constant during the handling process; • The allocated crane can be moved to another task (bay) before the previous one is completed; • There is one terminal operator for both quays that offers the public service; • There is a mutual agreement between the shipping company and the terminal operator where a policy for the port service exists.
The first three assumptions are applied in practice. Standard conventions of berth marking and orientation of the vessels are necessary to avoid confusion in operations. The same principle is applied in the model. If any restriction in terms of berth availability exists, it will most probably affect the whole terminal or even port choice. If only part of the quay is affected by draft restrictions, then it can be managed by setting up upper and lower bounds of available berth segments such that b i > b LB when initial segments have draft limitations, and b i + l i − 1 < b UB if upper berth segments are affected. Following the principle applied in public ports, all ships have equal treatment without priority. The fifth and sixth assumptions relate to space and time values that are constant and do not affect the solution.
The main assumption is that there is a constant number of cranes for the entire duration of transshipment operations. This is explained in the previous chapter, and this is the principle of how a model with scenario options works. The next assumption is closely related to the previous one. If we release the restriction that tasks cannot be shared between cranes (switch of cranes before completion of the task), we can improve the utilization of cranes and get a more favorable output from the QCSP. In this way, we can reduce the cranes' idle time while the handling operations are still in progress and the ship is not finished.
The last two assumptions relate to the quay assignment or terminal choice. The model is applicable if the same operator provides public service at both quays and terminals or where a policy for the port service exists between ship liner operators and terminal operators such that it is possible to arrange a storage area and the transport and delivery of containers from one place to another depending on logistic costs.

Parameters and Variables
The following indices and notations are used in the model: The model mostly uses binary decision variables from previous BAP and QCAP studies, i.e., y ij , z ij that compare the position of pairs of vessels in a time-space plane to prevent overlapping [13] and r it that specifies each time window associated with the ship on berth [23]. A newly developed binary decision variable x ik assigns a quay to the ship, and o iv sets the optimal operational scenario with a predefined number of quay cranes and working schedule to operate onboard.

Objective Function
The objective function minimizes the total time of ships' stay in a port system consisting of multi-quay layouts or individual terminals by the expression (t + 1)r it ≤ d i , ∀i ∈ V, ∀t ∈ T (12) The objective function (3) calculates the optimum solution according to three criteria: the waiting time of the ship for a free berth, the duration of the cargo handling process depending on the selected scenario and the number of allocated cranes, and the quay/terminal logistic costs. Conceptually, the model with a multi-quay layout is characterized by function constraints (4), (5), (6), and (7). Constraint (4) takes outputs from the QCSP solution, considering three possible options, and ensures that the sum of deployed cranes for each quay, vessel, and time window does not exceed their total number. Only one operational scenario may be selected for the vessel (5), and only one quay may be allocated for each vessel granted by (6). Quay length may vary; ships with different lengths may also come to port. Hence, constraint (7) ensures that the correct number of berth segments is allocated to the vessel within the quay boundary.
The next set of constraints (8)-(11) is a modified version of the integrated BAP and QCAP model developed by Meisel and Bierwirth [23] such that it fits the multi-quay environment. In (8) and (9), the conditions for the decision variable r kv it are set. According to (8), variable r kv it = 1 only if each of r it , o iv , x ik has the value equal to 1. At the same time, because of (9), it must be r kv it = 0 if any of the above has a value equal to 0. Thus, the value of the variable r kv it . is unambiguous for all cases. The relationship between two decision variables is defined by (10) and (11), where at the same time, the relationship between r it and procession time p i is granted no matter which scenario is selected and which quay is assigned to the vessel.
Berthing time and the start of cargo handling operations, end of operations, and relations between these values are determined by constraints (12), (13), and (14), in a similar way as in [23]. The condition for overlapping ships in constraints (15), (16), and (17) was taken from the standard BAP model developed by Guan and Cheung [13]. The only change relates to constraint (17), where it is necessary to define overlapping conditions only when pairs of ships are assigned to the same quay or terminal. When ships are berthed at different quays, overlapping is allowed because they are physically dislocated. Therefore, inequality y ij + y ji + z ij + z ji > 0, indicating a non-overlapping condition, must be satisfied only in the case when x ik = 1 and x jk = 1.
The remaining constraints (18), (19), and (20) define the ship's waiting time and the relationship between arrival time, early arrival time, waiting time, and berthing time. Finally, binary variables are defined by constraint (21).

Experiment Setup
To test the model, we generated a representative set of data using the heuristic procedure based on real ship data. The basis of data creation was the programming script "ships and cargo generator" created in the R-programming language whose task was to create a database of ships according to historical data on arrivals at target ports ( Table 1). The following data are considered: the overall length expressed in berth segments (l), the capacity in TEU, positions and upper bound of container bays (h up ), and the maximum capacity per bay (D max ). The script also allocates the appropriate number of containers for each ship and distributes them along the ship bays. Once these data were generated, we used heuristics to group containers located in adjacent bays into clusters to obtain the final loading/unloading tasks. Then, values may be entered into the QCSP model to solve the task scheduling problem with different operation scenarios depending on the number of cranes deployed. We used two different QCSP models, explained in detail in previous research [50]. The algorithm used is based on the generation of pseudorandom numbers; however, when generating the data, we calculated the average loading/discharging container demand per vessel to fit the requirement for small and medium-sized terminals with an annual throughput of around 1 million TEUs. Based on empirical indicators, the largest ships are less likely to arrive at small terminals than medium-sized terminals. Therefore, we have set the probability distribution so that the highest probability (30%) is for ships of length 5 and the lowest (10%) for ships of length 7. The rest of the ships have the same probability of arrivals (20%). It was necessary to ensure that the daily frequency of ship arrivals and freight demand per vessel call corresponded to the annual terminal throughput, which is approximately 1 million TEU (Table 2). This was obtained with an average frequency of arrival λ between 3.2 and 3.5 ships/day (around 1200 vessel calls). Since we needed ship arrival times, the distribution of time intervals between two consecutive arrivals was calculated using an exponential probability distribution Exp(t) = λe −λt , t ≥ 0. The principle of determining loading/discharging tasks and the distribution of containers by ship's bays and QCSP modeling is beyond the scope of this paper; however, it is explained in [50], so we used the model from our previous research for the initiation stage in the optimization process modeling.
The result from the initiation stage obtained is presented in Table A2. We generated 100 ships with different cargo distributions and different demands. For each case, both models specified in [50] are used for problem solving, with tasks split (or task sharing) and without. For testing, we defined two separate quays (or terminals) with a total of five quay cranes available for each of them. This is a realistic approximation for a given terminal size with equal technical performances. It should be noted that the model has no limitation in this regard but becomes more complex and requires a longer solving time. However, we focus here on methods of modeling rather than on computing performances.
Since there are five quay cranes available at each quay, theoretically, it is possible to create 5, or even 10, handling scenarios depending on the number of cranes assigned to the vessel, considering both models and modes of operation. Depending on that, the total handling time is calculated as output from the QCSP solution. However, it makes no sense to consider all of them for the next stage of optimization if there is no solution improvement. The distribution of the cargo affects the possibility of the parallel operation of more cranes, as explained earlier. That is why we selected three realistic and reliable scenario options using simple heuristics:

•
If increasing the number of cranes does not bring improvement in processing time, the corresponding scenario is excluded from the selection; • If more than three scenarios are qualified, three of them with the best score (lower processing time) are selected; • If there are less than three scenarios qualified, a dummy option with a big integer value for processing time is inserted to prevent it from being further considered as the option. Table 3 shows how the scenarios were chosen depending on results from the QCSP solution and according to the described heuristics. Then, selected option scenarios (highlighted cells) are forwarded to the assignment stage, where they are used for quay crane allocation inside the BAP and QCAP integrated model.
We divided ships into five groups with 20 ships corresponding to the weekly planning horizon for testing purposes. Total cargo handling demand corresponds to a monthly volume above 82.000 TEU, equivalent to around 1 million TEU per year. Four ship arrival time distribution patterns were created, with an average frequency of arrival equal to 3.2 and 3.5 ships per day. Further, two different pseudorandom seeds are used for each case. That means, for each group of ships or each case, two experiments were performed for λ = 3.2 and for λ = 3.5 depending on the seed value of the pseudorandom function (seed = 400 and seed = 700). The order of arrivals is successive and follows the order of the vessel generation. An overview of the vessels' input parameters and their values for the model in the assignment stage is shown in the Appendix A in Table A1.
Other basic settings include: For optimization and model testing purposes, we used the AIMMS optimization and modeling environment with integrated CPLEX (ver. 12.10) and GUROBI (ver.9.0) solvers, performing on PC I7-8750H CPU 2.2 GHz with 16 GB of RAM. Since GUROBI has shown better performance for the particular model, it was used for problem solving.

Results
The optimization results are shown in Table 4 and the Appendix A (Tables A3-A8) for selected cases, so it is possible to construct a complete operational plan to allocate berths and cranes to ships, as Case 17 shows in Figure 3. The value of Z refers to the output of the integrated model after the assignment stage, while the value of Z refers to the final solution after the adjustment stage, considering early arrival capability.
To prove the model's success, we set up an alternative plan called the "classical approach" of berths and quays allocation as a benchmark. The classical approach implies applying the "first-in, first-serve" rule and quay/terminal selection in advance, disregarding the optimization procedure. Following this rule, quay 2 was assigned to larger ships (size 6 and 7), while quay 1 was selected for the remaining ships. Similar rules apply in practice as well. The value of Z" denotes the results after applying this alternative plan with the classical approach.
It is possible to identify improvements, especially for cases when ship arrivals are densely distributed. It is also justified to carry out adjustments with early arrival capability, to make better utilization of time windows and meet expectations of shipping operators in terms of service quality.
The model's performance can be illustrated by the ratio between the waiting time and the total ship service time. Figure 6 shows this for the selected most significant cases (a-e). Note that the time scale and total service time are much longer with the classical approach, as well as the ratio between waiting time and total service time for the ships concerned.

Utilization Analysis
An analysis of resource utilization was performed for different cases, the integrated model application, and the classical approach. The result for Case 17 is shown in Figure 7. This case is the most significant as it has the highest resource requirements over the time series. Figures 7a,b, show the QCs' operating hours and their utilization over a time horizon for both quays/terminals. Figure  7a shows the QCs' utilization due to optimization using the integrated model, while Figure 7b shows the utilization when the classical approach is applied. With the application of the integrated model, we found results with higher cranes utilization, especially in peak periods. When analyzing the utilization of cranes itself, it may be concluded that it depends on job requirements. It should be noted that the model is tested for medium-sized terminals and that there is no such high frequency of  Z-no adjustment, Z -early arrival adjustment, Z"-classical approach (first in, first serve).

Utilization Analysis
An analysis of resource utilization was performed for different cases, the integrated model application, and the classical approach. The result for Case 17 is shown in Figure 7. This case is the most significant as it has the highest resource requirements over the time series. Figure 7a,b, show the QCs' operating hours and their utilization over a time horizon for both quays/terminals. Figure 7a shows the QCs' utilization due to optimization using the integrated model, while Figure 7b shows the utilization when the classical approach is applied. With the application of the integrated model, we found results with higher cranes utilization, especially in peak periods. When analyzing the utilization of cranes itself, it may be concluded that it depends on job requirements. It should be noted that the model is tested for medium-sized terminals and that there is no such high frequency of vessels' arrivals. That is the reason for the lower utilization of cranes in off-peak periods. This is even more visible in Figure 7c,d, showing utilization of berthing space (or utilization of quays), where there are periods with low berth utilization. However, if we compare peak periods, there is a significant improvement in quay utilization by applying the integrated optimization model. vessels' arrivals. That is the reason for the lower utilization of cranes in off-peak periods. This is even more visible in Figures 7c,d, showing utilization of berthing space (or utilization of quays), where there are periods with low berth utilization. However, if we compare peak periods, there is a significant improvement in quay utilization by applying the integrated optimization model.

Conclusions
Even though there are many papers on this topic, there is no universal model applicable to all types of container terminals that satisfies the specific requirements of different terminal operators. We developed a three-stage optimization process with an integrated model for solving berth and crane allocation problems for terminals with multi-quay or discontinued quay layouts focusing on medium-sized terminals. Higher resistance to possible deviations from the planned task schedule has been generated by allocating a constant number of cranes during the handling operation, considering the sequences of handling operations according to stowage plans and the containers' positions onboard. The model guarantees a high level of reliability of the service to shipping liner companies and simplifies resource management.
The experiment we performed compares the results of the integrated model with the results when the classical approach with the principle of first come, first serve is applied. The results showed

Conclusions
Even though there are many papers on this topic, there is no universal model applicable to all types of container terminals that satisfies the specific requirements of different terminal operators. We developed a three-stage optimization process with an integrated model for solving berth and crane allocation problems for terminals with multi-quay or discontinued quay layouts focusing on medium-sized terminals. Higher resistance to possible deviations from the planned task schedule has been generated by allocating a constant number of cranes during the handling operation, considering the sequences of handling operations according to stowage plans and the containers' positions onboard. The model guarantees a high level of reliability of the service to shipping liner companies and simplifies resource management.
The experiment we performed compares the results of the integrated model with the results when the classical approach with the principle of first come, first serve is applied. The results showed savings in the total time spent by ships in the port and demonstrated a better utilization of resources, especially during peak hours. It should be noted that we strongly followed the non-preference principle when quay or terminal choice was considered. When we released this assumption and used the higher logistic cost coefficient for the target ships for the selected preferred quay, we found higher objective function values and a lower utilization of berths and cranes. However, we know that berth preference is the default practice in some ports and that non-preference plans require additional efforts in terminal management considering logistic constraints in container transportation in the yard.
One might argue that allocating a constant number of QCs to a ship throughout the handling process does not ensure optimal use of resources. We accept this as a week point, but on the other hand, terminal operators can guarantee a high level of service to ships, and quay cranes workload may be reduced. The latter is also important from the perspective of energy consumption.
Another weak point in the model's practical implementation is the solving time for more complex setups with more ships and time series on terminals with more than two quays. This could be resolved in future research with the implementation of the most recent metaheuristics.
The main contribution of this paper is the proposed design of the optimization process with an integrated model for solving seaside operation problems in container terminals with a specific multi-quay layout. The model can be applied in a real environment to support decision making in port management at medium-sized container terminals.
Future research may go in the direction of balanced stowage plans in terms of the distribution of containers in bays to optimize terminal resources by allowing parallel operations of quay cranes throughout the entire period of cargo operations. In this way, the common interest of shipping liner companies and port operators would be achieved. Another direction in which future research may go is towards more energy-efficient use of quay cranes by balancing their loads and movements.