Multi-Hop Genetic-Algorithm-Optimized Routing Technique in Diffusion-Based Molecular Communication

Molecular communication (MC) is a modern communication paradigm inspired by biological mechanisms and systems. Due to the short range of molecular diffusion, MC systems necessitate a multi-hop diffusion-based network to transmit information. Finding the optimal routing path is one of the most critical challenges in MC. The main goal is to transfer information through the diffusion of molecules within an optimal state by detecting the shortest route and the proper relays. In this paper, finding the optimal routing path using a genetic algorithm (GA) is investigated in order to find the shortest and the most energy-efficient path. Our model intelligently plans the optimum trajectory between the transmitter (TX) and the receiver (RX) by identifying the appropriate relays both locally and globally. Our GA implementation uses a variable-length chromosome encoding to obtain the optimal path by selecting an appropriate fitness function. We also examine and compare the performance of the proposed algorithm with Dijkstra’s algorithm (DA), which is one of the deterministic algorithms. Finally, various simulations for different sizes of MC networks are performed to verify the accuracy of the proposed method. Our simulation results demonstrate that the presented GA offers an accurate routing path within an excellent time, even in large-sized environments.

environments. Diffusion-based MC (DMC) encodes information by means of discharging some molecules that eventually propagate by following diffusion laws [15]. It is worth mentioning that in order to attain a solid and reliable MC, all the information particles should be chemically stable and robust against possible environmental threats; otherwise, the consequence will be degradation or damage of the information particles.
As with other types of communication, MC necessitates an energy source for the TX, the RX, along with the whole propagation process itself. There are many ways to provide the required energy. Occasionally, this energy is present in the environment; otherwise, it is captured from the outside environment through chemical processes. MC systems require energy at all stages, from the production and diffusion/distribution of the molecules in the environment to their reception. Due to the small sizes of nanosystems, the batteries in these systems cannot store much energy. Therefore, the TX is expected to be able to generate and store energy. Part of the energy generated by the TX is utilized in the regular operation of the system, and the rest is stored. The energy consumed in these systems should not be more than the energy produced by them, so the discussion of energy constraints in these systems is critical.
Nanomachines (NMs), due to their sizes and functionalities, are only able to perform simple tasks at nanoscales. These NMs only allow information exchange within a short-range MC (nm-Bµm) [16]. Therefore, it is impractical to exchange and transfer information on a larger scale outside the range of a NM without a relay, TX, RX, and coordination protocols. In MC, the molecules are dispersed in the environment once released, and after a certain distance and time due to their low concentration, it is difficult and unlikely for the RX to detect them. Hence, a swarm of NMs within multi-hop nanonetworks should coordinate in order to perform an enormous scale task. Similar to computer networks, relays are placed to convey the message from the TX to the RX. Routing is the main issue to be considered in the network layer of multi-hop nanonetworks.
Addressing NMs and opportunistic routing (OR) are two main routing techniques in nanonetworks [2], [17], [18], [19]. In the former technique, a TX chooses a RX NM using a preset type of molecules, including different kinds of peptide, ion, or specific Deoxyribonucleic acid (DNA) sequence/tags and beacon particles [2], [18]. The addressing-based routing could be impractical due to the simplicity of the NMs and the lack of routing state information (due to high memory requirements). The state is a routing table, i.e., routing protocol, comprising the best paths that initially have been calculated and constructed by each node in the form of a map or a graph [20].
As opposed to the scenario where the system depends on a single next-hop node to transfer the information signal, OR pre-designates a collection of candidate relays with related priorities. The pre-determination of the forwarders set occurs via different sorts of data exchange. Depending on the instantaneous conditions of the channel, the node having the highest priority is elected to forward the message. OR guarantees the exclusive selection of relays by utilizing a specific coordination scheme [19]. The work in [19] and [21] have proven that OR is a reliable and executable option that can improve and enhance the traditional routing paradigms. The routing protocols in MC systems should be stateless, and simple addressing features should be utilized to achieve a robust DMC. Accordingly, OR outperforms other techniques for routing in nanonetworks.
Hitherto, several research work have considered relaying and routing for MC systems [19], [22], [23], [24], [25], [26], [27]. The authors in [23] introduce the sense-and-forward relaying method in which the relays sense the concentration of diffused information particles and simply forward them to the RX (through single-type molecule and multi-type molecules). The work in [24] investigates the decode-andforward relaying technique for M-ary signaling in DMC. The relay node assists the RX node to decode the transmitted information by establishing a new route to the RX. The relay node decodes and forwards the received information symbols that the TX broadcasts.
Amplify-and-forward relaying in mobile multi-hop MCvD is proposed and investigated in [28], [29]. The relay nano-machine amplifies the received signal by a constant or variable amplification factor in the amplify-and-forward relaying technique. The study in [30] exploits the estimateand-forward (EF) relaying scheme in two-hop DMC networks. By deriving the maximum likelihood principle, the presented relaying model of [30] conveys an estimate of the transmitted number of molecules. Eventually, the RX receives the information from both the TX and the relay nodes. An acknowledgment-based OR model is explored for DMC in [19].
The authors in [25] propose a novel routing mechanism based on concentration gradient for molecular nanonetworks. Ghasvarian et al. [26] investigate a two-phase relay election and routing approach in a multi-hop diffusion-based nanonetwork. The network consists of a TX, an RX, and several nanorelay nodes. It is aimed to improve the energy consumption in multi-hop routing by using a fix and an adaptive number of released molecules. The study in [27] utilizes density routing and ant colony optimization (ACO) for routing in MC. The former uses the concentration of the molecules within a spherical area surrounding the destination to establish a route. In the latter, the ACO is employed to find the shortest path by considering both the force and acceleration of molecules near the destination.
All existing mechanisms contain complex algorithms encountering implementation complexity. Therefore, considering the nature and ability of each biological cell, it is challenging and unlikely that the system will perform the routing operation properly. In addition, none of the existing work consider the presence of objectionable cells or barriers in their proposed networks. Also, none of the presented studies provided an optimal global view and approach to MC in a multi-hop network through the shortest path.
This study obtains the optimal multi-hop DMC path between TX and RX for information-carrying molecules by using a genetic algorithm (GA). GA is one of the most fundamental optimization techniques introduced by Holland in the early 1970s [31]. GAs are the most well-known type of evolutionary algorithms. GAs possess iterative processes and function with one or more different solutions in each iteration. These models create an effective search method in vast spaces, which ultimately leads to the orientation toward finding the optimal solution. Crossover and mutation operators are added to the model to prevent the algorithm from getting trapped in the local optimum.
The significant characteristic of the proposed GA is that the chromosomes are set to possess variable lengths in order to represent different paths. The TX, RX, relays, and obstacles are included to acquire an optimal route for MC in an ECS discretized into a grid net. Each cell in this grid represents a chromosome gene. The obtained path is optimal in the sense of the best relays and the shortest distance. The proposed model determines and employs the most efficient relays for optimal routing in a multi-hop DMC network. In this regard, the proposed model with a global view calculates and selects the shortest path by determining the most useful relays. Choosing the best relays and the shortest route always minimizes energy consumption, contributing to a controlled molecular diffusion. The sense-and-forward [23] and decode-and-forward [24] relaying are considered in this paper. An important point to note is that, unlike previous studies, this work simultaneously obtains the shortest path and the best relays using a GA. The routing and relaying processes are optimized and accomplished both locally and globally. Furthermore, Dijkstra's algorithm (DA) is exploited to compare and verify the accuracy of the proposed GA. DA is one of the well-known algorithms of the shortest path finding introduced in 1959 [32]. In the case of DA, the entire space and the relays and obstacles distributions are available with a fixed global view.
In light of the above, the contribution of this paper can be summarized as follows.
• We formulate the routing in the multi-hop DMC networks as an optimization problem considering computation complexity, diffusion range constraints, and obstacle existence.
• We propose a heuristic optimization method to find the optimal routing path by detecting and employing the most efficient relays and avoiding the existing obstacles.
• We perform accurate and authentic simulations by implementing an environment that mimics an ECS. In addition to RX, TX, and relays, this work considers barriers or destructive cells that are inspired by living organisms.
• We leverage both the GA and DA for routing in the multi-hop DMC networks to attain the optimal/shortest path.
• We investigate the accuracy of the proposed model by making a comprehensive comparison between the presented heuristic algorithm and a deterministic method as the benchmark for our analytical results.
The remainder of the paper is organized as follows. Section II gives an insightful overview of various MC contexts. Section III describes the multi-hop diffusion-based nanonetwork model. Section IV introduces the proposed algorithmic approach and the details of the algorithm. The details of DA are discussed in Section V. The simulation and evaluation of the proposed model are presented in Section VI. Finally, Section VII provides a summary, conclusion, and avenues for future work.

II. MOLECULAR COMMUNICATION
The communication methods in MC systems are broadly classified into two main categories: passive transport-based MC and active transport-based MC. In the former, the communication is based on passive transfer, in which molecules are spontaneously released (diffused) into the environment. However, in the latter, molecules are directed and emitted by employing chemical energy with a high degree of reliability and fewer required molecules [1], [33].
Passive MC offers a simple way to propagate signal molecules inside and between cells. In this method, signal molecules are randomly diffused in all directions. Therefore, this method of transmission is appropriate in highly dynamic and unpredictable environments, as well as in situations where the necessary infrastructure for communication is not possible. But the active transmission is a communication mechanism that allows directional transmission of signal molecules to specific points.
Active transmission can propagate signal molecules over longer distances compared to passive transmission. It should also be noted that the transmission of large-signal molecules in the passive transmission is very weak due to their sizes. In the active transmission using chemical energy, enough force is produced to transmit large-signal molecules. Two examples of MC based on active transport-based in biological systems are molecular and bacterial motors-based [34]. Fig. 1 illustrates a MC network consisting of a TX, a RX, and a relay. The communication through direct and indirect links using a relay is depicted.
To date, the uses and applications that have been spotted from MC technology still are just in the early stages. Indeed, this can trigger many possibilities and enable more and more bio-nanotechnology applications [2], [35], [36], [37]. The control and detection of chemical reactions, better understanding of biology, environmental management and preservation, computational biology, etc., could be mentioned as other applications of MC. As mentioned before, the MC has a wide variety of uses in the medical field. The most researched so far is about the artificial immune system (AIS), which works by injecting super tiny artificial devices into the body [38], [39], [40]. These machines work as small robots that analyze the inner parts of the body. Moreover, they could be designated to find pathogens and eventually destroy them, so these little devices act as our immune system does [2], [5], [36].
Some microscale features of MC, including drug delivery and health monitoring, have already been investigated and discussed [6]. On the other hand, several macroscale applications such as underwater communication can be stated [41]. The macroscale MC mainly focuses on radio communication or sending information/materials through several ways like oil or gas in the industrial field. In addition, animals employ this principle, and they converse and communicate with one another via pheromones which are used as chemical signals. Macroscale MC mainly utilizes diffusion and flow-based propagation, which means that instead of using a single information particle, a larger quantity of particles is used to transfer the information [5].
Various research work have been done in different fields related to MC, including signal detection [42], modulation [43], [44], channel estimation [45], oscillation/ synchronization [46], [47], etc. The study in [48] utilizes energy detection and amplitude detection methods for a proposed pulse-based modulation technique. Chang et al. in [49] investigate two adaptive detection approaches, namely peak-time-based adaptive detection (PAD) and concentration-based adaptive threshold detection (CATD), to mitigate the effect of intersymbol interference (ISI) for mobile MC.
Literature has investigated various schemes of signal modulations, which is a physical layer concern in MC. A bio-NM RX in MC is able to discriminate various types of molecules, e.g., calcium and a specific sequence of DNA. Therefore, various molecules representing distinct signals can be employed, which refers to type-based modulation, e.g., molecular shift keying (MoSK) [44], [50]. Concentrationbased modulation accomplishes by relying on the number of molecules released from the Tx, e.g., concentration shift keying (CSK) [50]. Some MC systems utilize the releasing time of the molecules within a specific time slot, which refers to time-based modulation, e.g., pulse position modulation (PPM) [51]. In the spatial-based modulation technique, the information is conveyed utilizing the spatial location, especially in multiple-input multiple-output (MIMO) systems, e.g., molecular space shift keying (MSSK) [52]. In some cases, the system benefits from a set of mentioned features as a hybrid modulation scheme (HMS) [18], [43], [53].
The studies in [54] and [55] investigate pilot-based channel estimators employing least squares (LS) and maximum likelihood (ML) benchmarks for the cases of single-input single-output (SISO) and MIMO MC channels, respectively. In addition, the authors in [45] propose semi-blind expectation maximization (EM), semi-blind decision-directed (DD)-LS, and semi-blind DD-ML estimator schemes.

III. SYSTEM MODEL
We consider an ECS in a specific part of the living organism. This environment contains components such as TX, RX, various relay nodes Fig. 2 depicts the schematic of an ECS encompassing TX, RX, multiple relays, and obstacles of arbitrary geometries while diffusing various molecules and particles. The system exchanges the data through a multi-hop DMC network. We assume that all the components involved in establishing MC, including the TX, RX, relays, and obstacles, are all spherical, capable of scattering and absorbing molecules in all directions and angles. The nodes are placed completely randomly in the environment. Each node possesses a communication range, the maximum radius at which the receiving nodes in that area can reliably detect the diffused molecules. The receptor nodes by specific chemical reactions attract the stray molecules which are within their affinity radius [56]. The effective radius of the nodes is expressed by [57] r effective = r cell + r affinity . (1) Due to the molecular nature of the MC systems, it is known that the communication range of the nodes is small compared to the distance between TX and RX. Therefore, we need a multi-hop network consisting of relays to transmit information. The RX, relays, and obstacles secrete biomarkers within a certain radius through which they are identified and positioned. Several types of information molecules participate in the entire diffusion process. The molecular concentration at different times and spaces employing Fick's law is calculated as [58] where Q indicates the number of released molecules, D represents the diffusion coefficient of the medium, and r is the distance from the center of the relay or the TX. This study utilizes a simple pulse-based modulation technique to convey the information among the nodes. In the desired modulation technique, the transmitting node exudes a pulse of molecules to forward the data. The proposed model employs energy detection and amplitude detection techniques of [48] to detect molecular pulses. The RX node measures the energy of the molecular pulse in the energy detection method. In this case, the energy is computed by integrating the molecular concentration over time as follows [48] where T p denotes the pulse duration. Finally, the system decodes and extracts the received information by comparing the calculated energy with the considered threshold value. According to the amplitude detection approach, the RX nodes first need to measure the fluctuation of the local concentration of the emitted molecules calculated by (2) over time. The maximum concentration value is then compared to the preset threshold value to decode the received signal. The pulse amplitude or the maximum concentration of the molecules is expressed by [48]

IV. PROPOSED GENETIC ALGORITHM
Presently, optimization is deployed widely in our lives, playing a critical role in engineering and industrial fields. Evolutionary and population-based optimization algorithms are prevalent and well-known [59]. The existing optimization methods aim to provide the optimum solution to the problems intelligently. Due to their high computational power and easy transformations, intelligent optimization and search algorithms are impressively employed in numerous applications [60]. Various artificial intelligence optimization algorithms are presented and categorized into different groups, including physics-based, chemical-based, mathematics-based, biology-based, musicbased, social-based, sports-based, swarm-based, waterbased, light-based, plant-based, and hybrid-based techniques [59], [61]. The proposed design aims to find the optimal routing path in DMC. This study tries to perform optimal MC in an ECS amid different particles, molecules, and biological cells from TX to RX by selecting appropriate relays, the shortest path, and avoiding obstacles. First, we construct the chromosomes of different lengths encoding a path, unlike many existing algorithms in which the size of these chromosomes is fixed. The fitness function (objective function) is defined so that the algorithm finds the cells with the most weight and selects the appropriate relays to determine the shortest path for exchanging information from TX to RX.
In this multi-hop MC network, cells are divided into relays and obstacles according to their ability. Relays help transfer data in the MC by receiving molecules and forwarding them. On the other hand, obstacles either absorb or block information particles, which interrupts communication and disrupts systems and information exchange. The weight given to each cell is the amount that each cell receives according to the specified objective function, proximity to relays, distance from obstacles, and proximity to the straight line connecting the TX to the RX.
Optimal selection of MC paths and relays minimizes energy consumption [62], [63]. In addition, reducing the loss of diffused molecules plays an essential role in increasing system efficiency. The MC system loses fewer molecules or information particles, which means the system consumes less energy on creating and dispersing molecules. On the other hand, by selecting the shortest path, fewer relays are required to receive and forward data. The flowchart related to the proposed GA is illustrated in Fig. 3. In the following, the GA is examined in the stated problem.

A. ENVIRONMENT REPRESENTATION
The first and most crucial step in GA is to provide proper coding. The cell decomposition method [64] is employed to describe the environment. Partitioning the environment into disjoint sets is known as the cell decomposition technique. Fig. 4 depicts an example of a 10 × 10 sequentially numbered environment. We assume a two-dimensional environment  consisting of cells which can be considered as a grid/cellular network [62], [63]. Fig. 4 illustrates the desired cell numbering based on orderly numbered grids [65] for the proposed coding. This type of coding makes the calculations and applications of GA operators easier and requires less memory [66], [67].
It is worth mentioning that the start/end point in this cellular environment can be any of the cells. As an example in Fig. 5, a source, destination, and an optimum path are shown. It should be noted that increasing the number of cells in the grid network improves the proposed system's accuracy. However, increasing the number of cells in this network increases the length of the chromosomes, which results in higher computational complexity.

B. REPRESENTATION OF CHROMOSOMES
There is a relationship between the coding space and the response space in GA coding. The characteristics of the problem lie in the genes. Various methods can be used to display and form chromosomes in GA. The defined chromosome used in the proposed algorithm has a variable length and expresses a continuous path from the starting point to the end point. As depicted in Fig. 6, each gene on this chromosome belongs to a cell along the pathway, representing the cell number through which the transmission pathway occurs. The genes forming each chromosome are made up of cell numbers from the defined grid. In the given chromosome, C 1 represents the source cell, and C n denotes the destination cell. In GA coding, the start and end points are considered as fixed genes in the path chromosomes. Therefore, none of the GA operators are applied to these two genes/cells.

C. RELAYS AND OBSTACLES
As mentioned, ECS includes different components, each of which has different responsibilities. Depending on the function of ECM, the characteristics and performance of each element or cell may vary, operating as a relay or an obstacle in  It should be noted that the existence and distribution of molecules within the cells is done by utilizing the diffusion process and the score that each cell obtains. This diffusion is important in finding the optimal path and fitness function values in the later stages. For example, in Fig. 7, the cell numbering from 0 to 35 in a 6 × 6 environment is provided. This environment contains several simple cells, relays, and obstacles. Each cell can emit a biomarker that helps identify its presence and location. This work assumes a three-dimensional diffusion within a specific range holding a positive amplitude, i.e., the concentration of the molecules, for the relays and a negative one for the obstacles. This distribution with positive and negative amplitudes helps to identify and separate relays and obstacles. Cells emit biomarkers in a circular diffusion of radius 5. As a result, each of the numbered cells is later divided into a 5×5 environment. This redistribution gives us a 30 × 30 cell environment. Fig. 8 depicts the variation of distribution with positive and negative amplitudes indicating the relays and obstacles.
The proposed coding considers coefficients for each relay and obstacle in their centers and surroundings, i.e., positive Gaussian distribution for relays and a negative Gaussian distribution for obstacles. The phenomenon mentioned above can be represented by a matrix. Each of the matrix elements, or cells, has weight α = +ve, for the relays (8a) −ve, for the obstacles (8b) where w(x, y) represents the weight of each cell, x and y denote the distance to the center of the cell in the Gaussian distribution, and s indicates the index associated with an arbitrary element on the plane (location of relays/obstacles). Moreover, R is the radius associated with the distribution of molecules around a node, h(u, v) represents the Gaussian function, u and v are the variables required for Gaussian distribution, and σ is the Gaussian coefficient of propagation or radius of propagation. It is assumed that α > 1 for the relay nodes and α < 1 for the obstacle nodes (α values can vary depending on the data). As can be seen, hills and valleys emerge, and these values are stored in a two-dimensional matrix. The main goal is to find the shortest trajectory from a specific origin to a particular destination amid the unevenness by maximizing a fitness function (or minimizing the inverse of a fitness value) in the GA. The origin location, e.g., the injection site, is known. It is assumed that cells, including relays and the RX node, emit biomarkers within a spherical range. Therefore, to find the target /RX node, the proposed model calculates the scores or weights for all the cells. These scores are the concentration of diffused molecules computed using (2) around the node. The highest scored node is determined using the maximum operator in the GA coding to be the destination point. The maximum value is evident in Fig. 8.

D. THE GENERATION OF THE INITIAL POPULATION
Once the genes are put together on one chromosome, several chromosomes are produced, and this set of chromosomes forms the first generation. In the proposed algorithm, GA has the ability to move in all directions, as shown in Fig. 9. It is worth mentioning that moving downwards or towards the opposite direction of the main goal is possible only when it reduces costs, which is observed in the algorithm. A randomized (stochastic) approach has been employed in the production of the initial population. In the proposed method, an R-directional vector with eight elements is defined. A straight line is drawn from the starting point (TX) to the end point (RX) at the beginning of the process. Each of the three directions shown in Fig. 9 that are closest to this line gets the highest probability. Furthermore, the lowest probabilities are assigned to the other directions. The roulette wheel method is adopted in each step of the movement to select the next cell. In the move toward the destination point, the adjacent cell with the higher probability value is more likely to be chosen as the next cell.
The selection of primary pathways is not random in order to avoid placing inappropriate pathways in the initial population. Consequently, the proposed GA has a faster convergence rate. In the GA, the start and end points are considered as fixed genes in the path chromosomes. In this population production method, unfitting paths such as loops may be created. The redundant routes are eliminated using the loop removal operator that is studied in the next section.

E. EVOLUTIONARY OPERATORS
In the proposed method, the chromosomes of the GA represent different routes to reach the receptor. By applying the defined operators of GA appropriate to these chromosomes and considering a target function according to the user's needs, the GA intends to improve the primary paths over several generations. The main idea of GA is to transfer inherited traits by genes. Changes always accompany gene transfer from one generation to the next, and in this transfer, two natural occurrences happen for the chromosomes. The first event is the crossover (combination) of chromosomes, and the second is the mutation operator in which some genes are altered randomly [68], [69], [70]. The output of the algorithm converges towards the optimal answer to the user's needs while guaranteeing the global optimum. Proposed operators must operate so that the continuity of the route is maintained from the beginning to the end. Writing an appropriate code and setting constraints and conditions guarantee the continuity of the path.

1) CROSSOVER OPERATION
As mentioned earlier, the crossover is one of the most critical GA operators and leads to reproduction (production of offspring) [68]. In practice, some of the genes are shared between two chromosomes. First, two chromosomes are chosen using selection methods. Next, some common points of these two chromosome strings, excluding the first and last common points, are elected. One or more points are randomly selected from the genes, depending on the type of combination operator. Afterward, the crossover operator is performed on the specified gene of the chromosome. Fig. 10 illustrates an example of how a single point crossover is executed.

2) MUTATION OPERATION
The mutation is another important operator in the GA in which one or more genes in the chromosomes produced by parents are randomly changed [69]. In the proposed method, the mutation operator is applied to path cells and therefore faces many limitations. Due to the necessity of having continuous paths created by the algorithm and maintaining them, and also with the existing limitations in routing and using a non-fixed configuration, i.e., chromosomes with variable length, the mutation operator must be applied carefully, assuring the continuity of the route. Besides, it must be ensured that no unjustified routes are generated. Implementation of mutation operators on the routes is depicted in Fig. 11.

3) LOOP REMOVAL AND SHORTCUT OPERATOR
The loop removal operator does not exist in the actual GA. Like many other applications, the loop removal operator has been added to the model as required by the operator. This technique is utilized to remove extra genes. The loop removal is mainly used to shorten the path. Loop removal is applied to the initial population, the population created after the crossover, and the mutation. Fig. 12 shows the redundant loops that the loop removal operator eliminates.

4) SELECTION OPERATION
The selection operator aims to choose two chromosomes that must be utilized to produce the next generation. There are different methods for selection, namely random, roulette wheels, tournaments, etc [70]. This work is implemented based on the random, roulette wheel and the tournament selection strategies. The reason for these selection methods is that the combination of the two top chromosomes may always cause the algorithm to get stuck in the local optimum instead of finding the optimal path.

F. EVALUATION (FITNESS FUNCTION)
Fitness function evaluates and determines the fitness value of each chromosome [68], [69]. Achieving the shortest and best route and choosing the most efficient relays are essential factors in the operation of the DMC network. Selection of the route with maximum weight is always one of the main concerns and goals of the operator. Moreover, reducing the path length is always one of the primary concerns taken into account in various models. In this study, the fitness functions are defined as follows: where w i represents the weight of each cell, N indicates the number of genes on the target chromosome, c i indicates the number associated with the genes, d(·) is the distance between two cells to be calculated, x c i and y c i denote the spatial positions of the genes in the environment, and β is a coefficient that prevents the fitness function from becoming too large (the goal is to minimize the F function). The preference of this algorithm is to select the d 21 + d 22 path instead of the d 11 + d 12 path, as illustrated in Fig. 13. Indeed, it should be noted that any other criterion can be added to the algorithm and used as a parameter to acquire the optimal path.

G. NEW GENERATION
In order to consistently improve the value of the objective function in successive generations, a percentage of the best chromosomes in each generation are selected for transfer to the next stage or generation [68]. This approach ensures the improvement of the objective function and moves towards the optimal solution. Replacement strategies refer to methods in which children derived from GA operators replace their parents. As shown in Fig. 14, 20% of the best parents in each generation are selected initially. The chosen parents are passed on to the next generation without applying any GA operator. Next, the crossover, mutation, and loop removal operators are performed on the entire population. Fig. 14 provides a demonstration of the desired process.
Finally, in the following, the pseudo-code related to the proposed algorithm is given. The code consists of three main parts, namely population selection, crossover, and mutation.

V. DIJKSTRA's ALGORITHM
The presented DA finds the shortest route between two points of a weighted graph. DA begins from the initial node, finds the weight of the paths from node to node, and finally places the least weight on the destination path. The algorithm acquires the distance from the starting point to all other nodes [71]. According to the intended purposes of the problem, in most of the presented approaches, the equation that DA utilizes to define the edge coefficients is as follows [71] where B i indicates the criterion of the problem, and a i is the corresponding coefficient of this criterion. It is worth VOLUME 11, 2023

A. DA CODING AND GRAPH CONSTRUCTION
Proper coding is necessary to perform a precise comparison between the proposed GA and the DA approach. To convert and map the ECS, we need an appropriate coding scheme for DA and a suitable criterion for defining the weight of the edges. DA places a node at each cell vertex. Assuming that n is the number of cells in the rows of the cellular network, and the number of cells in the grid columns is equal to m, then the total number of nodes acquired for this environment is equal to (n + 1) × (m + 1). Fig. 15 illustrates the network of nodes positioned at the four vertices of the ECS cells.
As observed, the nodes are fully connected in DA. The coefficients of the edges that conjoin the nodes together are computed as follows where w i is the weight associated with each cell, α indicates the optimization coefficient selected according to the degree of importance, the coefficient A represents a coefficient equal to 1 in vertical and horizontal movements and √ 2 in the diagonal motion. In DA, like the GA, the start and end points are given to the algorithm as input data.

VI. SIMULATION RESULTS AND ANALYSIS
MATLAB simulations are conducted in order to validate and examine the proposed model. A laptop with an Intel Core i5 processor, 2.4 GHz, and 4-GB DDR3 RAM is employed for this study. Two distinguished scenarios are considered for the simulation studies; small complex ECS and large complex ECS. The two differ in terms of size, i.e., the number of cells involved for each case. The environment is transformed into smaller sets for both simulations, and a separate GA is implemented for each section (locally). Eventually, these local paths connect to each other, forming a global pathway from the source to the destination.
In implementing the proposed GA, the search for the appropriate relay is accomplished cross-sectionally due to the nature of routing in MCvD. First, the environment is divided into smaller segments, and the GA selects the best path and relay for each section separately. In order to acquire the best path and relays with a global view, the algorithm must follow a series of conditions and constraints at each stage. Finally, the proposed model selects the optimal path and relays to forward the message from TX to RX with a sequential and ascending path. Whereas DA, which is used to compare and verify the accuracy of the proposed GA, assumes that the entire space and the relays and obstacles distributions are available with a fixed global view.
A. 6 × 6 COMPLEX EXTRACELLULAR SPACE The first simulation comprises an ECS of a 6 × 6 in which relays and obstacles are placed randomly. Fig. 16 shows the desired domain and distribution of the relays. The proposed GA code includes all the substances mentioned in the previous sections. The structure of the code is designed in such a way that our model avoids the existing obstacles. Table 1 summarizes all the parameter values considered in this simulation. Fig. 17 shows the final output obtained by the proposed model. The yellow cells are the obstacles, pale greens indicate the relays, and red trail represents the communication path. Therefore, the final path is determined,  and the diffusion process is initiated according to the specified cell numbers.
The above procedure results in the designation of selected relays, revealing the final output. The above selections cause the final route and the elected relays to be obtained, as displayed in Fig. 18. Finally, the changes related to the   values of the fitness function (costs) are shown in Fig. 19. The presented GA, one of the heuristic methods, is compared with DA, which is one of the deterministic methods. Fig. 20 depicts the optimal routing path determined utilizing DA for the ECS. We investigate and compare the performance of both algorithms. Table 2  In another attempt, a large complex ECS is divided into a 10 × 10 grid for the desired simulation. As mentioned VOLUME 11, 2023    previously, some of these cells act as relays and some as obstacles. The overall schematic of the space for this simulation, including the relays and obstacles, is depicted in Fig. 21. The GA code similarly includes all the items expressed previously. Table 3 provides the relevant information to be considered in this simulation. Fig. 22 displays the final  output comprising the components. Hence, according to the specified numbers, the communication and relaying process is initiated, as depicted in Fig. 23. The procedure establishes a route from the source to the destination.
The final output and the employed relays for transmission of the information molecules are shown. In addition, Fig. 24 illustrates the variation of the fitness function values. Fig. 25 illustrates the optimal routing path achieved by employing DA. In addition, Table 4 compares the performance of both models in terms of cost function value and computational time. It is worth noting that expanding the ECS size also upsurges the computation time and necessitates more software resources. The processing time per different numbers of cells is illustrated in Fig. 26.
The output of the simulations for the 6 × 6 ECS indicates that the proposed GA provides the optimal routing depending on the number of initial generations and the number of iterations compared to that of DA. It is observed that in environments with larger dimensions (10 × 10), the GA can provide the optimal answer within a shorter time interval.   DA suffers from a high memory requirement in case of the excessive increase of the ECS size. Compared to GA, the time complexity of DA is proportional to the number of relays and obstacles in the ECS. Another advantage that our proposed GA comprises over DA is that if there is a memory shortage problem, the model can work adaptively, i.e., the number of chromosomes can be dropped, and the number of replications can be increased.
The proposed GA also views and performs locally (local search). The ECS is transformed into smaller environments, and a separate GA can be implemented over each section. Eventually, these local paths connect with each other, forming a global route. Also, during the implementation phase, if some of the obstacles move, the GA can still find the number of justified paths that are obtained considering the obstacles. Then, by reproducing the original population and reaching the adequate initial population level, the algorithm converges again by performing the appropriate number of iterations to achieve the optimal answer. However, analytical methods such as DA use sequential search algorithms to find the answers; therefore, if there is a change in the environment, these methods have to repeat all the calculations to find the path.

C. ADAPTIVE CROSSOVER AND MUTATION OPERATORS
In order to check the accuracy and efficiency of the model, we perform the coding in such a way that the probabilities of the crossover and mutation operators vary. In the presented adaptive GA (AGA), the values of p c and p m get adjusted adaptively. The model achieves the adaptation phase by employing the information that is obtained from the population at each generation. This adaptation process can be formulated as follows [72], [73]: where f avg and f min respectively indicate the average and the best values of the fitness function in the population, f and f ′ are the best fitness values in two consecutive crossover and mutation individuals. The values of the coefficients R 1 , R 2 , R 3 , and R 4 are chosen from the interval [0, 1], to update the two probabilities adaptively. The convergence criterion of the model, i.e., error (E), is defined as  where C I and C I −1 respectively represent the best fitness values for two consecutive I th and (I − 1) th generations. Fig. 27 shows the course of the changes in the cost function for a 10 × 10 ECS obtained by the two algorithm strategies. It is observed that employing the AGA enhances the convergence rate of our proposed model. It is observed that the proposed GA/AGA model recognizes and selects the most efficient relays accurately, and at the same time, obstacles are identified and avoided. The results further indicate that the proposed model provides an optimized multi-hop routing for the MCvD. The outputs of the simulations illustrate that the proposed GA and AGA provide the optimal routing depending on the number of initial generations and the number of iterations. It is observed that the GA and AGA can provide optimal routing within a shorter time interval in environments with larger dimensions. It is noted that DA suffers from a high memory requirement in case of the excessive increase of the ECS size. Compared to GA, the time complexity of DA is proportional to the number of relays and obstacles in the ECS.
Another advantage that our proposed GA and AGA comprises over DA is that if there is a memory shortage problem, the model can work adaptively, i.e., the number of chromosomes can be dropped, and the number of replications can be increased. The proposed GA and AGA are capable of viewing and performing local and global searches. The ECS is transformed into smaller environments in the proposed framework, and a separate GA/AGA can be implemented over each section. Eventually, these local paths connect, forming a global route. Also, during the implementation phase, if some of the obstacles move, the proposed model can still find the number of justified paths that are obtained considering the relays and obstacles. It is observed that by reproducing the original population and reaching the adequate initial population level, the algorithm converges again by performing the appropriate number of iterations to achieve the optimal relaying. However, analytical methods, i.e., deterministic models, such as DA, use sequential search algorithms to find the answers; therefore, if there is a change in the environment, these methods must repeat all the calculations to acquire the path. In addition, the presented GA and AGA can also be leveraged to solve scenarios with multiple dynamic objectives or constraints. The results further indicate that the proposed framework is more prominent in more extensive networks and coverage faster compared to that of other models. The proposed GA and AGA can be considered time-efficient models, guaranteeing optimal routing in complex environments.

VII. CONCLUSION
The main components and aspects of MC are based on the transfer of molecules, which have been considered in biological processes. This paper proposes and investigates a novel routing technique in multi-hop DMC in an ECS. Our proposed intelligent system elevates DMC by selecting the most advantageous relays and the shortest routes. Accurate search method based on graph coding is investigated as the benchmark in this study. The paper further compares the performance and accuracy of the presented model with the analytical (deterministic) method. The simulations and comparisons confirm the significant superiority of the proposed model. The proposed GA and AGA with optimal routing have a significant effect on minimizing the latency and energy consumption of the communication system. We should bear in mind that by increasing the number of cells, these methods face the problem of temporal and computational complexity. Accordingly, hybrid models employing deterministic and heuristic techniques can be investigated in the future to improve the accuracy and efficiency of the system. Moreover, methods such as Q-Learning can be used as other comparative techniques.