Modeling and Solving the Three Seaside Operational Problems Using an Object-oriented and Timed Predicate/transition Net

Container terminals (CTs) play an essential role in the global transportation system. To deal with growing container shipments, a CT needs to better solve the three essential seaside operational problems; berth allocation problem (BAP), quay crane assignment problem (QCAP), and quay crane scheduling problem (QCSP), which affect the performance of a CT considerably. In past studies, the three seaside operational problems have often been solved individually or partially, which is likely to result in poor overall system performance. However, solving the three seaside operational problems simultaneously is in fact a very complicated task. In this research, we dealt with the three seaside operational problems at the same time by using a novel high-level Petri net, termed an Object-Oriented and Timed Predicate/Transition Net (OOTPr/Tr net). After defining the three seaside operational problems formally, we integrated them as a three-level framework that was further transformed into an OOTPr/Tr net model. Then, using the Prolog programming language, we implemented this model as a simulation tool to find the best solution based on the various combinations of heuristic rules used.


Introduction
Container terminals (CTs), connecting seaside and landside transportation, are an essential part of the global transportation system.Over the past two decades, the demand for maritime transport has increased dramatically [1].The number of container shipments between 1990 and 2008 has increased from 28.7 million to 152 million, representing a 9.5% average annual compound growth rate [2].In addition, about 60% of the maritime transports employed containers, with a growth rate of 6.4% each year.This figure even approaches 100% for developed countries [3].The above figures show the need to improve the efficiency of CTs.
One effective way to improve the efficiency of a CT is to directly improve its operations, which are usually separated into three areas: seaside, yard, and landside [4,5].The seaside operations are particularly critical as they employ berths and quay cranes (QCs), two scarce resources that can Appl.Sci.2017, 7, 218 2 of 21 affect the CT performance considerably [6].For the seaside operations, there are three well known operational problems, i.e., berth assignment problem (BAP), quay crane assignment problem (QCAP), and quay crane scheduling problem (QCSP).Essentially, the BAP is a problem of allocating berths to ships.The QCAP focuses on assigning QCs to ships whereas the QCSP focuses on the further assignment of QCs to the tasks of ships, where each task consists of a group of containers from a same ship to be loaded and unloaded, so that the QC schedules can be finally settled down.A solution to the QCSP should clarify which task is handled by which QC and what are the starting and ending times of each task.To solve the QCAP, it usually needs to solve the QCAP first.The solution found for the QCAP can affect the solution found for the QCSP, thus the two problems are related.In our approach, we use an indirect approach to assign QCs to ships, i.e., QCs are first assigned to berths based on the workload of the berths and then the QCs assigned to a berth are used to serve the ships that moor that berth.
After a literature review, it was found that the three seaside operational problems have often been solved separately or partially [7][8][9].The drawback of a separate study is that it tends to result in a poor overall system performance while neglecting the interrelationship between the various levels of seaside operational problems.Thus, it has been suggested to solve the three operational problems in an integrated way [5].
Various approaches have been proposed to deal with the three seaside operational problems separately or simultaneously.For example, Mixed Integer Programming (MIP) has been used to solve BAP [10,11], QCSP separately [12,13], and BAP and QCAP simultaneously [8].Simulation has been used to solve BAP [14], QCSP [11,15], and as an evaluation tool for terminal operations [16].Genetic algorithms (GAs) have been used to solve dynamic QCAP [17], QCSP [1,18], simultaneous BAP and QCAP [19][20][21], and simultaneous BAP and QCSP [7,[22][23][24].Heuristic rules have been employed to solve QCSP [25].The branch and bound (B & B) approach has been applied towards QCSP [23].Timed Petri net (PN) has been used to deal with QCSP [26], and stochastic PNs have been applied for the modeling and analysis of the activities of human operations [27] and logistic systems [28] for a container terminal.Decision support systems (DSSs) have been used to solve both BAP and QCAP [2], and as a tool for decision making [3,29].While exact approaches, such as Mixed Integer Programming (MIP), have the capability to solve a problem to optimality, they are usually computationally intractable when dealing with problems of practical size [12,25,30], due to non-deterministic polynomial-time hard (NP-hard) [2].Approximate approaches, such as heuristics, meta-heuristics and Genetic Algorithms (GAs), and PN-based approaches [31][32][33] have thus been widely used to find near-optimal solutions within an acceptable time.However, studies that deal with the three seaside operational problems at the same time have rarely appeared.In addition, while simulation studies [11,16,34] have been used to deal with operational problems in a container terminal, almost all of them used a "what-if" analysis manually, which is found to be time-consuming and labor-intensive [4].
For improvement, in this research we propose an approach which combines heuristics with a simulation technique as an evaluation tool to automatically find the best solution from a reduced solution space.Through a systematic procedure, we have modeled and solved the three seaside operational problems in an integrated way.Specifically, after defining the three seaside operational problems formally, we integrated them into a three-level framework.The first level deals with the BAP in which ships are assigned to berths based on the workloads on the berths; the second level deals with the QCAP and QCSP in which the tasks of ships are assigned to QCs based on the workloads of the QCs; finally, the third level determines the beginning and ending times of each task through discrete event simulation.This framework has been first transformed into a high-level Petri net, termed as an Object-Oriented and Timed Predicate/Transition Net (OOTPr/Tr net) and was then implemented using the Prolog programming language as an evaluation tool.Experiments showed that this tool could automatically find the best solution from the reduced solution space formed by the combinative uses of heuristics.
The rest of this paper is organized as follows: Section 2 gives a detailed literature review on BAP, QCAP, and QCSP.Section 3 defines and integrates the BAP, QCAP, and QCSP together and represents them as a three-level framework.Section 4 proposes an OOTPr/Tr net to model the three-level framework and finally implements this OOTPr/Tr net as a simulation optimization tool.Section 5 gives an example to demonstrate the applicability of this approach.Section 6 makes a brief conclusion and provides some directions for future study.

Literature Review
2.1.Studies Focusing on BAP or QCAP Some studies have been dedicated to dealing with the BAP.Legato and Mazzy [4] used a queuing network model to simulate the arrivals, berthing, and departures of vessels at a CT.Using the simulation tool, SLAM, they continued to find better solutions through "what-if" analyses.To deal with the BAP, Kim and Moon [35] formulated a MIP for the BAP and then proposed a simulated annealing algorithm to solve it.The derived solutions were found to be similar to those obtained from the MIP model.Following a multiple-stage decision procedure, Wang and Lim [36] solved the BAP using a stochastic beam search algorithm (SBSA), and the experimental results showed good performance of their algorithm.This algorithm was found to be more accurate and efficient than the state-of-the-art meta-heuristics and traditional deterministic beam search.Lee and Chen (2009) [6] presented a neighborhood search-based heuristic to determine the berthing time and space for each ship.In that study the quay was used as a continuous space with factors such as first-come-first-serve, clearance distance between ships, and the possibility of ship shifting taken into consideration.Zhen et al. [37] dealt with BAP through a two-stage decision procedure in which the arrival times and handling times of vessels were treated as uncertainties.In addition, they provided a meta-heuristic to deal with problems of practical size.Buhrkal et al. [38] also dealt with the BAP with discrete berths.Having investigated three relevant models for solving the BAP, they improved one of the three models.Regarding a parallel-machine scheduling problem, Xu et al. [24] dealt with the BAP with constraints that included taking into account the water depth and tidal condition.That study considered both static and dynamic versions of BAP and a heuristic was proposed to deal with them.
The above-mentioned studies only focused on the BAP, and our literature review showed only Peterkofsky and Daganzo [15] focused on the QCAP alone.Most studies have combined the QCAP with BAP or QCSP.

Studies Focusing on QCSP
Some studies have focused on the QCSP.Kim and Park [12] formulated a MIP model for the QCSP.However, due to NP-hard they provided a greedy randomized adaptive search procedure (GRASP), which includes a B & B and heuristic to deal with this problem.Ng and Mak [25] proposed another heuristic to solve this problem.That heuristic first decomposed the QCSP into sub-problems, and then solved them.Canonaco et al. [11] proposed a hybrid approach combining a queuing network model with discrete event simulation to deal with the QCSP.The throughput and completion time of the QCs of each generated solution were evaluated.The objective of that approach was to maximize the CT efficiency.Their experiments showed encouraging results.Lee et al. [10] first formulated a MIP for the QCSP and then proposed a GA to determine QC schedules for each task of the ships.They concluded that the proposed GA was effective and efficient.Zhang and Kim [13] modeled the QCSP with a MIP model with the aim of minimizing the number of QC operational cycles required for loading and unloading all the containers.Finally, they proposed a hybrid heuristic to solve this problem, taking inter-stage sequencing (hatch sequencing) and intra-stage sequencing (stack sequencing in the same hatch) into account.Their experimental results showed that the proposed approach could mostly find the optimal solution.In addition, they concluded that the schedule resulting from that approach was much better than that constructed by human planners.Legato et al. [26] proposed a rich model to solve QCSP with factors including individual crane service rates, ready times, due dates, safety requirements, and precedence relations among container groups taken into account.They also used a timed Petri net model to determine the loading and unloading QC schedules.Their experimental results showed the desired results.Given the constraint of non-crossing for QCs and sequence requirements among tasks, Jin and Li [18] used a GA to solve the QCSP.In another study, Chung and Choy [1] also employed a GA to deal with the QCSP.Their experimental results showed that the proposed GA was as good as many of the existing algorithms, but it needed less computational time.However, the aforementioned studies did not consider the BAP.

Studies Focusing on Simultaneous Problems
Some studies have been dedicated to solving the three seaside operational problems simultaneously.Treating the arrival times and handling times of ships as stochastic variables, Zhou and Kang [20] proposed a model to deal with the berth and QC allocation problems simultaneously, with the aim of minimizing the average waiting time for calling ships.However, because of the polynomial computational time of computer they proposed a GA approach to the solution from a reduced solution space.Chang et al. [21] used a dynamic allocation model to deal with the BAP and QCAP simultaneously.In that study, the authors employed a hybrid parallel genetic algorithm (HPGA), combining a parallel genetic algorithm (PGA) with a heuristic to find solutions that were being further evaluated by the simulation approach.Zhang et al. [9] studied the berths and QCs allocation problem, with the special factor of the QC coverage range limitation taken into account.A sub-gradient optimization algorithm was developed solve the BAP and QCAP simultaneously.However, that algorithm only allowed limited QC adjustments during the loading and unloading of containers.Raa et al. [8] formulated a Mixed Integer Linear Programming (MILP) model for the BAP and QCAP, taking into account the ship priorities, preferred berthing locations, and handling time.Finally, they concluded that this model was able to support operational and tactical decision-making.Liang et al. [17] had a study on the BAP and dynamic QCAP.A multi-objective hybrid GA was proposed in that study to assign QCs dynamically.
Some studies have focused on the BAP and QCSP simultaneously.Having formulated the BAP and QCSP as a MIP model, Imai et al. [19] proposed a GA-based heuristic to deal with the two problems due to NP-hard.The GA-based heuristic was able to find approximate solutions and their experimental results concluded the applicability of that heuristic.Liang et al. [7] solved the BAP together with the QCSP with the aim of minimizing the total handling time, waiting time, and the delay for every ship.After formulating the two problems as mathematical models, a GA was later proposed to find approximate solutions.Similarly, Lee and Wang [22] formulated the BAP and QCSP as a MIP model and solved them with a GA.Their experimental results showed that the GA was effective and efficient in finding near-optimal solutions.Han et al. [23] dealt with the BAP and QCSP.In that study, the arrival and handling times of vessels were treated as uncertainties and the quay was configured as discrete berths.Ships were assumed to arrive stochastically and QCs were allowed to move among the berths.Having formulated a MIP model, the authors proposed a simulation-based GA approach to generate schedules for the berths and QCs.They found that the obtained results were desirable.To deal with the BAP and QCSP, Song et al. [28] provided a Bi-Level Programming (BLP) to deal with the two problems.At the upper level a GA was used to deal with the BAP and at the lower level a Branch and Bound (B & B) approach was proposed to deal with the QCSP.Petering [29] used a simulation model to study an automated container terminal with multiple discrete berths.
In addition to the aforementioned approaches, some other approaches have been proposed for dealing with CT seaside operational problems.For example, Yin et al. [39] proposed an agent-based approach for dynamic port planning.Murty et al. [27] used a Decision Support System (DSS) to help make decisions for yard operations in a CT.The DSS aimed to use minimal resources to minimize the berthing time of vessels, the waiting time of customer trucks, the congestion on the roads, storage blocks, and docks inside the terminal, and to best utilize the available storage space.Salido et al. [2] also proposed a DSS to assist decisions for both BAP and QCAP as they found QCAP can affect BAP and both of them can affect the container stacking problem.Sun et al. [17] proposed a general simulation platform, MicroPort, to evaluate operational capability and efficiency.The platform was used for "what-if" analyses for seaport designs.Zeng et al. [40] also employed a simulation optimization method for scheduling the loading operations for a CT.In their approach, dispatching rules was first used to generate an initial container loading sequence, and then GA was further used to improve the initial solution.Finally, simulation was used to evaluate the final solution.During the solution procedure, a Neural Network (NN) was also used to filter out potentially bad solutions.Pratap et al. [41] used a heuristic rule to develop a decision support model for the operations of a bulk material port.

Problem Definitions and Formulation
3.1.The Definitions of BAP, QCAP, and QCSP Definition 1.The problem P1 is defined as a berth allocation problem (BAP), which includes 6-tuple: the length of berth j BD j the depth of berth j C 1 a set of constraints T the planning horizon in units of hours T = {1, . . .,H}; H = 168 h for 1 week X t ij a decision variable; if ship i is assigned to berth j at time period t then X t ij = 1; Otherwise, X t ij = 0. ξ a collection of sets of solutions with ship-to-berth assignments; The objective of P1 is to find a ξ g or ξ * (ξ g , ξ * ∈ ξ), where the ξ g is a feasible solution while ξ * is an optimal solution.Both ξ g and ξ * are subject to C 1 .In ξ g and ξ * each ship i is assigned with a berth j, denoted as (i, j), and as a result of this assignment, the corresponding decision variable X t ij = 1.Finding ξ * is a NP-hard problem [2].The assignment of ships to berths is restricted by constraints such as berth length, berth depth, ship length, and ship draft.Definition 2. The problem P2 is defined as a quay crane assignment problem (QCAP), which includes 7-tuple: an objective function that maps ρ g to a time/cost value The objective of P2 is to find a ρ g or ρ * (ρ g , ρ * ∈ ρ), where ρ g is a feasible solution and ρ * is an optimal solution.Both ρ g and ρ * are subject to C 2 .In ρ g and ρ * each task k of ship i is handled by a specific QCs q, denoted as (i,q,k).As a result, the corresponding decision variable Y t iqk equals 1 (i.e., Y t iqk = 1).The set C 2 includes constraints such as sequential assignments of QCs to berths and the constraint ensuring that the total number of QCs assigned to ships at the same time period is equal to or less than the total number of QCs available.Definition 3. The problem P3 is defined as the quay crane scheduling problem (QCSP) that includes 8-tuple: the number of ships l the total number of quay cranes l i the total number of quay cranes assigned to the ship i (1 ≤ i ≤ m) K i the total number of tasks of ship i S a set of ships; S = {1, . . .,m} B a set of berths; B = {1, . . .,n} C 3 a set of constraints Q a set of quay cranes Q = {1, . . .,l} T1 iqk a decision variable; the beginning time of QC q to process the task k of ship i T2 iqk a decision variable; the end time of the QC q to process the task k of ship i T the planning horizon in units of hours T = {1, . . .,H}; H = 168 h (10,080 min) for 1 week.ϕ a collection of sets of QC schedules for all ships; The objective of P3 is to find a ϕ g or ϕ * (ϕ g , ϕ * ∈ ρ), where ϕ g is a feasible solution and ϕ * is an optimal solution.Both ϕ g and ϕ * are subject to C 3 .In ϕ g and ϕ * a time interval T1 iqk , T2 iqk indicates that a quay crane q is assigned to work for the task k of ship i.The set C 3 includes constraints stipulating the reasonable ranges of value for T1 iqk and T2 iqk and their relationships.
Definition 4. The integrated problem P consisting of P1, P2, and P3 is represented as 8-tuple.
where f is a function that maps ϕ g to a makespan.
The objective of the integrated problem P is to find a solution with the minimum makespan, subjecting to the constraints defined in

The Mathematical Formulation of the Integrated Problem
The mathematical model for this integrated problem P is formulated as follows.
Equation ( 1) is the objective function Z aimed at minimizing the makespan of the integrated problem P. Equation (2) ensures enough berth length for the ship to berth.Equation ( 3) is a constraint guaranteeing enough water depth to accommodate an assigned ship.Equation ( 4) stipulates that only one ship is served at a time on a berth.Equation ( 5) is a constraint stipulating that QCs are sequentially assigned to ships according to increasing QC number and berth number.Equation ( 6) is a constraint ensuring that the total number of QCs assigned to ships in the same time period is equal to or less than the total number of QCs available.Equations ( 7) and ( 8) indicate the feasible value ranges for T1 iqk and T2 iqk .Equation (9) defines the relationship between T1 iqk and T2 iqk .Equation (10) defines the berth duration of a ship.Equations ( 11) and ( 12) define the value domains for the decision variables X t ij and Y t iqk .However, this mathematical model cannot be solved by commercial software as the variable t is unbounded.We solve them using a heuristic and simulation-based approach as described in Section 4.

A Three-Level Framework of Planning
To solve the three problems together, a three-stage procedure is proposed as shown in Figure 1.At the first stage, each ship i is assigned to a specific berth j taking both constraints (2) and (3) into account.Such an assignment is denoted as (i,j) so that the decision variable X t ij = 1.At the second stage, for a berth j a number of QCs are assigned to serve the ships berthing on it.For each task k of ship i, a specific quay crane q is assigned to handle it with both constraints ( 5) and ( 6) taken into consideration.This assignment is denoted as (i,q,k) and it makes the decision variable Y t iqk = 1.At the third stage, it determines the beginning time (T1 iqk ) and the end time (T2 iqk ) for a task k of ship i with this schedule denoted as T1 iqk , T2 iqk that is subject to constraints ( 7)-( 9).In Bierwirth and Meisel (2010), the authors pointed out that one way to integrate the seaside operational problems is to feed back the beginning time and completion time of the tasks determined in the QCSP to the BAP.This approach is adopted in this framework.Level 1: this level deals with the BAP.In this stage, heuristic rules can be used to allocate ships to berths.For example, the least workload (LWL) rule always assigns a ship to a berth that currently has the least workload.As a result, the workload among berths are balanced.The algorithm of the LWL is detailed below.
Set the current workload of each berth to zero.Step 2.
Sort the calling ships by their Estimated Time of Arrivals (ETAs) to an ascending list S.
Sort the berths by their workloads to an ascending set B. Step 5.
Update the current workload of the selected berth, and then go to Step 3. Step 6.
End Level 2: this level deals with QCAP and QCSP.In this level, heuristics rules are used to assign QCs to ships.For example, the Load Balance (LB) rule assigns QCs to berths according to the workloads of ships assigned to berths.After determining the number of QCs assigned to each berth, the QCs are sequentially assigned to berths according to the QC number (Assume that QC along the quayside are assigned with an increasing QC number).Then, Each level in the framework is detailed as follows: Level 1: this level deals with the BAP.In this stage, heuristic rules can be used to allocate ships to berths.For example, the least workload (LWL) rule always assigns a ship to a berth that currently has the least workload.As a result, the workload among berths are balanced.The algorithm of the LWL is detailed below.
Step 1. Set the current workload of each berth to zero.
Step 2. Sort the calling ships by their Estimated Time of Arrivals (ETAs) to an ascending list S.
Step 3. Sort the berths by their workloads to an ascending set B. Step 5. Update the current workload of the selected berth, and then go to Step 3.
Step 6. End Level 2: this level deals with QCAP and QCSP.In this level, heuristics rules are used to assign QCs to ships.For example, the Load Balance (LB) rule assigns QCs to berths according to the workloads of ships assigned to berths.After determining the number of QCs assigned to each berth, the QCs are sequentially assigned to berths according to the QC number (Assume that QC along the quayside are assigned with an increasing QC number).Then, each task of a ship can be assigned to an assigned QC to that ship by using a LB rule, subjecting to the non-crossing characteristic of QCs.The LB rule is detailed below.
Step 1. Calculate the numbers of QCs (l j , j ∈ B) to be assigned to each berth j using Equation (13), in which the round operator rounds each l j off to the nearest whole digit; N i k is the total number of containers to be handled for the task k of ship i; n j is the number of ships assigned to berth j at Level 1.
Step 4. Allocate QCs one by one to each berth j according to the QC numbers until the amount l j is reached.Then the QCs assigned to a same berth are a group and denoted as Q j , where j ∈ B. Step 5. Sort the tasks of each ship i into an ascending task set T i according to the task numbers.Step 6. Calculate the current workload of ship i (N i L,uL ) by totaling the numbers of containers to load (N i L ) and unload (N i uL ) for each task k in the task set T i using Equation (14).
Step 7. Calculate the average number of containers (AN i L,uL ) as a benchmark using Equation (15).
Step 8. Calculate the respective workload of the first task k (denoted as N i k ) and the second task k + 1 (denoted as N i k+1 ) in the task set Ti by totaling the number of containers to load and unload.
Step 9. Estimate the expected workload (W q ) of the first QC q in Q j if the task k of ship i is added using Equation ( 16).
Step 10.If W q ≥ AN i L,uL then assign the task k of ship i to the QC q pop the task k out of the T i pop the QC q out of the Q j q = q + 1 (change to the next QC) l j = l j − 1 Else if W q < AN i L,uL and (W q + N i k+1 ) −AN i L,uL ≥ AN i L,uL − W q assign the task k of ship i to the QC q pop the task k out of the task set T i pop the QC q out of the Q j q = q + 1 (change to the next QC) l j = l j − 1 Else assign the task k of ship i to the QC q pop the task k out of the task set Level 3: this level deals with the QCSP.After determining which task is handled by which QC in level 2, this level uses a discrete simulation approach to simulate container loading and unloading for each task of a ship.As a result, the beginning and ending times of each task can be determined.Finally, the starting and ending working time of a ship are fed back to level 1 as the berthing time of each ship.The following steps are used in this level.
Step 1. Find the task token with least available time.
Step 2. Find the QC assigned to the task token.
Step 3. Determine the beginning time and the end time of the task based on the available time of the assigned QC.Step 4. Update the available time of the QC after serving this task token.
Step 5.Return the assigned QC.
Figure 1 also shows the data flows (dotted lines) of each level in the framework.For Level 1, the berth data, ship data, and BAP rules are inputs while Data 1 {( i=m i=1 (i, j): X t ij = 1)} is an output.
For Level 2, Data 1 {( i=m i=1 (i, j): X t ij = 1)}, QC data, task data, and QCAP rules are inputs while Data 2 { i=m i=1 (i, q, k) : Y t iqk = 1, q ∈ Q, k ∈ K i , t ∈ T} is an output.For Level 3, the QC data, task data, and Data 2 { i=m i=1 (i, q, k) : Having explored all the combinations of BAP and QCAP rules, the best solution can be found.These data are required to run the model established in the next section.

Modeling and Implementing the Three-Level Framework of Heuristics and Simulation
We intend to deal with the three-level planning framework using a graphical tool.For this purpose, we first define a novel high-level Petri net, termed OOTPr/Tr net, as a modeling tool.Then, based on the OOTPr/Tr net model, a program was developed using the Prolog programming language.Finally, the OOTPr/Tr net model was implemented as an evaluation tool for solving the three seaside operational problems at the same time.TPr/Tr net = (P,T,A,Σ,L,LF,M,F,f ) where P a set of predicates.P = P time ∪ P nontime , P i ∈ P time or P nontime .P time ∩ P nontime = ∅, P time is the set of timed predicates while P nontime is the set of predicates with zero time T a set of transitions (with logical formulas) A a set of arcs Σ a structure Σ consisting of some sort of individual tokens together with some operations (OP j ) and relations (R k ), i.e., Σ = (T 1 ,...,T i ; OP 1 ,...,OP j ; R 1 ,...,R k ) L a labeling of all arcs with a formal sum of n attributes of the token's variables (attributes), including zero-attributes that indicate a no-argument token LF a set of inscriptions on some transitions being logical formulas built from the operations and relations of the structure Σ; Variables occurring free in a formula have to occur at an adjacent arc M a marking M of the predicates of P with formal sums of n-topples of individual tokens.

F
firing rule of each element of T representing a class of possible changes of markings.Such a change, also called transition firing, consists of removing tokens from a subset of predicates and adding them to other subsets of predicates according to the expressions labeling the arcs.A transition is enabled whenever a set of tokens associated with that transition are satisfied.
f f (P i ) → T i ; is a function mapping P i to a handling time T i ; T i equals 0 i f P i ∈ P nontime ; T i is equal to or greater than 0 if P i ∈ P time .
Definition 6.An Object-Oriented Timed Pr/Tr net (OOTPr/Tr net) is defined as a 2-tuple: where O: is a set of finite subnet objects.R: is a set of communication relations between O i .

Definition 7.
A subnet object is a TPr/Tr net with its structure defined in Definition 6.
O i = (P, T, A, Σ, L, F, f , M) Instead of focusing on what rules are to be executed, an Object-Oriented model pays more attention to the structure, sub-models, and the communications between subnets.In an OOTPr/Tr net, subnets establish communications through predicates.If P i ∩ P j = ∅ (where P i ∈ O i and P j ∈ O j ) then the two subnet objects O i and O j have communication.Formed by subnet objects, an OOTPr/Tr is more readable and maintainable than a traditional TPr/Tr net.
While there are still other Open_task_tokens <I,D,Q,K,W,T3> at the predicate Open_task another simulation run will be generated; Otherwise, if all Open_task_tokens <I,D,Q,K,W,T3> have been transited to the predicate Closed_task then the simulation stops running.When there are other BAP_rule_tokens and/or QCAP_rule_tokens at the predicates BAP_rule and/or QCAP_rule, respectively, The OOTr/Pr works in this way.First, in O 1 , when Ship_token <I,D,T1>, Berth_token <D,T2>, BAP_rule_token <R1>, and Task_tokens <I,K,W> respectively appear at the predicates Ship, Berth, BAR_rule, and Task at the same time, it enables the transition assign_B.After firing the transition assign_B, a BAP heuristic rule (such as LWL) will be used to assign a berth number to a ship_token <I,D,T3> with the number binding with the token variable D. For instance, if Berth 1 is assigned to the ship_token <1,D,T3> then it results in the unified Ship_token <1,1,T3>.The procedure of binding a value with a token variable is called "unification", which leads to the generation of a unified token.This assignment, indicated as (i,j) = (1,1) or X t 11 = 1, will be part of the solution to the BAP.After this, a unified token will return to the predicate Ship and it will trigger the subnet O 1 to check the existence of the following tokens: QCAP_rule_token <LB>, Task_tokens <I,K,W> and Avail_QC_tokens <Q,T4>.If these tokens respectively appear at the predicates, Ship, QCAP_rule, Task, and Avail_QC, respectively, and meanwhile the logical formula F0 (D = ∅) is satisfied, the transition assign_QC will be enabled.After firing the transition assign_QC, a QCAP rule will assign an Avail_QC_token <Q,T4> to a Task_token <I,K,W>.For instance, if the Avail_QC_token <1,0> is assigned to the Task_token <1,1,78> it then generates a Open_task_token <1,1,Q,1,78,T3> in which the token variable Q is bound with the value 1 and the token variable T3 will be unified with the value Max{T1,T2,T4} = max{4,0,0} = 4.This assignment, indicated as (i,q,k) = (1,1,1) or Y t 111 = 1, will be part of the solution to the QCAP.In O 2 , it will start simulating the loading and unloading of containers.When the tokens Open_Task_tokens <1,1,1,1,78,4> and Avail_QC_tokens <1,0> simultaneously appear at the corresponding predicate Open_task and Avail_QC, respectively, with the logical formula F1 (Q = Q1) also being satisfied, it enables the transition t1.After firing the transition t1, it will generate a begin_event, E(t1,I,Q,K), and transform the Open_task_token <1,1,1,1,78,4> into a used_QC_token <1,1,1,1,78,T5> to stay at the predicate Used_QC.The event time t1 and token variable T5 will bind with the value Max{T3,T4} = Max{4,0} = 4.After the firing of t2, it generates an end_event, denoted as E(t2,I,Q,K).The T6 will unify with the value, T5+usage_time.After this, the used_ QC_token <1,T6> will return to the predicate Avail_QC as a Avail_QC_token <1,T6> and meanwhile a Closed_Task_token <1,1,1,1,78,T6> will be generated and transited to the predicate Close_task.Then [T1 111 ,T2 111 ] = [4,T6] is generated as a partial schedule of QC 1.
While there are still other Open_task_tokens <I,D,Q,K,W,T3> at the predicate Open_task another simulation run will be generated; Otherwise, if all Open_task_tokens <I,D,Q,K,W,T3> have been transited to the predicate Closed_task then the simulation stops running.When there are other BAP_rule_tokens and/or QCAP_rule_tokens at the predicates BAP_rule and/or QCAP_rule, respectively, it will continue to trigger more simulation runs to explore alternative solutions based on the combinations of the two kinds of heuristic rules.The best solution will be finally identified.We regard this graphical model as a discrete event simulation model.
Step 3 Trigger the transition assign_QC, it will assign a number of QCs to each berth (D) using the QCAP_rule_token <R2>.In addition, a QC (Q) will be subsequently assigned to handle a specific Open_Task_token <I,D,Q,K,W,T3> of the specific ship I.
Step 4 (In O 2 ) trigger the transition t1, it will simulate loading and unloading Open_Task_tokens <I,D,Q,K,W,T3> based on assigned QCs.Repeat this until all Open_Task_tokens <I,D,Q,K,W,T3> have been completed and transited to the predicate Close_task as Close_task_tokens <I,D,Q,K,W,T6>.
During the simulation, generate the beginning time (T1 iqk ) and the end time (T2 iqk ) for each task of a ship.This results in a solution s.

Step 5
Evaluate the solution s using the objective function defined in Equation (1).Step 6 Compare the solution s to the current best solution s*.If s > s* then s* = s.

Step 8
Determine the berthing time (BT i ) of each ship i using Equation (10).
Step 9 End

Numerical Example
Hsu and Su [42] and Hsu and Hsu [43] have proposed a systematic procedure for the implementation of a Pr/Tr net model.Accordingly, we have implemented the OOTPr/Tr net model as an evaluation tool using the Prolog programming language.Using the input data as described in Section 5.1, the derived output data are shown in Section 5.2.

Inputs
To run the OOTPr/Tr net, relevant inputs such as berths, ships, QCs, tasks, BAP rules, and QCAP rules are required.The Appendix A lists all the input data for this example in which 9 ships, 3 berths, 10 QCs, and some tasks of calling ships are included.

Outputs
After running the simulation tool, Table 1 shows the total solution to the BAP, QCAP, and QCSP.For ship 7, it is assigned to berth 1 and QC 1 is assigned to handle tasks 1 and 5; QC 2 handles the task 7; and QC 3 handles tasks 11 and 13.For each task k, a QC q is assigned to work it during the time period [T1 iqk , T2 iqk ].For instance, the QC 1 is assigned to handle task 1 of ship 7 during the time period [0,174].Table 2 shows the schedules for all QCs.The solution to the BAP is denoted as , 2), (3, 2), (4, 1), (5, 3), (6, 2), (7, 1), (8, 1), (9, 3)} Furthermore, based on Equation (10), the BT 1 to BT 9 of the calling ships are derived as follows.Figure 3 shows the berthing plan for these calling ships.The total makespan of this berthing plan is 1590, and is found to be quite promising as the workloads on these berths are well balanced.As a result, the makespan on Berth 1 (1590) is very close to the makespan on Berth 2 (1524) as well as the makespan on Berth 3 (1527).In addition, it is found that the berth utilization rates for Berth 1, Berth 2, and Berth 3 reach 100%, 97%, and 100%, respectively, which indicates that these scarce resources can be efficiently utilized.Figure 3 shows the berthing plan for these calling ships.The total makespan of this berthing plan is 1590, and is found to be quite promising as the workloads on these berths are well balanced.As a result, the makespan on Berth 1 (1590) is very close to the makespan on Berth 2 (1524) as well as the makespan on Berth 3 (1527).In addition, it is found that the berth utilization rates for Berth 1, Berth 2, and Berth 3 reach 100%, 97%, and 100%, respectively, which indicates that these scarce resources can be efficiently utilized.

Conclusions and Future Research Direction
To deal with increasing shipments of containers, improving the efficiency of a container terminal is important.To achieve this, one effective way is to directly improve the operational efficiency of a CT.As most past studies were found to have solved the three seaside operational problems separately, which tends to result in poor overall system performance, solving the three seaside operational problems together is thus necessary.Therefore, in this research we have employed a graphical tool, termed an OOTPr/Tr net, to model and solve them at the same time.
Due to the search in a reduced solution space, one advantage of our approach is that it can avoid the computationally intractable problems often encountered by exact approaches when they are used to deal with problems of practical size.Another advantage of our approach is that it can avoid the problems of being time-consuming and labor-intensive that are faced by "what-if" analyses in a traditional simulation approach.In our approach, after giving formal definitions to the three seaside operational problems, we transformed them into a three-level framework.This framework was then further modeled by a novel graphical tool, the OOTPr/Tr net.Finally, we implemented this OOTPr/Tr net as an evaluation tool using the Prolog programming language.Our experimental results showed the applicability of this tool.The contributions of this research are highlighted as follows.
(1) We have initiated a novel graphical tool, termed OOTPr/Tr net, which can be used for modeling and problem solving.(2) Using this novel graphical tool, we have successfully modeling the three seaside operational problems.This model was found to be quite flexible since resources such as ships, berths, and QCs are represented as tokens that can easily added into the model.In addition, we have implemented the derived OOTPr/Tr net as an evaluation tool.(3) The approach proposed in this study can be regarded as a simulation approach based on a reduced search space formed by the combinations of BAP and QCAP heuristic rules.

Step 4 .
If S ≠ ∅ then Assign the first ship in S to the first berth in B Remove the first ship from S Go to Step 5 Else Go to Step 6 End if.

Figure 1 .
Figure 1.The input and output of the three-level framework of heuristics for simulation.Data 1: the

Step 4 .
If S = ∅ then Assign the first ship in S to the first berth in B Remove the first ship from S Go to Step 5 Else Go to Step 6 End if.

4. 1 .
The Definition of Object-Oriented and Timed Predicate/Transition Net Definition 5. A Timed Pr/Tr net (TPr/Tr net) is defined as 8-tuple.

Figure 2
Figure 2 shows the OOTPr/Tr net model.It includes two subnets O 1 and O 2 and there is a communication relation (R 1 ) formed by two sets of predicates, {Task, Ship, OCAP_rule} ∈ O 1 and {Open_task, Avail_QC} ∈ O 2 .When these predicates contain tokens simultaneously, it enables the transition assign_QC.

Figure 2 .
Figure 2. The OOTPr/Tr net model for the three-level framework.

Figure 2 .
Figure 2. The OOTPr/Tr net model for the three-level framework.

Figure 3 .
Figure 3.The berthing planning for 9 calling ships.Figure 3. The berthing planning for 9 calling ships.

Figure 3 .
Figure 3.The berthing planning for 9 calling ships.Figure 3. The berthing planning for 9 calling ships.
Q = {1, . . .,l} T the planning horizon in units of hours T = {1, . . .,H}; H = 168 h (10,080 min) for 1 week.; if quay crane q is assigned to process the task k of ship i at time t then Y t iqk = 1; otherwise Y t iqk = 0.
ρa collection of sets of QC-to-task assignments for ships i = 1, . . .,m;

Table 1 .
The total solution to BAP, QCAP, and QCSP

Table 2 .
The schedule of QCs (sorted by QC No.).