In this study, the GA provided in the MATLAB 2012b Global Optimization Toolbox is used but modified for the current problem. This version of GA has the capability to solve mixed integer nonlinear programming problems and has been used in Kaveshgar et al. (2012).
The overall GA framework is shown in Figure 5.2. Before GA starts, two lower and upper bounds are calculated for the task numbers and the number of tasks that can be processed by each equipment (see Section 3.3 for more details). In order to reduce the computation time, a two-stage heuristic is used to create a high quality initial solution for the GA. The initial solution has two parts. The first part is used for the first stage of the problem (quay crane scheduling) and is based on the S-LOAD rule proposed by Sammarra et al. (2007). The second part is used for the second stage of the problem (yard truck scheduling) and is based on a heuristic proposed by Bish et al. (2005) and used in (Lee et al. 2008). Bish et al. (2005) showed that their heuristic finds the optimal
it could only find near optimal solutions for multiple QCs. We extended Bish’s look- ahead rule to work for multiple QCs. It is essentially a greedy algorithm. Below we first explain how the look-ahead rule work and then explain the improvement we made to it.
Let iq,j,q=1,2 and j =1,2,...,n denote the jth task in the task sequence of quay
crane q. Each task is represented in terms of its traveling time between the ship and its location in the storage yard area. Each vehicle that arrives at the ship area looks for the earliest task (container) that is ready to be picked up. When there are multiple QCs, it may happen that multiple tasks are ready at the same time. In Bish et al. (2005), a weight is assigned to each task and the truck picks the task with the highest weight. If each QC q
has
l
q tasks, letp≤l
q be a fixed number and a weight is assigned to each task q j q fork l i , , =1,..., as follows: { }∑
+ = = j plq j k qk j q i w, min , , (5.21)The weight represents the minimum required time to finish the remaining tasks on QC q’s list and depends only on the travelling time between the ship and the containers’ location in the storage yard area. The calculated weight in Equation (5.21) does not consider the QC completion time in the first stage. In the case of multiple QCs, it would be better if the YTs were to serve the QC that has a longer makespan and that makespan is the completion time for both stages of the problem. Thus, we have modified Equation (5.21) to give a higher priority to the tasks that belong to the QC that has a longer makespan. Specifically, i is modified to include the processing time for both stages. The makespan of each QC is approximated by combining the QC completion time (obtained from the initial solution for the first stage) and YT traveling time.
The initial solutions were used as one of the individuals in the GA initial population. The remaining ones were generated randomly but the specified lower and upper bounds were applied when generating them. In Step 2, the objective function value for every individual was calculated. These values were stored for creating the next generation. Until the stopping criteria are met (step 3), the GA algorithm continued with the creation of new generations (step 4) and repeated the process starting at step 2. The process for creating the next generation is explained in Section 3.3 of this dissertation.
5.3.1 CHROMOSOME REPRESENTATION
In each generation, GA creates a population of solutions. Each solution is called a chromosome and each gene represents a decision variable. The chromosome used for representing the solutions in this study is composed of two sections as shown in Equation (5.22). The first section represents the solution for the first stage (QC scheduling). It consists of three kinds of genes: Xs are the sequence of tasks assigned to the quay cranes,
Ks represent the number of tasks assigned to the quay cranes, and finally Hs represent the movement direction of each quay crane (ascending or descending). As mentioned previously, solutions with unidirectional movement of the quay cranes are optimal or near optimal in most of cases and highly reduces the computational time of the solution method. Thus, here, cranes are limited to unidirectional movement. The second section of the chromosome represents the solution for the second stage of the problem (YT scheduling). It has the same elements as the first section, except for the Hs. Xs represent the sequence of tasks assigned to the YTs and Ks represent the number of tasks assigned to each YT. ] ... ... [ 1 2 2 1 1 1 1 2 1 2 1 2 1 2 2 1X Xn K K Km H H Hm X X Xn K K Km X s = (5.22)
Figure 5.3 shows a sample chromosome of a problem with 4 tasks, 2 quay cranes, 6 containers and 2 trucks. Tasks (container groups) 1 and 3 are assigned to the first quay crane and tasks 2 and 4 are assigned to the second quay crane. The third part of the chromosome indicates that both quay cranes will move from left to right (in ascending
order). Section two indicates that tasks (containers) 1, 3, 2 and 4 will be transported by the first YT, and tasks 5 and 6 will be transported by the second YT.
QC No. Task sequence YT No. Task sequence
1 1, 3 1 1, 3, 2, 4
2 2, 4 2 5, 6
Figure 5.3 Chromosome representation.
By defining the lower and upper bound on the decision variables we can further reduce the number of decision variables. The first stage has three different kinds of genes and each kind has a unique lower and upper bound. The first part of the lower bound for section one (QCs) is defined based on the locations of the tasks and quay cranes. Since quay cranes share the same track and when two or more quay cranes are assigned to a vessel, the first quay crane on the left is the only one that can process the tasks located on the first ship bay (left most tasks).
The lower bound of the first (n-(m-1)) genes of the section one of chromosome is 1. The next (m-1) remaining genes’ lower bound is 2, 4, 6,… , m. The skip in number represents of safety margin between the quay cranes (one bay is used in this study). The lower bound for all the genes in section two is equal to 1.
Part one Part Two
Section one (QCs) Section two (YTs)
Partone PartTwo
The upper bound of the first (n-(m-1)) genes of section one, is set to n-2(m-1), n- 2(m-1) + 2, n-2(m-1) + 4, ...; for the remaining genes of section one and all genes in section two the upper bound is the total number of tasks.
The lower bound of the second part of the chromosome for both sections is set to one task for each equipment (QC or YT) and the upper bound is calculated using the procedure described below:
Step 1. Start by arranging the processing time of tasks in an ascending order (set Q)
Step 2. Set ,
Step 3. Set (5.23)
Step 4. Rearrange the tasks in a descending order (set G)
Step 5. Set (5.24)
If stop and set upper limit=i; otherwise, set i=i-1 and go to step 3.
The above procedure would set a limit on the maximum number of tasks assigned to equipment. The tasks are arranged in an ascending order according to their processing time. The algorithm finds the maximum number of tasks that could be grouped together and be assigned to a QC or YT such that its total processing time is not greater than the processing time of the longest task. The number of tasks identified for the group is the maximum number of tasks that can be assigned to a QC or YT.
If the precedence relationship between tasks is not satisfied, then the tasks will be swapped. The GA in MATLAB could create identical values for two genes in the first section of the chromosome. To overcome this shortcoming, we coded a function to validate the chromosomes.
1 + − =n m i
∑
= i Q a 1∑
− − − = ( 2) 1 k i n G b a b>5.3.2 EVALUATING THE GA OBJECTIVE FUNCTION
The objective function is a unique part of the GA and must be developed based on the particular characteristics of each problem. The developed objective function in this study simulates the container unloading operation and calculates the makespan. It consists of a set of procedures that are repeated until all the tasks are processed. These procedures involve selecting the equipment (QC or YT) with the earliest ready time. The equipment would then process task in its schedule, taking into account operational constraints like interference (if it is a QC). If the equipment needs to wait (e.g. QC has to wait for the YT to deliver the container) then a waiting time is added to that equipment ready time. The equipment with the minimum ready time will be the one selected next to process a task. These steps are repeated until all the tasks (containers) are stored in the container yard. The following sections explain how the operational constraints are accounted for in the determination of the objective function value.
Avoiding interference
The location of each quay crane, the starting and finishing time of each task, and where each quay crane is working is tracked by the objective function in GA and stored in a matrix data structure. Each time a quay crane needs to start processing a new task on a bay different from the crane’s current bay location, it would check the tasks on adjacent bays (to the left and right of the new task’s bay). If there are tasks being performed by a different quay crane that interferes with its movement, then the finishing time of those tasks is checked. If those tasks are not complete, then the current quay crane needs to wait; otherwise, it may move to the next task’s location and start the unloading or loading operation.
QCs’ positions
Each quay crane has to maintain its initial and final position, and each time a quay crane performs a task it has to reevaluate its position and set a destination according to its work schedule. The travel time is determined according to the positions and destinations of the quay crane. Based on the current location of the quay crane, the location of the task it will perform next, and the location of other quay cranes, four different destinations are possible: (1) quay crane travels to its assigned task and processes that task, (2) quay crane needs to wait to avoid a collision with another crane and then traverses to its next task location, (3) quay crane remains idle and will stay at its current position, and (4) quay crane remains idle, but needs to move in order to avoid a collision with adjacent quay cranes.
YTs’ travel time
YTs have to get the containers from the QCs and transport them to the YCs in the yard. Every time a truck transfers a container from a QC to the yard area, a value equal to the travel time is multiplied by two and the yard crane operation time is added to its current ready time. If the truck has already reached to its final task in its schedule then only one travel time and yard crane operation time is added to its current ready time.
Makespan time and blocking
The quay crane’s completion time is calculated based on the processing time of the tasks (Pi), the travel time according to one of the four different possibilities stated above, and the delay caused by the YT serving that quay crane. The following example illustrates how a crane’s completion time is calculated.
Figure 5.4 Illustration of how quay crane’s completion time is determined.
Consider the scenario shown in Figure 5.4 that has 3 quay cranes and 6 tasks located on bays 1 to 6. Tasks 1, 3 and5are currently being processed by cranes 1, 2 and 3, respectively. Cranes 1 and 3 next tasks are tasks 2 and 6according to their schedule and the second quay crane is done with its assigned tasks after completing task 3. If crane 1 finishes its task earlier than cranes 2 or 3, or crane 2 or 3 need to wait for a truck to deliver the container, due to the one bay safety margin, it is not possible for the crane 1 to perform task 2 until task 3 is finished as well as task 5 because crane 2 needs to move over to bay 4 in order for crane 1 to be in bay 2. After crane 2 finished processing task 3 and relocated to bay 4 then crane 1 can start task 2 and the total completion time of crane 1 after processing task 2 is computed as follows:
1 2 2 3 2 1 max{C ,C } P l l C = + + − (5.25)
As shown in the above example, any possible interference between the quay cranes and delay caused by YTs is checked and considered in the objective function. The makespan is set as the maximum completion time among all quay cranes.
5.3.3 STOPPING CRITERIA
Different stopping criteria could be specified in MATLAB GA. In this study the following stopping criteria are used:
• Generations — the algorithm stops after reaching a certain number of generations.
• Stall generations — the algorithm stops if the weighted average change in the objective function value over Stall generations is less than Function tolerance.
• Function Tolerance — the algorithm stops when the cumulative change in the objective function value over Stall generations is less than or equal to the Function tolerance (1e-6) over the stall generations limit.