OPTIMIZATION OF SHIP CARGO OPERATIONS BY GENETIC ALGORITHM

This paper addresses the optimization possibilities of cargo operations onboard ship in order to minimize the operational costs through optimal structure of resources required. Since the setup model consists of composite objective function with several decision variables whose solution is constrained in the field Z+, the method for direct finding of optimal solution does not lead to satisfactory results. Therefore, for the solution of the problem a genetic algorithm has been developed, which yields an acceptable solution in a short time. In the given area of the possible solutions, the genetic algorithm, with variations of different crossover methods and mutation rates, gives a solution that coincides with the observed and expected results when operations of loading/unloading of general cargo ship are concerned. With the obtained structure of resources allocated in cargo operations, the minimum of operational costs is reached.


INTRODUCTION
The main cargo operations on the ship during her stay in the seaport are cargo loading and discharging.There are also operations that usually go together with and constitute cargo handling such us cargo stowing, securing against shifting in ship holds during the voyage as well as cargo marking per discharging ports.All these operations are linked together inside the cargo handling process on the ship.The sequence of cargo units arrival alongside ship ready to be loaded, service time of ship cargo cranes, forklifts and gangs of workers follow the known probability distributions.Hence, in this paper the assumption is made that the cargo operations (assessed from the ship aspect) can be defined through the application of the queuing theory.A similar methodology has been used in various scientific papers for modelling and resolving the problems of port operations planning, port capacities estimation and port investments planning which lead to positive advancement in direction of port cargo opera-tions optimization with the goal of minimizing the operational costs [7,8,9].The theory has also been successfully applied in modelling of port management decision-making process [10].
However, in the majority of scientific literature addressing the application of queuing theory to maritime industry, the subject in focus is the port and cargo operations assessed from the port aspect [5,9,2] whereas the ship is not defined as the queuing system.Moreover, the systems studied are defined as one-phase systems, while the cargo operations on the ship in port are carried out in more than one phase from the position alongside the ship till they are properly stowed in the ship holds.This paper examines the possibility of modelling cargo operations onboard ship as a multiphase queuing system, where the system is defined as multichannel, multiphase queuing system with the arriving general cargo units which pass through four handling phases onboard general cargo ship.The objective function minimizes the total operational and waiting costs taking into consideration the decision variables: optimal number of ship cargo cranes, number of forklifts in holds, and number of workers engaged in cargo securing and marking.
The problem that arises with such models and the search for their solution lies in the complexity of mathematical calculations and finding of the optimum due to composite form of the objective function which contains several decision variables and constraints in a large solution space.In the last two decades many scientific papers appeared in the field of operations research, proposing various optimization and solution search methods of composite functions.The majority of those methods rely heavily on the utilization of specific algorithms that resolve the given problems by computers through iteration of input parameters and evaluation of output values [3,16].The main factor here is the speed of calculation or the number of iterations that can be carried out within a time unit [13,17].The search methods are based on heuristic procedures and innovative algorithms suitable in most of the optimization models, particularly in stochastic and com-posite ones or models with incomplete or inaccurate parameters [14].It is worth mentioning that such methods are based on completely different assumptions in view of optimization modelling than standard mathematical methods that can be found in operational research literature [4,11,18].The problem of optimization of cargo handling resources while minimizing operational costs in this paper is solved by the application of a form of a genetic algorithm.
The next section describes the problem, followed by a mathematical model and genetic algorithm setting for the solution search.The model is tested with data of general cargo ship having six holds and five cargo cranes.The obtained results and model utilization are discussed together with its limitations and suggestions for further research.

THE PROBLEM
The problem in the process of planning the cargo handling onboard ship during the stay at the port lies in the organization and optimal utilization of the existing port and ship resources, i.e. ship cranes, forklifts and workers, with the objective of minimizing total operational costs.For the purpose of finding the problem solution, the process of cargo loading is divided into four operations: -cargo loading by ship cranes (implies cargo tacking alongside the ship and lowering cargo into hold or twin deck), cargo stowage (from the place on tanktop where slouched by crane the cargo is carried with forklift to the stowage place), cargo securing against shifting during the voyage (consisting of cargo lagging and chocking, cargo gripping and tightening), cargo marking (consisting of cargo separation for different unloading ports, rigging, painting and covering with sheets).
In the process of unloading, the operations are carried out in reverse order -removing separation and cargo securing material, moving cargo from hold corners to lift-on place on tanktop by forklifts, and cargo lifting by ship cranes.
Due to the tricky mathematical procedure of finding the solution of the composite objective function, in this paper the genetic algorithm is applied as a computer optimization model.This model uses optimization methods to reach a solution as close to the optimal one as possible.By means of a genetic algorithm the area of the optimal solution can be reached quickly, but for the solution convergence it may happen that many cycles of the function evaluation are needed, which may eventually disable achieving the optimal solution.To avoid this problem, different methods for determining rates of crossover and mutation will be applied and compared.
This kind of solution finding procedure contributes to model accuracy and efficiency in providing most favourable configuration (number of cranes, forklifts and workers) within the possible or given solution space, in conjunction with minimal operational costs.Standard methods of calculation, despite well defined cost function, due to the large number of input parameters and large solution space would require long and laborious procedure of calculation and in the end may fail to find a satisfactory result.

MATHEMATICAL MODEL
For analyzing cargo operations on a ship, as a queuing system, the following assumptions are made: -the commencement of loading/unloading cargo is planned but subject to random changes, -ship is an open system since the cargo entries are not part of it, -ship has several cargo cranes for which cargo loading queuing lines are formed on the wharf, -cargo units for loading are "patient clients", since as a rule they do not abandon queue, -the arrival rate of cargo is Poisson distributed which is determined by c 2 statistical test, -service time follows exponential distribution.
The input flow of cargo is stationary Poisson flow with the following properties: time independence property (general cargo units are loaded into the ship one by one), "no memory" property (arrivals of cargo units are independent) and stationarity (intensity of the cargo flow does not depend on the moment since it is value-dependent only on the length of the observed period).
For the selected queuing system of cargo operations onboard ship, the arrival rate l represents the average number of general cargo units arriving alongside the ship during an observed time unit (e.g. during a year, month or day).Generally speaking, the average number of general cargo units that can be served at a ship in a time unit is service rate m.The ratio between the arrival rate and service rate of cargo quantity is the traffic rate or utilization factor r, which is the traffic intensity of the ship.Based on the definition of cargo operations on ship as a queuing system and its basic parameters, the operation indices can be computed.According to the queuing systems classification, the cargo operations on ship is the queuing system with more than one service places and unlimited number of cargo entities in queue, with Kendall notation M/M/S/¥.
As already stated, when handling cargo onboard ship four operations run simultaneously representing a multi-phase queuing system.Each of the phases corresponds to a separate queuing system with different service places.In the first phase the arrival rate is total cargo units that need to be loaded on the ship, and service places are ship cranes.Since the entire cargo loaded into a ship is to be stowed in holds, in the second phase, the arrival rate is the same as in the former phase, while service places are forklifts in the ship holds that stow loaded units of cargo.In the third phase the service places are workers who secure cargo, while in the fourth phase the secured cargo is marked for different recipients, where servicing chains are represented by another group of workers.As mentioned, the whole cargo loaded into the ship is to be stowed in holds, output from the former phase is input to the consecutive phase of the multi-phase queuing system, i.e. all four phases have equal arrival rate l ("equivalence property" of multi-phase queuing system).Furthermore, for all four phases of this queuing system the valid assumption is that the arrival rate has Poisson and service time exponential distribution, where m i is the service rate of the phase i, i=1,2,3,4.
Service rates for all service places in the same phase are assumed to be equal.
In the model setup the following notations are used: S i -number of service places in phase i, i=1,2,3,4; r i -traffic rate of phase i, i=1,2,3,4; r i = l/m i y i = r i /S i -coefficient of system occupancy; condition of queuing system stability (statistical equilibrium) is the following: y i <1, i=1,2,3,4.p ni -probability of n units waiting for phase i, i=1,2,3,4 From the condition p p probability p 0i of no units waiting on phase i, i=1,2,3,4, can be calculated, as well as all probabilities p ni for n³1.Now we have [20, p. 355] and if r i ³S i then due to divergence of the above series p 0i =0, implying p ni =0 for each other n.Therefore, in case r i ³S i queue increases infinitely with time, so that the condition of queuing system stability is: L qi -average number of units queuing for service in phase i, i=1,2,3,4 L -average number of units in the queuing system in phase i, i=1,2,3,4 The problem is to determine the number of required service places in all four phases with constraints in the solution.In order to develop the formula to estimate the optimum number of service places in each phase it is necessary to set up a four-phase model with the objective of minimizing the sum of the expected total service cost C s and the expected total waiting cost C w : The expected total service cost is: where C i is the service cost per time period for each service place in phase i, i=1,2,3,4.
If the function of waiting cost per one cargo in time period is f i (n), i=1,2,3,4, and the number of cargo units waiting on each phase is n, then under the assumption that f i represents linear functions, it follows: where C wi are the expected waiting costs per time period for each cargo unit, for phases i=1,2,3,4.
Considering the above expressions, the expected total waiting cost is: Inserting the derived expressions ( 7) and ( 9) into function (6) we get: where the input variables are: and the decision variables: S 1 , …, S 4 .

PROBLEM SOLUTION AND RESULTS ANALYSIS
In the cases of constrained optimization problems of composite objective functions with a number of decision variables in a large solution space, the direct search methods often fail to produce a satisfactory solution.In the research conducted, a mathematical solution of finding the minimum cost configuration, even supported by a high level application such as Mathematica failed to produce the results as expected.Therefore, the optimal solution has been derived by a model which implements the genetic algorithm.Using the objective function, input parameters and constraints, the model seeks optimal resource configuration in order to minimize the operation costs.
In the first step, the decision variables should be encoded into the binary strings.For this purpose, 8 bits one-dimensional array is used to represent a variable.On the basis of the real example of the general cargo terminal (see Table 2) the constraints are: The population of each generation consists of 20 randomly generated chromosomes.Taking that the total length of a randomly generated chromosome K 1 is 32 bits: 10100110 11001110 01001011 10110010, then the calculated corresponding values are given in Table 1.
The mapping from a binary string to a real number for variables S 1 , …, S 4 is accomplished as follows: where S i ' is the decimal value of the substring for decision variables S 1 , …, S 4 .
The initial population G i is formed around randomly generated chromosomes in the following configuration: In the first generation, after initial calculation, chromosome K 11 shows the best (Eval(K 11 )= =702841.509),whereas chromosome K 19 the least fitness to create offsprings (Eval(K 19 )=0.000).
The next step after evaluation is represented by a process of creation of a new population from the present generation by reproduction, crossover, and mutation.For the purpose of reproduction, the chromosome with the best fitness and the one with the second best fitness are used to go further to the next generation.From the first generation these are chromosomes K 11 and K 14 .For the selection purpose, the cumulative probability method is used, according to which the cumulative fitness evaluation of the whole population (N is the population size) should be assessed by: then the selection probability P i for each chromosome is calculated by the equation: ) Finally, the cumulative probability Z i for each chromosome is given by: The output of calculation for each chromosome is represented in the form: P 1 =0.014;Z 1 =0.014; … ; P 20 =0.055; Z 20 =1.000.
Single point crossover type is taken in the process of crossover, which makes random addressing of parents' genes (bits).The algorithm for this purpose is specified through five steps: 1. Generate a random number m in the range [0,1].

If
be the parent one.3. Repeat step 1 and 2 to reproduce parent two.4. Generate another random number m' from the range [0,1].If m' is less than the chosen probability of crossover execution (if 1.0 is chosen, then the crossover will certainly happen), then crossover will continue, and the point is selected behind the gene (bit) whose place is the nearest integer greater than or equal to m'×(32-1).5. Repeat step 1 to step 4 nine times to finish the whole crossover.In the process, the population of 18 chromosomes was produced in each generation.
In addition, two reproduced chromosomes, the one with the best fitness K 11 and the one with the second best fitness K 14 are allowed to go further to the next generation intact.Consequently, each population will consist of 20 chromosomes, because each pair of parents produces one new pair.For example, if m'=0.72 then the crossover point equals 23, meaning that the first 23 bits are taken from parent 1 and the rest from parent 2, thus creating new chromosome 1.New chromosome 2 is created in the way that the first 23 bits are taken from parent 2 and the rest from parent 1.parent 1: 10100110 11001110 01101011 10110010 parent 2: 10010100 01110111 00100001 11001000 new chromosome 1: 10100110 11001110 01101011 11001000 new chromosome 2: 10010100 01110111 00100001 10110010 After selection and crossover a new population is generated.Thereafter, the mutation process is applied to the whole population which iterates one or more genes equivalent to the mutation rate.The rate chosen here is 0.01 and the assessment algorithm is: 1. Generate a sequence of random numbers m j (j=1, …, 640).The number of bits in the entire population is 20×32=640.2. If m i =1, change the i-th bit in the entire population from 1 to 0 or vice versa.3. The reproduced chromosomes are not subject to mutation.
After initial iteration of genetic algorithm a new population is created.For the purpose of this paper, the process is repeated 40 times, meaning 40 generations are created.After the final processing of the input parameters, the genetic algorithm (GA) produced the results given in Table 2.
To accomplish the calculation on the basis of the GA algorithm, a structural application in programming language Matlab has been created.After 40 generations, the processing time to reach the results amounted to less than 2 seconds on processor AMD 1800 MHz.It is important to point out that after 18th generation the output was very close to the final GA solution as shown in Figure 1.
The entire process of calculation has been tested with the method of single point crossover, as well as some other methods, such as double point crossover and equalized crossover.The shown crossover outperformed other methods in the selection and evaluation for offspring creation in new generations.Furthermore, in the process of mutation, various mutation rates have been attempted and finally the 0.01 rate lead to the best algorithm performance.
In the given solution space, GA found the optimal solution (minimized total operation cost) with the configuration of four ship cranes serving four or five holds.There are four forklifts for cargo handling, one in each hold worked.In case that the fifth hold is worked, one of the forklifts would be transferred to that hold.If the solution space in the third phase is in the range of 3-18 workers, taking that in each hold worked there is a group of three workers for cargo securing, GA gives the solution of 9 workers.This could be explained with three workers being engaged in three holds and transferred to the rest of holds as necessary.Assuming that in each working hold two workers are engaged on cargo marking, amounting in total to 12 workers, the GA solution for the fourth phase gives three workers which are transferred from hold to hold as may be necessary for the purpose of marking cargo per discharging ports.
The solution obtained by the genetic algorithm is in line with the observed and expected results considering loading and/or discharging ship operations during her stay at port.

CONCLUSION
The process of cargo operations onboard ship during her stay at the port has been addressed in this paper.The process consists of more interdependent operational phases that are linked together.Cargo loading on the general cargo ship by means of ship cranes, cargo stowing, securing and marking should be carefully planned and synchronized through operational plans with the aim of operational costs minimization.The results of this research indicate that the process could be defined as multiphase queuing system, so the queuing theory was used for setting the objective function whose solution gives the optimal number of ship cranes and forklifts in operation, as well as optimal number of workers in use, yielding minimal cargo handling costs.
Since the derived objective function is composite and comprises several variables and constraints in the large solution space, direct solution search failed to provide satisfactory results.Hence, for the purpose of solving the problem, a genetic algorithm has been set up which generates acceptable solution in a short time.
In the given space of possible solutions the genetic algorithm, with variations of different methods of crossover and mutation, gives the results that match the observed and expected ones considering loading/unloading operations on the general cargo ship.With calculated structure of resources allocated in cargo operations multi-phase system, the minimum of operation cost is achieved.
In further research it is recommended to find a solution of objective function by forming a larger starting population of genetic algorithm or defining the structure of given system with a larger number of genes in chromosome.Furthermore, the usage of certain innovative heuristic methods in crossover, selection and mutation procedures could generate even better results.Alternative procedures that might be used here, as in some other optimization problems, is the hybrid computational model.This model uses the genetic algorithm supplemented with additional optimization method for obtaining an even better solution.The area close to optimality can be reached quickly by the genetic algorithm, after which, for reaching convergence, the next optimization method is used which is faster and more effective in the process of finding a constrained optimal result.For the mentioned purpose, a structural algorithm of solution search can be used which will minimize the function with linear constraints.