A Fuzzy Optimization Model for the Berth Allocation Problem and Quay Crane Allocation Problem (BAP + QCAP) with n Quays

: This work introduces a fuzzy optimization model, which solves in an integrated way the berth allocation problem (BAP) and the quay crane allocation problem (QCAP). The problem is solved for multiple quays, considering vessels’ imprecise arrival times. The model optimizes the use of the quays. The BAP + QCAP, is a NP-hard (Non-deterministic polynomial-time hardness) combinatorial optimization problem, where the decision to assign available quays for each vessel adds more complexity. The imprecise vessel arrival times and the decision variables—berth and departure times—are represented by triangular fuzzy numbers. The model obtains a robust berthing plan that supports early and late arrivals and also assigns cranes to each berth vessel. The model was implemented in the CPLEX solver (IBM ILOG CPLEX Optimization Studio); obtaining in a short time an optimal solution for very small instances. For medium instances, an undeﬁned behavior was found, where a solution (optimal or not) may be found. For large instances, no solutions were found during the assigned processing time (60 min). Although the model was applied for n = 2 quays, it can be adapted to “ n ” quays. For medium and large instances, the model must be solved with metaheuristics. administration, E.V.; E.V.


Introduction
Maritime container terminals (MCTs) are vital elements in the global supply chain. The essential objective of an MCT is to provide the resources and organization to the transport of containers between the landside and maritime mediums. In this process, the MCT must guarantee the best conditions of speed, efficiency, and safety, in accordance with the environment [1].
Due to the current rise in the global maritime trade, many ports have suffered from resource constraints, such as space, time, quay cranes, etc. The problems that exist in an MCT are different. This work addresses the berth allocation problem (BAP) and the quay crane allocation problem (QCAP). The BAP is a NP-hard (Non-deterministic polynomialtime hardness) combinatorial optimization problem [2], which involves assigning each incoming vessel a berth position and arrival time at the quay. On the other hand, the QCAP tries to assign a number of quay cranes (QC) to each berth vessel, aiming to perform all the necessary unload or load movements of the containers in the vehicles. The QC are giant cranes that are mounted on rails, therefore, they cannot break through to each other.
The vessel arrival times are very uncertain, i.e., they can arrive earlier or later than their expected arrival time. This imprecision depends on several factors, such as: technical

Fuzzy Arithmetic
Definition 1. Let X be the discourse universe, and a fuzzy set A in X is a set of ordered pairs.
where µ A : X → [0, 1] is the membership function, which represents the belonging degree of x with the set A.
In this work, fuzzy sets are defined over the real numbers R. A membership function can be triangular, trapezoidal, sigmoidal, quadratic, etc.

Definition 2.
A fuzzy singleton is a fuzzy set with a membership function.
where ε is a margin of error. The fuzzy singleton allows the expression of a real number as a fuzzy set.

Definition 3.
A fuzzy number is a normal and convex fuzzy set in R.

Definition 6.
A real number a can be represented by a fuzzy singleton in the form of a triangular fuzzy number a = (a − ε, a, a + ε), where ε is a margin of error.

Definition 7.
For two non-negative triangular fuzzy numbers a = (a1, a2, a3) and b = (b1, b2, b3), the sum difference and multiplication operations are defined as follows: a + b = (a1 + b1, a2 + b2, a3 + b3) a − b = (a1 − b3, a2 − b2, a3 − b1) a. b = (a1.b1, a2.b2, a3.b3). ( Ordering methods allows us to decide the greater number between two fuzzy numbers a and b. Fuzzy numbers do not always provide an ordered set as found in real numbers. Ordering methods in fuzzy numbers have advantages and disadvantages. There are different ordering methods, depending on the representation: preference, rationality, and robustness, etc. [16]. In this work, the objective of the fuzzy model optimization is to achieve an ordering (planning) for the berthing of vessels, therefore, any ordering method that orders fuzzy numbers could be used. Ordering methods that use intervals to order fuzzy numbers are not recommended, as they could add more imprecision to the model. This work utilizes the Yagger First Index [17] ordering method, which is defined below.
Definition 8. Given two triangular fuzzy numbers a and b alongside the ordering function,

Fully Fuzzy Linear Programming (FFLP)
There are different approaches in fuzzy mathematical programming, the classical fuzzy linear programming methods are used when the parameters are fuzzy; in this work, some of the decision variables are fuzzy, for this case, the FFLP approach is the most appropriate.
In the FFLP approach, the decision parameters and variables are fuzzy and linear, respectively. Several solution methods can be applied to the FFLP model [18]. Most of them convert the fuzzy model into a classic linear programming one. In this work, we use the method proposed by Nasseri [19].
Given the FFLP problem: Subject to: where the parameters C j , a ij , b j and the decision variable x j are non-negative triangular fuzzy numbers, The Nasseri method transforms the previous model into a classic linear programming problem, Subject to: where is an ordering function (see Definition 8).

Problem Description
According to [20], an MCT is a composition of several subsystems integrated into a single one. This system has physical and information connections with the transport networks (landside and maritime). The subsystems (see Figure 1) are:

1.
The loading-unloading container subsystem, which is responsible for resolving the maritime interface.

2.
The storage container subsystem, which occupies most of the MCT surface. 3.
The landside reception and delivery subsystem, which act as gates in the landside for trucks and/or railways. 4.
The internal connection subsystem. To the previous three subsystems, which address the basic terminal functions, a fourth subsystem must be added, this ensures the horizontal transport of containers between the previous subsystems. The BAP + QCAP discussed in this work occur in subsystem 1, however any incident will affect the other subsystems. For example, if a vessel berths outside their scheduled time, it will cause problems to the assigned cranes, affecting the prepared warehouses for the containers and the trucks waiting to receive them.
The existence of n quays in the port is assumed, where vessels can berth in any of them. Arrival time is imprecise, i.e., vessels are allowed to be early or late until a predetermined time. The BAP focuses on choosing a quay (if any) and the arrival time and position where each arriving vessel at the MCT must berth. The other problem is the QCAP, which involves the assigning of a number of quay cranes to each vessel to be handled.
The BAP can be represented in a two-dimensional form (see Figure 2), where the horizontal axis represents the time and the vertical axis represents the berth length. The BAP + QCAP discussed in this work occur in subsystem 1, however any incident will affect the other subsystems. For example, if a vessel berths outside their scheduled time, it will cause problems to the assigned cranes, affecting the prepared warehouses for the containers and the trucks waiting to receive them.
The existence of n quays in the port is assumed, where vessels can berth in any of them. Arrival time is imprecise, i.e., vessels are allowed to be early or late until a predetermined time. The BAP focuses on choosing a quay (if any) and the arrival time and position where each arriving vessel at the MCT must berth. The other problem is the QCAP, which involves the assigning of a number of quay cranes to each vessel to be handled.
The BAP can be represented in a two-dimensional form (see Figure 2), where the horizontal axis represents the time and the vertical axis represents the berth length. We consider the following assumptions and limitations: Assumptions: The vessel information is previously known, each vessel has a draft less or equal than the quay, and that the berthing and departure do not consume much time. Simultaneous berthing is allowed and the safety distance between vessels is not considered. The number of cranes assigned to the vessels does not change during the berthing time, once a QC starts a task on a vessel they must complete it without any pause, all QCs We consider the following assumptions and limitations: Assumptions: The vessel information is previously known, each vessel has a draft less or equal than the quay, and that the berthing and departure do not consume much time. Simultaneous berthing is allowed and the safety distance between vessels is not considered. The number of cranes assigned to the vessels does not change during the berthing time, once a QC starts a task on a vessel they must complete it without any pause, all QCs assigned to vessel i have the same working time (t ik = h i , ∀k ∈ QC, u ik = 1). The model assigns the berthing place to each vessel, that is, preference zones are not allowed for berthing a vessel.
Limitations: The quay length must be limited, the available crane number in each quay is five. There is a safety distance between cranes which must to be maintained (35 m). The maximum crane number that can be assigned to a vessel is four. The number of crane movements performed in a given time is 2.5. There must be at least one QC assigned to each vessel.
In this work we use the following notation, which was taken from [12]: H: Planning Horizon.
Let be Q the set of existent quays in an MCT, where q ∈ Q is a quay. QC q : Available cranes at quay q. All QCs perform the same number of movements per unit time (movsQC), data provided by the MCT. QC + iq : The maximum number of QCs assigned to each vessel i at quay q L q : Length of quay q.
Let be V a set of vessels which arrive at the port, the data for each vessel i ∈ V is given by: a i : Vessel arrival time at port. l i : Vessel length. c i : Required number of movements to load or unload the containers from the vessel.
The decision variables are: BM iq : Takes the value of 1 when vessel i berths at quay q, and takes 0 otherwise. m iq : Berthing time of vessel i at quay q. The waiting time (w i ) is computed as (w i = m iq − a i ) p iq : Position at quay q, where vessel i must berth. n iq : Number of QCs in quay q assigned to vessel i. u ik : Indicates whether k, (which belonging to QC q ) works (1) or not (0) on vessel i.
The variables that are deduced from above are: Indices for the first and last QC, on quay q, used in vessel i, respectively. M: Is a sufficiently large number.

Fuzzy Optimization Model for the BAP + QCAP with Two Quays
The arrival, berthing, handling, waiting and departure time of each vessel are considered imprecise (fuzzy), they are denoted by: a, m, h, w and d respectively.
Assuming the presence of imprecision in some parameters and decision variables, the fuzzy optimization model for BAP + QCAP is introduced. This model is based on the deterministic model developed in [12]. The objective function minimizes the waiting and handling time for all vessels.
Subject to: There are two auxiliary variables: z x ijq is a decision variable that indicates whether the vessel i is located to the left of vessel j at quay (z x ijq = 1), while z y ijq indicates that vessel i berths before vessel j in time, at quay q (z x ijq = 1) (see restriction 34). Constraint (12), assigns each vessel to a quay q. Constrain (13), indicates that all vessels can berth once they arrive at the port. Constraints (14) and (15)  Constraints (17)-(21) assign a number of working QCs at quay q for vessel i. Constraint (22) sets the minimum handling time required to load or unload containers, according with the assigned number of QCs to vessel i. Constraint (23) assigns the handling time to vessel i. Constraint (24) ensures that unassigned QCs have a value of t ik = 0. Constraint (25) forces the assigned QCs in vessel i to work the same number of hours. Constraint (26) prevents a QC from being assigned to different vessels at the same time. Constraints (27) and (28) force QCs to be contiguously assigned (from s i to e i ) at quay q. Constraint (29) takes into account the safety distance. Constraint (30) prevents a vessel from using a QC which breaks through other QCs. Constraint (31) prevents vessel j from berthing at the quay, while vessel i is still berthed at the same quay. Constraint (32) indicates that the berthing and handling time for vessel i must not exceed the planning horizon (H). Finally, constraint (33) establishes the relationship between each pair of vessels.

Fuzzy Optimization Model Solution
It is assumed that, in the fuzzy optimization model from Section 2.4, the imprecision times related with the vessel operations: arrival, berthing, handling, and departure, are represented by the triangular fuzzy numbers a = (a1, a2, a3), m = (m1, m2, m3), h = (h1, h2, h3), and d = (d1, d2, d3), respectively. h, is considered a fuzzy singleton; also, if the model parameters are linear, the model is a FFLP.
The method used to transform the FFLP model into a classic linear programming model requires the application of fuzzy arithmetic operations; restrictions (25), (31), and (32) show such operations between fuzzy and real numbers, in order to perform such operations, real numbers are considered to be fuzzy singletons (See Definition 6), for example, in constraint (31), Simplifying, As indicated in the Nasseri method (see Section 2.2), operations between fuzzy numbers which involve sum, difference, and multiplication operations, are performed in the FFLP model; an ordering method is applied to the objective function, in this case, the First Yagger Index is used (see Definition 8), obtaining the following MILP model.
Subject to:

Results
For both the case study and the model evaluation efficiency a set of uniform distributed instances were used. The model was implemented with the IBM ILOG CPLEX Optimization Studio (CPLEX) solver and was programmed on a personal computer: Intel(R) Core (TM) i7-8550U CPU, 1.80 GHz processor and 8 GB of RAM. The experiments were conducted within a 60 min timeout.

Study Case
To evaluate the model, an instance of ten vessels was used as a case study (see Table  1); the input data are the vessel imprecise arrival times (early, exact, late), its length, and the number of crane movements required to handle it. Figure 3 displays the vessels' uncertain arrivals from Table 1, represented as triangular fuzzy numbers.   Table 2).
For example, for vessel V7, the arrival time with all its possibilities gives us 138 time units, but it can also arrive early or late by up to 126 and 147 time units, respectively. The vessel length is 366 m and 8110 crane movements are required to handling it.
The model assumes that: two quays are used; each having five cranes, with a minimum of one crane operating on each vessel to a maximum of four cranes per vessel. Each quay has a length of 700 m.
The obtained results are shown in Table 2. Within an hour of computing time, an objective value of 15,570 was obtained, this is not the optimal value; but the best value obtained within that time.   Table 2).
For example, for vessel V7, the arrival time with all its possibilities gives us 138 time units, but it can also arrive early or late by up to 126 and 147 time units, respectively. The vessel length is 366 m and 8110 crane movements are required to handling it.
The model assumes that: two quays are used; each having five cranes, with a minimum of one crane operating on each vessel to a maximum of four cranes per vessel. Each quay has a length of 700 m.
The obtained results are shown in Table 2. Within an hour of computing time, an objective value of 15,570 was obtained, this is not the optimal value; but the best value obtained within that time.
For example, vessel V7 can berth between the time units 663 and 693, with more possibility at time unit 667. It can depart between units 2015 and 2045, with more possibility at unit 2027. Additionally, it must berth at position 334 of the quay. Finally, two cranes are assigned to this vessel, and they must berth at quay 1.
The fuzzy berthing plan is displayed in Figure 4. Vessels are represented as polygons (not as rectangles as in the deterministic problem). The red polygon line represents the allowed early time which can be tolerated for the vessel to berth; meanwhile the green line is the tolerated late arrival time. The small triangle represents the berthing with more possibility. at unit 2027. Additionally, it must berth at position 334 of the quay. Finally, two cranes are assigned to this vessel, and they must berth at quay 1.
The fuzzy berthing plan is displayed in Figure 4. Vessels are represented as polygons (not as rectangles as in the deterministic problem). The red polygon line represents the allowed early time which can be tolerated for the vessel to berth; meanwhile the green line is the tolerated late arrival time. The small triangle represents the berthing with more possibility.  Table 2).
In Figure 4, in quay 2, the blue circle suggests a conflict area between the departure and berthing of vessels V5 and V9. However as explained in Figure 5, such conflict is not real. For example, if vessel V5 departures late from the quay at time unit 1365, vessel V9 could berthing between the 1365 and 1370 units.  Table 2).
In Figure 4, in quay 2, the blue circle suggests a conflict area between the departure and berthing of vessels V5 and V9. However as explained in Figure 5, such conflict is not real. For example, if vessel V5 departures late from the quay at time unit 1365, vessel V9 could berthing between the 1365 and 1370 units.  Table 2).
In order to verify the fuzzy model robustness, incidences were simulated in the vessel arrivals (see Table 3). With these incidences, the final berthing plan is obtained (see Table 4). Figure 6 shows that the final berthing plan is part of the fuzzy berthing plan. Exactly 0  Table 2).
In order to verify the fuzzy model robustness, incidences were simulated in the vessel arrivals (see Table 3). With these incidences, the final berthing plan is obtained (see Table 4). Figure 6 shows that the final berthing plan is part of the fuzzy berthing plan. Exactly 0   Table 4).

Model Efficiency Analysis
In order to analyze the model efficiency, data from vessels 5 to 35 with 100 instances each were used. The results are shown in Table 5.   Table 4).

Model Efficiency Analysis
In order to analyze the model efficiency, data from vessels 5 to 35 with 100 instances each were used. The results are shown in Table 5. Optimal values were found for five vessels, with an average objective value and processing time of 4922 and 0.2 min, respectively; this was the unique number of vessels for which an optimal solution was obtained in all its instances. For six vessels, an average objective value of 6655.3 was obtained within an average processing time of 1.3 min, where a total of 47 instances were optimally solved. No optimal solutions were found for 7 to 12 vessels. Instead, a single non-optimal solution was found in just one instance. For 13 to 22 vessels there were between one and three optimal solutions. No optimal solutions were found for 23 to 34 vessels, rather, just a best solution in the given processing time. However, for 29 vessels an optimal solution was obtained. For 35 vessels onwards, no solution was found.
Regarding the processing time (see Figure 7), is noted that for six vessels, the average time it took to find a solution was 1.3 min. Meanwhile, for seven vessels the average processing time drastically increases until it matches the allowed processing time (60 min). For 13 to 22 vessels the time varies between 19 and 38.8 min, respectively. For 23 vessels onwards, the time processing was 60 min, except for 29 vessels, which takes 39.7 min.
However, for 29 vessels an optimal solution was obtained. For 35 vessels onwards, no solution was found.
Regarding the processing time (see Figure 7), is noted that for six vessels, the average time it took to find a solution was 1.3 min. Meanwhile, for seven vessels the average processing time drastically increases until it matches the allowed processing time (60 min). For 13 to 22 vessels the time varies between 19 and 38.8 min, respectively. For 23 vessels onwards, the time processing was 60 min, except for 29 vessels, which takes 39.7 min.

Discussion
A fuzzy optimization model for the BAP + QCAP with two quays was developed, considering the vessels' imprecise arrivals. The model was implemented in the CPLEX solver. For previously known input data from a set of vessels, the model obtained a fuzzy berthing and crane allocation plan, which supported incidences of vessels being early or late in their arrival times.
The model efficiency was evaluated with a benchmark of 100 instances for each number of vessels, with one hour of computing processing. Only for a very small number of instances (five vessels) were optimal solutions obtained in all instances. For 6 to 34 vessels, only some optimal and non-optimal solutions were obtained: these do not follow a defined behavior regarding the processing time, this is because the problem is NP-hard and solutions will only be obtained in medium instances that have a structure that allows the algorithm used by the Solver CPLEX to find a solution. For 35 vessels onwards, the CPLEX solver was unable to find solutions within the allowed processing time. The same results applied for large instances.
The model was designed for "n" quays, but in this work is applied to only n = 2. Each time the quay number increases, the complexity will increase as well.
For medium and large instances, the model must be solved with metaheuristics, because it is a highly complex combinatorial optimization problem.

Discussion
A fuzzy optimization model for the BAP + QCAP with two quays was developed, considering the vessels' imprecise arrivals. The model was implemented in the CPLEX solver. For previously known input data from a set of vessels, the model obtained a fuzzy berthing and crane allocation plan, which supported incidences of vessels being early or late in their arrival times.
The model efficiency was evaluated with a benchmark of 100 instances for each number of vessels, with one hour of computing processing. Only for a very small number of instances (five vessels) were optimal solutions obtained in all instances. For 6 to 34 vessels, only some optimal and non-optimal solutions were obtained: these do not follow a defined behavior regarding the processing time, this is because the problem is NP-hard and solutions will only be obtained in medium instances that have a structure that allows the algorithm used by the Solver CPLEX to find a solution. For 35 vessels onwards, the CPLEX solver was unable to find solutions within the allowed processing time. The same results applied for large instances.
The model was designed for "n" quays, but in this work is applied to only n = 2. Each time the quay number increases, the complexity will increase as well.
For medium and large instances, the model must be solved with metaheuristics, because it is a highly complex combinatorial optimization problem.