Demand Prediction of Railway Emergency Resources Based on Case-Based Reasoning

+e demand prediction of emergency resources is helpful for rational allocation and optimization of emergency resources for railway rescue when emergency incident occurs. In this paper, a case base containing China railway traffic accident that has occurred since 1978 is established, and the case-based reasoning (CBR) method is applied in railway emergency resource demand predicting research. +e core case attributes of railway emergencies are described. In view of the attribute types of railway emergency cases, five types of attributes, including enumeration, numerical, interval, character and fuzzy type, are considered, and the local similarity calculation models of different attributes are given. In order to avoid the problem of missing attribute in the traditional nearest neighbor algorithm, a global case similarity calculation method based on structural similarity and attribute similarity is designed.+e empirical results show that case 3 is the most similar to the target case, and the calculating quantities of the proposed model are closer to the actual usage quantity and more accurate in the demand prediction of railway emergency resources, compared with the traditional empirical method. +e relative errors of demand forecasts for the 9 resources have been, respectively, reduced by 15.9884%, 15.1471%, 6.4286%, 17.1429%, 66.6667%, 38.8889%, 27.5%, 0%, and 17.7778%. +erefore, the proposed model is both reasonable and applicable. +e research results are of great significance to effectively deal with railway emergencies.


Introduction
China's railway is growing at a high speed, and the pace of construction is accelerating year by year. All kinds of emergency accidents, such as railway traffic accidents and railway line faults, occur from time to time [1]. It is necessary to ensure that reasonable arrangements for railway emergency rescue. Taking emergency measures scientifically, timely and effective process is an important prerequisite for avoiding the accident upgrading to a higher level and reducing the loss of personnel and property. erefore, the decision-making ability improvement of railway emergency rescue is an important part of the sustainable development of railway transportation [2,3].
At present, some scholars have been done some research on emergency resource demand forecasting, mainly including grey system [4], Markov chain [5], regression prediction [6], and other methods. Mohammadi et al. [7] applied the hybrid evolutionary radial basis function method (RBF) to demand forecasting of automatic selection node and emergency supply demand time. Yao et al. [8] used the BP neural network classification method to construct an evaluation index system that affected the urgency of disaster demand, established the model based on BP neural network, and furthermore sorted the urgency of demand. Mu et al. [9] adopted fuzzy comprehensive evaluation method to obtain the emergency degree value of emergency resources according to the different characteristics of diverse emergency point utilities. Zhang et al. [10] combined the neural network method with the wavelet theory, established the resource prediction model of the wavelet neural network, and dynamically predicted emergency resource demand for maritime emergencies. Duan et al. [11] used multiple data analysis and reasoning techniques to increase the speed and reliability of material demand prediction. Li et al. [12] constructed a three-layer emergency resource allocation model including "supply point, transit point, disaster point".
In recent years, artificial intelligence technology has been rapidly developed and widely applied. Case-based reasoning (CBR), as a new direction of artificial intelligence, has been widely studied in the field of emergency decision making. CBR is a strategy based on historical experience for solving current problems. e basic steps of a typical CBR problem solving process can be summarized into four major processes: retrieve, reuse, revise, and retain. erefore, casebased reasoning is also called 4R, and its working process is shown in Figure 1. In CBR, the unresolved issue or working condition is usually called the target case, the historical case is called the base case, and the collection of source cases is called the case base. It can be seen from Figure 1 that the basic process of CBR problem solving is as follows: a new problem to be solved appears, and this is the target case; the description information of the target case is used to query the similar cases in the historical, that is, the case base is retrieved to get the source cases that are similar to the target case, and then some solutions to the new problems are obtained. If the solution fails, it will be adjusted to get a savable, successful case. At the end of this process, a complete solution for the target case can be obtained; if the source case does not give the correct solution, a new source case can be obtained by the revise and retain. In CBR, whether the solution of the source case is suitable for the target case needs to be judged by the similarity. If the similarity between the base case and the target case is greater than the preset threshold, it can be used directly by studying the historical experience of the base case. However, if the similarity is smaller than the preset threshold, it needs to be more domain knowledge or people involved in the process of reuse, and after solve the problem, the solution experience will be stored as a new base case into case base, so as to make the CBR system more and more rich.
At present, some scholars have made extensive studies on it. Amailef et al. [13] presented a mobile-based emergency response system (MERS), by using the ontology-supported CBR (OS-CBR) method, and built decision making pattern adapted for intelligent m-Government emergency decision making. Zhao et al. [14] selected 8 key factors such as earthquake location, earthquake season, earthquake magnitude, focal depth, earthquake intensity, building collapse rate, number of victims, and injured people as the case attributes and, based on CBR, predicted the emergency material demand after disastrous earthquake. Mulyana et al. [15] applied CBR to the psychological treatment of patients after an accident and verified its effectiveness through examples. Zhang et al. [16] used CBR method to find the situation similar to the target situation, and found the solution to fire emergency rescue according to the evolutionary process and solution measures of similar situations in the past. Souvik et al. [17] proposed the resource demand prediction based on CBR and distributed it to the control station with a smart phone delay tolerance network. Built on CBR, as well as combining the principles of artificial intelligence with computer system, Ye et al. [18] developed the technical support system for the emergency decision making of urban rail transit emergencies. At the beginning of the event, under the limited information condition, the emergency solutions for urban rail transit emergencies were promoted rapidly. By use of CBR, Deng et al. [19] predicted the resource demand of water traffic emergencies according to the similarity of case attribute types and the global similarity of the nearest neighbor method. In the field of railway operation, CBR also has a few research applications. Zhou [20] introduced CBR into railway emergency decision making, examined the structural characteristics of the railway emergency, utilized the experience of past cases and proposed an overall case similarity calculation method, and solved the current railway emergency decision making problems. e accuracy of railway emergency resource demand prediction is directly related to the success or failure of accident rescue as well as the prevention and operation of guaranteeing secondary, derived and coupled accidents. According to the existing literature, the related researches mainly focus on the research of prediction methods and how to allocate the types and quantity of emergency resources.
ere is no literature to establish a relatively perfect case base of emergency resource demand for railway traffic accidents in China over the years, so it is difficult to guarantee the adaptability and scientificity of railway emergency resource demand forecast. Based on the case base containing China railway traffic accident that has occurred since 1978, according to the particularity of railway emergency rescue, case attributes are classified and the source case and target case similarity measure and calculation methods are put forward. Furthermore, goals case emergency resource allocation scheme is set based on CBR reasoning. e research is of great significance for railway emergency incident fast response and scientific rescue.

Expression of Railway Emergency
CBR can use a lot of empirical knowledge to make up for the decision maker's own knowledge limitation, and at the same time, it can avoid the interference of decision maker's  psychological factors on the emergency decision. Emergency decision of railway emergency is a complicated problem, which has some similarities with CBR in the process of problem handling [21]. e CBR method can effectively and rapidly make emergency decisions on railway emergencies, improve the decision-making ability of railway emergency rescue, strengthen the construction of railway emergency management ability, and ensure the sustainable development of railway transportation industry by finding similar historical cases and using specific cases from existing experience or results to solve new problems.

Case Presentation of Railway Emergencies.
Case representation is the process of transforming case information so that the computer can store and recognize the information.
e content of the case is generally composed of case information description, solution description, and effect description after implementation of the solution [22].
(1) Description of case information: the description of case information mainly includes two aspects: basic case information and case feature attribute. Basic information about the case includes the case number, name, time, place, type, response level, and brief description. e characteristic attribute description of railway emergencies itself includes five aspects, such as accident type, accident basic information, accident status, surrounding geographical environment, and meteorological conditions. Furthermore, each attribute can be further subdivided. (2) Description of solutions: description of railway emergency rescue solutions, including emergency command system, passenger rescue, passenger transport, demand and deployment of emergency resources, railway restoration, and after-treatment. (3) e effect description after the implementation of the solution: the effect description of the case application includes the final casualties, the interruption of railway running time, direct economic losses, the impact of the case on the society, and the public reflection and evaluation.
e case representation describes the case of railway emergencies by using a ternary expression, as shown in where F � (f 1 , f 2 , . . . , f n ) is the characteristic attribute of the case information, M is the characteristic attribute of the emergency solution, and U is the characteristic attribute of the effect after the implementation of the solution.

Case Attributes Frame Representation of Railway
Emergencies. Case knowledge is divided into frameworks, production rules, semantic web, and object-oriented methods [23]. Case representation directly affects the storage, management, and retrieval of cases in a CBR system. An appropriate and reasonable case representation method can increase the accuracy and efficiency of case solution. It is an important foundation of case-based reasoning research to select fitting case characteristic attributes to represent cases. China National Railway Group Co. Ltd established the system of railway emergency management plans and regulations. e system is composed of two parts, which take the emergency plan as the core, as well as emergency handling rules and regulations as the operation. It has made the related regulation for the railway emergency disposal content and carried on the compilation according to the scene mode [24]. In addition, hierarchical response and emergency disposal strategies are adopted (i.e., specific emergency disposal measures such as mobilizing rescue teams and rescue equipment are adopted depending on the emergency level) [25]. In the establishment of the scene model, it considers the basic information of the emergency, the impact of the incident, and the environment in which it occurs, such as type of time, time of occurrence, number of people affected, location of occurrence, type of train, number of deaths, number of injuries, damage degree of vehicle body, damage degree of line, weather conditions, and terrain conditions [26].
In this paper, considering that emergencies have multiattribute characteristics and each attribute plays diverse roles in emergency response, the multiattribute of emergencies are classified and divided. e core attributes of emergencies are examined, such as event type, key attribute, subordinate attribute, environment attribute, and hazard assessment attribute. Based on the systematic analysis of accident types, accident specific information, detailed rescue process, resource demand, resource allocation and use, as well as railway accident cases in recent years [27], 27 typical case characteristic attributes are selected from them [28], so that these attributes can well represent railway emergency situations, as shown in Table 1.
Furthermore, in accordance with relevant railway laws and regulations, a systematic analysis of railway accident cases in recent years is carried out. For efficient processing and operation, all the attributes are divided into five types: enumeration type, numerical type, interval type, character type, and fuzzy type, also as shown in Table 1.

Case Attributes Similarity Calculation.
In each case, there are a lot different attributes, and the types of attribute values are also different. It is necessary in order to select different methods to calculate, so as to improve calculation accuracy of attribute similarity. According to the attributes of the existing historical cases in the case base, the attributes can consist of five types: enumeration type, numerical type, interval type, character type, and fuzzy type. e calculation of interval type similarity also includes two cases: the similarity between the value and the interval and the similarity between interval and interval.
(1) Enumerated attributes, including accident type, locomotive and vehicle type, weather, train type, and cargo type: attribute similarity only has two values: 1 Journal of Advanced Transportation 3 (the enumeration value of the attribute is the same) or 0 (the enumeration value of the attribute is different): where T f is the value of the target case attribute f and C if is the value of the i th source case attribute f. (2) Numerical attributes, including the number of deaths, the number of injured, the number of derailment vehicles, the maximum distance of train derailment, the wind force, and the economic loss: this kind of attribute adopts the method based on hamming distance formula to calculate the similarity between attributes [29]: where β and α, respectively, represent the maximum and minimum values of the value range of the numerical attribute f. e result solved by formula (3) is located between 0 and 1. e closer the calculation result is 1, the higher the similarity of the attribute f of case T and C is. On the contrary, the more dissimilar. (3) Interval attributes: when a railway emergency occurs, it is needed to determine the number of passenger casualties, vehicle derailment, and other on-site information. Since much information cannot be accurately observed, the specific data obtained may be a certain interval value. erefore, it is necessary in order to define the similarity calculation method between values and intervals as well as between intervals and intervals. Similarity calculation between numerical value and interval: Given a specific value a and an interval range value , the similarity between them is defined as Putting formulae (3) into (4), the formula (5) can be derived and gotten as follows: Similarity calculation between two intervals: e similarity calculation formula between interval [a 1 , a 2 ] and [b 1 , b 2 ] is as follows: In the formula (6), a 1 , Putting formulae (3) into (6), the formula (7) can be derived and gotten as follows: In the case of a 1 > b 1 , a 1 and b 1 are exchanged with the values of a 2 and b 2 , and then the similarity is calculated with this formula. (4) Character-based attributes, including event name, rescue plan, rescue process, and other attributes: these case attributes are described by strings, which are divided into numerous small keywords and combined into a set that can fully express this attribute. Assuming that x 0 � k 1 , k 2 , . . . , k m and x 1 � p 1 , p 2 , . . . , p m are the set representation of a certain attribute in two different cases, the similarity between x 0 and x 1 is defined as where T f , C if is triangular fuzzy number,

Computation of Case Global Similarity.
e global similarity of the case is calculated on the basis of the similarity of each attribute, which takes into account the local similarity and attribute weight of each attribute. e common global similarity measure of emergency cases is the weighted value of attribute local similarity, such as weighted Euclidean distance and weighted Hamming distance. In addition, some scholars have introduced rough set, fuzzy number, semantic distance, and neural network into the global similarity calculation of cases. ese similarity measurement models assume that each attribute describing the case can be substituted with each other and do not consider the influence of missing value attribute on the similarity of the case structure features. However, due to the complexity and variety of emergency case attributes, it is inevitable that there will be incomplete information of historical cases or incomplete description of cases by decision-makers, which will seriously cause the inaccuracy of CBR results. Emergency case similarity algorithm needs to solve the problem of missing attribute value of an emergency case to avoid deviation as much as possible. In this paper, based on structural similarity and attribute similarity, an improved case global similarity measurement model is proposed, which calculates the similarity degree by different formulae when the attributes are missing or complete, so as to describe the contribution of missing data and attribute substitution relationship to the case global similarity more accurately. e method in this paper can avoid the problem of missing attribute value in traditional nearest neighbor algorithm.
When the attributes are completed, according to the characteristics of railway emergency case representation, the nearest neighbor algorithm is utilized to calculate the global similarity of the case. e nearest neighbor algorithm accumulates the similarity values of the attributes of the current case and the historical case to identify the global similarity of the case. e formula for calculating the global similarity between the current case and the source case is where sim(T, C i ) is the overall similarity value of accident case T and case C i ; ω f is the weight value of the attribute f; sim(T f , C if ) is the similarity between the f attribute of the current case T and the f attribute of the case i. When the attributes are missing, there are various reasons for missing attributes, including the difficult access to information or damage of data acquisition and preservation equipment, as well as human subjective error, historical limitation, or deliberate concealment.
In the case of attribute missing, the calculation method of global similarity will adopt different calculation methods, combining the attribute similarity of current case and historical case with the structural similarity, and the calculation formula of global similarity considering attribute missing is as follows: where W C i ∩T is the sum of the weights of the intersection of case T and case C i , W j is the weight of the j th attribute in the intersection of case T and case C i , m is the number of attributes in the intersection of case T and case C i , sim(T j , C ij ) is the similarity of the j th attribute in the current case and the historical case. sim(T, C i ) ∈ [0, 1], the closer the value is to 1, the higher the similarity between the two cases is. When some attributes are missing, relative to equation (10), the equation (11) considers the influence of missing attribute values on the importance of the information system, which will make the result more accurate and objective.

Attribute Weight Determination.
In the evaluation of case similarity, the weight coefficient can be used to assess the relative importance of case characteristic attributes. e larger the weight is, the greater the influence will be. Its reasonable allocation is the decisive factor for the accuracy of case retrieval and the final result.
is paper adopts the expert scoring method to determine the weight value of characteristic attributes, and several experts determine the weight after focusing on some evaluations according to their own experience.

Establishment of Railway Emergency
Resource Demand Model e source case with the highest similarity is calculated by using the similarity calculation method, and then the resource demand is predicted by invoking the relevant historical data and information of the source case. In the early stage of an emergency, the main factors affecting the demand for emergency rescue resources include the number of affected passengers, the number of deaths, the number of injured, the number of derailment vehicles, the number of damaged vehicles, and the number of damaged locomotives [31]. According to previous investigation reports on railway emergency rescue, the emergency resources needed mainly include rescue food, rescue team, truck crane, railway repair materials, fire truck, and rescue vehicle [32]. X 1 , X 2 , X 3 , X 4 , X 5 , and X 6 are, respectively, the demand for rescue food, rescue team, truck crane, railway repair materials, fire truck, and rescue vehicle in similar cases. en, the emergency resource demand prediction model of the target case is as follows: where D(i) is the demand for the i th emergency resource. X i is the demand for the i th emergency resource in the similar case. When i � 1, 2, . . . , 9, it corresponds to 9 kinds of emergency resources, including food, drinking water, medical supplies, rescue teams, rescue cranes, railway repair materials, railway maintenance equipment, fire trucks, and rescue vehicles. ω ji is the influence weight of the j th attribute on the demand for the i th emergency resource, m is the attribute value selected from the target case and similar cases, Q T j is the value of the j th attribute in the target case, and Q j is the value of the j th attribute in similar cases.

Empirical Analysis
ere are five cases C � C 1 , C 2 , C 3 , C 4 , C 5 in the known case base, containing China railway traffic accident that has occurred since 1978. And, the source cases are independent from each other. For example, the data in Case 1 comes from the "4.28 Jiao-Ji line major transportation accident" in China on April 28 th , 2008, the data in Case 2 comes from the "7.9 Hengyang North derailment accident" in China on July 9 th , 1999, the data in Case 3 comes from the "3. e target case T is summarized through the basic information of the accident site transmitted by the accident site personnel, and the 12 attributes with the highest weight are selected as shown in Table 2.
As can be seen from the Table 2, the missing damage degree of railway lines in the target case T is caused by the difficult access to information. All missing attributes need to be processed through formula (11).
Data missing will affect the assurance, variation, and bias of CBR decision results. Reducing the number of valid cases available for analysis due to incomplete data may lead to a decrease in statistical confidence. e greater the missing information, the greater the decrease in confidence. In addition, those with incomplete data are more likely to have extreme values, and the missing of these incomplete data lead to underestimation of variation, thus artificially narrowing the confidence interval of CBR decision results. Missing information also lead to biassing conclusions about whether CBR has an effect and how big the effect is. erefore, attribute information should be as complete as possible.
According to the formulae by formulae (2) to (9), the similarity of each attribute between the target case and the case can be obtained, and the global similarity of the case can be calculated through formula (10). Considering the existence of attribute missing, the global similarity of attribute missing is calculated through formula (11), as shown in Table 3. It can be seen from Table 3 that Case 3 has the highest similarity with the current case T, which is 0.9481. e number of emergency resources in the target case T can be predicted according to the type and quantity of emergency resources in case 3. e expert scoring method has been widely used in the determination of attribute weight, experts are the main body of weight determination, and the importance of the quality of expert scoring goes without saying. To improve the quality of expert evaluation, on the one hand, it is necessary to select appropriate experts (such as to limit the title, position, and working life of the expert) for participating in the evaluation; on the other hand, increasing the number of scoring experts. In this paper, 100 experts with intermediate titles or above with more than 10 years of working experience were invited to score weight coefficient for an attribute corresponding to a certain emergency resource. According to the proportion of the votes of the evaluated attribute in a certain emergency resource to the total votes in the emergency resource, the weight coefficient ω ji can be obtained, as shown in Table 4: e demand for Case 3 emergency resources can be inquired by consulting the case database, as shown in Table 5: According to formula (12), the emergency resource demand of the target case of this accident can be obtained, as shown in Table 6. For the convenience of comparison, in Table 6, CBR method in this paper is called Method A, and the traditional empirical method (the prediction of resource demand by managers at all levels according to their past work experience as well as the estimation of the change of target cases) is called Method B.
From the results in Table 6, it can be seen that, compared with the traditional empirical method, the method in this paper proposed in this paper is closer to the actual use amount (the relative errors of demand forecasts for the 9 resources have been, respectively, reduced by 15.9884%, 15.1471%, 6.4286%, 17.1429%, 66.6667%, 38.8889%, 27.5%,0%, and 17.7778%), as well as more accurate and more quickly in the prediction of the emergency resource demand of the target case. Meanwhile, the prediction value of the CBR method is smaller than that of the traditional method, which can avoid the waste of resources.   Table 5: Types and quantity of emergency resources needed for case3.

Conclusions
e demand prediction of emergency resources is a prerequisite for the allocation and command decision of emergency resources in railway emergencies and an important basis for improving post-disaster rescue capabilities. e current emergency resource demand prediction of railway emergencies is based primarily on the experience and subjective judgment of decision-makers, which may lead to unreasonable allocation of resources and increase rescue costs. erefore, this paper proposes the emergency resource demand prediction based on case-based reasoning and the principle of similar cases has similar solutions, and the main conclusions are as follows: (1) According to the characteristics of railway emergency rescue, the case attributes of railway emergencies are divided into five types: enumeration, numerical, interval, character, and fuzzy type, and the similarity calculation method of each type of attribute is defined. (2) In order to avoid the problem of missing attribute in the traditional nearest neighbor algorithm, a global case similarity calculation method based on structural similarity and attribute similarity is designed. (3) e similarity between case 3 and target case in the case base is the highest, which is 94.81%. Calculated quantity of the proposed model is closer to the actual usage quantity and more accurate in the demand prediction of railway emergency resources, comparing with the traditional empirical method. e relative errors of demand forecasts for the 9 resources have been, respectively, reduced by 15.9884%, 15.1471%, 6.4286%, 17.1429%, 66.6667%, 38.8889%, 27.5%, 0%, and 17.7778%.
CBR, as an important reasoning method in the field of artificial intelligence, has achieved practical results in the fields of legal case analysis, equipment fault diagnosis, auxiliary engineering design, auxiliary planning, and so on. But for now, there are still shortcomings in solving complex decision-making problems with bad structure, incomplete information, fuzziness, and strong uncertainty. And, the limitations of the research and future steps are as follows: (1) Standardization research should be further strengthened for the determination of the value and value range of case attributes, and more accurate information processing methods should be established for uncertain and fuzzy data. (2) e basis of CBR is the construction of the case base.
However, China's current basic data construction is not perfect, the data sharing system is not perfect, and the statistical data granularity of various departments is not unified, which makes the construction of the case base still has a certain complexity. e next step is tantamount to further strengthen the data integrity and expand the case base.
With the increase of the richness and similarity of the case base, this method can effectively solve the problem of scientific prediction of emergency resource demand in railway emergencies and provide support and reference for the prediction of emergency resource demand in railway emergency rescue.

Data Availability
e data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
e authors declare that there are no conflicts of interest regarding the publication of this paper.