Berth Allocation in a Stochastic Environment

Size: px
Start display at page:

Download "Berth Allocation in a Stochastic Environment"

Transcription

1 Berth Allocation in a Stochastic Environment Benonie Carette Supervisor: Prof. ir. Birger Raa Counsellor: Prof. Wout Dullaert (Vrije Universiteit Amsterdam, Nederland & Universiteit Antwerpen) Master's dissertation submitted in order to obtain the academic degree of Master of Science in Industrial Engineering and Operations Research Department of Industrial Systems Engineering and Product Design Chair: Prof. dr. El-Houssaine Aghezzaf Faculty of Engineering and Architecture Academic year

2

3 Berth Allocation in a Stochastic Environment Benonie Carette Supervisor: Prof. ir. Birger Raa Counsellor: Prof. Wout Dullaert (Vrije Universiteit Amsterdam, Nederland & Universiteit Antwerpen) Master's dissertation submitted in order to obtain the academic degree of Master of Science in Industrial Engineering and Operations Research Department of Industrial Systems Engineering and Product Design Chair: Prof. dr. El-Houssaine Aghezzaf Faculty of Engineering and Architecture Academic year

4

5 i The author gives permission to make this master dissertation available for consultation and to copy parts of this master dissertation for personal use. In the case of any other use, the copyright terms have to be respected, in particular with regard to the obligation to state expressly the source when quoting results from this master dissertation. August 8, 2016

6 ii This master dissertation on container terminals is the conclusion of my master in Industrial Engineering and Operational Research. I start by thanking prof. dr. ir. Birger Raa for his assistance during this thesis. His suggestions and feedback have certainly helped me improving this master dissertation. Furthermore I would like to specially thank my classmates and family, for their support during this master thesis, and more generally, also during my engineering curriculum.

7 iii Abstract Container traffic is of vital importance to global trade. Given the high investment and operational costs for both container ships and container terminals, a good coordination of all logistical processes in container traffic imperative. In this master dissertation we will focus on the (un)loading of container ships at the quay. When a container ship enters the terminal, it is allocated a specific location at the quay, which it will occupy during its entire handling time. The search for an optimal allocation is known as the berth allocation problem (BAP). Aside from berthing locations, also a specific number of quay cranes needs to be assigned (quay crane assignment problem QCAP). These quay cranes will transport containers between the quay and the container ships. The goal of both the BAP and QCAP is to minimize waiting and handling times for all container vessels. Schedules defining the berth location and number of quay cranes of each ship, are usually created in advance, based on the expected arrival and handling times of the vessels. The effective arrival or handling times may however deviate significantly from expected times. Therefore recently researchers started looking for scheduling techniques to make planning more robust to perturbations. A robust schedule can however never anticipate all possible disruptions, and in practice rescheduling will be often required. The topic of rescheduling is to the best of our knowledge not yet explicitly investigated in academic literature. We have developed a method to accurately simulate the stochastic arrival and handling process, and also formulated a mixed linear program to solve the integrated BAP and QCAP in rescheduling. Using both the stochastic process and periodic rescheduling, we assess numerically the effect of multiple parameters: congestion level, planning horizon, reschedule period,... Keywords Container Terminal, Container Logistics, Mixed Integer Linear Programming, Monte Carlo Simulation, Quay Crane Allocation, Stochastic Berth Allocation, Stochastic Optimization, Stochastic Process, Reactive Scheduling

8 Berth Allocation in a Stochastic Context Benonie Carette Supervisor(s): Prof. dr. ir. Birger Raa, Prof. dr. Wout Dullaert Abstract This article describes a rescheduling approach, using mixed integer linear programs to solve the Berth Allocation Problem and Quay Crane Allocation Problem, based on updated handling and arrival times. In order to assess performance a stochastic process for Monte Carlo simulations is designed and different configurations numerically simulated. I. Introduction WHEN a container ship enters a container terminal it is assigned a location at the quay and a number of quay cranes, which will (un)load all containers on board. An efficient schedule for both berth locations and quay cranes may reduce both operational costs and minimize waiting and handling times. As effective arrival and handling times are stochastic and often deviate from the schedule, the schedule requires periodic rescheduling. Given the high cost of present day mega-container ships and the dominant position of container traffic in global trade, the importance of qualitative schedules may not be underestimated II. Literature In 1994 the first paper by Hoffarth and Voß (1994), on Berth Allocation appeared. Since then, over 100 papers on the issue have been published. One of the land mark papers was Park and Kim (2003), who integrated the quay crane assignment problem into the berth allocation problem. In recent times researchers have developed models, which explicitly take the stochastic nature of arrival and handling times into account (stochastic berth allocation) (Zhou and Kang, 2008) (Lu and Xi, 2010) (Zhen et al., 2011) (Du et al., 2010) (Golias et al., 2014). These papers want to generate a predictive schedule (home schedule) in advance, which is robust to deviations of arrival or handling times. Another strategy to cope with variance, is periodic rescheduling (Aytug et al., 2005), as robust predictive schedules, may turn out to be infeasible or suboptimal. Some papers on stochastic optimization, (Zhen et al., 2011), (Du et al., 2010), approximate the effect of rescheduling using several scenarios. However a full rescheduling approach with a rolling horizon and periodic updates of the expected arrival and handling times is to our knowledge not yet implemented. Neither is a stochastic processes required for simulations described. A. Optimization III. Implementation The reschedule optimization problem is formulated as a mixed integer linear program in which we assume a discrete quay layout. Novel in our approach (for MILP s at least) is the continuous treatment of time as we do not require any discretization of time into periods. Our model decides whether ship j moors at berth i (l ij ), together with the berthing time b j, handling time c j and number of quay cranes q j. These decision variables are constrained by the arrival times A j, the total handling times (sum of handling times on all quay cranes) C j, the total number of quay cranes Q max and maximum number of quay cranes per ship Q j. Also the completion times S i and number of quay cranes Q i of the ships currently berthed at the quay must be respected. Furthermore some binary auxiliary variables are used (a 1 j 1j 2, a 1 ji and a2 j 1j 2, a 3 j 1j 2 ) and integer variables k j1j 2 and k ji. The model is aimed at minimizing the port stay time (at cost Pj w ), and deviations from the preferred berthing position (at cost Pij b ). The mathematical formulation is: j V maximize: ( (bj A j + c j )Pj w + i B P ij b l ij) subject to: (1) b j A j (2) l ij = 1 (3) i B b j1 b j2 c j2 M w a 1 j 1j 2 (4) l ij1 + l ij2 1 M w a 2 j 1j 2 (5) a 1 j 1j 2 + a 1 j 2j 1. + a 2 j 1j 2 2 (6) b j S i ( 1 + l ij )M w (7) b j2 b j1 ɛ M w a 3 j 1j 2 (8) M q (2 a 1 j 1j 2 a 3 j 1j 2 ) + q j2 k j1j 2 (9)

9 v b j S(i) M w a 1 ji (10) M q (1 a 1 ji) + Q i k ji (11) k j1i + k j1j 2 + q j1 Q max (12) i V j 2 V C j ( 2 n q j n 2 ) c j n {1,., Q j } (13) Constraint 2 assures ships only berth after arrival, 3 guarantees a unique berthing location. Constraint 4 till 7 assure that only one ship occupies the berth simultaneously, while 8 till 12 take care of the number of quay cranes in use. Finally constraint 13 assures correct handling times. B. Simulation We create a simulation method which allows to update the expected event time over a succession of periods of arbitrary length. As soon as the expected event times becomes zero, the event has happened. The expected time until the event is required to be non-increasing, invariant to the length of the update interval and its variance must decrease to zero as the event approaches. The procedure is described in Algorithm 1. We update expected times with period = T p, for an event which is initially expected to take place in T e hours and has a ratio of variance R v (ratio between variance and mean). Algorithm 1 Event Time 1: w T e 2: T 0 3: while w > 0 do 4: w w Γ(k = T p R V, θ = R V ) 5: T T + T p In this procedure Γ(k, θ) represents a gamma distributed random number, with shape parameter k and scale parameter θ. Figure 1 shows the evolution of expected event time over multiple replications. C. Integration We write a C++ program, which allows Monte Carlo simulations of container terminals. Arrival times and handling times are simulated using the stochastic process. Each reschedule period a new schedule is generated based on updated handling and arrival times for all ships arriving in the planning horizon. During simulation, a set of performance indicators is recorded and saved afterwards. Expected Time until Event [h] replication 1 replication 2 replication 3 replication 4 replication Time [h] Fig. 1: Multiple evolutions of the expected event time as generated by the stochastic process A. Configuration IV. Results For numerical simulations we use a quay consisting of 4 berths. We set the planning horizon to 24 h, and reschedule each 6 h. The long term expected arrival times are drawn from a uniform distribution, while the handling times are lognormally distributed with a mean of 8 h and standard deviation of 2 h. The evolution of the expected handling and arrival times is generated by the stochastic process, for which we assume a ratio of variance R v of 0.1 h (this implies 1 h 30 of standard deviation on a 24 h period). Simulations start with an empty terminal and last one month and each experiment is replicated four times. We assess the effect of four external and three internal parameters. The four external parameters are those related to the terminal and container ships: the congestion, positional cost, degree of uncertainty and number of quay cranes. The three internal parameters are related to the rescheduling mechanism: the planning horizon, rescheduling period and the amount of time buffer in the planning. B. External With increasing number of ships arriving (increasing congestion) we see waiting times rise spectacularly (Figure 2), and the required solution times for the MILP expand exponentially (Figure 3). We notice that the allocated berths per ship change more often in rescheduling, indicating growing nervousness with increasing congestion. If we vary the ratio of variance R v we notice that after a certain threshold (R v = 0.1) the average waiting times start expanding (Figure 4), although the average workload remains the same. The extra uncertainties make scheduling much harder.

10 vi Waiting Time [h] Congestion Ratio Fig. 2: Average waiting time for different congestion levels Solution Time [s] Congestion Ratio Fig. 3: Average solution time for different congestion levels Waiting Time [h] Ratio of Variance [h] Increasing the number of quay cranes decreases both waiting and handling times. Scheduling becomes also easier, as there is less waiting. C. Internal Waiting Time [h] Planning Horizon [h] Fig. 5: Average waiting times for different planning horizons in a congested terminal We notice that best performance at high congestion levels, is delivered by setting the planning horizon to 24 h (Figure 5). Shorter periods are too myopic, while longer make scheduling overly complex and incorporate highly uncertain data into the schedule. For lower congestions the planning horizon seems to matter little. For normal variance (R v = 0.1) we see how lower rescheduling periods improve performance. For high variance(r v = 1.0) we can distinguish a similar trend, but results are harder to interpret due to the noise caused by the high ratio of variance. We try making the planning more robust to perturbations, by inserting time buffers of fixed length in the schedule. Numerical experiments, however, show that this does not improve and even decreases performance. Du et al. (2010) obtained a similar result. Fig. 4: Average waiting timefor different variance levels Each ship gets initially assigned a preferred berth at random. Differences between assigned berth and preferred berth are punished by a cost in the objective function. Higher punishments make the ship berth closer to its preferred position, but cause longer waiting times. The planning becomes, however, easier for higher positional cost and less nervous. If we assign preferred berths in a more intelligent way, we notice waiting times to increase much slower. V. Conclusion We developed a Monte Carlo simulation method for container terminals with periodic rescheduling. The stochastic process allows to simulate the evolution of handling and arrival times, while MILP s generated periodically updated schedules. As this was, to our best knowledge, the first time rescheduling was investigated, our exploratory experiments have far from solved all remaining research questions. Furthermore we deliberately avoided including non-essential features (continuous layout, inclusion of proactive scheduling,...), which nonetheless would improve performance and

11 vii render simulations more accurate. Anyhow, we believe the developed simulation techniques and obtained results may aid further research on rescheduling. The simulations may also allow comparing different proactive home schedules, or even predicting container terminal performance, to select the right number of quay cranes or number of berths. References Aytug, Haldun et al. (2005). Executing production schedules in the face of uncertainties: A review and some future directions. In: European Journal of Operational Research 161.1, pp Du, Yuquan, Ya Xu, and Qiushuang Chen (2010). A feedback procedure for robust berth allocation with stochastic vessel delays. In: Intelligent control and automation (WCICA), th World Congress on. IEEE, pp Golias, Mihalis et al. (2014). Robust berth scheduling at marine container terminals via hierarchical optimization. In: Computers & Operations Research 41, pp Hoffarth, Lutz and Stefan Voß (1994). Liegeplatzdisposition auf einem Container Terminal Ansätze zur Entwicklung eines entscheidungsunterstützenden Systems. In: Operations Research Proceedings Springer, pp Lu, Zhi-qiang, Li-feng Xi, et al. (2010). A proactive approach for simultaneous berth and quay crane scheduling problem with stochastic arrival and handling time. In: European Journal of Operational Research 207.3, pp Park, Young-Man and Kap Hwan Kim (2003). A scheduling method for berth and quay cranes. In: OR spectrum 25.1, pp Zhen, Lu, Loo Hay Lee, and Ek Peng Chew (2011). A decision model for berth allocation under uncertainty. In: European Journal of Operational Research 212.1, pp Zhou, Peng-fei and Hai-gui Kang (2008). Study on berth and quay-crane allocation under stochastic environments in container terminal. In: Systems Engineering-Theory & Practice 28.1, pp

12 viii

13 Contents Glossary Acronyms xiii xiii 1 Introduction A Brief History Impact of Containerization Berth Allocation Thesis Overview Literature Overview of the Container Terminal Ship Planning Storage and Stacking Logistics Transport Berth Allocation History Classification New Trends & Challenges Stochastic Optimization Classification Results S-BAP Zhou and Kang (2008) Lu and Xi (2010) Zhen et al. (2011) Du et al. (2010) Golias et al. (2014) Real Time Allocation Implementation Goal General Procedure ix

14 Contents x 3.3 Stochastic Process Requirements Procedure Location Examples Implications BAP model Idea Mathematical Representation Extra Constraints Probabilistic Extensions QCBAP model Mathematical Model Probabilistic Extensions Real Life Implementation C++ Implementation Concepts Global Phases Rescheduling Execution Updating Handling & Arrival Times Data Collection Real Time Graphical Output Results Accuracy Check BAP QCBAP General Setup & Default Parameters Objective Function External Parameters Influence of Congestion Influence of Variance Influence of Positional Cost Number of Quay Cranes Internal Parameters Planning Horizon Rescheduling Fixed Time Buffers

15 Contents xi 5 Conclusion Implementation Results External parameters Internal Parameters Improvements Research Questions Future Applications Appendices 65 A Code 67 B MILP 69 B.1 QCBAP discrete B.2 QCBAP continuous Bibliography 71

16 Contents xii

17 Acronyms xiii Glossary Arrival Time Time at which the containers ship arrives at the container terminal and is ready to moor as soon as a berth becomes available. Berthing Time Time at which the container vessel moors at the wharf. Completion Time Time at which all containers are loaded and unloaded and the vessel is ready to leave the terminal. Handling Time The time required for loading and unloading containers, this is the time the container vessel moors at the wharf (Completion Time minus Berthing Time). Port Stay Time Total time the container ship spends in the port, this is the sum of the Waiting and Handling Time or the Completion Time minus the Arrival Time. Total Handling Time The sum of times required for loading and unloading containers on all quay cranes. If only one quay crane is assigned, handling time equals the total handling time. Waiting Time Time the containers vessels waits before it can moor at the wharf (Berthing Time minus Arrival Time). Acronyms BAP Berth Allocation Problem. CT Container Terminal. MILP Mixed Integer Linear Program. MQW Mobile Quay Walls. PDF Probability Density Function. QCA Quay Crane Assignment. QCBAP Quay Crane and Berth Allocation Problem (in literature often the longer abbreviation QCAP-BAP is used). S-BAP Stochastic Berth Allocation Problem.

18 Acronyms xiv

19 1 Introduction In this chapter we start with a brief history of container ships and discuss the current position of container traffic in global trade. We then proceed with a brief explanation on berth allocation, and finish with an overview of all chapters in this dissertation. 1.1 A Brief History Although container shipping has now become the most common way to ship goods, containers emerged much more recently than one would think at first instance. Before 1960 almost all cargo was shipped as break bulk cargo. The goods needed to be loaded individually, and were not combined in a larger units. Handling break bulk cargo required lots of labor, which resulted in long loading and unloading times. In the 1950s the first container line was founded, but the concept of containers dates back much further. During the first half of the twentieth century rail companies in both Europe and the USA already used containers as they could easily be placed on flatcars. Many different non-compatible standards for these containers where in use. Soon these containers were adapted to be used for sea cargo. Although many previous versions of sea containers existed, only in the 1950s, sea containers were used on a large scale. In 1952 the US army developed the CONEX box (Container Express), which was used for engineering supplies and spare parts. The use of containers cut handling times in half compared to break bulk shipping. 1

20 Chapter 1. Introduction 2 In 1955 McLean, often called the father of containerization (German Insurance Association, 2016), developed the modern intermodal 1 container, resistant to long sea travels, which could also be loaded on trucks; In 1956 he founded the first successful shipping company and sailed with a converted oil tanker, the SS Ideal X and 56 containers from New Jersey to Texas, where containers could be directly loaded on trucks. This saved space compared to previous versions where trucks were directly transported on the ships. Soon, containers in all sizes were developed, often incompatible with each other. Therefore between , ISO issued four important recommendations, which led to a standardization of containers. Standardization, together with the deregulation of the trucking and rail sector, led to the current dominant position of containers in non-bulk trade. The low cost and fast shipping times have significantly increased global trade. 1.2 Impact of Containerization Today container traffic represents 90% (Ebeling, 2009) of all non-bulk cargo shipped world wide or 57% (Statista, 2016a) of all cargo (including bulk cargo) shipped by marine vessels. With a compound annual growth of 8.5% (Statista, 2016b) since 1980, container traffic expands at a much higher pace than the world wide gross domestic product. Thus the importance of container traffic in the economy is rapidly expanding. In the future container traffic is expected to continue its rapid expansion. The increasing container volumes have lead to ever expanding vessel sizes. The high operational costs of these vessels and competition between neighboring harbors necessitate a good coordination between the different logistical processes at container terminals (CT s) to minimize waiting and handling times. The increasing container traffic and the often limited space in harbors, further complicates this coordination. As completely manual coordination of all resources proves insufficient, good optimization and scheduling algorithms are required. A wide range of scheduling algorithms for the numerous logistical processes in CT s have been developed in academic literature. Container terminals are relatively complex, with different typical time scales for the various processes. Thus planning algorithms usually focus on one or two logistical processes solely. 1 Intermodal containers are containers which can be used across different ways of transport (e.g. sea, rail, road,...). The facts that goods do not need to be repacked for each transport, allows for time- and cost-efficient long distance shipping.

21 Chapter 1. Introduction Berth Allocation In this dissertation, we will focus on one specific aspect of operations at a CT. When a ship enters the CT it will be assigned a specific location to moor. This problem is known as the berth allocation problem (BAP). A ship will normally occupy this position until all operations are completed, and thus will influence the location of other ships arriving during its operations. Thus the berth assignment problem is far from trivial as the consequences of an assignment can have a long term influence. In this master thesis we will more specifically investigate the influence of variability on berth allocation. In most of academic literature, so far, the arrival times and handling times of the container ships are assumed to be exactly known in advance. In real life container operation these times are of course stochastic. We will develop methods to reschedule based on updated information. The impact of various factors on CT performance will be assessed in simulations. We will thus be able to numerically compare various techniques aimed at improving performance. 1.4 Thesis Overview Chapter 2 starts with a brief overview of optimization problems in CT s and continues with a more elaborate description of the BAP and specifically the stochastic berth allocation (S- BAP). In chapter 3 we design a simulation framework which allows to realistically simulate all factors related to the allocation of berths. We develop different scheduling approaches to generate new schedules, and describe how they are integrated in the simulation framework. Chapter 4 continues with the result of these numerical simulations in various settings. In chapter 5 a summary and conclusion of this master thesis is given.

22 Chapter 1. Introduction 4

23 2 Literature This chapter provides an overview of the current academic literature related to the berth allocation problem. We start by summarizing the different logistical processes and corresponding optimization problems. As the berth allocation will interact with these processes and optimizations, a basic understanding is required. Afterwards we describe different approaches toward berth allocation. We continue with a general description of stochastic optimization, and finish with the application of stochastic optimization on the berth allocation problem. 2.1 Overview of the Container Terminal In a CT, numerous logistical operations take place, which all pose a specific optimization problem. Figure 2.1 gives a schematic overview of the typical layout of a CT. We will discuss the most important optimization problems related to ship, storage and transport planning using the classification scheme offered by the comprehensive review paper of Steenken et al. (2004). We will not run into details or solutions for the optimization problems, but give a brief overview of the different fields in CT optimization Ship Planning Berth Allocation Before the ship arrives at the harbor, a specific location at the wharf is assigned to a container ship for mooring. The ship will usually occupy this position for the whole handling time. The 5

24 Chapter 2. Literature 6 Figure 2.1: A typical container terminal layout. A container ship is moored at the quay, and is unloaded by a large quay cranes. The containers are brought from the crane to the yard by straddle carriers. Containers are stacked in multiple levels at the yard, where they wait for transport. At the right, trucks or trains can pick up or deliver containers. corresponding optimization problem is usually referred to as the Berth Allocation Problem. The arrival times of large vessels are often known already about one year in advance, but Steenken et al. (2004) advise performing berth allocation only two or three weeks before the ships arrival Stowage Planning All containers must receive a specific position on the container ship, this is called stowage planning. Stowage planning usually consists of two phases. First the shipping line decides on the location of categories (e.g. based on destination) of containers on the ship. The terminal operator then further refines this plan into the stowage instruction, which explicitly describes the location of each container. The main objective of stowage planning is to minimize the number of container reshuffles (i.e. removing containers on top in order to access lower containers) and reach ship stability (an unbalanced distribution of containers would make the ship unstable) Quay Crane Assignment In order to unload the containers from the ship onto the quay or load them onto the ship, large gantry cranes, called quay cranes, are used. As soon as the container ship is moored, a specific number of quay cranes (see Figure 2.2a) have to be assigned. The associated optimization problem is referred to, in academic literature, as Crane Split or Quay Crane Assignment (QCA). Obviously the number of dedicated quay cranes has a profound impact

25 Chapter 2. Literature (a) Quay Crane 7 (b) Gantry Crane (c) Straddle Carrier Figure 2.2: Common container transport equipment on the handling time. The QCA is not considered a hard problem and is seldom solved on its own (Bierwirth and Meisel, 2010). QCA is usually combined with the BAP into the Quay Crane Berth Allocation Problem (QCBAP), as handling times play an important role in both problems Crane Scheduling Although not yet explicitly mentioned by Steenken et al. (2004) but by Bierwirth and Meisel (2010), Quay Crane Scheduling (QCS) is also crucial in reducing handling time. QCS determines the sequence in which containers are loaded and unloaded on the ship, and aims to minimize the distance traveled by the quay cranes. The quay crane schedule influences the processing time and is thus sometimes included in the QCBAP. Berth allocation, however, affects a much longer time scale (order days), while QCS schedules individual containers (order minutes). Due to these different time scales both problems are seldom deeply integrated but solved in an iterative way or even only as preprocess (only one iteration) Storage and Stacking Logistics As space at the container storage area (yard) is limited, containers are usually stacked in several levels. To access lower containers, removing upper containers is thus needed. In order to minimize both reshuffling and transportation times, intelligent yard optimization methods are required. Important input for this optimization is the transportation mode (ship, train, truck) and expected transportation time. Unfortunately at the moment a container enters the yard this information is in practice often not yet available, leading to suboptimal storage decisions. Yard optimization is associated with berth allocation as the ship must preferably dock close to where its containers are stored.

26 Chapter 2. Literature Transport Quayside In order to assure maximum productivity of the quay cranes, transport between these cranes and the yard needs to be well coordinated. These transportations are carried out by either straddle carriers (Figure 2.2c) or gantry cranes (Figure 2.2b). Gantry cranes can stack containers higher and more compact but offer usually less flexibility. Important for the transport optimization is the minimization of congestion, which increases very fast with an increasing number of vehicles or increasing vehicle speed. In case of manned transport equipment, each straddle carrier usually serves only one crane, while in automatic transport (e.g. automatic guided vehicles) a straddle carriers may serve all quay cranes. This pooling of transport vehicles creates more opportunities for optimization Landside Transport At the landside, containers are sent to or arrive by trucks or trains. Trains require a loading plan before they are loaded by gantry cranes. Trucks should be assigned transition points where they can pick up the containers. As arrival of trucks is uncertain, a fast and flexible online optimization method is required. Aside from these external transports, also internal movements can occur if containers with specific needs are present (e.g. empty or unpacked containers) or containers could not be loaded on the correct ship. 2.2 Berth Allocation History Since the first papers on the berth allocation problem by Hoffarth and Voß (1994) and Imai et al. (1997) interest in BAP has significantly increased. Major landmarks are the first integration of the BAP with the Quay Crane assignment Problem (Park and Kim, 2003) and the first CT survey paper (Steenken et al., 2004). Today the berth allocation problem is a well researched problem of which many models are developed: Bierwirth and Meisel (2015) count 136 papers about the subject which are published Classification As berth allocation is a well studied problem in academic literature, it is worthwhile to investigate different approaches of the problems. We will use a classification scheme proposed by Bierwirth and Meisel (2010) and Bierwirth and Meisel (2015). We will not discuss the numerous individual papers but sketch general categories of approaches.

27 Chapter 2. Literature 9 Figure 2.3: Total number of BAP models published in academic literature (Bierwirth and Meisel, 2015) Quay Space Layout Imai et al. (2005) distinguish two different approaches regarding to the layout of the CT. In a first approach called the discrete layout, the quay has been divided in different sections, named berths. One ship, irrespective of ship or berth size, exclusively occupies one berth for the whole handling time. In the second approach, called continuous layout, no such division is made in advance. As the ship only occupies its exact length, quay space can be used more efficiently. Unfortunately the extra degrees of freedom increase the complexity of the planning problem. Both the discreate and continuous approach are frequently used today. Sometimes a mixture between the two, called the hybrid layout, is chosen. Discrete berths still exist, but one berth can be occupied by multiple small ships or one long ship can occupy several neighboring berths. One can incorporate further special layouts or add extra constraints regarding layout: Draft restrictions Some berths may have a limited depth, which puts a restriction on the draft of ships mooring at this position. Draft restrictions are relatively commonly used in academic literature (more than 10 % of the papers summarized in Bierwirth and Meisel (2010) and Bierwirth and Meisel (2015) take this into account). Tidal restrictions (Xu et al., 2012) Due to the tides present in most CT s it may occur that some berthing positions with limited depth are only available at specific instances, which puts time dependent draft restrictions on the BAP. Indented berths (Imai et al., 2013) these berths due to their indented form (see Figure 2.4a) can be served from two sides by quay cranes thus speeding up the handling times of high priority megaships. As such megaships arrive infrequently, the indented berth is often used by multiple smaller vessels. However if multiple ships are inside the

28 Chapter 2. Literature 10 (a) Indented Berth (b) Mobile Quay Wall Figure 2.4: Innovative container terminal layouts berth, the ships closest to the entrance must of course leave first, before other ships can leave. Mobile quay walls (Emde et al., 2014) Mobile Quay Walls (MQW) are propelled floating platforms on which quay cranes are mounted (Figure 2.4b). Similar to indented berths, they also enable serving the container ships from two sides. MQW create two different possible positions for vessels: a ship can moor either at the immobile quayside or at the seaside of the mobile quay. The first will result in the shortest handling time as it can be served from two sides, but the ship has to wait until the mobile quay wall is removed before it can leave Ship Arrival Times Imai et al. (2001) differentiates two different views on timing. In the static approach one assumes all ships are already waiting in the port, and one seeks the optimal sequence to minimize their waiting time. This approach greatly simplifies the optimization problem. The second view is the dynamic approach. Not all ships are present at the start of the optimization but their arrival time is exactly known beforehand. In the early days of berth allocation the static approach was predominant, but in current research this is much less used as the dynamic is much more realistic. Sometimes an alternative version of the static problem is used. The CT decides on the arrival time by deciding on the speed of the container ship. The goal is then to minimize speedups or slowdowns from the preferred vessel speed. Over time other versions have emerged. In the cyclical approach one explicitly takes the cyclical nature of the arrival times into account, and generates a schedule which is periodly

29 Chapter 2. Literature 11 repeated. The stochastic approach considers the arrival a stochastic process instead of the deterministic view employed by all other methods Handling Times The handling time required for container loading and unloading can be treated in different ways. The simplest option is to assume a fixed value, which can not be influenced by any decision variables. In more accurate approaches handling depends on the berth position or the number of cranes assigned or both. Similar to the arrival times handling may also be described by a stochastic process, and variance must be taken into account Performance Metric Most models are aimed at minimizing the port stay time. For this purpose multiple objective functions can be used: handling time, waiting time before berthing, service completion times, number of tardy vessel departures. In the static case also the speedup of vessels can be used as objective function. Often penalties for the use of quay cranes or other resources are also included. This can be performed e.g. by including a positional cost, which reflects the cost for the extra distances straddle carriers and gantry cranes have to travel Solution Methods As the models used for (QC)BAP are predominantly NP-complete, the berthing allocation problem is mainly solved by (meta-)heuristic methods. Genetic Algorithms and Evolutionary Algorithms represent 40% of all papers summarized in Bierwirth and Meisel (2015), other methods often used are Tabu-Search, Simulated Annealing, problem specific heuristics and greedy rules. Only 25% of instances use exact methods such as Mixed Integer Linear Programs (MILP) formulations solved either with specific branching algorithms or with standard solvers (CPLEX, Gurobi,...) New Trends & Challenges Bierwirth and Meisel (2015) analyze the current state and issues of BAP research and determine several directions for the future. Lack of comparison: Currently a plethora of different solutions methods is available. Performance can unfortunately not be compared due to the lack of standardized bench mark tests and the wide variety of problem formulations. In order to find the most promising techniques for further research, however, an explicit quantitative comparison between different models is needed.

30 Chapter 2. Literature 12 New layouts, operation concepts and technology: Most of the innovations (MQC, indendented berths,...) are discussed in separate models and never combined to assess how much performance gain they can deliver General meta-heuristics: Genetic algorithms and evolutionary strategies comprise the largest fraction of current solution methods, as they are require little implementation and are very flexible. Unfortunately they are usually outperformed by problem-specific heuristics, therefore in this well researched domain focus should lie on more mathematically driven, problem-specific heuristics. Uncertain problem data: Few papers have yet focused on the impact of variability in arrival times and handling times on the berth allocation problem. This while in real-life CT s, punctual arrivals are rare. 2.3 Stochastic Optimization Although stochastic berth allocation is a new research field, techniques to generate schedules in a stochastic context have been developed much earlier in other situations. We will investigate different approaches and their results Classification In a review paper, Aytug et al. (2005) describe techniques and approaches to allocate resources in manufacturing environments under stochastic conditions. They describe three ways of coping with uncertainties: 1. Completely reactive: This is the simplest approach. No predictions or schedules for the future are made, but simple logic decides based on the current state of the system. In more advanced systems, the decision rule may change dynamically based on the system state. Implementation is easy, but decisions may turn out to be myopic. 2. Robust scheduling: The goal of robust scheduling is to generate a schedule which does minimize the effects of perturbations, while retaining satisfactory performance. This can be implemented as only one schedule which must perform best either in a worst case scenario or under a broad range of scenarios. Another possibility is one base schedule, from which deviations in the real executed schedules must be minimized. Other realizations aim at maximizing the predictability of effective completion times by providing sufficient time safety buffers. 3. Predictive-reactive: Predictive reactive scheduling starts from a predictive (robust) schedule. During execution, if a disruption occurs, rescheduling will happen, and the new schedule will be adjusted to this disruption.

31 Chapter 2. Literature 13 In predictive-reactive scheduling different possibilities exist to decide when to initiate a rescheduling. Church and Uzsoy (1992) distinguish three approaches: 1. Continuous: The schedule is constantly updated, based on most recent data. This may lead to nervousness in the schedule and waste computational resources as the newly generated schedules will often not significantly improve performance compared to older ones. 2. Event-driven: The schedule is only updated as soon as a disruption with major implications occurs. It may not be easy to distinguish such a major disruption. 3. Periodic: Planning is updated in each period. This approach can be problematic as a major disruption inside a period may render the schedule infeasible. In practice often combinations of periodic and event-driven rescheduling are used in order to keep planning feasible Results Two important questions are investigated in literature: What is the ideal amount of rescheduling, and does rescheduling outperform simple reactive systems? First, how often should one reschedule, and what is the effect on performance? Church and Uzsoy (1992) find an initial rapid increase with increasing rescheduling frequency. Performance however quickly saturates and extra rescheduling does not significantly improve performance. Other researchers arrive at similar conclusions (Sabuncuoglu and Karabuk, 1998), (Shafaei and Brunn, 1999), (Sabuncuoglu and Bayız, 2000). Second, what is the most effective, reactive actions or predictive scheduling & rescheduling? Different studies come to different conclusions. Hutchison and Khumawala (1990) demonstrate that periodic rescheduling outperforms purely reactive responses. Wan (1995) draws the opposite conclusion. Lawrence and Sewell (1997) find that only for low variance rescheduling outperforms reactive responses. Barua et al. (2001) similarly conclude that periodic rescheduling is better, but for high uncertainty, performance becomes comparable to simple reactive systems. As a general line we can conclude that rescheduling usually works best for systems with low variance, but is outperformed or at least matched by reactive responses at high variance. The answers found in literature are however of a qualitative nature. No expression for the quantitative thresholds related to both questions have yet been developed. Furthermore it should be noted that the cited papers only investigated rescheduling in manufacturing contexts, and conclusions may thus not be applicable to the S-BAP.

32 Chapter 2. Literature S-BAP In this section we will describe in detail the approaches towards stochastic berth allocation as described in multiple papers. All papers aim at creating a robust schedule, called home schedule or baseline schedule, which must result in satisfactory expected or worst case performance (potentially after some rescheduling) Zhou and Kang (2008) Zhou and Kang (2008) investigate the QCBAP problem, with a discrete CT layout. Their solution method uses genetic algorithms, in which the berths and order of service at each berth per ship is encoded. Deviations on the arrival times and handling times of the containers are modeled using a normal distribution. They require constraints to be respected with a minimum probability: the arrival time of a ship must precede the berthing time with a probability of at least α. The time spent at the quay must exceed the effective handling time with probability of at least β for each ship. The objective is to minimize the expected waiting time of the home schedule. Higher values for α and β make the schedule become more robust, but at the cost of increasing waiting times. The strength of the method is, that it does not require any Monte Carlo simulation, but can be calculated from the probability distributions themselves, reducing computational complexity. The home schedule will however often turn out to be infeasible, as each constraint individually is satisfied with probability of only α or β. Thus often rescheduling will have to occur in practice. The expected cost however assumes the home schedule is carried out exactly, also when it becomes suboptimal or even infeasible. Therefore the expected cost does not give a reliable estimate of expected true costs Lu and Xi (2010) Lu and Xi (2010) also use Genetic Algorithms (with some Local Search improvements) to solve the QCBAP with discrete berth layout. Both deviations from the expected arrival and handling times are assumed to be stochastically distributed. The aim is minimizing the sum of the expected handling time and the standard deviation of this handling time. To evaluate this sum, a Monte Carlo simulation with multiple scenarios is used. The chromosomes represent the berthing locations and number of quay cranes assigned to each ship. A heuristic is used to convert this information into a feasible schedule for each scenario. Thus the heuristic allows for some amount of rescheduling and ensures that the schedule remains feasible, which makes the calculated expected cost, a more reliable estimate. The allocated berths however remain

33 Chapter 2. Literature 15 fixed over all scenarios, and are not optimized per scenario Zhen et al. (2011) Zhen et al. (2011) focus on the continuous BAP problem. They develop a complex procedure based on a combination of MILP, simulated annealing and heuristic solutions. They explicitly distinguish between baseline cost and recovery cost. The first expresses the costs of the standard baseline schedule, while the second are the costs of deviations from this schedule in the different scenarios. Both deviations in time (i.e. berthing time) and space (berth allocation) are punished. For the berthing time e.g. they choose a baseline cost c i, a positive recovery cost c + i for delays from the home schedule (c i < c + i 1 ) and a negative cost c i for advances ( c i < c i < 0). They optimize the sum of the expected baseline schedule cost and recovery costs over a set of predefined scenarios. This gives a complex MILP problem which is hard to solve directly, thus they created a meta-heuristic procedure. The procedure starts with the arrival sequence based on the expected arrival times of the ships. Based on this sequence they apply a heuristic procedure to determine a baseline schedule. They then solve a MILP, with the CPLEX solver, to create the different optimal recovery schedules. Both schedules are then further optimized while keeping certain decision variables fixed. Then the arrival sequence is slightly changed by a small random change and the whole process (baseline recovery improvements) is repeated. If the expected total cost improves, the change is accepted, otherwise it is accepted only with a probability depending on the performance difference and the temperature of the simulated annealing algorithm. The procedure thus combines rescheduling in different scenarios with a proactive approach to generate a robust baseline schedule. The interaction between the baseline and recovery schedules happens through the adaptation of the arrival schedule Du et al. (2010) Du et al. (2010) solve the BAP (without QCAP) in a continuous container layout using a feedback procedure and simulated annealing. They proceed on the work of Yan and Tang (2007) on stochastic allocation of gates in airports. Their goal is to create a baseline schedule, which minimizes the expected baseline and recovery cost, under stochastic arrival times (not container handling times). They first solve the deterministic problem based on the expected arrival times using simulated annealing. Subsequently they solve the recovery schedules for a set of scenarios, with deviations drawn from a normal distribution. 1 The reason that c + i > c i is that because of the delay unscheduled extra resources (e.g. quays cranes, operators, straddle carrier,...) are required, usually at higher cost. For a similar reason c i > c i

34 Chapter 2. Literature 16 Central to their approach is a feedback procedure between baseline and recovery schedules. In the baseline scenario a time buffer is introduced which represents the minimum difference between the berthing time and the expected arrival time. Larger time buffers will result in more robust schedules, but may cause longer waiting times. Thus the time buffer is tuned for each ship individually. In each iteration the inconsistency cost ( = expected recovery costs) is calculated per ship. Ships with high inconsistency costs, or with high variance of arrival times get a higher time buffer. This is performed by the starting time criticality heuristic (Van de Vonder et al., 2008) which compares the buffer size to the standard deviation. Similar to Zhen et al. (2011), a combination of proactive scheduling and reactive scheduling is used, but using a considerably less complex model Golias et al. (2014) Golias et al. (2014) use Genetic Algorithms to solve the BAP (without QCAP) in container terminals with discrete layout. They minimize both the expected service times (calculated as the average between best possible and worst case behavior) and range of service times (difference between best and worst case). They encode the ships per berth in the chromosomes, and per generation allow only individuals on the Pareto frontier of range and expected service time to survive. Both best and worst case for a specific schedule are determined using a separate optimization problem. They start from upper and lower bounds for all arrival and handling times, and search for the set of arrival and handling times which either maximize or minimize performance for this specific schedule Real Time Allocation Most papers focus on creating a robust home template, but do not consider, how to perform rescheduling at all (Zhou and Kang, 2008), (Golias et al., 2014) or in an unrealistic form. Lu and Xi (2010), Du et al. (2010) and Zhen et al. (2011) perform rescheduling under perfect information of the scenario, as both processing times and arrivals are assumed to exactly known in advance for each different scenario. More realistic in this regard is Umang and Bierlaire (2012), which only considers arrival times and processing times to be deterministic for the next 5 hours, and stochastic afterwards. In real time execution, when performing rescheduling, variability of arrival times, although less than at the moment the home template was generated, will still be an issue.

35 3 Implementation 3.1 Goal As mentioned in subsection current academic literature has still only focused on generating robust schedules for berth allocation. Fully developed predictive-reactive approaches as described by Aytug et al. (2005) have to our knowledge not yet been developed in the context of berth allocation. We want to make a first attempt at designing such a predictivereactive system. Furthermore we desire to assess the influence of internal (i.e. scheduling method related, e.g. planning horizon, frequency of rescheduling) and external (i.e. container terminal related, e.g. number of ships mooring, variance in arrival times,... ) parameters on performance. In order to evaluate and compare different predictive-reactive approaches two items are required. First, it is necessary to create a lifelike simulator, in which all stochastic elements are realistically implemented. Second we need optimization methods which can quickly generate schedules of good quality. Especially the speed of solution is important as numerous schedules will have to be generated in the simulations. We will assume a discrete CT layout, with stochastic handling and arrival times and aim at minimizing the total operational cost, which consists of both the positional and waiting cost. We will start this chapter with an overview of the simulation procedure and then dive into details: first a mathematical description of the stochastic process for the arrival and handling 17

36 Chapter 3. Implementation 18 times, followed by a short discussion on the influence of container distribution on the positional cost of the berths. We continue by developing the MILP-models for both the BAP and QCBAP, and finish with a brief description of the implementation in C General Procedure We distinguish three time scales on which decisions should be taken. 1. Long Term: On the long term (order weeks) a home schedule is created, which will also influence the yard planning. 2. Short Term: In the short term (order hours) the arrivals of ships is near, or ships are already waiting. An updated plan should be generated which optimally uses current knowledge on arrival and handling times. 3. Very Short Term: The plan should be executed, ships moor at the quay and are assigned quay cranes. The long term decisions are not treated explicitly in the simulation, but are considered as fixed in advance. They are implemented by randomly assigning a preferred berth to each container ship in advance (subsection provides more details). We will focus on the decisions made on the short and very short term. Each period a new schedule (either of the BAP or QCBAP 1 ) is generated based on the expected handling and arrival times as of the moment. The schedule specifies for each ship the berth, the order in the service sequence per berth, and in case of the QCBAP, the number of quay cranes assigned to the ship. This schedule is then executed on the very short term time scale: waiting ships are allowed to berth, if the right berth becomes free and quay cranes are assigned if available. Figure 3.1 presents a schematic representation of the interaction between the different time scales. 3.3 Stochastic Process We will treat both the arrival and handling times of container ships in a stochastic way. In current academic literature, the uncertainty, is implemented as one stochastic number. At the moment of creating the home schedule only the distributions are known, but then at the moment of rescheduling all arrival and execution times are assumed to be deterministic and exactly known, which is quite unrealistic. In real life, container ships send periodically their expected time of arrival (ETA) via Electronic Data Interchange (EDI) (Lu and Xi, 2010). As the ship gets closer to the CT, variance of the arrival time diminishes and the ETA becomes 1 The QCS problem is not implemented as this would render simulations too slow, and overly complex.

37 Chapter 3. Implementation 19 Figure 3.1: Interaction between the different timescales a more reliable estimate. The handling time evolves in a similar way. As the number of containers yet to be (un)loaded decreases, the completion time can be estimated more accurately. We thus need a full continuous stochastic process, instead of a simple random number, to realistically describe the evolution of both handling and arrival times. The procedure we adopt is based on the amount W (t) of work 2 left at moment t until the event happens (this amount W corresponds to the expected time until the event). This amount is updated each period and as soon as its becomes zero or lower, we know that the event has happened in that period. Crucial in this treatment will be the distribution of F (t 1, t 2 ) which represents the amount of work performed between t 1 and t 2. Table 3.1 provides an overview of the symbols used for the stochastic process. We start by defining the update rule for W (t) W (t 2 W (t 1 ) = w(t 1 )) = (w(t 1 ) F (t 1, t 2 )) +. (3.1) We assume that F (c1, c2) is independent of w(t 1 ) or any values of w before t 1. Thus W (t 2 ) is conditionally independent of all values of W before t 1, if W (t 1 ) is known Requirements The stochastic process should correspond to a real-life arrival or handling process. Thus we propose five requirements, which must be satisfied exactly by our process. In all equations we assume t 1 t 2 t 3. 2 In the case of handling time it straightforward to intuitively interpret this amount of work as the number of containers multiplied by the average required time per container. For the arrival times one can see this as the remaining distance from the container terminal divided by the average speed.

38 Chapter 3. Implementation 20 Table 3.1: List of symbols used to describe the stochastic process, stochastic counterparts are indicated in angular brackets t R : time at which a stochastic variable is evaluated W (t) w(t) R R : the amount of work left until the event, as a function of time F (t 1, t 2 ) f(t 1, t 2 ) R R R: the amount of work performed between time t 1 and t 2 E[...] : Expectation value of a stochastic variable Var[...] : Variance of a stochastic variable P [...] : Probability of a certain event or Probability Density Function (PDF) of a stochastic variable (...) + : Equivalent to max(..., 0) Correct Expected Work Processed First the expected amount of work processed in a certain time unit must of course equal this time unit (i.e. after one hour on average one hour of work will be completed). Thus E[F (t 1, t 2 )] = t 2 t 1 t 1, t 2 (3.2a) No Negative Work The amount of work performed is a nonnegative value. The expected remaining time until completion can thus not increase. While this constraint will often be violated in real life (crane, lock or motor failure, changing weather conditions,... ) it simplifies simulations 3. The formal representation is P [F (t 1, t 2 ) < 0] = 0. t 1, t 2 (3.2b) Variance goes to Zero As the remaining time left decreases and the expected arrival times becomes closer and closer to the current time, the variance should also decreases to zero 4. If a container ship is one hour from the harbor, deviations of one day are very unlikely, while this is not the case if the 3 Allowing negative work would mean the amount of work could become positive again, after reaching the zero, which raises multiple issues. 4 Although one might intuitively think this automatically follows from the combination of Equation 3.2a and 1 Equation 3.2b, this is not the case. As a counterexample consider F (t 1, t 2) equal to with probability t 2 t 1 (t 2 t 1) 2 and zero otherwise. F is thus non negative and has expected value t 2 t 1, but variance remains 1 for all t 2 and t 1.

39 Chapter 3. Implementation k = 1 k = 2 k = 5 k = θ = 0.05 θ = 0.10 θ = 0.20 θ = 0.50 PDF x (a) various k, with θ = 0.1 PDF x (b) various θ, with k = 2 Figure 3.2: PDF of the gamma distribution for different values of k and θ ship is expected to arrive in three weeks. Mathematically this constraint can be expressed as: Closed Form lim Var[F (t 1, t 2 )] = 0 t 1. (3.2c) t 2 t 1 We require a closed form expression for the PDF of F (t 1, t 3 ), regardless of the time step between t 1 and t 3. This is important as it allows the direct generation of W (t 3 ) without requiring any other intermediate generated random numbers (e.g. W (t 2 ) at an intermediate point in time t Invariance The probability distribution of work performed between t 3 and t 1 must be equal to the distribution of the sum of work performed from t 1 to t 2 and the work performed between t 2 and t 3. F (t 1, t 3 ) = F (t 1, t 2 ) + F (t 2, t 3 ) t 1, t 2, t 3. (3.2d) If the invariance is violated, tracking the intermediate progress would affect the distribution of the expected event time at W (t 3 ), which is obviously completely unrealistic Procedure In order to satisfy the five requirements we must carefully select a PDF for F (t 1, t 2 ). We choose F to be gamma distributed and will determine the required shape parameter k and scale parameter θ Gamma Distribution We summarize the main properties of the gamma distribution (Schervish and DeGroot, 2014), in order to assess the statistical properties of our stochastic process and select appropriate

40 Chapter 3. Implementation 22 values for k and θ. The PDF of the Gamma Distribution is given by x P [x k, θ] = xk 1 e θ θ k Γ(k), (3.3a) with Γ(k) the gamma function evaluated at k. The PDF of the gamma distrubtion for various k and θ is shown in Figure 3.2. The mean of a gamma distributed variable is calculated as E[x] = kθ, (3.3b) while variance is Var[x] = kθ 2. (3.3c) The distribution of the sum of gamma distributed variables can be easily calculated, if the variables share a common scale parameter θ, X i Gamma(k i, θ) = i X i Gamma( i k i, θ). (3.3d) Specific Procedure Equation 3.3d allows to easily calculate the distribution of a sum of gamma distributed variables, if they share the same θ. From Equation 3.3b and Equation 3.3c we can derive that θ is the ratio between the variance and the mean, we will keep it fixed, independent of t 1 and t 2, and refer to it as the ratio of variance R 5 v In order to satisfy the expected value constraint (Equation 3.2a), we set k(t 1, t 2 ) = t 2 t 1 R v. (3.4) As R v is fixed and finite, this choice automatically satisfies Equation 3.2c as the variance becomes indeed zero. Furthermore our choice ensures that k(t 1, t 3 ) = k(t 1, t 2 ) + k(t 2, t 3 ) (3.5) which is required by Equation 3.3d to fulfill the invariance Equation 3.2d. Finally we can express the PDF of F analytically as F (t 1, t 2 ) Gamma( t 2 t 1 R v, R v ) (3.6) As the gamma function is always positive, Equation 3.2b is always satisfied. 5 This may not be confused with the coefficient of variation, a dimensionless ratio between the standard deviation and mean.

41 Chapter 3. Implementation 23 Table 3.2: Standard deviation as determined by the period and ratio of variance. Period Ratio of Variance 1 h 0.5 h 0.2 h 0.1 h 0.05 h 0.02 h 0.01 h 1 week 12:57 9:09 5:47 4:05 2:53 1:49 1:17 1 day 4:53 3:27 2:11 1:32 1:05 0:41 0:29 4 h 2:00 1:24 0:53 0:37 0:26 0:16 0:12 1h 1:00 0:42 0:26 0:18 0:13 0:08 0:06 20 min 0:34 0:24 0:15 0:10 0:07 0:04 0:03 5 min 0:17 0:12 0:07 0:05 0:03 0:02 0: Examples Table 3.2 displays the standard deviation of the event time as a function of the time until the event and the ratio of variance. Events that are near, have lower standard deviation, while a higher ratio of variance clearly increases the standard deviation Work w [h] replication 1 replication 2 replication 3 replication 4 replication Time c [h] Figure 3.3: 5 simulations of the evolution of the workload Figure 3.3 shows 5 simulations with a time step of 0.1 h (i.e each 0.1 h the work w(t) left is calculated by our stochastic procedure and displayed on the plot). The process starts with a workload of 10 hours and has a ratio of variance of 0.1 h. We also generate a plot which indicates the fraction of events which have al ready happened in this or the previous periods. Figure 3.4 is generated by repeating the stochastic process times for different time steps. We see that the fraction of events completed, is indeed independent of the magnitude

42 Chapter 3. Implementation 24 of the time steps, an all points lie along one curve. Our statistic procedure allows only to tell whether an event has already happened but not when it has exactly occurred. If we make time steps sufficiently small, however, we can safely assume that the first time interval at which the work w becomes zero, is a good approximation of the time of the event. Using a time step of 0.01 h and replications, the sample average turns out to be be h and has sample standard deviation h. This is close to the work load of 10 h, and the σ = 1 h as a result of the fraction of variance of CDF time step = 0.01 h time step = 0.1 h time step = 1 h Time of Event c [h] Figure 3.4: Cumulative fraction of the events happened before a certain time, for different time steps. 3.4 Location As already previously described, long term decisions affect the distribution of containers along the quay. If containers are located far away from the berth, straddle carriers have to drive long distances, which results in extra costs or longer handling times. In this section we will briefly describe how the distribution of containers along the quay affects the average distance towards the berth. We will assume the location of the containers is fixed in advance. This is almost certainly the case for export containers, which are already physically located at the yard, but is not necessarily certain for import containers, which yet have to be placed on the container terminal. To measure distances we will use the Manhattan distance instead of the standard Euclidean distance, as the containers obstruct straddle carriers from moving in straight lines between

43 Chapter 3. Implementation 25 origin and destination. As depicted on Figure 3.5 the vertical distance is not influenced by the location of the berth, but only the horizontal distance. In the following description we will only consider the horizontal distance. Figure 3.5: Schematic depiction of the container yard and the distances to the berths. Analytically once the probability distribution of containers, p(x), among the quay is known, one can calculate the average horizontal distance d(x b ) as a function of the horizontal location x b of the berth, using d(x b ) = xmax 0 p(x) x x b dx. (3.7a) We can study d(x b ) for two extremes: either all containers are concentrated on one location or homogeneously spread among the yard. In case all containers are stored at one place x p, p(x) becomes the Dirac distribution. Using Equation 3.7a we then obtain d(x b ) = x p x b. (3.7b) If containers are homogeneously spread between 0 and x max the average distance becomes: d(x b ) = 1 (x b 1 4 x max + 2 x max) 2. (3.7c) x max

44 Chapter 3. Implementation Examples In order to gain more insight, we plotted the average distance to each container in Figure 3.6, for different distributions of containers. We use a quay of 1000 m length, and generate the location of containers according to several distributions. Figure 3.6a shows clearly a linear dependence on x b as containers are put closely together (Equation 3.7b), Figure 3.6d shows the quadratic behavior as containers are homogeneously spread along the quay (Equation 3.7c). We see that for distributions in between perfectly concentrated and homogeneously scattered, curves will consist of a mixture of linear and quadratic parts (e.g. Figure 3.6b) Implications For the simulation we will not take the location of each individual container into account. We assume containers are closely grouped together, as should be the objective of good yard management. One clearly sees that the average distance for concentrated distributions (Figure 3.6a) is lower for all positions than for spread distributions (Figure 3.6d). Thus if we assume costs for straddle carriers are linear in the distance they have to cross, we assume a linear cost for deviations from the preferred berthing position. In case of bad yard planning, the influence of the preferred berth becomes less important. For convenience, for each ship we generate a preferred berth Z 1 from a uniform integer distribution in advance. The cost using berth Z 2 is then Z 2 Z 1 multiplied by a fixed positional cost 6. We assume the expected handling time of the container ships to be independent of berthing location. 3.5 BAP model Idea In order to perform the rescheduling effectively we need an optimization method which generates solutions of good quality in a limited amount of time. We think it is worthwhile to describe and implement a BAP, and not jump directly into the QCBAP. The QCBAP is more realistic and delivers better performance, but is unfortunately more complex, which probably implies longer solution times and may render analysis somewhat harder. We start with enumerating the constraints of the basic model, discuss some extra constraints, and finally include some stochastic elements into the model, to render the schedule more robust. 6 In a more advanced model the cost could also be proportional to the number of containers to be shipped

45 Chapter 3. Implementation average distance [m] average distance [m] x-position [m] x-position [m] (a) Normally distributed with σ = 1 m (b) Normally distributed with σ = 50 m average distance [m] average distance [m] x-position [m] x-position [m] (c) Normally distributed with σ = 200 m (d) Uniformly distributed average distance [m] average distance [m] x-position [m] x-position [m] (e) Multimodal normally distributed with σ = 50 m, peaking at 250 m and 750 m (f) Normally distributed with σ = 50 m, peaking at 750 m Figure 3.6: average distance (blue solid line) to the containers as a function of position for various container distributions. The locations of the containers are indicated by the black stripes.

46 Chapter 3. Implementation Mathematical Representation In order to solve the BAP, we design a MILP, which we can then solve with the Gurobi solver. In comparison with meta-heuristics such as genetic algorithms, a MILP formulation allows to find solutions, without any tuning of meta-parameters and guarantees optimal results. Furthermore if the problem is not overly complex or coupled, relatively fast generation of solutions is often possible, if we tolerate some amount of sub-optimality (a non-zero MIPgap). For the MILP we choose not to discretize time into multiple intervals, but treat time in a continuous way. We describe the BAP-MILP using the notation adapted from Imai et al. (2008) and use the following conventions (which we will also use for the QCBAP): Decision variables: lower case symbols Parameters: upper case symbols Indices: lower case symbols in subscript, one letter per specific set (e.g. i for berths) Table 3.3 presents an overview of all the symbols used in the BAP-MILP. Sets i B j V Parameters A j R C j R Table 3.3: List of symbols used in the BAP : Berths at the quay : Ships expected to arrive in the planning horizon : Expected arrival time of ship j : Expected handling time for ship j P w j R : Cost of letting ship j wait for one hour P b ij R M w R S i R Decision Variables a 1 j 1 j 2 a 2 j 1 j 2 b j R : Cost of letting ship j moor at berth i : Big M for all waiting times : Expected time of availability for berth i (i.e. the expected time at which handling of the current ship at berth i is completed) : Berthing time of vessel j l ij {0, 1}: Whether ship j uses berth i {0, 1}: Auxiliary variable 1 whether ship j 1 berths before j 2 is completed. {0, 1}: Auxiliary variable 2 whether ship j 1, and j 2 berth at the same berth, only defined for j 2 < j 1.

47 Chapter 3. Implementation 29 Objective The objective is to minimize the cost associated with both the waiting times and the position of the ship at the quay (cf. section 3.4) ( (b j A j )Pj w + ) Pijl b ij j V i B Arrival Time (3.8a) Ships can of course not be berthed before they have arrived at the container terminal. Thus we require, b j A j j V. (3.8b) The berthing time is not constrained to the planning horizon, and may exceed it. In this way we assure that both the planning remains feasible and all ships are completed at the end of the schedule. Unique Location Each ship can only berth at one location, l ij = 1 j V. (3.8c) i B One ship per berth simultaneously At no point in time, two ships may be present at the same berth. This constraint is more difficult to implement, and we will use some auxiliary constraints and variables to implement it. We notice that three conditions are required in order to have a violation or overlap. 1. ship 1 must arrive before ship 2 is left 2. ship 2 must arrive before ship 1 is left 3. both ships should use the same berth First we investigate whether ship j 1 starts before j 2 is completed. If this is the case then a 1 j 1 j 2 should become one. b j1 b j2 C j2 M w a 1 j 1 j 2 j 1, j 2 j 1 V. (3.8d) Then we check whether j 1 and j 2 use the same berth, which makes a 2 j 1 j 2 one: l ij1 + l ij2 1 M w a 2 j 1 j 2 i B, j 1, j 2 < j 1 V. (3.8e) As previously mentioned the three conditions may not be simultaneously valid, but as soon as one of them is invalid, no overlap occurs, thus we require: a 1 j 1 j 2 + a 1 j 2 j 1. + a 2 j 1 j 2 2 j 1, j 2 < j 1 V. (3.8f)

48 Chapter 3. Implementation 30 Ships currently moored At this point, we have only checked whether there is no overlap with ships that will berth in the future (future ships) but not yet whether there is overlap with ships currently (at the moment of rescheduling) moored at the quay (current ships). As we do not allow any relocation of the current ships, we require b j S i ( 1 + l ij )M w i B, j V. (3.8g) Extra Constraints We can easily extend this model to include extra constraints. Certain berths may not be accessible for all ships, because they exceed the length or depth of the quay. We can either set P b ij at a prohibitively high cost, or more rigorously add the constraint l ij F ij, i B, j V, (3.9) to the set of constraints. Parameter F ij is 1 if ship j can moor at berth i and 0 otherwise. In order to ensure a fair treatment of all container ships, one can implement a maximum waiting time for each container ship. In practice, CT s usually have a contractual obligation to handle the container ship within a certain time window if the ship arrives on time (Maarten Hendriks et al., 2010). b j A j W max j V (3.10a) Choosing the maximum waiting time W max too short may result, however in an infeasible problem. Therefore a soft constraint is to be preferred, b j A j W max e j j V. (3.10b) With the excess variable e j heavily punished in the objective function Probabilistic Extensions The BAP-MILP developed above, treats the arrival times as deterministic, while they are in reality stochastic. The standard deviation at the moment of rescheduling is however not huge. Ships arriving in 4 h have a σ of 37 minutes (assuming R v = 0.1), while for ships arriving in 24 h, σ is 92 minutes. Nonetheless one can generate schedules which will be more robust Margin A convenient and simple way to generate robust schedules is implementing fixed time buffers. In order to introduce an arrival margin A marg j and handling margin C marg j per ship we replace Equation 3.8b by b j A j + A marg j j V. (3.11a)

49 Chapter 3. Implementation 31 We also substitute Equation 3.8d by b j1 b j2 A marg j 1 A marg j 2 C marg j 2 C j2 M w a 1 j 1 j 2 j 1, j 2 V. (3.11b) Equation 3.11b is derived from the worst case scenario in which ship j 1 is A marg j 1 early, and j 2 arrived A marg j 2 late and has extra handling time C marg j 2. The margin does not increase the complexity of the problem, but suitable A marg j and C marg j, have to be found. In experiments we will set A marg j = C marg j = α, with α a parameter indicating the size of the time buffer Scenarios A better but more complex method consist in generating a set of scenarios K. For each scenario k and ship j an arrival time A jk and container handling time C jk is generated. The location assigned to each ship is equal among all scenarios (this approach is similar to Lu and Xi (2010) described in subsection 2.4.2). The problem then becomes maximize: ( j V,k K (bjk A jk )Pj w + i B P ij b l ) ij subject to: (3.12a) b j,k A jk j V, k K (3.12b) l ij = 1 j V (3.12c) i B b j1 k b j2 k C j2 k M w a 1 j 1 j 2 k j 1, j 2 j 1 V, k K (3.12d) l ij1 + l ij2 1 M w a 2 j 1 j 2 i B, j 1, j 2 < j 1 V (3.12e) a 1 j 1 j 2 k + a1 j 2 j 1 k. + a2 j 1 j 2 2 j 1, j 2 < j 1 V, k K (3.12f) b jk S i,k ( 1 + l ij )M w i B, j V, k K. (3.12g) This MILP significantly increases complexity as the number of variables increases linearly with the number of scenarios. simple time buffer method. The approach should however give better results than the 3.6 QCBAP model In the previous section we assumed that each berth had a fixed number of quay cranes, and thus the expected handling time could be treated as a parameter instead of decision variable. In a more realistic and advanced model we also select the optimal number of quay cranes assigned to each ship. We must now take care that at no point in time more than the maximum

50 Chapter 3. Implementation 32 number of quay cranes is allocated. Furthermore only a limited number of quay cranes can work simultaneously on one vessel. All MILP models treating the QCBAP to our knowledge, discretize the time in multiple intervals (Raa et al., 2011),(Türkoğulları et al., 2014), (Hu et al., 2014) 7, (M Hendriks et al., 2012). Thus they are not compatible, with our BAP model previously developed, and have the disadvantage of either using a lot of variables or only applying a rough time discretion. Below we present our model which does not require such a discretization in time. As a disadvantage however the number of quay cranes is fixed during its berthing time (similar to Liang et al. (2009) and Imai et al. (2008) ). In Table 3.4 the symbols used in the QCBAP model are shown, with modifications with respect to those used in the BAP indicated in bold Mathematical Model Objective The objective of Equation 3.8a is slightly changed. As the handling time becomes now a decision variable, one should now minimize the port stay time instead of only the waiting time. Berthing Constraints ( (bj A j + c j )Pj w + Pijl b ) ij j V i B (3.13a) The constraints related to berthing remain mainly unchanged. Only Equation 3.8d undergoes a minor change as parameter C j is replaced by decision variable c j resulting in Equation 3.13b. b j A j j V. (3.8b revisited) l ij = 1 j V. (3.8c revisited) i B b j1 b j2 c j2 M w a 1 j 1 j 2 j 1, j 2 j 1 V (3.13b) l ij1 + l ij2 1 M w a 2 j 1 j 2 i B, j 1, j 2 < j 1 V, (3.8e revisited) a 1 j 1 j 2 + a 1 j 2 j 1. + a 2 j 1 j 2 2 j 1, j 2 < j 1 V. (3.8f revisited) 7 The model developed by Hu et al. is not strictly speaking a MILP as also quadratic terms are used.

51 Chapter 3. Implementation 33 Sets i B j V Parameters A j R C j R Table 3.4: List of symbols used in the QCBAP : the berths at the quay : the ships expected to arrive in the planning horizon : Expected arrival time of ship j : Expected total handling time for ship j (handling time if only one quay crane would be assigned) P w j R : Cost of letting ship j wait for one hour P b ij R M q R M w R Q j N Q max N Q i N : Cost of letting ship j moor at berth i : Big M for Cranes : Big M for all waiting times : Maximum number of quay cranes that can work on ship j : Total number of quay cranes on the quay : Number of cranes allocated to the ship currently moored at berth i S i R : Expected time of availability for berth i (i.e. the expected time at Decision Variables b j R l ij {0, 1} which handling of the current ship at berth i is completed) : Berthing time of vessel j : Whether ship j uses berth i q j {1,...Q j } : Number of cranes allocated to ship j c j R : Expected handling time of ship j a 1 j 1 j 2 {0, 1} : Auxiliary variable 1 whether ship j 1 berths before j 2 is completed. a 1 ji {0, 1} : Auxiliary variable 1 whether ship j berths before the ship currently processed at berth i is completed. a 2 j 1 j 2 {0, 1} : Auxiliary variable 2 whether ship j 1, and j 2 berth at the same berth, only defined for j 2 < j 1 a 3 j 1 j 2 {0, 1} : Auxiliary variable 3 whether ship j 2 starts before j 1 k j1 j 2 {0,...Q j2 } : number of cranes allocated to j 2 at the moment j 1 berths k ji {0,...Q j2 } : number of cranes allocated to the ship currently moored at berth i at the moment j 1 berths

52 Chapter 3. Implementation 34 b j S i ( 1 + l ij )M w i B, j V (3.8g revisited) Quay Cranes In order to check the number of quay cranes in use at some crucial moments, we need to use variables which represent the number of quay cranes used by each ship at that moment. Each time a ship arrives at the quay, new cranes are assigned and the total number of QC s in use must be checked. We need several auxiliary constraints and variables to implement this. First we need to determine which ships are at the quay when ship j 1 berths. For this we add the constraint: b j2 b j1 M w a 3 j 1 j 2 j 1, j 2 j 1 V. (3.13c) The ships at the quay are then those for which both ship j 2 is not yet finished (a 1 j 1 j 2 = 1 ), and j 2 berths before j 1 (a 3 j 1 j 2 = 1). This allows to determine k j1 j 2. k j1 j 2 M q (2 a 1 j 1 j 2 a 3 j 1 j 2 ) + q j2 j 1, j 2 V. (3.13d) Equation 3.13c will however lead to incorrect results. For two ships j 1 and j 2 berthing simultaneously, the total number of quay cranes used may exceed Q max. If we replace Equation 3.13c by b j2 b j1 ɛ M w a 3 j 1 j 2 j 1, j 2 V. (3.13c correct) with ɛ a small nonnegative number, the total number of cranes will be correctly respected 8. Now we have only counted the QC s used by future ships, but we should also calculate those assigned to current ships. Similar to the berthing location we consider the amount of QC s assigned to a current ship fixed. We can determine the number k ji in a similar way as k j1 j 2. First we check whether there is an overlap in time, b j S(i) M w a 1 ji j V, i B. (3.13e) If so k ji should be at least Q i. k ji M q (1 a 1 ji) + Q i j V, i B. (3.13f) Thus we arrive at the main constraint: the sum of the allocated cranes to future k j1 j 2 and current ships k ij1 and the ship itself q j1, at the moment of berthing, must of course be less or equal than the total number of cranes Q max 8 The reason behind this is that according to Equation 3.13c a 3 j 1 j 2 is guaranteed to be one if j 1 moors after j 2. For a simultaneously berthing ship j 2, a 3 j 1 j 2 and thus k j1 j 2 are allowed to be zero. This will then lead to mistakes in Equation 3.13g as the number of simultaneously used cranes is inappropriately counted. The ɛ in Equation 3.13c correct correctly forces a 3 j 1 j 2 to be one also for simultaneously berthing ships.

53 Chapter 3. Implementation 35 k j1 i + k j1 j 2 + q j1 Q max j 1 V. (3.13g) i V j 2 V Handling Time Finally we will then determine the expected handling time, given the number of allocated quay cranes q j. As this is a linear program we cannot directly make the constraint 9. c j C j q j j V. (3.13h) But fortunately the 1 x function is convex, so we can replace this constraint by tangents to 1 x at x = q j {1,...Q j }. The constraint is then replaced by the set of tangents, c j C j ( 2 n q j n 2 ) j V, n {1,...Q j}. (3.13i) 25 1 x tangents 20 Handling Time [h] Number of Quay Cranes Figure 3.7: Graphical depiction of Equation 3.13h (dashed) vs. Equation 3.13i (dashed), we see that in the integer points (dots), both sets of constraints are equivalent Equation 3.13h is completely equivalent to Equation 3.13h as q j is required to be an integer. This is clarified by Figure 3.7, where the tangents in all integer points are drawn. 9 We will assume for simplicity that the different cranes do not interfere with each other, and the productivity of the QC s remains fixed. In literature more advanced models take into account the decrease in QC productivity when multiple QC s are assigned (Blazewicz et al., 2009), (Meisel and Bierwirth, 2009), Zhou and Kang, 2008.

54 Chapter 3. Implementation Probabilistic Extensions We can in a similar way extend the QCBAP to obtain more robust schedules, either by adding time buffers to both the processing time and arrival time or using multiple scenarios. The time buffer formulation is almost exactly similar to the BAP and requires the replacement of Equation 3.13b and Equation 3.8b by constraints Equation 3.11b and Equation 3.11a 10 The scenario approach is also similar to the BAP, but now with extra decision variables. The number of quay cranes allocated, q j, is scenario independent, while handling time c jk and auxiliary variables a 3 j 1 j 2 k, k j 1 j 2 k and k jik are different per scenario. As the derivation of constraints is fairly straightforward, will not write them out explicitly here Real Life Implementation The assignment of quay cranes is guaranteed to be feasible if all ships arrive at their ETA and have the expected total handling times. As both numbers however are stochastic and will deviate, the schedule may become infeasible upon execution. Therefore when a ship moors at the quay, it is given the scheduled amount of QC s, unless the maximum number of QC s is reached. In that case the ship only gets the QC s available, and will receive the rest when another ship leaves the quay, and new QC s become available. 3.7 C++ Implementation This section discusses the implementation of the simulations. As codes spans approximately 3000 lines, we will not go into details but briefly give an outline of the main concepts behind the implementation. A more detailed discussion of the code can be found in appendix A. All simulation code is written in C++ as it offers a high execution speed, combined with a powerful object oriented syntax. The simulator can be run in the BAP configuration, ignoring all QC related issues, or work with the full QCBAP. Simulations in BAP-mode will be faster than QCBAP, but somewhat less realistic Concepts In order to better understand the concepts used in the implementation it is worthwile to look at Figure 3.8. Each Ship is represented by an object with a handling time, arrival time, preferred berth location, scheduled berth location, number of QC s scheduled,... All ships which arrive in the simulation period are grouped together in a Schedule. There is also 10 only with parameter C j2 now replaced by decision variable c j2.

55 Chapter 3. Implementation 37 a QuayCrane object which keeps track of the assignment of quay cranes to the different ships. Both Schedule and QuayCrane are part of the Planner that will take care of both the execution and the rescheduling. Figure 3.8: Schematic overview of the main objects in simulation code Three parameters are crucial to the simulation, and must be given in advance: 1. Reschedule period: Each reschedule period, a rescheduling occurs 2. Planning horizon: How far in the future the rescheduling must look, ships arriving outside the planning horizon are not taken into account. 3. Small step: How often the simulator must update handling and arrival times and look for ships which have arrived, are completed, Global Phases The simulation starts with the initialization of a schedule and a predefined number of ships is created. Long term expected arrival times are uniformly distributed among the simulation period, while the long term expected handling times per ship are drawn from a lognormal distribution, with certain mean and standard deviation. For each ship also a preferred berth is drawn uniformly among the different berths. Once initialized the C++ main loop depicted in Figure 3.9 starts working. If a new reschedule period starts, a new schedule will be generated. Anyway the simulator will then wait for a small step, update the handling and arrival times afterwards and finally execute the operations, if required.

56 Chapter 3. Implementation 38 Figure 3.9: Core of the simulation At the end of simulation all relevant simulated data is written to files, which can be analyzed and plotted afterwards Rescheduling The rescheduling solves either the BAP-MILP or QCBAP-MILP developed in section 3.5 and section 3.6 using the Gurobi solver. The ships included in the schedule are those expected to arrive within the planning horizon, the ones currently berthed or waiting at the CT for service. The schedule uses the most recent estimates of handling and arrival times. As in section 3.5 and section 3.6 berthing times, and completion times are not restricted to the planning horizon, and the generated schedule should have all ships completed. After the rescheduling, the future ships get assigned a berth location, sequence number and, in case of the QCBAP, also a scheduled number of quay cranes. As solving the MILP to full optimality may take a long time and high simulation speed is required, we allow some tolerance from optimality. We finish optimization as soon as the relative MIP-gap reaches 1%, after 5 seconds we allow 2%, and after 15 seconds, we stop already at MIP-gaps of 5 %. If after 30 seconds the MILP has not yet converged, we stop optimization, and return the best solution found. Although 30 s may seem fast at first instance, one should remember that if all optimizations took this long, evaluating 4 different CT configurations over a 4 month period, still requires

57 Chapter 3. Implementation hours of computations (assuming a 6 h reschedule period). Fortunately optimization turns out to often take less than a second to complete Execution Figure 3.10: The different stages of a ship from arriving to leaving the container terminal The execution manages the transition of the ships along the different stages as depicted in Figure All ships starts outside the planning horizon. As soon as the long term arrival time, as generated in the initialization phase, falls inside the planning horizon, the ship is put inside the planning horizon. It will be included in schedules, and the expected arrival time will now be periodically updated. As soon as the expected time until arrival has dropped to zero, the ship moves to the next stage. If the berth assigned to it by the schedule is free, it can directly be put at the quay, otherwise it is put in waiting. If the location becomes free and there is no earlier ship (according to the schedule) waiting for the same berth, then the ship moors at the quay. Berthing can also occur when the ship is assigned a new location by rescheduling. Once the ship arrives at the quay, it gets assigned quay cranes (at least in the QCBAP simulations) according to the schedule, if not enough quay cranes are available, then it gets only those available and has to wait until it receives quay cranes from a completed ship. The expected handling times of a moored ship are also updated periodically, taking the current number of assigned quay cranes into account. As soon as the expected handling times reaches zero, the ship leaves the quay, and undergoes no further actions. The execution is designed so that, whatever the schedule generated in rescheduling, the execution will always correctly satisfy all constraints and never suffer from infeasibilities from the

58 Chapter 3. Implementation 40 planning. A common issue with periodic rescheduling is that major disruptions may render the schedule infeasible (cf. subsection 2.3.1), but our carefully implemented execution step solves this problem Updating Handling & Arrival Times Before each execution step, both expected handling and arrival times are updated. A gamma distributed variable is generated as described in section 3.3, and subtracted from the expected time W until the event. If the ship has just entered the planning horizon W is initialized to the difference between the long term expected arrival time and the current time. For ships just mooring at the quay W is set to the long term expected handling time as initially generated by the lognormal distribution Data Collection At the end of simulation, the data is saved. For all ships individually the long term expected arrival time, actual arrival time, waiting time, preferred berth, actual berth, long term expected handling time, actual handling time,... are recorded in a.csv file. Another file records global data such as the average MILP solution time, MIP gap, the availability of QC, number of location switches among different schedules, the average number of QC used,... This data can than afterwards be processed and plotted using python code with the Matplotlib library, which is easier to use and more powerful than any C++ plotting library known to us Real Time Graphical Output The C++ code also generates real time graphical output, so the user can follow what is currently happening in simulation. The purpose of the graphical output is double. First it allows to check whether everything is correctly coded, and shows where to debug if necessary. Second once everything is correctly coded, it allows to obtain a deeper understanding of what is happening than would be possible based on only the plotted data afterwards. We designed the graphical output using Qt5, and the QCustomPlot library. We created a window consisting of 3 tabs. the first tab (Figure 3.11) displays the execution related steps: the ships in the planning horizon, the ships waiting for service, and the ships currently served, together with respectively the expected time till arrival, the waiting time and expected time till completion. The number of cranes assigned to each moored ship versus the scheduled amount are also displayed. The schedule tab (Figure 3.12), visualizes the last generated schedule with current and future ships. Of all ships the scheduled berthing and completion time is shown together with the number of assigned cranes and berthing location. The third

59 Chapter 3. Implementation 41 tab (Figure 3.13) shows the current average of multiple performance indicators: waiting time, time in port, MILP solution time,... Figure 3.11: The operational tab. At the top we see a plot of the time until arrival for ships expected to arrive within the planning horizon (location -1 means the schedule has not yet assigned a berth to this ship). Below, the waiting times for the vessels waiting for service are displayed, and at the bottom the remaining handling times for the container ships

60 Chapter 3. Implementation 42 Figure 3.12: The schedule tab. Ships currently served at the quay are indicated in black, the future ships alternating in red and blue. Per ship, scheduled berthing times, completion times, berth and number of QC s are indicated Figure 3.13: The performance tab. The current average of multiple performance indicators is shown.

61 4Results In this chapter we will first check whether both our BAP-MILP and QCBAP-MILP formulation yield correct results. We continue with a general overview of the default simulation parameters and some specific simulation procedures not yet described in section 3.7. Finally we describe the actual experiments and their results. We distinguish between external and internal parameters. External parameters are related to the container terminal and container ships (e.g. congestion level, positional cost, variance of handling and arrival times, number of quay cranes). The internal parameters are those which are related to the way rescheduling works (i.e. rescheduling period, planning horizon and fixed time buffers). We search for good values for these parameters, and check whether and how the optimal internal parameters depend on external parameters. 4.1 Accuracy Check In order to check whether the models we have developed in chapter 3 do not contain any mistakes, we create a simple example problem. Three ships will arrive in respectively 1, 6 and 10 hours. They have equal priority and no preferred berthing location. At the quay there are two berths, both of them occupied at the moment. The first ship will be ready in 2 hours and the second in 4 hours. We will solve both the BAP and the QCBAP version. 43

62 Chapter 4. Results BAP The expected handling time for each ship is 12 hours. The resulting schedule is depicted in Figure 4.1. We see that the planner generates the optimal schedule. Ship 0 arrives in 1 h, but berth 1 becomes only free at 2 h. Berthing time is thus set in 2 h. The second berth becomes free in 4 h, but ship 1 only arrives in 6 h. Ship 2 arrives in 10 h, but must wait until ship 0 is completed, i.e. 14 h. Figure 4.1: Optimal schedule for the test problem as determined by the BAP formulation QCBAP For the QCBAP we assume, 6 quay cranes are available and maximally 4 quay cranes can work simultaneously on a ship. The expected total handling time per ship is 24 h. Currently each ship on the quay has already 3 quay cranes. The correct schedule is generated as depicted in Figure 4.2. We notice that is most advantageous to give each ship 3 quay cranes instead of assigning 4 and 2. Figure 4.2: Optimal schedule for the test problem as determined by the QCBAP formulation. 4.2 General Setup & Default Parameters In order to run numerical simulations a lot of parameters need to be decided on. As this study it not aimed at one specific CT, most parameters choices are somewhat arbitrary, but must however fall within certain bounds to remain realistic. Table 4.1 summarizes the choices

63 Chapter 4. Results 45 Table 4.1: Overview of simulation parameters Name Value number of berths n l 4 simulation time 1 month planning horizon T p 24 h rescheduling period 6 h small step 5 minutes congestion u 0.85 mean handling time µ 8 h standard deviation handling time 2 h ratio of variance R v 0.1 h for each parameter. We use a terminal consisting of 4 berths. Each simulation starts with an empty container terminal and lasts over the span of one month. Long term handling times are lognormally distributed with a mean 1 of 8 h and standard deviation of 2 h. The PDF of the handling times is shown in Figure 4.3. Long term arrival times are uniformly distributed among the simulation period, and one berth per ship j is selected with uniform probability as preferred berth Z j PDF Handling Time Figure 4.3: Distribution of the long term handling times For each replication per experiment we generate one set of long term arrival and handling 1 This is the true mean, not the e µ often used in parametric representations of the lognormal distribution

64 Chapter 4. Results 46 times, to be used in all diverse configurations 2. This common random numbers approach minimizes variance of performance 3. Thus when different configurations are compared, we can more easily distinguish true performance differences, as results are less noisy. The ratio of variance R v for both arrival and handling times is, unless otherwise stated, fixed to 0.1 h (the consequences on the standard deviation can be seen in Table 3.2). The rescheduling period is set to 6 h, the small step for execution to 5 minutes (cf. subsection 3.7.4) and the planning horizon T p to 24 h. We define the congestion ratio u as the average utilization of the individual berths. We select a u of 0.85 by choosing the amount of ships n s so that unl T s n s =. (4.1) µ Objective Function In order to solve the (QC)BAP we need to define waiting and positional costs for all ships. We prioritize ships based on arrival times. Ships arriving earlier have a higher claim to be served as fast as possible. In this way the maximum waiting time is reduced. Furthermore the arrivals of ships far in the future have a considerate amount of uncertainty, so the schedule should not worry too much about them. We assume a positional cost proportional to the deviation from the preferred berthing position Z j (cf. section 3.4), at a rate equivalent to 1 h of waiting per berth deviation. A ship mooring at berth 1 but preferring berth 3, gets thus a cost punishment equivalent to 2 h of extra waiting. The objective functions thus becomes j V ( (A j t p )(b j A j + ) l ij Z j i ). (4.2) i B in which A j is the expected arrival time of ship j and t p, the end of the current planning horizon, i.e. the current time t c added to the planning horizon T p. 2 This approach is however not applicable to the congestion experiment as the number of arriving ships varies. 3 Such a common random number approach would theoretically also be possible for the effective times generated by the stochastic process. This however requires approximately 500 numbers to be saved per ship, and is far from trivial to implement.

65 Chapter 4. Results 47 Waiting Time [h] Congestion Ratio (a) Average waiting time Solution Time [s] Congestion Ratio (b) Average solution time Berth Switch Ratio Congestion Ratio (c) Average berth switch ratio Position Deviation Congestion Ratio (d) Average position deviation Number of Ships per Schedule Congestion Ratio (e) Average number of ships in the schedule Figure 4.4: Influence of Congestion 4.3 External Parameters We will investigate four external parameters in this section: congestion, variability, positional cost and the number of quay cranes. In order to speed experiments up, all experiments are performed using the BAP formulation, except for the crane experiment, obviously Influence of Congestion We simulate terminals ranging from lowly congested (u = 0.1) to highly congested (u = 0.9). Figure 4.4a reveals how the average waiting time per ship significantly increases with the congestion. Each replication is indicated by a small black dot, while the average per config-

66 Chapter 4. Results 48 uration is indicated by a larger blue dot. The multiple replications are largely different at high congestion which demonstrates the increasing variance of waiting times. Although the number of ships across replications remains equal, the average waiting times (over one month) varies from 5 h to 9 h, with an average of 6.5 h for u = 0.9. The solution time is rapidly increasing with congestion as indicated in Figure 4.4b (notice the logarithmic scale). The rise is caused by the increasing number of ships either expected to arrive in the planning horizon or waiting at the terminal (Figure 4.4e). In order to assess the nervousness of the schedule we measure the berth switch ratio, calculated as the number of times a ship gets a new location in the schedule (different from the previous), divided by the number of times the ship gets a location in the schedule (not counting the first time the ship enters the planning horizon). Figure 4.4c show how planning becomes more nervous with rescheduling in congested terminals. Higher congestion causes also a rising average deviation from the preferred position (Figure 4.4d). The preferred berth is indeed usually free in lowly congested terminals, while in highly congested terminals this is seldom the case Influence of Variance Variance is expected to make scheduling harder and to decrease performance. The reasons are twofold. First it becomes increasingly hard to anticipate and schedule events in the long run, as the event time uncertainty is too high (variance scales with the root of time). Second, since we only use periodic rescheduling (6 h), when executing, the schedule will be based on outdated information, and higher ratios of variances R v lead to larger deviations. Figure 4.5a clearly shows the effect of variability on waiting times. For low degrees of variance (until R v = 0.1) variance does not significantly exacerbate waiting times. For higher variance, waiting times are however quickly increasing. Important to notice is that the extra waiting times, are purely caused by extra uncertainty, as the average handling times (Figure 4.5c) or number of ships remain constant. The experiment suggests that there is a certain variance threshold, below which the amount of variance does not really matter, but above it starts increasingly harming performance. Also interesting is Figure 4.5b. The berth switch ratio increases, predictably, with increasing variance. More surprising is that for almost zero variance, the berth switch ratio still remains around 30 %, which is a consequence of the rolling horizon approach. As new ships enter the planning horizon, the planner often realizes it becomes more advantageous to move ships to other berthing locations.

67 Chapter 4. Results Waiting Time [h] Berth Switch Ratio Ratio of Variance [h] Ratio of Variance [h] (a) Average waiting time Handling Time [h] Ratio of Variance [h] (c) Average handling time Figure 4.5: Influence of Variance (b) Average berth switch ratio Influence of Positional Cost In the experiments described above we have set the positional cost by default to the equivalent of 1 hour waiting per berth deviation. In order to gain more insight in the role of the preferred berth we will adjust the objective to ( (A j t p )(b j A j + β ) l ij Z j i ) j V i B (4.3) with β a varying cost. At β = 0 the preferred berth is completely ignored, while at β the ship will always berth at the preferred berthing position (Figure 4.6d). As awaited, Figure 4.6a illustrates how a higher β results in longer waiting times (The 9 h waiting time at one replication for β = 0.1 is probably a statistical outlier). There is clearly a trade off between berthing at or close to the preferred position and having minimal waiting times. When interpreting Figure 4.6a we must bear into mind, that the preferred berths were assigned at random. If the preferred berth would be generated by a proactive robust schedule in advance, the effect of increasing β on waiting times would probably be less remarkable. We test this assumption: we first run the simulation for a specific set of long term arrival and handling times without variance, and determine the optimal berth location (not taking

68 Chapter 4. Results Waiting Time [h] Solution Time [s] Position Cost [h] Position Cost [h] (a) Average waiting time (b) Average solution time Berth Switch Ratio Position Cost [h] (c) Average berth switch ratio Position Deviation Position Cost [h] (d) Average position deviation Figure 4.6: Influence of positional cost Waiting Time [h] Solution Time [s] Position Cost [h] (a) Average waiting time Position Cost [h] (b) Average solution time Figure 4.7: Influence of positional cost with intelligently assigned preferred berths into account any preferred berths). In subsequent simulations, using the same arrival and handling times, but with variance, we set the preferred berth to the optimal berth found in the first simulation. We again vary the positional cost β, and evaluate effects on performance. In Figure 4.7a we see that the waiting times rise much less with increasing β, which proves the importance of a good robust schedule. High positional costs β have a positive effect on the stability and complexity of rescheduling.

69 Chapter 4. Results 51 Figure 4.6b demonstrates decreasing MILP solution times for higher β. The effect is even stronger in case of an intelligently assigned preferred berth (Figure 4.7b). As the scheduled berths are usually at or near the preferred berthing position, less alternatives have to be explored. For similar reasons Figure 4.6c demonstrates decreasing berth switch ratios for higher β Number of Quay Cranes To investigate the impact of the number of quay cranes, we must obviously use the QCBAP formulation. This require decisions on certain extra parameters. We assume that maximally 4 quay cranes can work simultaneously on one vessel. The handling times are lognormally distributed with mean 24 h and standard deviation of 6. If 3 quay cranes are assigned expected handling times thus have a mean of 8 h and standard deviation of 2 h (similar to the other experiments). We experiment with the number of quay cranes ranging from 9 to 16. The number of ships arriving is fixed over all configurations, and is chosen so that the terminal runs at 87 % of maximal crane capacity, if 9 quay cranes are available. This makes the terminal run at 49 % of crane capacity if 16 quay cranes are available. Figure 4.8a illustrates how an increasing number of quay cranes decreases the average waiting time effectively. Similarly handling times are reduced (Figure 4.8c), although the improvements are somewhat less striking. A reduced number of quay cranes, together with extra waiting ships makes scheduling harder and solution times rise quickly (Figure 4.8b). Figure 4.8d shows how globally the average scheduled number of cranes per ship rises with the increasing total number of cranes. A closer look reveals an interesting phenomenon: we see that for 13 cranes, all ships get assigned 4 cranes, while for 15 cranes, certain ships get assigned a lower amount. For 13 ships, if the other three ships at the quay get four cranes, it becomes advantageous to wait for one of the other ships to leave the quay and start with 4 quay cranes, instead of using only 1 crane to complete all operations (remember that in the schedule the number of quay cranes per ship is not allowed to change during handling). For 15 ships, 3 cranes are available if all other ships have 4 cranes and thus it becomes sometimes more advantageous to do not wait, but use only those 3 cranes 4. In Figure 4.8e, we notice how the average crane availability (defined as the ratio between current number of effective assigned cranes versus the scheduled number) rises with the total number of cranes. If operations were executed exactly as scheduled, crane availability would 4 The above reasoning is somewhat simplistic as or crane assignments could have been planned in advance, but apparently this turns out to be disadvantageous too.

70 Chapter 4. Results 52 Waiting Time [h] Handling Time [h] Number of Quay Cranes (a) Average waiting time Number of Quay Cranes (c) Average handling time Solution Time [s] Average Number of Cranes Number of Quay Cranes (b) Average solution time Number of Quay Cranes (d) Average number of cranes scheduled per ship 1.00 Crane Availability Number of Quay Cranes (e) Average crane availability Figure 4.8: Influence of the number of quay cranes be at 100 %. There are two reasons why this is not the case in simulations. First the presence of variance in arrival and handling times makes executed berthing times deviate from the scheduled times. Second, the way our execution works is slightly different from the planning. As explained in subsection 3.7.4, the ship berths as soon as the scheduled berth becomes free (assuming there are no other ships waiting for the same berth). Thus although the planner may postpone the berthing until quay cranes from another ship become free, this is ignored in execution and the ship is put immediately at the quay. This execution approach on one hand reduces port

71 Chapter 4. Results Waiting Time [h] Waiting Time [h] Planning Horizon [h] Planning Horizon [h] (a) Average waiting time for u = 0.9 and R v of 0.1 h (b) Average waiting time for u = 0.9 and R v of h Waiting Time [h] Planning Horizon [h] (c) Average waiting time for u = 0.75 and R v of 0.1 h Figure 4.9: Influence of planning horizon stay time, as the ship can already start operations with a limited number of quay cranes, but on the other hand leads to extra differences between schedule and execution. 4.4 Internal Parameters In this section we will investigate which values for the internal parameters are optimal for our rescheduling approach, and to a limited extent, the influence of external parameters on these optimal parameters. Unlike the external parameters, the influence of internal ones, is often subtle. The effects can be expected to be most visible at highly congested terminals. Low congestion acts as a buffer, as berths become often empty, which leads to lower long term effects and correlations in planning. As planning becomes easier, better planners may be harder to distinguish. We will therefore mainly use congested terminals. Simulating these congested terminals unfortunately requires long MILP solution times and one must also take the high variance of waiting times into account (Figure 4.4a).

72 Chapter 4. Results Planning Horizon The planning horizon is of crucial importance for rescheduling. Choosing a planning horizon too short will result in myopic decisions, while a horizon too long will render the schedule problem overly complex. Furthermore due to the large uncertainty, these scheduled locations and berthing times of ships in the far future will usually frequently be adjusted in rescheduling anyway. We will test planning horizons ranging from 6 hours to 72 hours. In highly congested terminals (u = 0.9 ) we see that both short planning horizons and long horizons have a negative impact on waiting times (Figure 4.9a). The optimal value lies at 24 h. Short planning horizons are disadvantageous for obvious reasons. The harming impact of long planning horizons is more complex and probably caused by three factors: suboptimality, uncertain far future ships and changed relative importance. First due to the high congestion, for the largest planning horizon (72 h), the problem gets overly complex and MIP gaps after 30 s of computations are very high (up to 30 %), resulting in suboptimal solutions. Second, long term planning horizons incorporate ships in the far future in the schedule while their arrival times are highly uncertain. In order to understand the consequences, we should compare the planning P s generated by a short planning horizon to P l, the one generated by a long planning horizon for an identical situation. We call S s the set of ships present in P s, while S l are those ships present in P l but not in P s. Assuming both schedules are optimal over their planning horizon, the sum of costs of ships in S s according to P s will be lower, or at least equal, than the sum of costs for S s according to P 5 l. The sacrifices made on ships in S s, will however be compensated by savings on S l, so that the sum according to P l is minimal. We must realize that this is only guaranteed if all ships would arrive at the expected arrival time and moor at the designated berth. In reality punctual arrival or completion times are rare and the rolling horizon will probably cause the location of ships to change, even if no variance was present. Both factors will degrade the effective savings on S l ships. An overly long planning horizon may degrade global performance, as the sacrifices made on S s may not be effectively compensated by savings on S l ships. Third the planning horizon due to Equation 4.2 affects the importance of the ship. In a 24 h planning horizon a ship j arriving in 23h, will have a relative importance of 0.04 compared to a ship currently waiting at the terminal, while for a 72h horizon the relative importance of ship j becomes The increased importance of ships in the far future may again harm performance as it further encourages sacrifices for uncertain rewards. 5 If the sum according to P s would be higher, the short term planning would not be optimal, as a better alternative exists for the ships in S s.

73 Chapter 4. Results 55 In Figure 4.9b we see that even for very low variance, large planning horizons do not increase performance, and causes even decreases (but smaller than for larger variance). The optimal planning horizon remains at 24 h. Figure 4.9c demonstrates the low impact of planning horizon on lowly congested terminals. As scheduling is considerably easier, even small planning horizons do not seem to harm performance Rescheduling The planning horizon tells how far to look in the future. The rescheduling period determines how often to generate a new schedule, based on updated information. Increasing planning horizon and decreasing rescheduling period both expand the computational burden of the rescheduling process. Intuitively (cf. subsection 2.3.2) one should expect high planning horizons to perform best under low variance and low rescheduling periods to work best under high variance. In this experiment we will test reschedule period values ranging from 1 h to 12 h. As Figure 4.5a indicated that variance only rises with increasing variance, starting from a R v of 0.1, we perform both tests with a normal (R v = 0.1 h) and high ratio of variance (R v = 1 h). We also check, whether similarly to the planning horizon, low congestion has a buffering effect. For normal variance we see in Figure 4.10a that shorter reschedule periods work better, although differences are not large (± 1 h). If we repeat the experiment with high variance we arrive at Figure 4.10b. This graph does not really allow to draw a reliable conclusion. First there is the issue that one replication suffers from gigantic average waiting times (up to 23 h), which disturbs the average over all replications. Second our common random number approach (with common long term arrival and handling times) limited variance within a replication, as long as the variance caused by the stochastic event process remained limited. For high ratios of variances, our common random number approach may prove insufficient. The consequences become clear in Figure 4.10c which displays the waiting times with the troubling replication omitted. The results suggest a rising trend with reschedule period, but with high variance. Actually either more replications or a common random numbers approach in the stochastic process is required to draw solid conclusions. The experiment in lowly congested terminals with high variance, suffers from the same issues. We see in Figure 4.10d again a rising trend but with much variance, and the effect is fairly limited (± 10 minutes).

74 Chapter 4. Results Waiting Time [h] Waiting Time [h] Reschedule Period [h] Reschedule Period [h] (a) Average waiting time for u = 0.9 and R v of 0.1 h (b) Average waiting time for u = 0.9 and R v of 1 h Waiting Time [h] Waiting Time [h] Reschedule Period [h] Reschedule Period [h] (c) Average waiting time for u = 0.9 and R v of 1 h (without replication 4) (d) Average waiting time for u = 0.60 and R v of 1 h Figure 4.10: Influence of rescheduling period Waiting Time [h] α [h] (a) Average waiting time Berth Switch Ratio α [h] (b) Average berth switch ratio Figure 4.11: Influence of fixed time buffer α Summarizing, we can conclude that small reschedule periods probably reduce waiting time. The results, due to high variance, do however not allow to reliably quantify the effect, or find a certain threshold from which extra rescheduling no longer improves performance.

75 Chapter 4. Results Fixed Time Buffers In subsubsection we introduced the BAP-MILP with fixed time buffers of length α regarding arrival and handling times. These extra buffers should make the schedule more robust: if the ship arrives somewhat late or handling time takes longer than expected, the schedule can still be executed as planned. We simulated the terminal with default parameters and the buffer α ranging from 0 till 4 h. In Figure 4.11a we see that extra time buffers cleary make the average waiting times rise. Furthermore the average berth switch ratio, a proxy for schedule nervousness, does not decrease (Figure 4.11b). Du et al. (2010) have also numerically found that fixed time buffers perform poorly. Therefore they propose a procedure to determine the right time buffer per ship, which requires unfortunately multiple iterations. We can conclude that a simple fixed time buffer is not sufficient to perform appropriate stochastic optimization. We will not perform numerical experiments with the scenario approach described in subsubsection In literature we find that creating schedules using multiple scenarios requires overly long solution times. Using simulated annealing, Du et al. (2010) needed almost 6 minutes to solve a problem with 20 ships. For MILP formulations, it becomes even worse, the MILP implementation of Zhen et al. (2011) ran out of memory for a similar 20 ship problem with only 5 scenarios.

76 Chapter 4. Results 58

77 5 Conclusion In this chapter we will summarize both implementation and results of this master dissertation. We continue with suggestions on how, based on our results and difficulties experienced, numerical simulations can be improved in the future. We also enumerate some open research questions and finish with possible applications for our simulation mechanism. 5.1 Implementation We implemented a simulation structure consisting of 3 parts: a stochastic process, a schedule generator and an execution mechanism. The stochastic process determines the evolution of expected arrival and handling times. The process generates for update intervals of arbitrary length, the remaining amount of work (expected time until the event), and as soon as the remaining work becomes zero, we know the event has happened. The stochastic process is based on gamma distributed variables and is designed to satisfy 5 requirements: invariance to the update interval, decreasing remaining work, variance going to zero as the expected event comes near, a closed expression for the PDF of the work performed and the expected amount of work performed in a certain time interval must equal the length of that interval. The schedules are generated by solving a MILP. We formulated two MILP s: one tackling only the berth allocation problem, and one integrating the berth allocation problem with the quay crane allocation problem. Both MILP s do not apply any form of time discretization into intervals. Possible extensions (stochastic formulations and extra constraints) to these models 59

78 Chapter 5. Conclusion 60 were also discussed. MILP formulations are usually outperformed in speed by heuristics, but have the advantage of delivering optimal results independent of the specific problem data at hand, and do not require any meta-parameter tuning. The executing component brings the arrived ships to the berths, as scheduled in the planning, effectively assigns the quay cranes, and removes completed vessels from the quay, to allow waiting ships to moor. Al three components were bundled together in a C++ program. At cyclic points in time, a new schedule, based on the most recent expected arrival and handling times, is generated. The execution component then takes decision based on the last generated schedule. Meanwhile both expected arriving and handling times are adjusted according to the stochastic process. 5.2 Results We distinguished between experiments on the impact of external (schedule method independent) and internal (schedule method related) parameters. Regarding internal parameters, we investigated the congestion level, variance, positional cost and the number of quay cranes. For the external parameters we varied the planning horizon, rescheduling period and the time buffers External parameters The amount of congestion had a profound impact on average waiting times. Moreover, the increasing amount of ships arriving, combined with the extra waiting expanded solution times exponentially. Congestion also made planning more nervous, and the average deviation from the preferred berth increased. High ratios of variance, above a certain threshold, increased waiting times and lead to extra nervousness. Even in the absence of variance schedule changes occurred, due to the rolling planning horizon. Increasing the cost of deviations from the preferred berthing positions made waiting times rise, but the schedule generation became easier and more stable. Using intelligent preferred berth assignment, limited the increase in waiting times, and caused extra reduction in solution times. Extra available quay cranes decreased both waiting and handling times significantly and

79 Chapter 5. Conclusion 61 enhanced crane availability. The average scheduled number of quay cranes, however, evolved in a more complex way Internal Parameters For the internal parameters conclusions were somewhat harder to draw, as the impact was more limited. Furthermore the highest effects are experienced in congested terminals, but these had high variance on average performance. The optimal planning horizon in congested terminals seemed to be 24 h for both low and medium variance. The planning horizon had little effect in lowly congested terminals. In terminals with medium variance lower reschedule periods improved performance. For higher variance results suggested a similar finding but the large noise on the results did not allow to draw firm conclusions. If performance in high variance terminals needs to be studied, more advanced variance reduction techniques are advised. The inclusion of fixed time buffers in the schedule harms performance. If one wants to account for variance, a scenario approach is probably more appropriate. We have not verified this numerically, as computational resources were limited. 5.3 Improvements In this master dissertation we have created the first, to the best of our knowledge, rescheduling mechanism in simulations for the QCBAP problem. For the implementation we kept the simulation as simple as possible for two reasons. First, as this was the first attempt to investigate this problem, we wanted to focus on the essential components, and not get lost in details. A simple implementation made analysis of results afterwards easier. Second we wanted to perform multiple experiments with only limited computational tools (i.e. a 1.8 GHz dual core laptop). Therefore too detailed or advanced scheduling techniques could not be used. In subsequent research, with probably more computational resources available, following items would certainly interesting to add: Proactive schedule: For simplicity we assigned the preferred berths at random. Assigning them by a proactive berthing schedule would probably improve performance and schedule stability, as was demonstrated in subsection Vessel classes: We implemented only fairly large vessels. Simulating multiple vessel classes (feeders, normal container vessels and megaships) with largely different handing times, maximum number of quay cranes per ship and priorities would make the simulation more realistic.

80 Chapter 5. Conclusion 62 Continuous layout: Because of the various types of ships with different lengths, it would then also make sense to implement a continuous quay layout, so that quay space is more efficiently used. Adjusting the QCBAP-MILP to a continuous layout is rather trivial (cf. section B.2), and even the execution component requires only minor changes. Complete common random numbers approach: If one wants to perform simulations with a high ratio of variance, it is advised to also implement a common random number system for the stochastic process (currently this is only available for the long term arrival and handling times). In this way noise on the resulting performance differences will be significantly reduced. In an ambitious project, with large computational resources, one could also include quay crane scheduling or even straddle carriers and yard planning. 5.4 Research Questions We have yet performed some exploratory experiments but numerous research questions remain yet unanswered: Best optimization method: In order to perform rescheduling what solution technique should used: genetic algorithms, MILP s, simulated annealing, custom heuristics,...? Also the formulation is probably important. How much does performance increase if the number of scheduled quay cranes is allowed to change? Is using a stochastic (scenariobased) formulation advantageous? Proactive scheduling: How important is a good proactive schedule, and what is the best technique in combination with a specific way of rescheduling? Appropriate variance: For most experiments we assumed the ratio of variance to be 0.1 h by default and in some experiment simulated other ratios. In current academic literature the intuition of the authors decides on the amount of variance. Du et al. (2010) use three categories of variance: low, normal and high, with standard deviations on arrival and handling times of respectively 1 1 h, 2 h and 3 h. Lu and Xi (2010) set the standard deviation equal to µ. Zhen et al. (2011) use scenarios of which the origin 3 is unclear. We believe it is worthwile to study more rigorously how uncertainty evolves over time, based on real-life data of container terminals. Accurate data allows first to estimate performance benefits more accurately and second also helps in deciding on optimal models. It is after all unlikely that a problem with high variance benefits equally from the same methods as one with low variance. 1 The values are averages, as in Du et al. (2010) the standard deviation per ship is drawn from a uniform distribution

81 Chapter 5. Conclusion 63 Outdated information: We always generated schedules based on the most recent updates of expected event times. How strong does using outdated information affect performance? What happens if there are no updates at all, and the terminal only sees if a container ship has yet arrived, or handling is finished? 5.5 Future Applications The integrated simulation and rescheduling method may prove useful in multiple applications: rescheduling experiments, robust schedule generation and container terminal design. First, quite obviously, the simulations may be used to assess and compare various rescheduling techniques or parameters. Second the simulations might be used to compare the quality of a robust schedule. The robust schedule has decided on a scheduled berthing time, berthing location and number of quay cranes. In rescheduling deviations from this home plan will be allowed, but at a certain cost. The robust plan with the lowest average cost 2 in multiple simulations is obviously the best choice. In this way the models proposed by different authors can be compared, and recovery costs can be estimated in a more reliable way. In a more advanced setup, the simulation results are integrated in the construction of the berth planning, and the home schedule is iteratively adjusted based on the outcome of simulations. A third possible application is the design of container terminals. When new container terminals are built, or existing ones renovated, a more life-like simulator may improve decisions on the right quay size, number of berths, number of quay cranes... 2 Other measure such as best worst case, lowest range, lowest standard deviation or combinations of these are, of course, also possible

82 Chapter 5. Conclusion 64

83 Appendices 65

84

85 ACode A copy of the code can be found at In order to run the program, Gurobi 6.5 and Qt 5.6 need to be installed. Figure A.1 provides a schematic overview of the classes in the project and the source files where they are defined. Figure A.2 visualizes the relation between all header and source files. The important classes Ship, QuayCrane, Schedule and Planner (with child class QC- Planner) are already discussed in subsection PerfInd records data on e.g. the MILP solution time or the waiting times of ships. The class (QC)Terminal bundles all information on container layout and via the schedule on long term arrival and handling times. Experiment encapsulates all the terminal parameters with the internal parameters: reschedule period, planning horizon, time buffers,... Experiment furthermore conveniently allows saving of simulation data via Saver. The abstract class MILP and child classes BAP and QCBAP, ensure the MILP problems are correctly solved using Gurobi. Visualization of operations, schedules and performance is provided by MainWindow, OperationalOverview, ScheduleOverview and PerformanceIndicators. All experiments using the BAP solver can be found in BAP.cpp, while those with QCBAP are in QCBAP.cpp 67

86 Appendix A. Code 68 Figure A.1: Overview of the relation between classes in the C++ solution Figure A.2: Overview of the relation between the files in the C++ solution