A Hybrid GA with Variable Quay Crane Assignment for Solving Berth Allocation Problem and Quay Crane Assignment Problem Simultaneously

Container terminals help countries to sustain their economic development. Improving the operational efficiency in a container terminal is important. In past research, genetic algorithms (GAs) have been widely used to cope with seaside operational problems, including the berth allocation problem (BAP) and quay crane assignment problem (QCAP) individually or simultaneously. However, most GA approaches in past studies were dedicated to generate time-invariant QC assignment that does not adjust QCs assigned to a ship. This may underutilize available QC capacity. In this research, three hybrid GAs (HGAs) have been proposed to deal with the dynamic and discrete BAP (DDBAP) and the dynamic QCAP (DQCAP) simultaneously. The three HGAs supports variable QC assignment in which QCs assigned to a ship can be further adjusted. The three HGAs employ the same crossover operator but a different mutation operator and a two-stage procedure is used. In the first stage, these HGAs can generate a BAP solution and a QCAP solution that is time-invariant. The time-invariant QC assignment solution is then further transformed into a variable one in the second stage. Experiments have been conducted to investigate the effects of the three HGA and the results showed that these HGAs outperformed traditional GAs in terms of fitness value. In particular, the HGA3 with Thoros mutation operator had the best performance.


Introduction
Maritime transport is essential to a country as it plays a major role for international trading that can sustain economic development.It is noted that about 60% of the maritime transports employed containers, with a growth rate of 6.4% each year [1].This shows that container terminals are important infrastructure sustaining global economic development.How to improve the operational efficiency in a container terminal is definitely an important issue.
Being an integrated part of the global transportation network, container terminals help deliver various products to consumers.Due to its importance, improving the operational efficiency of a container terminal is necessary.In a container terminal there are three operational areas: seaside, yard and landside [2].Among them, the operations in the seaside area are considered critical as they depend on the berth and quay crane, which are two rare resources that can affect the performance of a container terminal considerably.This has motivated us to focus on improving the operations in the seaside area.
There are three famous seaside operational problems in a container terminal.They are the berth allocation problem (BAP), quay cranes assignment problem (QCAP), and quay cranes scheduling problem (QCSP).In this research, both BAP and QCAP are simultaneously focused.The BAP is a problem of allocating berths to ships while the QCAP is a problem of assigning QCs to ships.In the past, various approaches have been proposed to cope with the BAP and QCAP simultaneously or individually, and these approaches can be exact or approximate.The exact approaches aim to solve problems to optimality.This kind of approaches, however, is fond likely to become computationally intractable when dealing with a problem of practical size, due to non-deterministic polynomial (NP)-hard [3].Consequently, approximate approaches have been popular, especially heuristics/metaheuristics have become increasingly used.One of the metaheuristics, the genetic algorithm (GA) approaches have been playing the major role in dealing with seaside operational problems [3].
Before dealing with a BAP, understanding its types is necessary.It is found that a BAP usually features two main factors: the arrival time of ship and the configuration of a quay used to accommodate calling ships.When taking the factor of arrival time of ship into consideration, a BAP is featured as a static or dynamic one.In the static BAP, this only considers arrived ships while in the dynamic BAP (DBAP) it also takes incoming ships into account.Due to the fact that ships continue to come during BAP planning, the DBAP is thus focused in this research.When taking the factor of quay configuration, a BAP can be featured as a discrete or continuous one.The discrete BAP separates a quay into fixed sections to accommodate calling ships while the continuous BAP treats the quay entirely as a continuous line so as to accommodate ships as much as possible at one time.Both types of quay configuration exist in the world.However, this research only focuses on the dynamic and discrete BAP (DDBAP).Accordingly, the version of dynamic QCAP (DQCAP) is focused in this research to align with the dynamic BAP that also considers incoming ships [2].
The BAP and QCAP were often solved separately [4][5][6][7].One disadvantage of a separate study is that it tends to result in poor overall system performance due to the lack of considering interrelationships among different levels of seaside operational problems simultaneously [8].Another disadvantage found for a BAP-only study is that it often needs to assume fixed handling times for ships because these handling times cannot be estimated based on their assigned number of QCs [6].For improvement, it has been suggested to solve the seaside operational problems in an integrated way [8].With respect to the approaches for dealing with the seaside operational problems, it is found that GAs have been widely used [4].Relevant studies include [9][10][11][12][13].However, when dealing with the QCAP, these GA approaches have been mostly used to yield time-invariant QC assignment based on a planning framework with fixed time intervals.One disadvantage found for the time-invariant QC assignment is that it cannot best utilize available QCs that have been released by leaving ships.As a result, overall QC capacity will not be best utilized.The disadvantage found for the planning framework that employs fixed time intervals is that it may waste some QC capacity as a QC has to be assigned to a fixed time interval fully.For example, a QC is assigned to a 1 h-interval planning framework to work for a ship but in fact that ship only requires a QC capability of 45 min.As a result this, planning will lead to 15 min of spare time for this QC.For improvement, in this research the variable QC assignment and the variable-interval planning framework are introduced.The variable QC assignment allows QC adjustment to a ship to best utilize released QCs while the variable-interval planning framework only allocates necessary QC capacity to a ship.
To overcome the disadvantages mentioned above, in this research three hybrid GAs (HGAs) have been developed to cope with the DDBAP together with the DQCAP.Based on a variable-time planning framework, each of the HGAs hybrids a specific GA with an event-based heuristic to generate variable QC assignment.These HGAs have a same crossover operator (Two-Point Crossover, TPX) but a different mutation operator.Specifically, HGA1 uses Swap mutation; HGA2 adopts Thoras mutation; HGA3 employs Thoros mutation.A variable QC assignment is derived through a two-stage procedure.Our experiments showed the HGAs with variable QC assignment outperformed a traditional GA with time-invariant QC assignment.Among the three HGAs, the HGA3 with Thoros mutation has the best performance in terms of fitness value (FV).
The other part of this paper is organized as follows.Section 2 provides a literature review.Section 3 mainly focuses on defining and formulating the simultaneous DDBAP and DQCAP.Section 4 formulates the simultaneous DDBAP and DQCAP.Section 4 introduces GA models and the HGAs developed in this research.Section 5 reports experimental methods and discusses experimental results.Finally, Section 6 gives a conclusion and highlights directions of future research.

Berth Allocation Problem (BAP)-Only Studies
BAP-only studies are reviewed as follows.Brown et al. [14] is one early study focusing solving the static BAP.In that study, the authors used an integer programming model (IPM) to find optimal ship-to-berth assignments.However, that study was based on a naval port that has different situations and conditions from a commercial port.Focusing on the commercial ports in Japan, Imai et al. [15] moved to deal with the DBAP study, taking into ship priority into consideration.Finally, the authors concluded the First Come First Served (FCFS) rule is unsuitable to find an optimal ship-to-berth assignment in terms of throughput.It is found that to be more practical recent studies have increasingly focused on the dynamic BAP (DBAP) due to the fact that ships continue to call when BAP planning.For example, Imai et al. [16] dealt with the DBAP by using a subgradient approach.In Reference [17], the authors further proposed a GA approach to solve the same problem as they found the solution procedure of the subgradient approach was still too complicated.In Reference [18], the authors proposed a variable neighborhood search (VNS) to solve the DBAP.The objective of this research was to find the solution with minimum cost that includes sub-costs of waiting, handling and earliness or tardiness of completion.Golias et al. [19] treated the discrete and dynamic berth allocation problem as a multi-objective combinatorial optimization problem in which vessel service is differentiated based on priority agreements.Then, a GA-based heuristic was developed to solve the problem.The results showed that the heuristic had the capability to solve large and real-life instances.Saharidis et al. [20] proposed a hierarchical optimization framework to deal with the discrete and dynamic BAP in a container teminal.A two-level hierarchy was employed.It differentiates between two conflicting objectives that terminal operators face when assigning ships to berths.Based on the k-th best algorithm, an interactive algorithm was developed for the case where multi-objective functions were considered in the upper level.Computational examples in that study showed that the proposed algorithm was capable of finding the optimal/near optimal solution.Xu et al. [21] proposed a heuristic to solve the DBAP, taking factors such as water depth and tidal effects into consideration.They found that a better decision can be achieved if these factors have been taken into account.Lalla-Ruiz et al. [22] proposed a set-partitioning-based model for BAP under time-dependent limitations.Ursavas et al. [23] proposed optimal policies for the BAP under a stochastic nature.Dulebenets [24] used a novel memetic algorithm with a deterministic parameter control for efficient berth scheduling at marine container terminals.Umang et al. [25] proposed real-time management of berth allocation with stochastic arrival and handling times.Zhen et al. [26] examined daily berth planning in a tidal port with channel flow control.Dulebenets [27] applied evolutionary computation for berth scheduling at marine container terminals.Dulebenets et al. [28] proposed a self-adaptive evolutionary algorithm for the berth scheduling problem.

Simultaneous BAP and Quay Crane Assignment Problem (QCAP) Studies
The DBAP and QCAP have been increasingly solved at the same time.In [9] the authors first formulated the DBAP and the QCAP as an integer programming model (IPM).The objective was to minimize total service time.Then, the two problems were solved by using a GA-based heuristic.A crane transfer scheduling algorithm, based on the maximum flow problem, was used to find the QCAP solution.The GA-based heuristic was found to be capable of finding an approximate solution for the two problems.However, the QCAP solution is time-invariant.Zhou et al. [10] also employed a GA approach to cope with the DBAP and QCAP simultaneously.They also formulated the two problems as a 0-1 non-linear programming model.In that study, the arrival times and handling times of calling ships were treated as stochastic variables.However, that GA approach can only yield time-invariant QC assignment.Liang et al. [5] proposed a HGA to cope with the DBAP and QCAP at the same time.An IPM was formulated in that study with the aim to find the minimized cost solution that considers sub-costs of waiting, handling and delay.That HGA was able to find an approximate solution for both problems.However, the QCAP solution is still a time-invariant one.In addition, it did not consider the costs of QC setups and movements.In [13] the authors further improved the HGA by considering the factors including QC movements and ship priority.However, that HGA still can only perform time-invariant QC assignment.Han et al. [12] also employed a GA to cope with the DBAP and QCAP simultaneously.Similar to Zhou et al. [10], the authors treated the arrival times and handling times of calling ships as stochastic variables and solve the two problems by using the GA approach.The objective of the GA was aimed to find the solution minimizing the expected value plus standard deviation of total service time and weighted tardiness time for all calling ships.The solutions obtained were further evaluated by the simulation approach.Giallombardo et al. [29] dealt with the BAP (TBAP) and QCAP at the tactical level.A two-level approach was employed.At the upper level, a Tabu search method was used to allocate berths; at the lower level, mathematical programming was used to update QCs profile.The two-level approach was able to support variable QC assignment.However, it did not use GA.Li et al. [30] solved the berth and quay crane coordinated scheduling using a multi-objective chaos cloud particle swarm optimization algorithm.Xiang et al. [31] used a reactive strategy for discrete berth allocation and quay crane assignment problems under uncertainty.
The above literature showed that the simultaneous DBAP and DQCAP have been mostly solved by GA approaches.However, these GA-based approaches can only support time-invariant QC assignment.

Berth Plans with Different QC Assignment
A berth plan has been usually used to represent a solution to the simultaneous DDBAP and DQCAP.Figure 1a illustrates a berth plan with time-invariant QC assignment in which each rectangle represents a ship.For example, the rectangle with the denotation "1(3)" indicates that ship 1 is assigned with 3 QCs.With the time-invariant QC assignment, each ship has one time of QC setups and movements for assigned QCs with these QCs not to be further changed during the whole service.
Figure 1b shows a berth plan with variable QC assignment, in which a ship has more than one times of QC setups and movements due to QC reassignments.For instance, ship 2 has two times of QC setups and movements, one at t(2) and another at t(3).Obviously, the variable QC assignment is more flexible at the costs of more QC setups and movements.But the gain and cost should be justified.Figure 1b shows a berth plan with variable QC assignment, in which a ship has more than one times of QC setups and movements due to QC reassignments.For instance, ship 2 has two times of QC setups and movements, one at t( 2) and another at t(3).Obviously, the variable QC assignment is more flexible at the costs of more QC setups and movements.But the gain and cost should be justified.

The Cost Factors to be Considered in an Objective Function
An objective function can be used to evaluate a berth plan and the objective function can include multiple costs.In this research, the costs of waiting, delay and handling times are considered in the objective function.These costs correspond to the service quality and operational efficiency.Specifically, the waiting and delay costs indicate the service quality while the handling cost indicates the operational efficiency [32].In addition, to justify the gain and the cost when using the variable QC assignment, the cost of QC setups and movements has to be taken into account in the objective function.

The Cost Factors to be Considered in an Objective Function
An objective function can be used to evaluate a berth plan and the objective function can include multiple costs.In this research, the costs of waiting, delay and handling times are considered in the objective function.These costs correspond to the service quality and operational efficiency.Specifically, the waiting and delay costs indicate the service quality while the handling cost indicates the operational efficiency [32].In addition, to justify the gain and the cost when using the variable QC assignment, the cost of QC setups and movements has to be taken into account in the objective function.

The Estimation of Handling Time for a Ship
To estimate the handling time for a ship, Equation ( 1) is proposed in [29]: where α: the interference exponent of QCs.(0 ≤ α < 1) β: the berth deviation factor, which indicates the QC capacity additionally required per one berth deviation.(β ≥ 0).m j : the demand of crane capacity for ship j in the unit of QC-hours.∆b j : a location deviation from the desired berth of ship j.
r min : the minimum number of QCs assignable to a ship.r max : the maximum number of QCs assignable to a ship.
This equation, however, does not take the times of QC setups and movements into account, thus we expand that equation as Equation ( 2) to estimate the actual operational time for a ship j at a time period t (denoted as OT tj ).In addition, it is assumed that QCs can be sequentially repositioned by a pushing-in and pulling-out procedure to another berth, but cannot cross over each other.
OT tj = QCs setup and movement time + working time = T j sm (t) + The T j sm (t) is the total time required for QC setup and movement for the ship j at the time period t and is further defined in Equation (3). where, • t s : the fixed time requires for setting up a QC.• t m : the average time required for moving a QC to the next berth.

•
∆d tj : the total moving distance (in units of berths) for additional QCs assigned to ship j at time period t.

•
θ tj : the total number of containers to be processed for the ship j at the time period t.

•
ρ: QC working rate (containers/hour).• r tj : the number of QCs assigned to the ship j at the time period t.
• r (t−1)j : the number of QCs assigned to the ship j at the time period t − 1.
Given the BT j as the beginning berthing time of ship j then the expected completion time of the ship j (ECT j ) can be determined by Equation (4).

The Definition of the DDBAP and DQCAP
Definition 1.The problem P of the simultaneous DDBAP and DQCAP is defined as 7-tupple.
where J: a set of ships; J = {1, . . ., n}; n the total number of ships I: a set of berths; I = {1, . . ., m}; m is the total number of berths Q: a set of quay crane; Q = {1, . . ., TQ}; TQ is the total number of QCs T: the planning horizon T = {1, . . ., H} in unit of hours; H is the total number of time periods within the planning horizon i: a berth number (i ∈ I) j: a ship number (j ∈ J) q: a quay crane number (q ∈ Q) t: a time interval (t ∈ T) C: a set of constraints ϑ: a collection of sets of assignments of ship-to-berth (variable X t ij ) and QC-to-ship (variable Y t jq ) at each time interval t. f : an objective function that maps ϑ g or ϑ * , ∀ ϑ g, ϑ * ∈ ϑ to a time/cost value The objective of P is to find a ϑ g or ϑ * (ϑ g , ϑ * ∈ ρ), where ϑ g . is a feasible solution and ϑ * is the optimal solution.Both ϑ g and ϑ * subject to C. In ϑ g and ϑ * a ship j is assigned to berth i and a QC q is assigned to the ship j at time t.The set C includes constraints for the simultaneous DDBAP and DQCAP.

The Mathematical Formulation of the DDBAP and DQCAP
Before formulating the simultaneous DDBAP and DQCAP, we first define some notion used.Notion a j the estimated time of arrival (ETA) of ship j d j .
the actual departure time of ship j b j the desired berth number for ship j (b j ∈ I) r min the minimum number of QCs assignable to a ship r max the maximum number of QCs assignable to a ship c1 the cost rate of waiting time c2 the cost rate of delay time c3 the cost rate of handling time (including times of QC setups and movements)

Decision variables
X ijt = 1, if the ship j is assigned to the berth i at time period t 0, otherwise if QC q is assigned to ship j at the time period t 0, otherwise BT j : The berthing time of the ship j (j ∈ J).Now, the mathematical model for the simultaneous DDBAP and DQCAP is formulated as follows: Equation ( 5) is the objective function that aims to minimize the summation of total cost that includes three terms.The first term is waiting cost; the second term is departure delay cost; the third term is handling cost that also includes QC setups and movements.Equation ( 6) stipulates that one ship can only occupy one berth at one time period and this also indicates that one ship is continuously processed until completed.Constraint (7) stipulates that a berth can only be occupied by one ship for one period.Constraint (8) stipulates that a QC can only be assigned to one time period for one ship.Constraint (9) limits the range the total number of QCs that can be assigned to a ship.Constraint (10) stipulates that the total number of QCs assigned to ships at a given time period t cannot exceed the total number of QCs available (TQ).Constraints ( 9) and (10) ensure that the assigned number of QCs to a ship is feasible.Constraint ( 11) is a requirement for the decision variable BT j .Constraint ( 12) is a binary value requirement for the decision variables X ijt and Y jqt .Due to NP-complete, we proposed HGAs in Section 4 to deal with the two problems simultaneously.

The Hybrid Genetic Algorithm (HGA) Approach
To solve the simultaneous DDBAP and DQCAP, three HGAs are developed in this section.Figure 2 illustrates the solution process of a HGA that hybridizes a GA with an event-based heuristic.First, a HGA employs a GA used to generate a BAP solution and a time-invariant QCAP solution.Secondly, it transforms the time-invariant QCAP solution into a variable one using the event-based heuristic.The GA model and the event-based heuristic are detailed in Sections 4.1 and 4.2, respectively.stipulates that the total number of QCs assigned to ships at a given time period t cannot exceed the total number of QCs available (TQ).Constraints ( 9) and ( 10) ensure that the assigned number of QCs to a ship is feasible.Constraint ( 11) is a requirement for the decision variable .Constraint ( 12) is a binary value requirement for the decision variables and .Due to NP-complete, we proposed HGAs in Section 4 to deal with the two problems simultaneously.

The Hybrid Genetic Algorithm (HGA) Approach
To solve the simultaneous DDBAP and DQCAP, three HGAs are developed in this section.Figure 2 illustrates the solution process of a HGA that hybridizes a GA with an event-based heuristic.Figure 3 illustrates the chromosome for a GA approach.The chromosome includes two segments, each containing n genes, where n is the total number of ships to call within the planning horizon.In the left segment, the jth gene is an integer indicating the berth number assigned to the ship j; in the right segment the jth is an integer representing the number of QCs assigned to the ship j.The two segments together indicate a total solution to the simultaneous DDBAP and DQCAP.3 illustrates the chromosome for a GA approach.The chromosome includes two segments, each containing n genes, where n is the total number of ships to call within the planning horizon.In the left segment, the jth gene is an integer indicating the berth number assigned to the ship j; in the right segment the jth is an integer representing the number of QCs assigned to the ship j.The two segments together indicate a total solution to the simultaneous DDBAP and DQCAP.
Figure 3 illustrates the chromosome for a GA approach.The chromosome includes two segments, each containing n genes, where n is the total number of ships to call within the planning horizon.In the left segment, the jth gene is an integer indicating the berth number assigned to the ship j; in the right segment the jth is an integer representing the number of QCs assigned to the ship j.The two segments together indicate a total solution to the simultaneous DDBAP and DQCAP.

Population Initialization
Given a total number of chromosomes, the GA generates integers within [1,m] for the left segment as well as integers within [ , ] for the right segment of a chromosome iteratively in these chromosomes.

Population Reproduction
The proposed GA employs roulette wheel selection (RWS) for population reproduction.Equation ( 13) is the formula used to calculate the selection probability for each chromosome, in which

Population Initialization
Given a total number of chromosomes, the GA generates integers within [1,m] for the left segment as well as integers within [r min , r max ] for the right segment of a chromosome iteratively in these chromosomes.

Population Reproduction
The proposed GA employs roulette wheel selection (RWS) for population reproduction.Equation ( 13) is the formula used to calculate the selection probability for each chromosome, in which FV i indicates the fitness value of the chromosome i.In addition, Equation (14) shows the calculation of cumulative probability for each chromosome.The RWS sampling allows the best chromosomes with a higher opportunity to be selected as parents for generating offspring.

Crossover Operation
The crossover operator is used to generate offspring chromosomes.It works as follows.As shown in Figure 4a, it selects two points (p1 and p2) as a matching section from two parent chromosomes (A and B).Then, it switches all the elements in the matching section between the two parent chromosomes.After crossover operation, it results in two offspring chromosomes (A 1 and B 1 ) as shown in Figure 4b.indicates the fitness value of the chromosome i.In addition, Equation ( 14) shows the calculation of cumulative probability for each chromosome.The RWS sampling allows the best chromosomes with a higher opportunity to be selected as parents for generating offspring.

Crossover Operation
The crossover operator is used to generate offspring chromosomes.It works as follows.As shown in Figure 4a, it selects two points (p1 and p2) as a matching section from two parent chromosomes (A and B).Then, it switches all the elements in the matching section between the two parent chromosomes.After crossover operation, it results in two offspring chromosomes (A1 and B1) as shown in Figure 4b.

Mutation Operation
Mutation operation can be used to diversify a population to prevent a solution from being trapped in local optima.A mutation is bound by a specified mutation rate (Rm); if a selected random number from the range [0,1] is equal or smaller than the Rm then the mutation triggers.In this research, three kinds of mutation operators are focused and they are detailed below.
(1) Swap mutation (SWM): as shown in Figure 5a, two genes located at the positions p1 and p2 of a same segment are select and swapped.Thus, the chromosome A mutates to A2 as shown in Figure 5b.(2) Thoros mutation: as shown in Figure 6a, three gene positions p1 < p2 < p3 are chosen randomly, which shall take the different positions not necessarily successively.Then, the gene value of position p1 becomes the gene value of position p2, the original gene value of p2 becomes the gene value of p3, and finally the original gene value of p3 becomes the gene value of p1.After mutation, Figure 6a becomes Figure 6b.(3) Thoras mutation: as shown in Figure 7a, the process of Thoras mutation is similar that of Thoros mutation.But the Thoras selects three consecutive genes.After randomly selecting the first gene position (p1), the two other successive genes are then determined.As a result, the last becomes the first of the sequence, the second becomes last and the first becomes the second the sequence.After mutation, the Figure 7a becomes Figure 7b.Each mutation is subject to constraints, Equations ( 10) and (11).For an infeasible solution, it is discarded and regenerated.sequence.After mutation, the Figure 7a becomes Figure 7b.Each mutation is subject to constraints, Equations ( 10) and (11).For an infeasible solution, it is discarded and regenerated.sequence.After mutation, the Figure 7a becomes Figure 7b.Each mutation is subject to constraints, Equations ( 10) and (11).For an infeasible solution, it is discarded and regenerated.

Termination
A termination condition is used to stop running a GA within an acceptable computational time.In this research, a number of total generations determined by a preliminary test of convergence is used as a terminate condition.

Fitness Value Function
To evaluate the derived solutions, Equation ( 15) is defined as the fitness value (FV) function.The higher the FV, the better the solution is.Multiplication of 1000 is used to shift a decimal point for better presentation in a table, and this will not alter the comparative results of different approaches:

Termination
A termination condition is used to stop running a GA within an acceptable computational time.In this research, a number of total generations determined by a preliminary test of convergence is used as a terminate condition.

Fitness Value Function
To evaluate the derived solutions, Equation ( 15) is defined as the fitness value (FV) function.The higher the FV, the better the solution is.Multiplication of 1000 is used to shift a decimal point for better presentation in a table, and this will not alter the comparative results of different approaches:

.8. The Whole Process Flow of the HGA Approaches
The main process flow of the HGAs is outlined as follows.
(1) Set the population size (P) crossover rate (Rm), mutation rate (Rc), the maximum number of generation g m , and set the current generation i to 1 (I = 1).( 2  otherwise, i = i + 1 and go to step (4).

States and Events
In this research, a "state" is defined as a status of a ship and an "event" is defined as thing happens at a specific point of time and this event can change the state of a ship.In this research, we define "to berth," "berthed," and "left" as three states of ships and "berth" and "leave" as two events.Figure 8 illustrates a state transition diagram.First, a ship is with the "to berth" state.Then, the "to berth" state can be changed to the "berthed" state triggered by a "berth" event.Finally, the "berthed" state can be changed to "left" state triggered by a "leave" event.The current states of all calling ships can represent a "system" state that can be used to control the running of the event-based heuristic.If all calling ships are with the "left" state, this indicates that all calling ships have been completed so that the event-based heuristic should stop running.The events are also used to trigger QC assignments or reassignments in our approach.
(8.1) Sort the estimated times of arrival (ETAs) of those ships assigned to a same berth.Break a tie by ship priority.(8.2) Determine the BTj of each ship.(8.3) Determine the ECTj of each ship using Equation ( 5). ( 9) Calculate the FV of the current solution and compare it to the best solution; if better then update the best solution.( 10) Check if the termination condition ( > gm) is met.If "yes" then output the best solution; otherwise, i = i + 1 and go to step (4).

States and Events
In this research, a "state" is defined as a status of a ship and an "event" is defined as thing happens at a specific point of time and this event can change the state of a ship.In this research, we define "to berth," "berthed," and "left" as three states of ships and "berth" and "leave" as two events.Figure 8 illustrates a state transition diagram.First, a ship is with the "to berth" state.Then, the "to berth" state can be changed to the "berthed" state triggered by a "berth" event.Finally, the "berthed" state can be changed to "left" state triggered by a "leave" event.The current states of all calling ships can represent a "system" state that can be used to control the running of the event-based heuristic.If all calling ships are with the "left" state, this indicates that all calling ships have been completed so that the event-based heuristic should stop running.The events are also used to trigger QC assignments or reassignments in our approach.

Event-Triggered QC Assignment/Reassignment
Figure 9 illustrates berthing plan that includes variable QC assignment, in which each time interval is termed a "stage" formed by a pair of "berth" and "leave" events.For n ships to call, there will be 2n-1 stages.Each stage is a time period denoted as [t( ), t( + 1)], where t( ) and t( + 1) correspond to event times of E( ) and E( +1), respectively.QCs are assigned to each stage to work for ships.Also, note that in this berth plan one employs "leave" events to trigger QC reassignments when

Event-Triggered QC Assignment/Reassignment
Figure 9 illustrates berthing plan that includes variable QC assignment, in which each time interval is termed a "stage" formed by a pair of "berth" and "leave" events.For n ships to call, there will be 2n − 1 stages.Each stage is a time period denoted as [t(ε), t(ε + 1)], where t(ε) and t(ε + 1) correspond to event times of E(ε) and E(ε + 1), respectively.QCs are assigned to each stage to work for ships.Also, note that in this berth plan one employs "leave" events to trigger QC reassignments when QCs are released from finished ships.For example, the "leave" event E(4) of ship 1 reassigns 1 QC (released by ship 1) to ships 2 and 3, respectively.This reassignment should be subject to constraints including Equations ( 9) and (10).Due to the immediate reuse of released QCs, a higher QC utilization is expected but at the cost of more QC setups and movements.The gains and costs should be justified by in the objective function.In this research, only the "leave" events of ships are used to trigger QC reassignments.

Finding the Next Event
To generate a berth plan based on events, it is necessary to identify time, type and owner of the next event one by one.For this purpose, Equation ( 14) is used to find the next event time at the stage ε, denoted as t(ε).The t(ε) is the minimum value of the two data sets, i.e., a j j ∈ A and { ECT j (ε − 1) j ∈ B .The a j is the ETA of a ship j if j ∈ A, werhe A is the set of ships to berth; the ECT j (ε − 1) is the expected completion time of a berthed ship j if j ∈ B, where B is a set of berthed ships.Also note that the ECT j (ε − 1) is estimated at the stage ε − 1. Break a tie by ship priority.Having found the t(ε), then the type and owner of the next event can be determined accordingly.If the owner is (ship j) ∈ A, then the next event is a "to berth" event; otherwise, a "leave" type due to j ∈ B.
Also, Equation ( 16) is subject to the following constraints in Equation ( 17): where n: the total number of ships.
A: a set of ships at "to berth" state.B: a set of ships at "berthed" state.F: a set of ships at "left" state.
ε: the current stage number.
ECT j (ε − 1): the expected completion time (ECT) of ship j (j ∈ B) estimated at the previous stage ε − 1. a j : the ETA of ship j (j ∈ A).
For a berthed ship j, we can estimate its ECT j using Equation ( 4).However, this needs to update the ECT j for a ship j if the number of QCs assigned to it has been further changed.Equation ( 18) is the equation for updating the ETC j (ε) at the time point ε: where: r (ε−1)j : the amount of QCs assigned to the ship j at the previous stage ε − 1 QCs are released from finished ships.For example, the "leave" event E(4) of ship 1 reassigns 1 QC (released by ship 1) to ships 2 and 3, respectively.This reassignment should be subject to constraints including Equations ( 9) and (10).Due to the immediate reuse of released QCs, a higher QC utilization is expected but at the cost of more QC setups and movements.The gains and costs should be justified by in the objective function.In this research, only the "leave" events of ships are used to trigger QC reassignments.
Figure 9.The berth plan with variable QC assignment triggered by a "leave" event.

Finding the Next Event
To generate a berth plan based on events, it is necessary to identify time, type and owner of the next event one by one.For this purpose, Equation ( 14) is used to find the next event time at the stage , denoted as ( ) .The ( ) is the minimum value of the two data sets, i.e., ∈ } and { ( − 1)| ∈ }.The is the ETA of a ship j if ∈ , werhe A is the set of ships to berth; the 4.2.4.The Event-Based Heuristic for Variable QC Assignment Equation ( 19) is proposed to assign/reassign released QCs from a leaving ship to berthed ship(s).
where θ εj : is the remaining workload (the total number of containers) of berthed ship j estimated at the stage ε.q j : is the number of QCs assigned to the berthed ship j. q j : is the number of QCs released by leaving ship j .

The Main Process Flow of the Event-Based Heuristic
The main process flow of the event-based heuristic for generating a series of stage solutions to the DQCAP is outlined in Table 1.Initially, all calling ships (j = 1, . . ., n) are staying in set A and they will be finally moved to the set F, then this algorithm stops running.
Table 1.The main flow of the event-based heuristic.
While (F = {1, . . . ,n}) then 3 do{ 4 determine the next event time t(ε) using Equation ( 16) and identify the owner (ship j) of the next event 5 6 if (ship j ∈ A) then 7 trigger the "berth" event 8 move the ship j from set A to set 9 assign the number of QCs to the ship j (j ∈ B) according to the jth gene value (derived from GA1) in the right segment of the chromosome.10 11 else if (ship j ∈ B) then 12 trigger the "leave" event 13 move the ship j from set B to set F 14 reassign released QCs from ship j to remaining berthed ships j , (j , ∈ B) using Equation (19) 15 16 update ECT j , (ε) for berthed ships j , (j , ∈ B) using Equation (18) 17 End if

The Main Process Flow of HGAs
The main process flow of HGAs is outlined as follows.
(1) Set the population size (P) crossover rate (Rm), mutation rate (Rc), the maximum number of generations gm, and set the current generation i to 1 (i = 1).(2) Initiate a population of chromosomes.
(3) Determine the service priority for each ship.otherwise, i = i + 1 and go to step (4).

Numerical Example
Java 2 is used as the programming language and experiments are conducted on a PC equipped with an Intel Pentium 2.4 GHz CPU as well as 4G DRAM.

Parameter Setting and Ship Data Generation for the Example
In our experiments, the parameter settings, m = 3, n = 20, q = 8, α = 0.8, β = 0.3, ρ = 25 (containers/hour), t s = 0.15 (hour), t m = 0.25 (hour), Rc = 0.4, Rm = 0.5, P = 20 and g m = 500 and [r min , r max ] = [1,3] are used.The cost rates of c1, c2 and c3 are set to 1000 USD/hour, same to those used in [29].The ETA (a j ) and total number of containers to be handled for a ship j (θ j ) are randomly values taken from the ranges [0, 168] (hours) and [1,700] (Twenty-foot Equivalent Units; TEUs), respectively.After this, the program continues to generate ship priority (p j ), desired berth location (b j ) and expected time of departure (ETD j ) that is defined in Equation (11).The values of b j (j = 1, . . ., n) are randomly selected from the set of berths [1,m].The ETD j (j = 1, . . ., n) is an optimistic departure time due to the use of r max in Equation (20).

Comparison of Various GAs and HGAs
This section compares results obtained from HGA1, HGA2 and HGA3.Each HGA differs from each other by using a specific mutation operation, i.e., HGA1 uses Swap mutation, HGA2 uses Thoros mutation and HGA3 uses Thoras mutation.
Table 2 Illustrates the FVs and average FVs obtained from various GAs and HGAs at different problem sizes.The higher the FV the better the goodness of an approach.
Figure 10 depicts average FVs obtained from the three GAs with time-invariant QC assignment at differ problem sizes of n × 3 (with n = 20, 40, 60, 80 and 100).The average FV shows a downward trend when more ships are calling at the port.It is found that GA1 has the worst average FV; GA2 has the second best average FV; the GA3 has the best average FV.         Figure 10 depicts average FVs obtained from the three GAs with time-invariant QC assignment at differ problem sizes of n × 3 (with n = 20, 40, 60, 80 and 100).The average FV shows a downward trend when more ships are calling at the port.It is found that GA1 has the worst average FV; GA2 has the second best average FV; the GA3 has the best average FV.

Findings and Discussion
The findings and discussion are as follows: (1) Our experimental results showed that the three HGAs can generate variable QC assignments and the derived results are better than those obtained from a GA with time-invariant QC assignment.(2) Figure 12 shows the average advantages percentage obtained from the three HGAs compared with GAs under different problem sizes.Generally speaking, the larger the problem size, the greater the advantage.Compared with GA3, HGA3 has the best advantage (123.3%) at the problem size 100 × 3. (3) Different mutation operations employed by a GA or HGA can lead to different planning results.
In terms of average FV, our experiments showed that the GA3 with Thoros mutation had the best performance; the GA2 with Thoras is the second best; the GA1 with Swap mutation is the worst.Compared with the two-point mutation operation Swap, the three-point mutation operations including Thoras and Thoros appear to be more capable of exploring a solution space.(4) The variable QC assignment can lead to advantages for these HGAs.This kind of QC assignment can reassign released QCs immediately to other ships, which can reduce the handling time for ships due to increased QC capability.Furthermore, the reduced handling times of ships can lead to an earlier release of berth and thus waiting times and then delay times of ships.This initiates a positive chain effect.(5) In this research the gain from the variable QC assignment has been justified against the cost of more QC setups and movements.(6) Among the three proposed HGAs, our experiments showed that the HGA3 had the best performance in terms of average FV.(7)

Findings and Discussion
The findings and discussion are as follows: (1) Our experimental results showed that the three HGAs can generate variable QC assignments and the derived results are better than those obtained from a GA with time-invariant QC assignment.(2) Figure 12 shows the average advantages percentage obtained from the three HGAs compared with GAs under different problem sizes.Generally speaking, the larger the problem size, the greater the advantage.Compared with GA3, HGA3 has the best advantage (123.3%) at the problem size 100 × 3. (3) Different mutation operations employed by a GA or HGA can lead to different planning results.
In terms of average FV, our experiments showed that the GA3 with Thoros mutation had the best performance; the GA2 with Thoras is the second best; the GA1 with Swap mutation is the worst.Compared with the two-point mutation operation Swap, the three-point mutation operations including Thoras and Thoros appear to be more capable of exploring a solution space.(4) The variable QC assignment can lead to advantages for these HGAs.This kind of QC assignment can reassign released QCs immediately to other ships, which can reduce the handling time for ships due to increased QC capability.Furthermore, the reduced handling times of ships can lead to an earlier release of berth and thus waiting times and then delay times of ships.This initiates a positive chain effect.(5) In this research the gain from the variable QC assignment has been justified against the cost of more QC setups and movements.(6) Among the three proposed HGAs, our experiments showed that the HGA3 had the best performance in terms of average FV.(7) The average computational times required for HGAs to complete experimental runs at different problem sizes n × 3 (with n = 20, 40, 60, 80 to 100) are acceptable.For example, at the problem size 100 × 3 an average of 469.5 + 90.9 s (or about 9 min) are required for HGA3 to complete one experiment when setting n = 100 and iteration runs = 500.

Conclusions
DDBAP and DQCAP are two daily seaside operational problems faced by container teminal planners.To better utilize berths and QCs, a better way to cope with the two problems simultaneously is necessary.
Although GAs have been widely used to cope with the DDBAP and DQCAP, however, almost all of them have been used to perform time-invariant QC assignment.Due to the lack of flexibility, this cannot best utilize available QCs.In addition, in past study, fixed-time interval planning framework has been widely used.This kind of framework has the disadvantage of underutilizing available QC capability.To address this issue, in this research the variable-time interval planning framework has been proposed for HGAs.Each of the three HGA combines GA with an event-based heuristic to solve the DDBAP and DQCAP simultaneously.The experiments gave a good result.We highlight the contributions of this research as follows.
(1) Three novel HGAs have been proposed to cope with the DDBAP and DQCAP simultaneously.
Each of the three HGAs combines a GA with an event-based heuristic.The dynamic framework embedded in these HGAs enables variable QC assignment that can better utilize available QCs. (2) Our experiment results showed that the HGAs with variable QC assignments can outperform those GAs with time-invariant QC assignment.Also, it is found that the HGA3 had the best performance among the three HGAs.(3) In this research we have proposed Equation (1) to estimate the handling time for ships, with the handling time also include required times for QC setup and movements.In addition, in the objective function the costs of QC setup and movement have been included, which helps to justify the gains from the flexibility of QC reassignments.(4) The HGAs appear to be applicable for berth allocation and QC assignment for calling ships due to acceptable computational time.(5) The research compares time-invariant QC assignment with variable QC assignment.These kinds of studies have been rarely undertaken in the past.
In this research, the HGAs only employ "leave" events to trigger QC assignment/reassignment.The use of "berth" event only or both "leave" and "berth" events and the investigation of their effects can be conducted in future research.In addition, the effects of using different crossover operations for the HGAs can be investigated.Moreover, hybrid approaches combining other meta-heuristics such as artificial bee colony (ABC) and shuffle frog-leaping algorithm (SFLA) can be developed in future research.Extending the HGAs proposed in the research to deal with continuous BAP can be another focus in future research.

Figure
Figure3illustrates the chromosome for a GA approach.The chromosome includes two segments, each containing n genes, where n is the total number of ships to call within the planning horizon.In the left segment, the jth gene is an integer indicating the berth number assigned to the ship j; in the right segment the jth is an integer representing the number of QCs assigned to the ship j.The two segments together indicate a total solution to the simultaneous DDBAP and DQCAP.

Figure 3 .
Figure 3.The chromosome representation of a genetic algorithm (GA).

Figure 3 .
Figure 3.The chromosome representation of a genetic algorithm (GA).
) Initiate a population of chromosomes.(3) Determine the service priority for each ship.(4) If i = 1 then go to Step (6); otherwise, go to Step (5).(5) Population reproduction.(6) Crossover operation.(7) Mutation operation using SWM/THOROS/THORAS.(8) Transform each chromosome in the population into a berth plan.(8.1) Sort the estimated times of arrival (ETAs) of those ships assigned to a same berth.Break a tie by ship priority.(8.2) Determine the BT j of each ship.(8.3) Determine the ECT j of each ship using Equation (5).

( 9 )
Calculate the FV of the current solution and compare it to the best solution; if better then update the best solution.(10)Check if the termination condition (i > gm) is met.If "yes" then output the best solution;

Figure 8 .
Figure 8.The states and events defined in this research.

Figure 8 .
Figure 8.The states and events defined in this research.

r
εj : the amount of QCs assigned to the ship j at the current stage ε Sustainability 2019, 11, x FOR PEER REVIEW 12 of 21

Figure 9 .
Figure 9.The berth plan with variable QC assignment triggered by a "leave" event.

( 8 )
Transform each chromosome in the population into a berth plan.(9) Calculate the FV of the current solution and compare it to the best solution; if better then update the best solution.(10) Check if the termination condition (i > gm) is met.If "yes" then output the best solution;

Figure 10
Figure10depicts average FVs obtained from the three GAs with time-invariant QC assignment at differ problem sizes of n × 3 (with n = 20, 40, 60, 80 and 100).The average FV shows a downward trend when more ships are calling at the port.It is found that GA1 has the worst average FV; GA2 has the second best average FV; the GA3 has the best average FV.

Figure 10 .
Figure 10.The average FVs obtained from GAs with time-invariant QC assignment at different problem sizes n × 3 (with n = 20, 40 to 100).

Figure 11
Figure 11  depicts the graph of average FVs obtained from the three HGAs with variable QC assignment at different problem sizes of n × 3 (with n = 20, 40, 60, 80 and 100).The average FV shows a downward trend when more ships are calling at the port.Also, among the three HGAs, it is found that HGA1 has the worst average FVs; HGA2 has the second best average FV; and HGA3 has the best average FV.

Figure 10 .
Figure 10.The average FVs obtained from GAs with time-invariant QC assignment at different problem sizes n × 3 (with n = 20, 40 to 100).

Figure 11 depicts
Figure 11  depicts the graph of average FVs obtained from the three HGAs with variable QC assignment at different problem sizes of n × 3 (with n = 20, 40, 60, 80 and 100).The average FV shows a downward trend when more ships are calling at the port.Also, among the three HGAs, it is found that HGA1 has the worst average FVs; HGA2 has the second best average FV; and HGA3 has the best average FV.

Figure 10 .
Figure 10.The average FVs obtained from GAs with time-invariant QC assignment at different problem sizes n × 3 (with n = 20, 40 to 100).

Figure 11
Figure 11  depicts the graph of average FVs obtained from the three HGAs with variable QC assignment at different problem sizes of n × 3 (with n = 20, 40, 60, 80 and 100).The average FV shows a downward trend when more ships are calling at the port.Also, among the three HGAs, it is found that HGA1 has the worst average FVs; HGA2 has the second best average FV; and HGA3 has the best average FV.

Figure 12 shows 21 Figure 12
Figure 12 shows the improvements of average FVs obtained from different HGAs with different mutation operations at different problem sizes if n × 3 (n = 20, 40, 60, 80 and 100), compared to traditional GAs used for time-invariant QC assignments.We analyze this figure in the next section.Sustainability 2019, 11, x FOR PEER REVIEW 18 of 21

Figure 12 .
Figure 12.The improvements of average FVs obtained from different HGAs at different problem size n × 3 (with n = 20, 40 to 100).

Figure 12 .
Figure 12.The improvements of average FVs obtained from different HGAs at different problem size n × 3 (with n = 20, 40 to 100).

Table 2 .
The experimental results obtained from the GAs and HGAs.