# BA-CNN: Bat Algorithm-Based Convolutional Neural Network Algorithm for Ambulance Vehicle Routing in Smart Cities

Authors: Taha Darwassh Hanawy Hussein; Mondher Frikha; Sulayman Ahmed; Javad Rahebi
Journal: Mobile Information Systems
 (2022)

---

## Abstract

This article proposes an ambulance vehicle routing approach in smart cities. The approach is based on the bat algorithm and convolutional neural network (BA-CNN). It aims to take transfer the patients confidentially, accurately, and quickly. The type of CNN used in this research is a residual network (ResNet). The node method is responsible for creating the city map. In the beginning, information about the accident place is received by the control station and forwarded to both the hospital and the ambulance. The driver feeds the data that contain the ambulance vehicle’s node position and the accident location to the BA-CNN vehicle routing algorithm. The algorithm then obtains the shortest path to reach the location of the accident by the driver. When the vehicle arrives at the accident location, the driver updates the algorithm with hospital and accident positions. Then, the shortest path (which leads to the fast reach time) to the hospital is calculated. The bat algorithm provides offline data for a possible combination of different source and destination coordinates. The offline data are then trained by utilizing a neural network. The neural network is used for finding the shortest routes between source and destination. The performance evaluation of the BA-CNN algorithm is based on the following metrics: end-to-end delay (EED), throughput, and packet delivery fraction (PDF). This BA-CNN is compared with counterparts, including three different existing methods such as TBM, TVR, and SAODV. The experiments demonstrate that the PDF of our method is 0.90 for 10 malicious nodes, which is higher than in the TBM, TVR, and SAODV.


---

## Body

## 1. Introduction

Recently, scholars have devoted more attention to the Internet of Things (IoT) technology, which is implemented in different fields. In the IoT, the devices are intelligent, communicate, and exchange data among themselves through the connected network. The devices use sensors to collect the information and transmit it to the base stations. Very briefly, for communication and data collection, two types of sensors are available in smart devices. In the network layer, the devices in IoT exchange (collect and transmit) data among them [1]. Nowadays, the IoT is implemented in different places, such as smart homes [2] and smart cities [3]. In smart cities, IoT is utilized in different infrastructures, such as industry connections, health, and transportation systems.Applications programs are used in managing and interconnection among heterogeneous devices. Accordingly, a vast amount of data (big data) is produced in these devices [4]. Distributed computing systems (e.g., cloud computing) are utilized in processing data of smart cities. These systems are used to analyse big data in real-time. Recently, edge computing has been used to process big data. In the calculations and processing, sensor layer capabilities and generating objects are used. This model is known as fog computing [5]. The high ability to process big data in smart cities can be provided by fog computing with the cloud-computing layer. Despite dealing with big data being a critical issue, significant challenges in data security face smart cities.As mentioned earlier, smart cities manipulate a large amount of data exchange. To maintain the confidentiality of information, data transmission is required to be protected. Medical data security (including health-related data) is considered one of the crucial issues in smart cities. Over the network and its infrastructure, it is important to maintain the confidentially of health-related data transmission. Pieces of information may be leaked if the data are intercepted in the middle of the transmission. Therefore, during medical data transmission, there is a possibility of losing the data conditionality and the data manipulated. In some cases, disrupting treatment and even killing patients may be caused by manipulating medical data in smart cities. Accordingly, in smart cities, data encryption of medical information is essential. To other medical centers, the transmission of patient records on the blockchain and the IoT is a new treatment technique [6–8]. Human has a significant role in natural accidents and disasters. These disasters or accidents can impact people and infrastructures on a larger scale. To carry out in such circumstances, effective logistical operations are challenging. Therefore, medical help is impossible sometimes leading to further losses. Thus, the operations of rescue and assistance are needed to be managed efficiently after accidents or disasters [9].In emergencies, it is important to take the injured persons to the nearest hospitals. The following details are needed to operate efficiently: (1) location in the number of wounded persons and (2) the availability of ambulances. These are the key factors input to determine solutions for the accidents. After collecting these inputs, there must be an emergency schedule to rescue the injuries as fast as possible [10]. Therefore, this issue is concerned with the capacitated ambulance routing problem (CARP).The ambulance routing problem (ARP) is one of the CARP forms. It refers to injuries and their requests. This ARP aims to find the optimum (minimum) required distances between the ambulance station and accident places and between accident and hospital places to take the victims[11,12]. The ambulance collects the victims carefully from the accident location to the hospital. After that, the ambulances will return to their station. The CARP can propose different solutions: heuristic, metaheuristic, or exact solutions approaches.So far, despite proposing approaches, they lack the feasibility of the accident’s problematic situation. The best explanation is that the CARP is a nondeterministic polynomial problem (NP-hardness). Therefore, typically, heuristic and metaheuristic approaches are utilized to efficiently tackle CARP with an ambulance’s optimal route to the accident. Generally, several algorithms have been used to solve CARP problems, such as particle swarm optimization, genetic algorithm, ant colony, and simulated annealing. The various metaheuristics solution qualities are not significantly different for these optimization problems [12]. The methodology of this article is based on the bat algorithm and convolution neural network.Certain problem classes are currently best solved with evolutionary algorithms, many of which have several advantages, such as simplicity and flexibility [13,14]. In 2010, Yang proposed the bat algorithm (BA) [15] as an example of an evolutionary algorithm. It has been designed on the ability of the echolocation of bats. Specifically, the species Microchiroptera is used for a more extensive form of this ability to differentiate in the diverse dark types of insects. After the creation of the BA and verified its efficiency, several applications in several areas emerged, such as (1) image processing [16,17], (2) data mining [16,18], (3) solving the numerical optimization problem [19], and (4) optimization area [20]. They were developed, and their flexibility is evident [14,17]. The basic BA has several advantages over traditional global optimization methods [13].The contribution of this study is using the bat algorithm and convolutional neural network (BA-CNN) to find the best route between the injured or patient person and the best and most suitable hospital. It aims to take transfer the patients confidentially, accurately, and quickly.The structure of the following sections is as follows: the literature on ambulance routing algorithms is introduced in Section2. Section 3 describes the methodology of the proposed algorithm. Section 4 discusses the performance evaluations of the algorithm. Section 5 presents the conclusion of this article.


## 2. Literature Review

The shortest path (between the accident spot and the hospital) algorithm was proposed for ambulance routing in work [9]. In the set of node locations, Dijkstra’s algorithm was utilized for discovering the shortest path. The authors in reference [10] implemented effective communication metrologies using an ambulance to communicate traffic lights. To alter the traffic light signal, the authors utilized a vehicle to infrastructure communication technology. Via a communication protocol, the system first sends a short-wave message about the ambulance locations and routes to the core network. According to the position of the ambulance, the core network controlled the traffic light signals.To calculate the shortest path between the hospital and the accident place, the authors in reference [12] utilized the star algorithm. Furthermore, the algorithm can transfer it to the ambulance route control system. The authors in reference [21] used the video image processing concept to control the traffic light signals for allowing emergency vehicles to pass (e.g., fire engines and ambulances). The image processing technique analyses vehicle density. Additionally, the vehicle’s RFID signal is received by the system, and then accordingly, the traffic light is controlled, and then minimize the congestion of traffic. Similarly, for emergency vehicle routing applications, RFID-based traffic congestion control was suggested in reference [22]. The RFID system reads all vehicles’ information via the roadside capturing unit. The details are then sent to the control unit of the traffic main. For safe passing, in case of passing the emergency vehicle of the roadside unit, the traffic signal is changed by the main traffic control unit.For the smart traffic light system, the authors in reference [23] proposed a miniature model. The system consists of two units installed in the main control unit and emergency vehicle. The emergency condition of the emergency vehicle is sent to the vehicle’s module to the main control unit. Then, the traffic signal is controlled by the main control unit to the corresponding direction and then allows the emergency vehicle. For smart city applications, a smart traffic signal control system was proposed in reference [24]. The system utilized the following modules: (1) public transport signal priority, (2) adaptive traffic signal control, (3) emergency vehicle signal pre-emption, (4) message broadcasting, and (5) roadside unit control. In the beginning, with the vehicle near the intersection point of the traffic light signal, the emergency vehicle’s direction and position are shared. Then, the traffic near the intersection point is controlled to allow the vehicle. For emergency vehicles routing nearby traffic signals, a novel method using the Li-Fi protocol was proposed in reference [25]. With some fixed modulated frequency, the Li-Fi model is fixed in emergency and nonemergency vehicles and the systems of traffic light control. The emergency vehicle (in a stuck case) uses Li-Fi protocol to communicate with the nearest traffic light control systems to change the traffic signal.Emergency vehicle clearance control system-based IoT was proposed in reference [26]. The system consists of (1) traffic signal RFID control, (2) vehicle RFID control, and (3) the main control server. The system operates as follows: first, the main control server receives the emergency vehicle position and location. Second, based on the route traffic, these details are sent to the emergency vehicle. Accordingly, the vehicle RFID control is implemented at nearby intersection points to alter the traffic signal. After the vehicle passes, the traffic signal schedule is changed to normal by traffic signal RFID. The authors in reference [27] suggested a new smart traffic light system. The system is based on (1) Google maps, (2) micro-controlled traffic lights, (3) MQTT protocol, and (4) Android apps. In the beginning, the driver utilizes a Google map to determine the shortest path to the hospital (minimum time spent at each traffic signal in the route) [28,29]. Via MQTT protocol, it is sent to the main traffic control center. Then, according to the ambulance near the traffic signal, the traffic signal is changed by the main traffic control center.The authors in reference [30] proposed traffic light control utilizing Internet of Things (IoT) technology. For the emergency vehicle’s clearance, the traffic signal is controlled by GPS and application servers. According to the vehicle position, the traffic light signal is controlled by the application server. For emergency vehicle clearance, a traffic management system-based fuzzy logic was proposed in reference [31]. First, the method sends the vehicle’s emergency level to the traffic management system (TMS).According to the emergency level, the TMS fetches the following information: (1) occupancy level of the road, (2) average vehicle speed of the corresponding road, and (3) road map. Then, fuzzy logic control receives the information and obtains the congestion level and congestion vehicle to the TMS. Next, for fast clearance to the destination, the emergency response route and plan are then generated by the TMS and transferred to the emergency vehicle. For the emergency vehicle, a routing technique-based genetic algorithm was proposed in reference [32]. In the beginning, the following details are received by the genetic algorithm: (1) origin and destination data, (2) the current position of the vehicle, and (3) traffic data. Accordingly, for the emergency vehicle, the shortest path and new feasible route are determined.In reference [33], the emergency vehicle routing problem is solved using an improved genetic algorithm. The route node’s mathematical model was developed using graph theory, and the genetic algorithm solves it by origin and destination details of the emergency vehicle. The author in reference [34] proposed mixed integer programming to tackle the ambulance routing issue. This algorithm receives details of the victims, the number of ambulances available near the accident place, and hospital details, and this details program solves the best route for the ambulance. In reference [35], distributed ant colony optimization was used for the navigation of the emergency vehicle. Optimal routing was developed for the ambulance to quickly reach the accident place using ant colony optimization.In reference [36], an emergency vehicle routing schedule is generated using the Google map distance matrix API’s real-time traffic data. In this method, mixed integer programming generates vehicle routing based on incident location, vehicle tracking, and Google map routes. In reference [37], the ambulance routing problem was solved using the petal algorithm with particle swarm optimization (PSO). The problem was framed using open vehicle routing or vehicle routing problem with pickup and delivery concept. In reference [38], a multiobjective model-based ambulance routing algorithm was developed. This method sends accident location and victim injury levels to the algorithm’s input to generate the ambulance’s optimal route schedule.In reference [39], the ambulance routing techniques-based clustering concept is developed. In this method, the shortest distance between the patient and the hospital is generated based on the following algorithms: K-means algorithm, weighted K-means, and density-based cluster algorithm. In reference [40], the emergency vehicle’s optimal routing is developed using critical healthcare HTH service and real-time critical healthcare HTH service. The IoT sensor is placed on the roadside, and it sends the data (i.e., traffic level and the number of vehicles on the road). Accordingly, the algorithm generates the possible and the shortest routes for the ambulance. In reference [41], GSM and cloud-based automatic control of traffic signals for emergency vehicle clearance are developed. The GSM module in the emergency vehicle sends the details to the cloud via an android mobile application. Based on this data, the control unit and the cloud server alter the traffic signal to clear the vehicle route.In references [42,43], the deep learning-centered intrusion detection system (IDS) and hybrid machine learning are developed for detecting the malicious attacks in VANET. The modified K-harmonic means-based clustering was developed in the deep learning-based IDS to reduce the propagation delay. However, these IDS systems were mainly concentrated on the classification; it is not concentrated on the routing between the vehicles.The trust-based model (TBM) identified the rogue nodes in a vehicular network [44]. Next, the trust value of the node was estimated by TBM, and it was used to detect the rogue node. The developed TBM was used to provide secure data broadcasting with less overhead. However, this TBM was mainly dependent on the trust value of the nod during the relay node selection. In reference [45], the trust based on vehicles and roadside units (TVR) optimized the cluster head selection. The cluster head selected from the TVR was considered a highly trusted node used to stabilize their cluster. However, the increment in the transmission range affected the performance of TVR. Moreover, a secure ad-hoc on-demand distance vector (SAODV) method [46] was developed to identify the black hole nodes in the VANET. However, appropriate fitness function values such as trust and distance were not considered while generating the transmission path.


## 3. Modelling of the BA-CNN Algorithm

This section analyses the ambulance vehicle routing logic optimization methodology using the (BA-CNN) algorithm. Figure1 shows the general scenario of the ambulance vehicle routing. The injuries or people nearby the accident are informed of the accident’s location. The number of injured people and their injured level are sent to the control station for rescue. To convey all the accident details, the control station members contact the hospital near the accident location and the ambulance station to transfer all the accident details. The hospital is then prepared to deliver the necessary facilities to treat the injuries. The vacant ambulance near the accident location is then contacted via the ambulance station to transfer the details. Next, the vehicle moves to the accident location and carries the injuries to the nearest hospital. In the diagram, the road transport concept is indicated by dash lines. At the same time, in ambulance vehicle routing, the mobile communication concept is referred to by the dot-dash line. For ambulance vehicle routing, Figure 1 depicts the routing of an ambulance vehicle as follows: the road transport concept is illustrated with the dashed line, whereas the mobile communication concept is presented with the dot-dash line.Figure 1
The scenario of the ambulance vehicle routing concept.Figure2 shows the process of ambulance routing in the station. The details of the accidents are sent to the ambulance station. For the accident, the details of the local route map and local node details are fetched by the ambulance station. Then, the bat algorithm is fed with the gathered details to determine the best routes from the ambulance location to the accident and then to the hospital. The route is generated by the BAT algorithm trained by neural networks for all possible combinations of sources and destinations. The neural networks provide the optimal routing plan from the trained network. Via mobile communication, the details are sent to the ambulance driver. Accordingly, the driver follows the route to take the injuries to the hospital.Figure 2
The process of the ambulance routing in the ambulance station.


### 3.1. Mathematical Model

With minimum time and resources, the intelligence actions are utilized to construct the direction of the ambulance without following the unwanted routes in the available route map and meet the target. The vehicle must either follow the shortest route or accelerate over the trustworthy node to meet the target and satisfy the above requirements. Here, the node’s trustworthiness is identified by calculating the trust value for the node. The shortest path means the minimum distance between the target and the source. The minimum distance can be determined as follows:(1)F1=distSDi=Sxi−Dxi2+Syi−Dyi2,where F1 denotes the fitness function. The distance between the source and destination locations is denoted by distSDi, and i defines the current iteration. Additionally, Syi and Sxi refer to the y and x source location coordinates, whereas Dyi and Dxi are the y and x destination location coordinates, respectively.In monitoring the shortest direction, undesirable route positions must be paid attention to by the vehicle. Otherwise, the emergency vehicle consumes more time (delay) in the overall process by taking the unwanted routes. The vehicle must keep the maximum distance from the unwanted route locations to avoid these situations. The following equation is used to calculate the maximum distance:(2)F2=distAUi=Axi−Uxi2+Ayi−Uyi2,where F2 denotes the fitness function. The distance between the ambulance vehicle and unwanted location is denoted by distAUi, and i defines the current iteration. Ayi and Axi are the ambulance vehicle location coordinates, and Uyi and Uxi are the unwanted route location coordinates.In this network topology, the trust value of each node is the combination of direct and indirect trust values. The direct trustDT is also referred to as a local trust value, which is generally identified based on the packet sending behavior, as expressed in the equation (3). Moreover, the indirect trust IT is calculated based on the experience of the remaining nodes that exist in the network, which is used in the decision-making process. Equation (4) shows the indirect trust and combination of trust is expressed in equation (5). The trust value in the objective function is to provide robustness against the malicious nodes:(3)DTi,jt=Bi,jtCi,jt,(4)ITi,jt=1q∑l=0qDTl,j,where the number of packets correctly transmitted and received between node i and j in time t is represented as Bi,jt and Ci,jt, respectively; the neighbors of the i th node are denoted as q:(5)F3=DTi,jt+ITi,jt.For the ambulance vehicle routing, the fitness function or objective function is calculated using the following equation:(6)F=F1+11+F2+F3.The objective function (6) determines the best local and the best points of the global path. Therefore, according to the best global direction point, the new route point for emergency vehicles is obtained. This loop is repeated until the ambulance reaches its target.


### 3.2. BAT Algorithm

The echolocation activity of bats is the main idea of the bat algorithm. The activity comprises two steps: first, echolocation, a very intense sound pulse, is emitted. Then, they listen to the echo that can get back from the around objects. The amplitudes of signals are varied depending on their nature. Each sound signal is characterized by a specific emission rate of loudness, duration, and pitch. Specifically, bats travel at random routes and speeds, with variable pulse emission rate, loudness, and length [47,48].The majority of bats use fixed frequency signals, whereas some use tuning frequency signals. Usually, the frequency range of bats varies from 150 kHz and 25 kHz. Therefore, BAT algorithms concepts are as follows: in the beginning, bats use echolocation. Next, they separate the distinction between obstacle and victim. Figure3 illustrates the flow diagram of the bat algorithmic rule.Figure 3
Flowchart for the bat algorithm.The procedure can be clarified as follows:Step 1. Bat position Xi=X1,X2,X3…Xd and velocity Vi=V1,V2,V3…Vd are initialized. The number of optimized parameters of the system is symbolized with d. For the initial BAT position Xi, the following process Fi discovers the objective function value. The calculations are performed as follows:(7)Xi=randn,d;nis the number BAT population,(8)Vi=randn,d;nis the number BAT population,(9)Fi=Fitness value calculated based on.Lastly, to manipulate the bat algorithm further, store the objective function value and the corresponding position of the bat. equation (6).Step 2. In this step, we determine the following bat’s values: loudness factor Ai, pulse rate ri, and pulse frequency Qi.Step 3. In this step, start bat algorithm’s essential loop and beginning of iteration from 1. Here, we fix the maximum iteration for the main loop.Step 4. We change bats’ frequency parameters using maximum and minimum frequency values. The following formula can perform this process:(10)Qi=Qmin+Qmax−Qmin∗randn,d,whereQmax and Qmin represent the maximum and minimum bat frequency, respectively. Additionally, rand n,d represents the rand number between one to zero.Alter the bat’s speed to determine the best frequency and position. It can be performed as follows:(11)Vt=Vt−1+Xt−1−X∗Qi,whereQi refers to the bats’ frequency, and the best position among all bat positions is defined by X∗. Additionally, Xt−1 is the last bat iteration position. Lastly, the current and previous bat iteration velocities are denoted by Vt and. Vt−1From the following equation, we update bats’ position by using bats’ updated velocity:(12)Xt=Xt−1+Vt.As formulated below, adding the bats’ old position with their loudness factor determines their optimal position:(13)Xnew=Xt+rand∗Ait.Step 5. In this phase, a comparison is carried out between the pulse rate of the bats and the random pulse rate. When the pulse rate is less than a random pulse, the algorithm performs the following functions:(1)
Determine a solution between the best solution to the problem.(2)
The local solution is created around the determined best solution.(3)
Update the bats’ loudness factor and pulse rate by the following equation:(14)rit=δ∗rit−1,Ait=Ai01−e−∅t,where∅ and δ are random numbers by considering them as (0 < δ < 1 and ∅ > 0) and considering iteration reach infinite. Accordingly, the loudness factor and pulse rate are calculated as follows:(15)t⟶∞,ri∞⟶0,Ai∞=Ai0as.Last, levy flight conditions are utilized to create a new solution.Step 6. If (rand < Ai & F (Xi) < F(X∗))Here, a comparison is carried out between the loudness factor and the random loudness factor. Additionally, it is also compared to the current solution with the best solution. Consequently, by satisfying both conditions, the bats' loudness factor and pulse rate are changed (increased or reduced) according to formula (13).End ifThe solution of the bats is sorted, and calculate the current best solution isX∗.End whileLoop endStep 7. The bat algorithm presents the best solution.


### 3.3. Convolutional Neural Network

The CNN used in this research is ResNet, combined with a bat algorithm to identify the best and most secure relay nodes to communicate the VANET. The residual block is utilized by the ResNet [49], which is used to solve gradient disappearance and degradation issues in the general CNNs. The residual block extends the network depth and enhances the network performance.Figure4 shows the architecture of the residual block, where the residual is Fx and the residual block has input is x. In the first layer, after accomplishing the linear transformation and the activation, the Fx is the gained output. Next, the second layer’s input is added to the Fx after performing the second layer’s linear transformation. The ReLU is used to activate it to acquire the output. Next, x is inserted with the output’s second layer. Then, ResNet is utilized to activate it. This path is referred to as a shortcut connection.(16)F=W2σW2x,(17)y=Fx,Wi+x,(18)y=Fx,Wi+Wsx.Figure 4
Block of ResNet.Equations (16)–(18) show the operation of the residual block, where σ in equation (14) denotes the nonlinear function ReLU. In equation (15),y specifies the general output of the shortcut and second ReLU. Several channels and a linear transformation Ws are accomplished over x using the shortcut operation when the dimensions of input and output are needed to alter in the ResNet.


## 3.1. Mathematical Model

With minimum time and resources, the intelligence actions are utilized to construct the direction of the ambulance without following the unwanted routes in the available route map and meet the target. The vehicle must either follow the shortest route or accelerate over the trustworthy node to meet the target and satisfy the above requirements. Here, the node’s trustworthiness is identified by calculating the trust value for the node. The shortest path means the minimum distance between the target and the source. The minimum distance can be determined as follows:(1)F1=distSDi=Sxi−Dxi2+Syi−Dyi2,where F1 denotes the fitness function. The distance between the source and destination locations is denoted by distSDi, and i defines the current iteration. Additionally, Syi and Sxi refer to the y and x source location coordinates, whereas Dyi and Dxi are the y and x destination location coordinates, respectively.In monitoring the shortest direction, undesirable route positions must be paid attention to by the vehicle. Otherwise, the emergency vehicle consumes more time (delay) in the overall process by taking the unwanted routes. The vehicle must keep the maximum distance from the unwanted route locations to avoid these situations. The following equation is used to calculate the maximum distance:(2)F2=distAUi=Axi−Uxi2+Ayi−Uyi2,where F2 denotes the fitness function. The distance between the ambulance vehicle and unwanted location is denoted by distAUi, and i defines the current iteration. Ayi and Axi are the ambulance vehicle location coordinates, and Uyi and Uxi are the unwanted route location coordinates.In this network topology, the trust value of each node is the combination of direct and indirect trust values. The direct trustDT is also referred to as a local trust value, which is generally identified based on the packet sending behavior, as expressed in the equation (3). Moreover, the indirect trust IT is calculated based on the experience of the remaining nodes that exist in the network, which is used in the decision-making process. Equation (4) shows the indirect trust and combination of trust is expressed in equation (5). The trust value in the objective function is to provide robustness against the malicious nodes:(3)DTi,jt=Bi,jtCi,jt,(4)ITi,jt=1q∑l=0qDTl,j,where the number of packets correctly transmitted and received between node i and j in time t is represented as Bi,jt and Ci,jt, respectively; the neighbors of the i th node are denoted as q:(5)F3=DTi,jt+ITi,jt.For the ambulance vehicle routing, the fitness function or objective function is calculated using the following equation:(6)F=F1+11+F2+F3.The objective function (6) determines the best local and the best points of the global path. Therefore, according to the best global direction point, the new route point for emergency vehicles is obtained. This loop is repeated until the ambulance reaches its target.


## 3.2. BAT Algorithm

The echolocation activity of bats is the main idea of the bat algorithm. The activity comprises two steps: first, echolocation, a very intense sound pulse, is emitted. Then, they listen to the echo that can get back from the around objects. The amplitudes of signals are varied depending on their nature. Each sound signal is characterized by a specific emission rate of loudness, duration, and pitch. Specifically, bats travel at random routes and speeds, with variable pulse emission rate, loudness, and length [47,48].The majority of bats use fixed frequency signals, whereas some use tuning frequency signals. Usually, the frequency range of bats varies from 150 kHz and 25 kHz. Therefore, BAT algorithms concepts are as follows: in the beginning, bats use echolocation. Next, they separate the distinction between obstacle and victim. Figure3 illustrates the flow diagram of the bat algorithmic rule.Figure 3
Flowchart for the bat algorithm.The procedure can be clarified as follows:Step 1. Bat position Xi=X1,X2,X3…Xd and velocity Vi=V1,V2,V3…Vd are initialized. The number of optimized parameters of the system is symbolized with d. For the initial BAT position Xi, the following process Fi discovers the objective function value. The calculations are performed as follows:(7)Xi=randn,d;nis the number BAT population,(8)Vi=randn,d;nis the number BAT population,(9)Fi=Fitness value calculated based on.Lastly, to manipulate the bat algorithm further, store the objective function value and the corresponding position of the bat. equation (6).Step 2. In this step, we determine the following bat’s values: loudness factor Ai, pulse rate ri, and pulse frequency Qi.Step 3. In this step, start bat algorithm’s essential loop and beginning of iteration from 1. Here, we fix the maximum iteration for the main loop.Step 4. We change bats’ frequency parameters using maximum and minimum frequency values. The following formula can perform this process:(10)Qi=Qmin+Qmax−Qmin∗randn,d,whereQmax and Qmin represent the maximum and minimum bat frequency, respectively. Additionally, rand n,d represents the rand number between one to zero.Alter the bat’s speed to determine the best frequency and position. It can be performed as follows:(11)Vt=Vt−1+Xt−1−X∗Qi,whereQi refers to the bats’ frequency, and the best position among all bat positions is defined by X∗. Additionally, Xt−1 is the last bat iteration position. Lastly, the current and previous bat iteration velocities are denoted by Vt and. Vt−1From the following equation, we update bats’ position by using bats’ updated velocity:(12)Xt=Xt−1+Vt.As formulated below, adding the bats’ old position with their loudness factor determines their optimal position:(13)Xnew=Xt+rand∗Ait.Step 5. In this phase, a comparison is carried out between the pulse rate of the bats and the random pulse rate. When the pulse rate is less than a random pulse, the algorithm performs the following functions:(1)
Determine a solution between the best solution to the problem.(2)
The local solution is created around the determined best solution.(3)
Update the bats’ loudness factor and pulse rate by the following equation:(14)rit=δ∗rit−1,Ait=Ai01−e−∅t,where∅ and δ are random numbers by considering them as (0 < δ < 1 and ∅ > 0) and considering iteration reach infinite. Accordingly, the loudness factor and pulse rate are calculated as follows:(15)t⟶∞,ri∞⟶0,Ai∞=Ai0as.Last, levy flight conditions are utilized to create a new solution.Step 6. If (rand < Ai & F (Xi) < F(X∗))Here, a comparison is carried out between the loudness factor and the random loudness factor. Additionally, it is also compared to the current solution with the best solution. Consequently, by satisfying both conditions, the bats' loudness factor and pulse rate are changed (increased or reduced) according to formula (13).End ifThe solution of the bats is sorted, and calculate the current best solution isX∗.End whileLoop endStep 7. The bat algorithm presents the best solution.


## 3.3. Convolutional Neural Network

The CNN used in this research is ResNet, combined with a bat algorithm to identify the best and most secure relay nodes to communicate the VANET. The residual block is utilized by the ResNet [49], which is used to solve gradient disappearance and degradation issues in the general CNNs. The residual block extends the network depth and enhances the network performance.Figure4 shows the architecture of the residual block, where the residual is Fx and the residual block has input is x. In the first layer, after accomplishing the linear transformation and the activation, the Fx is the gained output. Next, the second layer’s input is added to the Fx after performing the second layer’s linear transformation. The ReLU is used to activate it to acquire the output. Next, x is inserted with the output’s second layer. Then, ResNet is utilized to activate it. This path is referred to as a shortcut connection.(16)F=W2σW2x,(17)y=Fx,Wi+x,(18)y=Fx,Wi+Wsx.Figure 4
Block of ResNet.Equations (16)–(18) show the operation of the residual block, where σ in equation (14) denotes the nonlinear function ReLU. In equation (15),y specifies the general output of the shortcut and second ReLU. Several channels and a linear transformation Ws are accomplished over x using the shortcut operation when the dimensions of input and output are needed to alter in the ResNet.


## 4. Performance Evaluation

This section conducts simulation experiments of an ambulance vehicle routing via MATLAB R2017a (Core i3 Intel processor and a 1.7 GHz PC). Table1 summarizes the assumptions assigned to the algorithm:Table 1
BAT algorithm specification.
ParameterValueMaximum number of iterations100Bat population100Minimum frequency0Maximum frequency1Loudness factor0.5Pulse rate0.5


### 4.1. Evaluation of the Routing Process

The coordinate details of the coordinates are listed in Table2. Additionally, in the considered area, the unwanted node details are shown in Figure 5.Table 2
The details of the coordinates.
CoordinatesValuesx coordinate(−10)–(+10)y coordinate(−10)–(+10)Unwanted route location pointsDiameter0.2, 0.3, 0.2, 0.2, 0.4, 0.2, 0.2, 0.2, 0.2, 0.5, and 0.2.x coordinate1.5, 4.0, 1.2, 8.0, 1.2, 4.8, 4.9, 5.1, 2.8, 5.6, and 7.3,y coordinate4.5, 3.0, 1.5, 9.0, 5.6, 4.8, 6.3, 6.5, 8.9, 1.4, and 7.6Figure 5
Unwanted node details of the considered area.Figure5 revealed 11 unwanted nodes, showing us the unwanted route location. These nodes are selected randomly. Two cases are used to test the algorithm between the coordinates: (1) 0.7–4.2 and (2) 4.2–7.1. Figures 6(a) and 6(c) show the corresponding results of route variation at every iteration. Figures 6(b) and 6(d) show the convergence graph of both cases. Accordingly, the total distance between the coordinates of Case 1 (0.7–4.2) during the iteration start is around 15.5 km. The figure revealed that the distance is reduced by increasing the number of iterations. Therefore, the distance became 7.5 km at the end of the iterations (i.e., 100). The algorithm needed 34 sec only to find the optimum route.Figure 6
The outcomes of two test conditions. (a) Best route between (0, 7) to (4, 2). (b) Convergence graph. (c) Best route between (4, 2) to (7, 1). (d) Convergence graph.
(a)(b)(c)(d)Figure6(d) illustrates the total distance between the coordinates (4, 2) to (7, 1) is around 11.3 km from the iteration’s starting. Additionally, the distance is decreased at the end of the iterations (i.e., 100) to around 3.7 km. Accordingly, the optimal route is calculated and found within 36 seconds. Besides, the algorithm is evaluated using the following sample coordinates of accidents, hospital, and ambulance locations ( Table 3).Table 3
Sample coordinates of accidents, hospital, and ambulance locations.
Cases123LocationAccidentX409Y269HospitalX736Y147AmbulanceX087Y759Figure7 shows the outcomes of the simulation of Case 1. The findings show that the optimum distance between the accident and the ambulance station is 8.2 km. Furthermore, the distance between the hospital and the accident place is optimized at 8.2 km. The algorithm calculated the optimum route in 63 secs.Figure 7
The outcomes of the simulation of Case 1. (a) Route from ambulance location to the accident. (b) Convergence graph. (c) Route from accident location to the hospital. (d) Convergence graph.
(a)(b)(c)(d)Figure8 illustrates the simulation outcomes of Case 2. The findings show that the ambulance station’s distance to the accident is optimized at 9.1 km. Furthermore, the optimum distance between the accident location to the hospital is 4.6 km. The algorithm calculated the optimum route in 62 secs. Similar to Figure 8, but for Case 3, the same parameters are simulated and depicted in Figure 9. The findings showed that the distance between the ambulance location to the accident is optimized to 2.4 km. The optimum distance between the accident location to the hospital is 3.6 km. the algorithm calculated the optimum route in 40 secs.Figure 8
The outcomes of the simulation of Case 2. (a) Route from ambulance location to the accident. (b) Convergence graph. (c) Route from accident location to the hospital. (d) Convergence graph.
(a)(b)(c)(d)Figure 9
The outcomes of the simulation of Case 3. (a) Route from ambulance location to the accident. (b) Convergence graph. (c) Route from accident location to the hospital. (d) Convergence graph.
(a)(b)(c)(d)The following process proposed is to train the ResNet by collecting data from the bat algorithm. The route coordinates from this bat algorithm (the bat algorithm’s outputs) for all possible sources and destination points are taken as the input for the ResNet. Figures10(a) and 10(b) illustrate the relation between input source-destination coordinates with output x and y coordinates from the bat algorithm, respectively. These input and output coordinates are taken as training data for the ResNet.Figure 10
Training data for the ResNet from bat algorithm. (a) Input coordinates vs. outputx coordinates. (b) Input coordinates vs. output y coordinates.
(a)(b)


### 4.2. Performance Analysis

The performance of the BA-CNN is analysed with the 100 vehicles with varying malicious nodes 5, 10, 15, 20, and 25. Here, the network is analysed in the network size of500m×500m with a mobility speed of 10–40 m/s. The efficiency of the BA-CNN is analysed by comparing it with three existing methods as TBM [44], TVR [45], and SAODV [46]. The metrics used in performance evaluation are an end-to-end delay, routing load, packet delivery fraction, and throughput.The comparative analysis of the BA-CNN with existing methods such as TBM [44], TVR [45], and SAODV [46] are shown in Table 4 and Figure 11. Here, the comparison is made by varying the malicious nodes into 5, 10, 15, 20, and 25. The analysis determined that the BA-CNN outperforms well than the TBM, TVR, and SAODV [46]. The main reason for BA-CNN with the better performance is the better relay node selection using the integration of BA and CNN (i.e., ResNet). The packet delivery of the BA-CNN is improved by avoiding the malicious nodes while transmitting the data packets over the VANET. Accordingly, the successful data transmission resulted in higher throughput for BA-CNN. Since the BA-CNN uses the optimal fitness functions during the generation of the transmission path, it does not require a high amount of control packets for generating the transmission path. The fitness functions used in the BA-CNN are the distance between source and destination, the distance between ambulance vehicle and unwanted location, and trust. Therefore, this BA-CNN achieves less routing load than the TBM [44], TVR [45], and SAODV [46]. Moreover, the shortest path generation using BA-CNN is used to obtain less EED than the TBM [44], TVR [45], and SAODV [46].Table 4
Comparative analysis of BA-CNN.
PerformancesMethodsNumber of malicious nodes510152025PDFTBM [44]0.610.460.410.350.26TVR [45]0.830.790.730.720.63SAODV [46]0.800.680.620.590.55BA-CNN0.960.900.890.830.76Throughput (kbps)TBM [44]148159150146122TVR [45]153163168157148SAODV [46]149161161150139BA-CNN161173175162158Routing loadTBM [44]0.10.280.781.191.05TVR [45]0.080.150.621.010.9SAODV [46]0.10.210.711.151.00BA-CNN0.050.100.340.870.95EED (s)TBM [44]0.1100.1100.1350.1510.180TVR [45]0.0900.1000.1240.1470.150SAODV [46]0.0900.1300.1300.1500.162BA-CNN0.0050.0190.1000.1090.110Figure 11
Performance comparison of BA-CNN. (a) PDF. (b) Throughput. (c) Routing load. (d) EED.
(a)(b)(c)(d)


## 4.1. Evaluation of the Routing Process

The coordinate details of the coordinates are listed in Table2. Additionally, in the considered area, the unwanted node details are shown in Figure 5.Table 2
The details of the coordinates.
CoordinatesValuesx coordinate(−10)–(+10)y coordinate(−10)–(+10)Unwanted route location pointsDiameter0.2, 0.3, 0.2, 0.2, 0.4, 0.2, 0.2, 0.2, 0.2, 0.5, and 0.2.x coordinate1.5, 4.0, 1.2, 8.0, 1.2, 4.8, 4.9, 5.1, 2.8, 5.6, and 7.3,y coordinate4.5, 3.0, 1.5, 9.0, 5.6, 4.8, 6.3, 6.5, 8.9, 1.4, and 7.6Figure 5
Unwanted node details of the considered area.Figure5 revealed 11 unwanted nodes, showing us the unwanted route location. These nodes are selected randomly. Two cases are used to test the algorithm between the coordinates: (1) 0.7–4.2 and (2) 4.2–7.1. Figures 6(a) and 6(c) show the corresponding results of route variation at every iteration. Figures 6(b) and 6(d) show the convergence graph of both cases. Accordingly, the total distance between the coordinates of Case 1 (0.7–4.2) during the iteration start is around 15.5 km. The figure revealed that the distance is reduced by increasing the number of iterations. Therefore, the distance became 7.5 km at the end of the iterations (i.e., 100). The algorithm needed 34 sec only to find the optimum route.Figure 6
The outcomes of two test conditions. (a) Best route between (0, 7) to (4, 2). (b) Convergence graph. (c) Best route between (4, 2) to (7, 1). (d) Convergence graph.
(a)(b)(c)(d)Figure6(d) illustrates the total distance between the coordinates (4, 2) to (7, 1) is around 11.3 km from the iteration’s starting. Additionally, the distance is decreased at the end of the iterations (i.e., 100) to around 3.7 km. Accordingly, the optimal route is calculated and found within 36 seconds. Besides, the algorithm is evaluated using the following sample coordinates of accidents, hospital, and ambulance locations ( Table 3).Table 3
Sample coordinates of accidents, hospital, and ambulance locations.
Cases123LocationAccidentX409Y269HospitalX736Y147AmbulanceX087Y759Figure7 shows the outcomes of the simulation of Case 1. The findings show that the optimum distance between the accident and the ambulance station is 8.2 km. Furthermore, the distance between the hospital and the accident place is optimized at 8.2 km. The algorithm calculated the optimum route in 63 secs.Figure 7
The outcomes of the simulation of Case 1. (a) Route from ambulance location to the accident. (b) Convergence graph. (c) Route from accident location to the hospital. (d) Convergence graph.
(a)(b)(c)(d)Figure8 illustrates the simulation outcomes of Case 2. The findings show that the ambulance station’s distance to the accident is optimized at 9.1 km. Furthermore, the optimum distance between the accident location to the hospital is 4.6 km. The algorithm calculated the optimum route in 62 secs. Similar to Figure 8, but for Case 3, the same parameters are simulated and depicted in Figure 9. The findings showed that the distance between the ambulance location to the accident is optimized to 2.4 km. The optimum distance between the accident location to the hospital is 3.6 km. the algorithm calculated the optimum route in 40 secs.Figure 8
The outcomes of the simulation of Case 2. (a) Route from ambulance location to the accident. (b) Convergence graph. (c) Route from accident location to the hospital. (d) Convergence graph.
(a)(b)(c)(d)Figure 9
The outcomes of the simulation of Case 3. (a) Route from ambulance location to the accident. (b) Convergence graph. (c) Route from accident location to the hospital. (d) Convergence graph.
(a)(b)(c)(d)The following process proposed is to train the ResNet by collecting data from the bat algorithm. The route coordinates from this bat algorithm (the bat algorithm’s outputs) for all possible sources and destination points are taken as the input for the ResNet. Figures10(a) and 10(b) illustrate the relation between input source-destination coordinates with output x and y coordinates from the bat algorithm, respectively. These input and output coordinates are taken as training data for the ResNet.Figure 10
Training data for the ResNet from bat algorithm. (a) Input coordinates vs. outputx coordinates. (b) Input coordinates vs. output y coordinates.
(a)(b)


## 4.2. Performance Analysis

The performance of the BA-CNN is analysed with the 100 vehicles with varying malicious nodes 5, 10, 15, 20, and 25. Here, the network is analysed in the network size of500m×500m with a mobility speed of 10–40 m/s. The efficiency of the BA-CNN is analysed by comparing it with three existing methods as TBM [44], TVR [45], and SAODV [46]. The metrics used in performance evaluation are an end-to-end delay, routing load, packet delivery fraction, and throughput.The comparative analysis of the BA-CNN with existing methods such as TBM [44], TVR [45], and SAODV [46] are shown in Table 4 and Figure 11. Here, the comparison is made by varying the malicious nodes into 5, 10, 15, 20, and 25. The analysis determined that the BA-CNN outperforms well than the TBM, TVR, and SAODV [46]. The main reason for BA-CNN with the better performance is the better relay node selection using the integration of BA and CNN (i.e., ResNet). The packet delivery of the BA-CNN is improved by avoiding the malicious nodes while transmitting the data packets over the VANET. Accordingly, the successful data transmission resulted in higher throughput for BA-CNN. Since the BA-CNN uses the optimal fitness functions during the generation of the transmission path, it does not require a high amount of control packets for generating the transmission path. The fitness functions used in the BA-CNN are the distance between source and destination, the distance between ambulance vehicle and unwanted location, and trust. Therefore, this BA-CNN achieves less routing load than the TBM [44], TVR [45], and SAODV [46]. Moreover, the shortest path generation using BA-CNN is used to obtain less EED than the TBM [44], TVR [45], and SAODV [46].Table 4
Comparative analysis of BA-CNN.
PerformancesMethodsNumber of malicious nodes510152025PDFTBM [44]0.610.460.410.350.26TVR [45]0.830.790.730.720.63SAODV [46]0.800.680.620.590.55BA-CNN0.960.900.890.830.76Throughput (kbps)TBM [44]148159150146122TVR [45]153163168157148SAODV [46]149161161150139BA-CNN161173175162158Routing loadTBM [44]0.10.280.781.191.05TVR [45]0.080.150.621.010.9SAODV [46]0.10.210.711.151.00BA-CNN0.050.100.340.870.95EED (s)TBM [44]0.1100.1100.1350.1510.180TVR [45]0.0900.1000.1240.1470.150SAODV [46]0.0900.1300.1300.1500.162BA-CNN0.0050.0190.1000.1090.110Figure 11
Performance comparison of BA-CNN. (a) PDF. (b) Throughput. (c) Routing load. (d) EED.
(a)(b)(c)(d)


## 5. Conclusion

Nowadays, management systems have become a substantial concern in different fields, for example, ambulance applications, military, banks, healthcare industry, enterprises, and educational centers. As we have seen, ambulance vehicle routing is a vital challenge in health and processing in smart cities. This work proposed the BA-CNN routing algorithm of ambulances following an accident. We observed that the proposed (BA-CNN) could achieve better solutions through extensive simulation experiments. In all scenarios, the system provided shorter total tour distances quickly. Accordingly, it can be argued that BA-CNN is resilient against the changes in the number of locations and the underlying topologies. Therefore, it can be seen that the bat algorithm continuously generates better results despite the different significant problem parameters. The experiments demonstrated the superiority of the BA-CNN algorithm over its counterparts (TBM, TVR, and SAODV). Furthermore, for ten malicious nodes, the PDF of the algorithm was 0.90, which is higher than the counterparts. For future works, the authors recommend using other new metaheuristic methods to improve the performance of the system.



---

*Source: 7339647-2022-06-08.xml*