Case-Based Reasoning with an Artiﬁcial Neural Network for Decision Support in Situations at Complex Technological Objects of Urban Infrastructure

: The article considers the tasks of intellectual support for decision support in relation to a complex technological object. The relevance is determined by a high level of responsibility, together with a variety of possible situations at a complex technological facility. The authors consider case-based reasoning (CBR) as a method for decision support. For a complex technological object, the problem deﬁned is the uniqueness of the situations, which is determined by a variety of elements and the possible environmental inﬂuence. This problem complicates the implementation of CBR, especially the stages of comparing situations and a further selection of the most similar situation from the database. As a solution to this problem, the authors consider the use of neural networks. The work examines two neural network architectures. The ﬁrst part of the research presents a neural network model that builds upon the multilayer perceptron. The second part considers the “Comparator-Adder” architecture. Experiments have shown that the proposed neural network architecture “Comparator-Adder” showed higher accuracy than the multilayer perceptron for the considered tasks of comparing situations. The results have a high level of generalization and can be used for decision support in various subject areas and systems where complex technological objects arise. this work, we considered the key problem of case-based reasoning. At issue is sit- uation similarity evaluation with regard to preventing dangerous situations that arise at complex technological objects of urban infrastructure. The variety of elements and their states at the complex object lead to high labor intensity or make it impossible to apply classical metrics of situation comparison and re- trieval when elements are represented in attribute space and it is necessary to estimate distance in this space. To improve the selection processes, we suggested using neural networks. Their use will speed up the decision-making process, which is especially important in critical situa- tions, eliminate the human factor, and reduce the labor intensity of the processes.


The Relevance of Research
Modern systems of urban infrastructure (power supply systems, gas, water, and heat supply systems) are complex technological objects (CTO). Their safety and stability processes are important not only for to enable city systems, but also for the protection of the ecology, people's lives, and health. The emergency situation has dangerous and fatal consequences. The prevention of such situations and their removal represent a relevant task in managing complex technological objects.
The dangerous situation prevention relates to monitoring and recognition and to retrieving solutions for neutralizing an incident. The implementation of both tasks in one software-hardware complex leads to the modern concept of intelligence monitoring and decision-making systems (IMDS) [1]. The decision-making process to neutralize (prevent) an arising dangerous situation is aimed at finding an action program (for personnel of operating, service organizations, operational dispatch service, and support services), which should convert the current emergency situation into a target, standard situation.
Two approaches are possible. One assumes the development "from scratch" of an effective action program (AP) based on the existing criteria, limitations, and standards. The second assumes a choice from the ready-made versions of the AP that will most fully correspond to the current situation. The second approach is good in that it does not require a lengthy development process (this is important in conditions of time pressure) and is applicable in cases where there is no formalization of target functions and selection criteria.
The approach in which the solution is retrieved from the already available database of ready-made solutions examples is called case-based reasoning (CBR) in artificial intelligence systems [2,3]. The CBR method proves to be effective in many applied tasks, including in the tasks of making decisions in emergency or undesirable situations [2][3][4][5].
The main idea of CBR is to find the same or a similar situation from past experience in the IMDS knowledge base in a hazardous situation case at CTO, and to apply the solution that was used previously.
To implement CBR inference in each specific subject area, it is necessary to solve a number of problems, where the key is the task to compare and retrieve similar situations. Decision-making in situations at urban infrastructure facilities must take into account many different conditions, not only the state of this or that technological equipment, but also many other factors, e.g., the environment, the state and availability of support systems and personal, the availability of resources, climatic conditions, etc. All these aspects give rise to a wide variety of possible situations, as well as difficulties in their formalized description and comparison for the solution retrieval.
Under such conditions, classical comparison methods based on the distance metrics in the parameter space do not achieve the required accuracy of the results. Therefore, one of the modern directions of research in CBR systems development and application has become the solution search for the problem of comparing and retrieving situations in complex areas [6][7][8][9].

Problem Description and Proposed Method
An important role in CBR is played by the procedure for evaluating the similarity of a situation with another, that is, determining Sim (.).
A sign of similarity between situations can be their belonging to the same class, i.e., Sim (.) ∈ {0, 1}, with the value 1 when two situations belong to the same class, and the value 0 otherwise. However, for a detailed classification, especially at the beginning of the system operation, there may not be a sufficient amount of information. In addition, during operation, new situations may appear that go beyond the previously created classification, which will require retraining of the system. Therefore, in CBR, the classification is used only at a sufficiently high level to separate typical situations.
More detailing within types is performed using a set of practical cases that may appear during the system operation. This is what makes it possible, if necessary, to find in the knowledge base those cases that will most closely correspond to the current problem situation.
As a consequence, some special similarity function [10] becomes more important than their belonging to one or another class for evaluating the similarity of the situations among themselves in CBR. The function value will show the similarity of situations among themselves.
Calculation of the similarity function can be performed based on metrics (weighted Euclidean, Manhattan metrics, etc.), by calculating the distance ρ between situations in the attribute space that describe these situations [6]. Then, Sim (.) = − ρ or Sim (.) = (1 − ρ) in the case of normalization of distance values.
This method has shown its effectiveness in many machine learning problems and in casebased inference problems when relatively simple and homogeneous objects are considered.
On a complex object case, it is necessary to take into account the states of its various elements and the connections between them, which are described by many quantitative and categorical parameters.
An attempt to compare situations in the multidimensional attributive space of a complex object faces some problems:

•
The need to create local similarity metrics and their aggregation into global metrics.

•
The need for expert judgment when ranking the importance of attributes.

•
The need to identify collisions, i.e., cases where the difference in situations in one attribute or local metrics can be compensated for by their similarity in other attributes.
The problems described are associated with time-consuming tasks that require expert intervention. At the same time, the more complex the object, the higher the labor intensity, and the higher the probability of error and collisions.
This set of problems requires new ways to assess the proximity of situations where expert intervention is minimized, and thereby the accuracy and speed of decision support processes is increased.
As a solution to the described problems, we consider the use of neural networks. Artificial intelligence will speed up the decision-making process, which is especially important in critical situations, eliminate the human factor, and reduce the labor intensity of processes.
The purpose of this work is to develop and research neural network architecture to evaluate the similarity of situations on a complex technological object of urban infrastructure.
The work is based on previous studies, where we define the situation on a complex object through a set of elements states and connections between them [11,12].
The article is organized as follows. Section 2 provides a brief overview of studies on the possibility of using neural networks to evaluate the proximity of the situation. Further, a formalized concept of a complex technological object is introduced, with a definition and formal presentation of situations arising at a complex object. Then, the process of forming a training data set is described. To do this, many situations in the building's heat supply point are used, on the basis of which two data-set are formed, namely training and validation. Section 3 considers neural network architectures for the situation comparison problem. Two developed architectures are proposed, namely multilayer perceptron and a complex architecture, Comparator-Adder. Section 4 discusses the results obtained and presents some conclusions. In particular, the developed neural network architecture "Comparator-Adder" showed higher accuracy than the multilayer perceptron for the considered problems of situation comparison.

Background and Related Work
Methods for learning similarity measures have been a topic of research in the CBR community for many years [13,14]. The possibilities of using neural networks for evaluating the proximity of situations are actively studied. Recent studies show positive results [7,8,15].
Thus, work [7] describes an experiment evaluating the quality of a car by determining its "similarity" in the space of the considered parameters with other known cars. The model under consideration is described by vectors. Those vectors concatenation is fed to the input of the multilayer perceptron, and the output is a signal, the value of which is projected onto the scale of quality classes. With a sufficiently large volume of the training sample, the model showed higher accuracy compared to the classical K-nearest neighbors method based on weighted local metrics.
The work [8] uses Siamese neural networks to compare cases. First, the input vectors are converted into the embeddings, namely vectors reflecting important features of the situations being compared. Next, on the output neuro-classifier, the value of the similarity function between embeddings is calculated. This study considered cases from the field of decision-making in the aquaculture industry, and the experiments showed a sufficiently high accuracy of the results for comparing and retrieving these cases when deriving decisions in the CBR system.
The study [10] proposes a typology of models for evaluating similarity functions, taking into account the ways of forming two components of the evaluation process, namely identifying important features and forming the embeddings, and comparing the embeddings to evaluate the similarity of situations.
Our proposed work is the continuation of applicability studies concerning neural network architectures for solving the problem of comparison and retrieval of situations in CBR systems as applied to complex technological objects of urban infrastructure. This paper considers two versions of the architectures: the multilayer perceptron and the Comparator-Adder architecture. Software implementation and experiments were carried out in the Google Colaboratory environment in Python using the Keras and Tensorflow libraries. The error function MeanSquaredError was selected as one of the standard functions of the Keras library, with an estimate of the calculation accuracy using the Mape metric (mean absolute percentage error).

Representation of the Situation at the CTO
For research, a complex technological object was considered, namely a house heat point. The technological scheme is an independent two-circuit heating system, where an external coolant through a heat exchanger transfers thermal energy to the coolant of the home heating system.
The elements of the "personnel" and "environment" groups are not directly related to the object but are considered part of it since they can influence it. For example, snowfall can make it difficult for personnel to access the facility and affect the composition of the solution to a problem situation.
In order to take into account the peculiarities of a complex technological object, we [11] introduce a formal representation of a complex object O through its elements and relations between them: where O i with i ∈ I 1 denotes complex object elements, and O i with i ∈ I 2 denotes relations between complex object elements; I 1 ∩ I 2 = ∅ denotes sets of indices of elements and relationships between them; N denotes the number of considered elements and connections in a complex object. Let each of O i ∈ O corresponds to its set of possible states S i = {S ij |j = 1, 2, . . . , M j } and at any time moment, the elements O i can be in one of these states. Definition 1. The situation at a complex technological object is a set of those states in which the elements O i are at a given time.
The situation can be formally represented through the matrix of states, where one in the column corresponds to the state of the element (Table 1).

Forming a Dataset for Experiments
For the experiment, the dataset has been prepared with 150 pairs of situations in the state matrix view at the object "house heat point" with known values of Sim. At the same time, 50% has been formed by similar situations and another 50% by dissimilar situations.
The situation's similarity Sim was determined by an expert review using the method previously described in our study [12]: where β i is the normalized element importance factor; d i is the distance between the states in which the i-th element of a complex object is in the compared situations.
The distance between the states of an element is determined by the following formula: where S i,act , S i,z is the state of the i-th element in the current situation and the z-th situation, respectively. For example, the possible states for the pump are ordered in the interval [0,1] in such a way that S 1 is at point 0, S 3 is at point 1, and the rest of the states take values between them. It is visualized in Figure 1.

Forming a Dataset for Experiments
For the experiment, the dataset has been prepared with 150 pairs of situations in the state matrix view at the object "house heat point" with known values of Sim. At the same time, 50% has been formed by similar situations and another 50% by dissimilar situations.
The situation's similarity Sim was determined by an expert review using the method previously described in our study [12]: where βi is the normalized element importance factor; di is the distance between the states in which the i-th element of a complex object is in the compared situations.
The distance between the states of an element is determined by the following formula: where Si,act, Si,z is the state of the i-th element in the current situation and the z-th situation, respectively. For example, the possible states for the pump are ordered in the interval [0,1] in such a way that S1 is at point 0, S3 is at point 1, and the rest of the states take values between them. It is visualized in Figure 1. Moreover, this method implies an expert evaluation of the importance of an element in each situation.
A set of matrix pairs has been converted to the embeddings in order to bring the required form for the functioning of neural networks. Namely, the matrices have been transformed in each pair into vectors x and y, respectively. Vector x = (xij|i = 1, 2, …, N, j = 1, 2, …, Mi), whose elements take the value 0 or 1, and xij = 1, if i-th element of Oi is in a state Sij, and 0-otherwise. A single set of 8 states was Moreover, this method implies an expert evaluation of the importance of an element in each situation.
A set of matrix pairs has been converted to the embeddings in order to bring the required form for the functioning of neural networks. Namely, the matrices have been transformed in each pair into vectors x and y, respectively. Vector x = (x ij |i = 1, 2, . . . , N, j = 1, 2, . . . , M i ), whose elements take the value 0 or 1, and x ij = 1, if i-th element of O i is in a state S ij , and 0-otherwise. A single set of 8 states was formed for each of the 14 elements of a complex object, when preparing the data set. The situation presented in the matrix of states (Table 1)

Multilayer Perceptron
The first part of the study considered the neural network model based on a multilayer perceptron, which was used in [7]. There have been changing parameters, i.e., the number of input neurons. The optimal architecture and the number of hidden layers have been selected during experiments. A source code snippet illustrating the multilayer perceptron model is shown below (Listing 1).
In the course of the experiments, the concatenation of two vectors (x, y) with a total length of 224 positions was fed to the input of the neural network. The value Sim (x, y) was calculated at the output.
Next, the neural network trained on the TDS operation was checked using a validation dataset (VDS). This contained a vector representation of 40 pairs of situations that were absent in the TDS.  It can be seen that fairly high calculation accuracy is achieved on the training data set. However, the results on the validation set were significantly worse than on the TDS.
Attempts to improve the quality of Sim prediction by increasing the number of network layers and introducing regularization layers did not lead to noticeable improvements in the quality of the results.
The most likely reason for this difference in computational accuracy is the small amount of training data. However, it is important to note that there may not be a large number of situation examples in a real system, especially at the beginning of the operation of a CBR system. We propose a more complex architecture, namely Comparator-Adder for application in a small amount of training data case.

Comparator-Adder Architecture
The proposed architecture Comparator-Adder is shown in Figure 3. We compare separately the vectors (xi, yi), the concatenation of which with a length of 16 positions entered the input of its i-th comparator. The comparator is implemented as a multilayer fully connected neural network that determines the similarity between these vectors. N = 14 com-

Comparator-Adder Architecture
The proposed architecture Comparator-Adder is shown in Figure 3. We compare separately the vectors (x i , y i ), the concatenation of which with a length of 16 positions entered the input of its i-th comparator. The comparator is implemented as a multilayer fully connected neural network that determines the similarity between these vectors. N = 14 comparators were trained on their part of the TDS, with each comparator giving a prediction regarding the similarity of the elements in two compared situations.  It can be seen data the Comparator-Adder architecture on the validation dataset showed results closer to the data on the TDS than in the study of the perceptron.
The next stage of the study is the analysis of the results of calculations according to the methodology presented in work [8] compliance with the requirements for similarity metrics: where k, z denote some indices of situations with different values.
In conditions of uncertainty and a lack of training information, the first two require-    As can be seen from the table, the results obtained correspond to the requirements in their not strict formulation, which approves the most similarities gets with comparison the situation with itself. It does say about sufficient precision to work under conditions of uncertainty and a lack of training data.
Thus, the experiments have shown that the proposed neural network architecture "Comparator-Adder" for the considered problems of comparison of situations showed: a) higher accuracy on the same validation file than a multilayer perceptron; b) the computed evaluation of the similarity of situations meets the requirements for the similarity metric.

Discussion
In this work, we considered the key problem of case-based reasoning. At issue is situation similarity evaluation with regard to preventing dangerous situations that arise at complex technological objects of urban infrastructure.
The variety of elements and their states at the complex object lead to high labor intensity or make it impossible to apply classical metrics of situation comparison and retrieval when elements are represented in attribute space and it is necessary to estimate distance in this space.
To improve the selection processes, we suggested using neural networks. Their use will speed up the decision-making process, which is especially important in critical situations, eliminate the human factor, and reduce the labor intensity of the processes. It can be seen data the Comparator-Adder architecture on the validation dataset showed results closer to the data on the TDS than in the study of the perceptron.
The next stage of the study is the analysis of the results of calculations according to the methodology presented in work [8] compliance with the requirements for similarity metrics: where k, z denote some indices of situations with different values. In conditions of uncertainty and a lack of training information, the first two requirements are formulated less rigorously: Sim (Sit k , Sit k ) → 1, Sim (Sit k , Sit z ) ≈ Sim (Sit z , Sit k ).
For this, a subset of various situations in the validation dataset has been selected. Next, the similarity function between them has been calculated using the trained neural network Comparator-Adder. Table 2 shows the calculation results. As can be seen from the table, the results obtained correspond to the requirements in their not strict formulation, which approves the most similarities gets with comparison the situation with itself. It does say about sufficient precision to work under conditions of uncertainty and a lack of training data.
Thus, the experiments have shown that the proposed neural network architecture "Comparator-Adder" for the considered problems of comparison of situations showed: (a) higher accuracy on the same validation file than a multilayer perceptron; (b) the computed evaluation of the similarity of situations meets the requirements for the similarity metric.

Discussion
In this work, we considered the key problem of case-based reasoning. At issue is situation similarity evaluation with regard to preventing dangerous situations that arise at complex technological objects of urban infrastructure.
The variety of elements and their states at the complex object lead to high labor intensity or make it impossible to apply classical metrics of situation comparison and retrieval when elements are represented in attribute space and it is necessary to estimate distance in this space.
To improve the selection processes, we suggested using neural networks. Their use will speed up the decision-making process, which is especially important in critical situations, eliminate the human factor, and reduce the labor intensity of the processes.
To solve similar problems in similar difficult conditions, a number of studies [7,8,10,16] have also shown the promise of using the method of neural networks. Neural networks make it possible to determine the similarity of situations through machine learning using examples of pairs of similar or dissimilar situations.
Our proposed architecture Comparator-Adder neural network is based on the idea of Siamese neural networks [8,[17][18][19], which are used to compare images or other signals. The architecture may be an example of the further development of such networks in relation to working with tabular data. In Siamese networks, two channels of neural network computations are organized to encode input images (signals) with their subsequent comparison at the output, decision element, which defines the class "similar" or "dissimilar".
The developed architecture compares separate parts of the input vectors of two situations. Each part corresponds to its own element of a complex technological object. Thus, N-comparison channels are organized in the form of N-trained neural network comparators. The outputs of comparators are fed to the "Adder" neural network. The adder at its output calculates the value of the similarity function, by which one can estimate the degree of similarity of two situations in their general representation.
The experiments showed that a trained neural network demonstrates sufficiently high accuracy under the conditions of a minimal training sample (we used a training date of 150 operations) when evaluating similar actions on the validation file (MAPE less than 10%).
The accuracy estimate obtained when processing the validation data set is a test of the neural network's reliability, while the reliability is digitized and estimated by the MAPE error.
The work [8] compares the results of studies on the application of various models of Siamese networks to assess the similarity function. Experiments carried out in the study showed that after 1000 epochs of training, the retrieval performance (measured as described in the [8]) is 90% (±0.7%) for esnn, 85.57% (±3.4%) for chopra, and 82.32% (±8.7%) for gabel.
Thus, we can say that the efficiency of the neural network presented in our work is sufficient in comparison with similar studies.
The basic idea of our approach to comparing and selecting situations at a complex technological object is to divide tasks into two large stages. At first, the states of the elements of a complex object and the connections between them independently of each other are recognized. As a result, the embeddings that represent situations in the state space are formed. In a second step, the embeddings for the quantitative evaluation of such situations are applied using a neural network. The practical significance of this approach is due to the different methods and technologies that can be used to recognize the states of dissimilar and diverse elements. So, machine classification methods, and in particular neural network classifiers, can be used in the case of a good description of elements with quantitative data with a sufficient amount of training examples for recognizing states. In cases where there are not enough training examples, it is advisable to use expert knowledge bases and inference systems to recognize the states of elements, including in conditions of uncertainty.
Thus, our approach offers a new opportunity for creating hybrid case-based reasoning models [20][21][22][23][24] and contributes to solving the actual problem of integrating two concepts of artificial intelligence, namely knowledge-based systems and machine learning [25,26].
However, the proposed neural network has some limitations. Namely, it is associated with uncertainty regarding the states of the elements. In such situations, an element with some probability can assume one of several states, which must be taken into account when selecting a similar situation from the base. The implementation of one-hot encoding is impossible in such a situation. Changes in the architecture of the neural network to add the ability to handle situations with uncertainty are the goal of further research.

Conclusions and Further Work
In this work, we continued to study the problem of intelligence monitoring and decision-making in emergencies at complex technological objects. Such facilities are present in various urban infrastructure systems (power supply systems, gas, water, and heat supply systems) and in large production, mining, or processing enterprises.
The system reaction speed is important for prompt decision-making and the choice of action programs to eliminate hazardous situations from the system, operational dispatch services, and maintenance personnel. The case-based reasoning method has a high potential to address this need, since it uses ready-made options for action and does not require the development of new solutions when a problem situation arises. At the same time, it is necessary to solve the problem of comparing situations and selecting the one in the knowledge base that is most similar to the current situation.
We have proposed a solution to this problem using trained neural networks. In the course of our research, we relied on the ontological model of a complex technological object proposed earlier [11] and the representation of situations on such an object through the states of its elements and connections between them. In this work, the following main results are obtained:

•
The formalization of the representation of the situation with the help of embeddings is proposed, which represent situations in the state space. • A neural network architecture, Comparator-Adder, is developed to assess the similarity of situations.

•
Using the example of the house heat point system, a training and validation dataset was prepared to test the efficiency of the proposed solutions. • Experiments were carried out to assess the accuracy in predicting the similarity of situations using the proposed neural network architecture. Experiments have shown the applicability of this model for problems of comparison and selection of situations by means of their representation in the state space.