Abstract

Long waiting time at railway level crossings poses a risk on the safety and affects capacity of rail and road traffic. However, in most cases, the long closing time can be prevented by reducing the time lost at a railway level crossing. The emphasis of this study is to present a numerical optimisation algorithm to reduce the time lost per train trip at a railway level crossing. Thus, attributes with the highest impact on the railway level crossing closing time were extracted from the data analysis of rail-road level crossings on the southern corridor of the Western Cape metro rail. Powell’s optimisation algorithm was formulated on the minimisation of the time lost at the railway level crossing per trip. Thus, time lost is constrained by the technical and train’s traction constraints. The upper and lower bounds of Powell’s algorithm were defined by the threshold closing time in addition to the actual and expected probability density functions. The algorithm was implemented in Matlab. Furthermore, the algorithm was trained on 8000 data sets and tested on 2000 data sets. The developed algorithm proved to be effective and robust in comparison to the current state of railway level crossings under study. Thus, the algorithm was validated to reduce the time lost at the railway level crossing by at least 50%.

1. Introduction

A railway level crossing marks a point of shared responsibility between rail and road transport. Both modes of transports have different operational characteristics, but first preference is given to the railway because of its operational complexities. There is a growing concern of unsafe human behaviour at the railway level crossings due to the long closing time of gates on the passage of the train [1]. In addition, the presence of railway level crossings increases the train’s travel time in the network, thus constraining traffic capacity. This is often attributed to the imposed speed restrictions as well as train’s scheduled stops. Moreover, long waiting time is inevitable in the case of increased railway traffic heterogeneity and volume. Furthermore, a train travelling at the speed significantly lower than the maximum permissible speed results in activation being triggered at the same point as when the train is travelling at the maximum permissible speed. Therefore, a train with slower speed increases the closure duration [2, 3]. Thus, triggering of the railway level crossing from far tends to result in the slower train spending more time over the entire crossing section. As a result, long waiting time poses safety and capacity risks at the railway level crossings [1].

Railway level crossings are both safety critical and sociotechnical. Therefore, the problem with such a system tends to be cross dimensional with a large number of underlying uncertainties. Thus, machine learning has demonstrated superior performance in transit problems and is drawing significant attention in data analysis and optimisation of the railway level crossing parameters [4]. Extensive literature exists in the application of machine learning in the safety and capacity of the railway level crossings in area of safety improvement. For instance, a data consolidation model was developed to determine which railway level crossings can be closed in the United States as part of the effective safety program [5]. This involved the application of an eXtreme Gradient Boosting (XGBoost) algorithm in determining the railway level crossing closing decision based on the 14 features derived from safety, engineering, economic, environmental, and social aspects. The model was able to achieve an expert judgement with an accuracy of 0.991. On the other hand, an Analytic Hierarchy Process based on the compromise ranking method was applied in railway route planning and design [6]. The results demonstrated that the explicit complex decision-making process can be achieved in railway applications using multicriteria optimisation methods.

Binary programming was applied in the prioritisation of the railway level crossing project, based on the average probability of having m crashes from the n railway level crossings within the corridor [7]. Thus, the average probability obtained from the binary programming was able to select the optimal set of safety improvement actions, which could yield the maximum railway level crossing reliability and mobility. Conversely, the Random Forest algorithm proved effective in the ranking and analysis of the railway level crossing attributes in the selection of the suitable protection type [8]. The algorithm was able to identify the key safety factors with highest influence on the safety improvement and collision prediction at the railway level crossings in Canada. In addition, a full Bayesian analysis has been applied in the selection of the best estimate of the accident modification factors, based on the combination of the likelihood and prior knowledge of countermeasures [9]. The framework was able to discern the anticipated safety benefit of countermeasures in the face of uncertainty across the accident modification factor credible interval.

However, Liang et al. proposed a similar framework on the railway level crossing risk assessment. A probabilistic risk assessment and improved decision was achieved based on the application of Bayesian framework on datasets collected from several railway level crossings in France [10]. Thus, the model indicated that about 81% of the rail and road vehicle accidents resulted in zero fatalities, whilst 19% of accidents were likely to result in fatalities [10]. A combination of Local Estimated Scatterplot Smoothing (LOESS) and Generalized Additive Model (GAM) performed effectively in evaluating the in-vehicle railway level crossing warning system based on a taxi’s speed, acceleration, and jerk data [11]. The model revealed that taxi drivers showed improved behaviour with an in-vehicle warning system. Yet speed, acceleration, and jerk difference per multiple transit indicated that the model showed a lack of empirical generalizations of the taxi drivers who used the service.

Machine learning has also been applied in traffic control at the railway level crossings. A multiagent system was proposed in modelling urban traffic control to improve capacity at the railway level crossings [12]. An intersection agent (ISA) was used for the railway level crossing since it marks the intersection of the rail and road. Therefore, fusion of the intelligent ISA control cooperation and genetic reinforcement learning algorithm was proposed to ensure effective cooperation among the rail and road agents. Thus, the ISA control strategy would modify the signal cycle of every intersection with the help of the reinforcement learning in actualizing the local traffic optimisation. The study reported that the intelligent cooperation control is most effective for higher traffic volume; however reinforcement learning allowed the evaluating index to increase when the traffic flow increases and surpasses saturation [12].

An object detection railway level crossing protection system is another field that has seen an increasing application of machine learning. Hence, object parametrisation and localisation usually involve the application of classification learning algorithms and Kalman filtering for object tracking [13, 14]. However, the challenge with these algorithms is evident in video processing because they cannot detect every pixel of the object [13]. Furthermore, machine learning application confirmed that the three best measures for managing railway level crossing accidents can be achieved by the in-vehicle warning system, obstacle detection, and constant warning time [9, 11]. However, constant warning time without optimal railway level crossing closing tends to perpetuate unsafe human behaviour [1, 15]. The impact of long railway level crossing closing time on the railway planning and operation is often significant and, if not monitored, may result in adverse consequences [3, 16]. Moreover, the inability to predict and reinforce minimal railway level crossing closing time is likely to disintegrate the traffic management system [17].

Nikolajevs et al. proposed prediction of the railway level crossing closure duration, based on the train speed measurement by either additional sensors or evaluation of the track circuit’s impedance [2]. However, prediction of the closure time does not reinforce adherence to minimal railway level crossing closing time. Alternatively, Work et al. proposed the use of a support vector machine in the prediction of the train arrival time at the railway level crossing. Comparative analysis of the various machine learning algorithms indicated that the Random Forest algorithm provides the best estimation within an appropriate timeframe compared to linear regression and neural network [18]. Likewise, the multitask deep neural network has proven effective in estimating short-term transit delays [4]. Nogushi et al. proposed the reduction of the railway level crossing closing time using an optimal rail-road schedule. The optimal schedule was calculated from a genetic algorithm using time delay for each train at each station as a gene value and the closing time as the fitness value. Thus, the study confirmed the reduction of the railway level crossing blocking time with the changing combinations of the departure time [19]. Moreover, the study concluded that the rail-road waiting time can be reduced through the application of the genetic algorithm on the calculation of the schedule, taking into account the train’s location and speed [20]. Thus far, there is limited literature on the application of machine learning or data-centric methods in the optimisation of the railway level crossing closing time.

The present study proposes reducing the time lost at railway level crossing per train trip. Thus, this study contributes to the existing literature in the application of machine learning in the railway level crossing safety and capacity analysis. Moreover, the study demonstrates the significance of data-centric models on rail-road level crossing operations. In this study, railway level crossings found the southern corridors of the Western Cape metro rail are used to formulate the optimisation of the railway level crossing closing time. Thus, the criterion used by Powell’s method [21] is based on the minimisation of the area bounded by the threshold closing time as well as the actual and expected density functions. The proposed method is compared to the current status quo of the railway level crossings in the Western Cape, South Africa. The method showed satisfactory results thus proving its effectiveness.

The structure of the paper takes the following form. Section 2 discusses preliminaries of the railway level crossing closing time and the application of numerical optimisation. The adopted methodological process is outlined in Section 3. Lastly, results and discussions are presented in Sections 4 and 5, respectively.

2. Preliminaries

The railway level crossing depends on the activation and deactivation points denoted by A and C in Figure 1. A simple illustration of the train trajectory at the railway level crossing is shown in Figure 1; thus a track section is delimited by at least two detection points (A or B or C). The detection of the first train axle over A triggers the railway level crossing protection. Similarly, detection of the last train axle over C will withdraw the railway level crossing protection. Thus, railway level crossing closing time is the time difference between the insertion and withdrawal of the protection. The train is expected to brake on the approach of the railway level crossing’s activation track (t_a). Furthermore, the train enters into coasting driving mode along the railway level crossing inner area bounded by S0 and S0_1. Lastly, the train accelerates on the exit of the deactivation point (C).

Assume that no vehicles or passengers get trapped inside the railway level crossing once the protection is enabled. The objective variable (level crossing closing time) is the sum of the contribution of the feature vector at the location on the railway level crossing. The objective function is constrained by the technical and traction parameters shown in Figures 1 and 2, respectively. Hence, optimisation of the railway level crossing time can be expressed as follows:

The term denotes attributes extracted from data collected from the railway level crossings under study. Thus, technical constraints include dwell time, railway level crossing speed restriction, and time delay on the protecting signals. In contrast, traction characteristics include the longitudinal forces and velocity at a location on the railway level crossing. The resultant traction force shown in equation (2) illustrates the relationship between the force acting on the train and the velocity.where is the train’s inertial mass, is the train’s traction force, is the sum of resistive forces, is the train’s braking force, is the train’s speed, rail curvature radius, and angle of inclination.

The rail curvature and angle of inclination are different for each railway level crossing. Moreover, coefficients , , and represent the axle-rail friction, mechanical resistance of shaft rotation, and aerodynamic resistance; is the tractive resistance. Lastly, coefficient depends on the rail characteristics.

3. Methodology

Railway level crossing closing time is influenced by many attributes, some generic or specific to each system. Generic parameters are always accounted in the design whilst specific parameters receive no attention [3, 22]. However, it is imperative to assess specific attributes to achieve optimal railway level crossing closing time. Thus, specific attributes of the railway level crossings found on the southern corridor of the Western Cape metro rail were analysed. Attributes with highest influence in the railway level crossing closing time were extracted from the analysis. It was found that dwell time, train speed, and time delay imposed on the protecting signals were the most important features influencing the closing time on the southern corridor [15]. Furthermore, the analysis revealed that the coexistence of at least two of these attributes has a severe effect on the level crossing system’s capacity and safety [15].

The diagram in Figure 2 illustrates the method adopted, followed by the detailed overview in Sections 3.1, 3.2, and 3.3. Data of events concerning the operation of the railway level crossings on the southern corridor of the Western Cape metro rail were collected. A total of 10000 separate events of the track occupancy and signal routing involved in the railway level crossing operation were recorded. Only, ‘occupied’ and ‘clear’ track occupancy statuses are considered. Thus, track occupation time marks the time at which the first axle of the train is detected on the track section, whilst the track’s vacancy or “clear” time marks the time at which the last axle of the train is counted out of the track section.

Railway level crossing closing time is approximated by the time difference between the occupation time of the activation track and clearing time of the deactivation track. In addition, speed of train as it enters the activation track is estimated from the distance, occupation, and release time of the section. Some of the considered railway level crossings have, at most, 15 s time delay on the protecting signals due to lack of braking distance. Thus, total time delay incurred due to the timer on these signals is evaluated from the time the activation track is occupied to the time at which the train exits the track in response to elapsed signal timer.

The regression model is derived from the data, as shown in Figure 2. The data is passed into the kernel density estimation (KDE) algorithm which is used to determine the probability density function of the time spent per train trip. Numerical optimisation (Powell’s method) is formulated based on the results of the regression model and KDE algorithm. At last, numerical optimisation is applied to reduce the time lost per train trip as a result yielding optimal railway level crossing closing time.

3.1. Data Analysis

Regression techniques are used to derive the model of the attributes with the highest influence on the railway level crossing closing time. Hence, regression model of railway level crossing closing time and feature vector of features and training sets were built in Matlab. Moreover, the model was tested using 2000 data sets. The feature vector represents dwell time, train entry speed, and time delay on the protecting signals denoted by , and , respectively. Dwell time exhibits a linear pattern whereas others exhibit nonlinear patterns, as shown in Figures 3, 4, and 5. Thus, feature transformation was applied to the nonlinear features.

The hypothesis of the regression model is given in (2) with and being the parameterised nonlinear function for train entry speed and time delay on the protecting signal, respectively. The quadratic and exponential feature transformation functions were selected for the train entry speed and time delay. The feature transformation has been introduced to allow for application of the gradient descent and least squares. Thus, expressions of the feature transformation function are shown in (3) and (4). Gradient descent is applied to tune the parameters of the model by minimising the regression cost function over as given in (5). In addition, Jacobian leverage is applied in estimating the parameters of the nonlinear feature transformation function.where , , and ; , , .. Here represents the estimated closing time based on the derived model and is the actual closing time.

3.2. Density Estimation

The kernel density estimation method is applied to reconstruct an estimate of the time spent at the railway level crossing per train trip. The reason is that kernel density estimation can converge to the true density faster whilst guaranteeing a smooth output in comparison to its counterparts [23, 24]. Thus, the kernel is a smooth function which determines the shape of the estimator [21, 25, 26]. In addition, the kernel function partitions dataset of railway level crossing closing time into several bins and estimates the density from the bin count [25, 26]. The Gaussian kernel is chosen for this application and the performance of its estimator is assessed using risk and the mean squared error (MSE), expressed in equations (5) and (8), respectively.where is the kernel density estimator, , , and is the smoothing bandwidth which depends on sampling size . In addition, it is assumed that the true density function is continuous at and that and . On that note, the estimator is assumed to convergence in probability to the true density function , i.e., . The notation is used for variance.

Similarly, the Gaussian kernel density estimate of the expected railway level crossing closing time per each train trip is to be populated. The expected closing time is the designed for case, based on the ideal railway level crossing technical parameters and train traction characteristics. Hence, is populated in accordance with the parameters of the technical and train traction constraints defined in Tables 1 and 2, respectively. Furthermore, threshold closing time is the maximal permissible railway level crossing closing time which takes into account the prevailing constraints. This varies for each railway level crossing. As already mentioned, the recovery of the time lost per passage can improve the railway level crossing safety and capacity. Therefore, time lost by trains at the railway level crossing is represented by the surface area bounded by the threshold railway level crossing’s closing time, density function , and density estimator .

3.3. Optimisation Method

Optimisation of the railway level crossing closing time is critical in improving safety and traffic capacity. Thus, optimal closing time is achieved by minimising the time spent by trains on activation, inner area, and deactivation of the railway level crossing. The time spent at the railway level crossings is constrained by the technical parameters listed in Table 1. Dwell time relates to the train’s scheduled stop. Hence, the effect due to dwell time is restricted to 10% of anticipated train stop time at the platform. Furthermore, the line speed and railway level crossing speed restriction are applied in accordance with specifications of the southern corridor of the Western Cape metro rail. Lastly, time delay on the protecting signal is limited to an average reaction rate of the driver of 2 s to 4 s.

Additionally, performance constraints are determined by the tractive characteristics on the presiding compartment of the railway level crossing closing time. Thus, resultant force and associated train speed restriction per driving mode are stated in Table 2.

As mentioned above, the time lost at the railway level crossing is represented by the surface area bounded by the threshold railway level crossing’s closing time, density function, and density estimator . Then, optimisation of the railway level crossing closing time reduces the denoted minimum surface area. In this case, the time lost at the railway level crossing is obtained by computing numerical or analytical integration, as shown in the following equation:where the integral is evaluated over the 3D bounded region defined by the kernel density estimators and . The points of interest of the region on which the integral is evaluated are denoted by , on the plane, , on the plane, and , on the plane.

Let which can be further composed into ; then numerical integration can be approximated to equation (10) by applying the generalized Gaussian quadrature to evaluate the nodes and weights for the product of the polynomial and logarithmic functions [27]. The generalized Gaussian quadrature formula has been proven to give better results for integration over three-dimensional regions particularly in common applications in science and engineering [27].where ; ; ; . The term is the number of selected point set over which the integration is to be evaluated.

Here, , and are the node points, and , , and are the corresponding weights in one dimension. Several assumptions are postulated; features such as dwell time, train entry speed, and time delay on the protecting signal are nonnegative. Furthermore, the constrained set is nonempty and the objective function is finite. Thus, numerical optimisation can be formulated as follows:

Powell’s optimisation method is applied to minimise the time lost at the railway level crossing per train trip. The Powell method is a single-shot and fast converging method which attempts to find the local fit-statistics minimum nearest to the starting point [28]. The advantage of using the Powell method is its robust direction set. Hence, it will move in one direction until it finds the minimum [28, 29]. Furthermore, it is a gradient-free minimisation algorithm and therefore it does not require the objective function to be smooth [2931]. In this application there are 3 design variables , , and ; thus the Powell algorithm can converge faster than numerical optimisation algorithms. In addition, it has been proven effective for problems with less than 10 design variables [28]. Although the algorithm can find multiple local optima there is no guarantee that it will find the global optimum [29]. Nonetheless, it can produce better results for this application.

The new unconstrained optimisation algorithm (NEWUOA) software of the Powell method is implemented in Matlab due to its efficacy in minimising a noisy objective function [30]. NEWUOA uses a truncated conjugated gradient algorithm to find the minimum within the trust region [32]. The efficiency of the algorithm is derived from the intermingled trust region iteration and model iteration. Thus, objective of the trust region step is to find the better objective function value whilst the model iteration improves the model [32]. Assume a starting point for each design variable with the objective function and initial interpolation set containing . The initialisation stage assigns , and . The initial point of the NEWUOA is chosen as a point with lowest objective function value. The result of optimisation is that the step is added to to give the new point; . The length of can either become the trust region iteration or model iteration. Thus, if the length of is the too short, it indicates that the model must be improved; therefore it is referred to as model iteration. Otherwise, the length of becomes the trust region iteration.

In the trust region step, where , the objective function value is replaced by the new point , whereas in the model iteration, a point will not be added to the model. Instead, a new point will be calculated and will replace the point furthest from . Moreover, new point is chosen in such a way that it improves minimisation . The algorithm uses several parameters such as the trust region radius , which is related to initial current radius , lower limit of the radius , and upper limit of the radius . The normal trust region radius is used to limit the step length. In addition, is used to keep enough distance between the interpolation points in the initial model so that it is still accurate in case of presence of errors in the evaluation of . The following parameters were used for the NEWUOA model.

4. Results

The results of the study are presented as follows. Section 4.1 entails the results of the data analysis followed by the kernel density estimation and optimisation results in Sections 4.2 and 4.3, respectively. Validation of the proposed method is presented in Section 4.4. Throughout, the study training dataset of 8000 samples and test dataset of 2000 samples have been used.

4.1. Data Analysis

The gradient descent algorithm has been applied to estimate the parameters of the model listed in Tables 3 and 4. Similarly, the learning curve shown in Figure 6 indicates that the regression algorithm converges to the local or global minima. The deviation in the training and test cost functions after convergence is not vast; thus there is no indication of overfitting or underfitting. However, the learning curve does not give an indication of the impact of the residuals. Hence, error analysis in Table 5 indicates that outliers, due to feature transformation, have been heavily penalised. Yet, the model achieves accuracy of 78.2 which is relatively good given the data.

4.2. Kernel Density Estimation

The bias-variance kernel density estimator trade-off is used to determine the amount of smoothing required. The optimal amount of smoothing minimises the risk and consequently reduces the mean square error. The smoothing bandwidth is chosen to be a multiple of the sampling rate. The iterations of smoothing bandwidths are run to determine the bandwidth that minimises the risk and mean square error by visually observing the estimator output. The summary of results is shown in Table 6. It can be observed that the appropriate smoothing bandwidth for this application is 0.08 since the spurious effect of the data is not masked. Furthermore, density estimators of the features with significant impact on the railway level crossing time per train trip are shown in Figure 7. The culmination of the estimators would result in the 3D output; however for this analysis they are separated. The contribution of the dwell time is less significant on the first lobe in comparison to the entry velocity and time delay.

4.3. NEWUOA Method

The NEWUOA software which is a Powell new unconstrained optimisation algorithm was used to minimise the area of a region between the density estimates of the features with highest influence on the railway level crossing time. The NEWUOA algorithm developed by Powell is run on Fortran and is interfaced to Matlab [29, 30]. The sensitivity analysis of the algorithm is shown in Table 7. Herein, the time consumption and number of iterations required for convergence at chosen initial points are also presented.

The sensitivity analysis of the optimisation solution indicates that the a priori information can significantly reduce the computation time and the number of iterations required. Moreover, choosing the initial point in between the far extremes reduces the computation time and number of iterations. The minimum required number of iterations has been kept, to increase chances of obtaining the global optima.

4.4. Validation

The efficacy of the solution is validated on the dataset of 2000 samples from the eight railway level crossings under study. The actual and optimal time lost at the railway level crossings are shown in Table 8. Thus, results indicate that the optimisation algorithm can achieve, at most, 40% reduction of the time lost at the railway level crossing. However, the effectiveness of the optimisation algorithm is not the same for each railway level crossing.

5. Discussion

In this study, it has shown that long closing time at the railway level crossings is attributed to three features. The features identified to have highest impact are dwell time, time delay on the protection signals, and train entry speed. The regression model confirmed the relationship of these features and the railway level crossing closing time. The model has shown that dwell time is directly proportional to the railway level crossing closing time. Since it is inevitable to remove the platform at activation of some railway level crossings, the algorithm imposed a delay on the triggering of the protection system, such that the impact is well mitigated. Similarly, train entry speed plays a significant role in the railway level crossing system. The model indicated that the railway level crossing closing time decreases with an increase in train speed following a hyperbolic trend. Train travelling over the railway level crossing at speed lower than the permissible speed results in longer closing time. Lastly, time delay imposed on the protecting signal tends to introduce a delayed train driver response and consequently increases the closing time.

The model has shown that the railway level crossing closing time increases with time delay on the protecting signal in an exponential manner particularly where automatic routing is applied. The presented railway level crossing optimisation incorporated regression models of the identified attributes. In addition, the optimisation algorithm makes use of the density functions of the features to define the time lost at the railway level crossing per train trip. The threshold closing time, as well as the actual and expected closing time density function, defines the lower and upper boundaries of the Powell algorithm. Thus, recovery of the time lost at the railway level crossing is posed as the minimisation of the area bounded by the threshold railway level crossing closing time, actual, and expected density functions.

The optimisation of the railway level crossing closing time is subjected to train speed (at least minimal permissible speed), dwell time (at most 10% of the anticipate dwell time value), and time delay of at least the average driver reaction time. Furthermore, train traction characteristics constrained the objective function. The developed optimisation algorithm was trained on 8000 data samples. The algorithm exhibited high performance for the number of training datasets. However, performance can still be improved by increasing the number of training datasets, as well as introducing additional attributes. Validation of the algorithm proved that the features identified have a significant impact on long level crossing closing time. Moreover, the optimisation algorithm achieved at least 50 decrease in the time lost at the railway level crossings on 2000 test datasets.

Overall, the algorithm has proven to improve safety and capacity at the railway level crossings by reducing the time lost per train trip. Hence, optimal railway level crossing closing time is feasible if the technical and train tractive constraints are adhered to. However, the inconsistency of the optimiser on respective railway level crossings suggests that there may be unique features other than those considered. Therefore, increasing the number of features may improve the generality of the algorithm. In addition, the solution does not take into account mechanical failures of the train at the railway level crossing.

6. Conclusion

The present study developed an optimisation method to reduce the time lost at the railway level crossing per train trip. As a result, optimal railway level crossing closing time can be achieved. The algorithm used minimisation of the area bounded by the threshold closing time, as well as the actual and expected density function of the railway level crossing closing time per train trip, as the criterion. Powell’s optimisation algorithm was trained on 8000 datasets and has shown to converge to the optimal solution. Furthermore, the algorithm was validated. The reduction in the time lost at the rail-road level crossing is at least 50% on 2000 test datasets. The proposed solution is critical in ensuring improved safety and capacity at the railway level crossings. However, the algorithm is still selective in the optimisation of some of the railway level crossing closing times, thus suggesting that improvement can be made to achieve consistent results.

Data Availability

The data are available on request.

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

Acknowledgments

The work was supported from ERDF/ESF “Cooperation in Applied Research between the University of Pardubice and Companies, in the Field of Positioning, Detection and Simulation Technology for Transport Systems (PosiTrans)” (no. CZ.02.1.01/0.0/0.0/17_049/0008394). Furthermore, the authors would like to acknowledge Thales Western Cape Projects and PRASA Western Cape for granting access to the data used in the study.