Prediction of Ship Traffic Flow Based on BP Neural Network and Markov Model

This paper discusses the distribution regularity of ship arrival and departure and the method of prediction of ship traffic flow. Depict the frequency histograms of ships arriving to port every day and fit the curve of the frequency histograms with a variety of distribution density function by using the mathematical statistic methods based on the samples of ship-to-port statistics of Fangcheng port nearly a year. By the chi-square testing: the fitting with Negative Binomial distribution and t-Location Scale distribution are superior to normal distribution and Logistic distribution in the branch channel; the fitting with Logistic distribution is superior to normal distribution, Negative Binomial distribution and t-Location Scale distribution in main channel. Build the BP neural network and Markov model based on BP neural network model to forecast ship traffic flow of Fangcheng port. The new prediction model is superior to BP neural network model by comparing the relative residuals of predictive value, which means the new model can improve the prediction accuracy.


Introduction
Ship traffic flow is composed of ships and other water transports. In order to establish the actual vessel traffic flow characteristics model to reveal the effects of changes of regularity and other factors, it's important to research the basic characteristics with time and space. The distribution regularity of ship arrival and departure is the basis research of vessel traffic flow, channel capacity, vessels accident analysis and whether the channel dimension is reasonable. The distribution regularity research of Tianjin port main channel and Xijiang River waterway obey normal distribution [1][2]. Studies on container ship to the port and Jinzhou Yangtze River Bridge waterway fit Poisson distribution [3][4]. ZHANG Huai Hui demonstrates that the distribution law of ships to port obeys the binomial distribution by mathematical statistics, the mathematical and physical meanings are clear and afford to the objective law, the binomial distribution matches the truth, the Poisson distribution is a similar method of the binomial distribution [5] The distribution model varied because of characteristics of port and waterways .Currently there is no a uniform distribution model to describe the ship regularity. In this paper, we fit the data using different statistical distribution models and finally get the optimal distribution model.
Accurate forecast of ship traffic flow is the key to maritime traffic control and induced. How to accurately forecast traffic flow has been a hot research scholars. For years, experts and scholars established a variety of forecasting models and methods, such as the historical average, time series, regression analysis, Karman filtering, etc. [6].These traditional prediction methods are basically carried out by ways of mathematical statistics and the prediction accuracy is low and does not have the selflearning ability. BP artificial neural network is a network in a classical algorithm and it itself has a strong nonlinear mapping and self-learning ability to improve prediction accuracy. However, this model has two drawbacks. First, it's easy to fall into local optimal solution. The second is the convergence speed is slow, which will lead to decline the prediction accuracy. Scholar modelled models to improve Prediction accuracy including the methods of BP (Back Propagation) neural network optimized BP neural network based on modified particle swarm optimization algorithm and nonlinear time series based on BP neural network [7][8][9].
Markov chain is a stochastic discrete process in mathematics which has the Markov properties. With a given knowledge or information, the past (previous status) is irrelevant to predict the future (future status).Scholars established gray Markov chain model to predict traffic volume, which could get a better prediction accuracy to meet the requirement of short-term forecast [10][11]. LI Huai Jun combined exponential-smoothing-Markov short-term traffic flow forecast method, which could solve the problems existing in exponential smoothing and improve forecast accuracy [12]. Yan Qi proposed a stochastic approach, Hidden Markov Model (HMM), for short-term freeway traffic prediction [13]. Some researcher combined BP neural network theory and Grey DOI: 10.1051/ 0 (2016) matecconf/201 MATEC Web of Conferences neural network with Markov theory to improve the prediction of annual runoff variation [14][15]. WANG Yi Fan incorporated the Markov chain concept into fuzzy stochastic prediction [16].
However, the gray model is only available for a strong exponential sequence, which can only describe monotonous and mutative process, it does not apply to non-monotonic sequence or swing development saturated S-shaped sequence. The size of the ship traffic is closely related to the weather, freight volume, sea conditions and so on, so the trend of ship traffic flow will not necessarily exhibit exponentially. In this paper, BP neural network model and Markov chain model will be combined to improve the short-term ship traffic flow.

Distribution model and hypothetical test
The regularity distribution model divided into normal, Poisson, binomial, negative binomial, logistic, gamma (Γ distribution), t-Location Scale, Waybill and so on.

BP neural network
BP network is based on Back Propagation algorithm for Multi-layer feed forward neural network FNN , which was first proposed by Rumelhart and McClelland in 1985. It is currently the most widely used and the most powerful of an artificial network. The algorithm learning process is consists of the forward propagation and reverse propagation. In the forward propagation process, beginning from the input layer input information pass to the layers, after treatment then produces an output, and get an error of the output to the desired output. Another again to reverse the spread of computing, from the output layer to the input layer, using forward error propagation obtained connection weights adjusted layer by layer, making the desired network output close to sequential output.

BP neural network modelling steps
1) Determine the network structure: Determine the network layer, the number of neurons within each layer and excitation function.
Input layer is i, Hidden layer is j and output layer is k.
2) Initial values to the connection weights w ij , w jk and neuron threshold θ j of Neural Networks. At the same initialization sample data, set the minimum error E, learning rate η, the maximum number of training n.
3) Calculate the hidden layer network output and actual output according to the input samples.
Hidden node output: Output node output: 4) Calculate the total error of actual output and the desired output: where, N is the number of samples, e u is the error of actual output and the desired output, u is the sample number. If the error meet the requirements, then end the training, or continue. 5) Repeatedly adjust the weighting value of each neuron, making E to achieve the error range requirements by repeat steps 3 to 5.

Markov prediction model
Markov chain predictions is a method which based on the initial status probability vector and the status transition probability matrix to speculate about the future status of a certain period of a variable. This theory is based on Markov process, which describes the dynamic process of a random time series.

Markov prediction model status division
According to Markov chain sequence data into a plurality of different statuses, which are represented with E 1 , E 2 ··· E m . The status transition only occurs in t 1 , t 2 ···t m .

Status transition probability matrix
The transition probability of Markov chain with the status of E i through k step transition to status E j is represent by where: M i is the total number of status E i appears, m ij (k ) is the times of status E i through k step transition to status m is the number of status division. Then the first step in the status transition probability matrix as follows: Repeated use of C-K equation (Chapman Kolmogorov equation), then the k-step transfer probability as follows.
Set the initial vector of a variable in the initial status E i as P (0) , the status vector after k steps transfer as follows.

BP neural network and markov forecasting model
Firstly, instruct the BP neural network model, reach conclusion of prediction sequence derived from the actual sequence, and get the Relative residuals. After the residuals is classified to [0,1], the classified relative residuals is placed under the status division, and then calculating the status transition probability matrix, therefore predicting the future trends.  (10) where, X(t)is the actual sequence of values, ) t ( X is the predicted value sequence, X(t) is the relative residuals. X is an element of the x(t), x min is the minimum element of the x(t), x max is the maximum element of the x(t), x is an element of the x(t) which is classified.
3) Calculate the status transition probability matrix. 4) Prediction. The status vector after k steps can be obtained by Equation (8), in order to determine the status interval in which the k steps is, thereby obtaining a final prediction.

Data sources
Gather the number of ships entering and leaving the Fangcheng port channel from October 2014 to September 2015, and use the samples to analyse the regular pattern of vessel entering the port of Fangcheng port.

Statistical analysis
The statistical characteristics of each vessel traffic flow of Fangcheng port are shown in Table 2.

Hypothetical test
Less than three vessels berthing in Channel 1 everyday, the data of into port obey negative binomial distribution(r=0.97,p=0.26). The data of out port obey negative binomial distribution(r=1.11,p=0.29). There are about 21 vessels inbound and outbound in channel 2 everyday. When inbound , its distribution obey t-Location Scale Distribution(u=20.64,σ=9.28,v=6.38) and Logistic Distribution(u=23.96,s=3.90),but its divergence 14.741<16.938,So t-Location Scale Distribution is superior to Logistic Distribution, when outbound, its distribution obey t-Location Scale distribution (u= 20.05,σ=8.70, v=4.83).

Prediction of ship traffic flow
For convenience the data of the first 12 days of 12 months are used to evaluate the performance of the proposed vessel traffic flow forecasting scheme. The first 11 data points are used as the training sample, while the remaining 1 data points are employed as the testing sample for measuring forecasting performance of the proposed model. Data are shown in Table 3.

BP neural network forecast
Set up BP neural network forecast model, input layer i=24, hidden layer j=10 and output layer k=12, Training times is 5000 and the error is 5%.The result of prediction see Table 4.

Analysis of distribution regularity of ship arrival and departure
By chi-square test, the data of Channel l obey negative binomial distribution, the data of Channel 2 and 3 obey t-Location Scale distribution, the data of main channel obey Logistic distribution.  Table 5 shows that the use of the prediction model of BP neural network and Markov chain to forecast vessel shortterm traffic flow, which can reduce the relative residuals from -15.21% and -33.38% to 7.29% and 5.48%. The absolute value of the prediction error is less than 10%.The model can improve prediction accuracy.

Conclusion
The results of Fangcheng port shows that the distribution regularity of ship arrival and departure may obey few of distribution models. In this paper, we use a variety of distribution models to fit the data, avoiding the error caused by one fitting. The prediction accuracy of short-term ship traffic flow is great significance to ensure the safety of navigation, efficient use of resources and reduce maritime accidents. This paper setup a prediction model based on BP neural network and Markov Chain to improve the prediction accuracy of short-term ship traffic flow. The empirical study indicates that using this method can achieve forecasting accuracy improvement feasible. This paper only forecast the ship traffic flow from the macro and did not consider the impact of other factors, such as weather, sea conditions, and policies and so on. In the future studies, we can put these factors into consideration to design a more efficient traffic flow forecasting model.