Multi-Objective Optimization with Mayﬂy Algorithm for Periodic Charging in Wireless Rechargeable Sensor Networks

: Wireless energy transfer (WET) is a revolutionary method that has the power to tackle the energy and longevity challenges in wireless sensor networks (WSN). This paper uses a mobile charger (MC) to discover the procedure of WET based on a wireless sensor network (WSN) for a periodic charging technique to maintain the network operational. The goal of this work is to lower overall system energy consumption and total distance traveled while increasing the mobile charger device vacation time ratio. Based on an analysis of total energy consumption, a new metaheuristic called mayﬂy algorithm (MA) is used to achieve energy savings. Instead of charging all nodes at the same time in each cycle, in our strategy, the mobile charger charges only energy-hungry nodes due to their levels of energy. In this strategy, when the ﬁrst node reaches the calculated minimum energy, it notiﬁes the base station (BS), which computes all nodes that fall under threshold energy and sends the MC to charge all of them to the maximum energy level in the same cycle. Mathematical results show that the mayﬂy algorithm can considerably decrease the charging device’s total energy consumption and distance traveled while maintaining performance because it can keep the network operational with less complexity than other schemes.


Introduction
A wireless sensor network (WSN) is a collection of low-cost, effective, and multipurpose sensors with the job of monitoring an area of interest (AoI) [1]. Since the majority of existing sensors are battery-powered, their lifespan is limited by the capacity of the battery, which makes energy effectiveness critical because sensor node energy resources are limited and easily depleted. Optimal energy distribution in WSN has emerged as a new issue [2][3][4]; energy lifecycle management problem, i.e., how to transfer energy in an optimized or accurate way to control a network, is also a critical issue in wireless sensor networks [5]. Researchers have proposed effective methods to extend sensor life spans in recent decades, including wireless recharging strategies [6,7], sensor network energy consumption reduction techniques, and harvesting energy from the surrounding environment, such as solar [8,9]. Nonetheless, due to inefficiency in power conversion and environmental uncertainty, power conversion from a source of external energy, such as solar energy, into electrical energy is unreliable. In addition to that, while reducing sensor energy consumption can extend the network lifetime, the sensors' energy could be avoided from being drained over time. To improve performance, wireless recharging strategies for supplying sensor energy for the wireless rechargeable sensor network (WRSN) [10,11] are suggested. Because each sensor's battery capacity is limited, it's critical to replenish the energy supply before the sensor's battery runs out. Using a moving car with charging devices that use wireless to replenish the sensors evolves as a right favorable answer to cover this matter [12][13][14][15].

1.
We find a solution to the problem of wireless energy transfer (WET) by researching the mobile charging demand method, which involves the introduction of two sets of energy variables: emin, which refers to the calculated minimum or lowest energy, and ethresh, which refers to the threshold energy in the node. In addition to this, we present the multi-objective functions as a potential solution to this problem.

2.
As far as we know, this is the first time the mayfly algorithm has been used in sensor node charging. Optimizing multiple objectives, including minimizing the total energy consumption of sensor nodes, minimizing the total distance traveled by MC, and maximizing vacation time for the mobile charger, is formulated in this work as an optimal problem. Using seven other good performance algorithms, we assessed MA's efficiency in reducing sensor node energy consumption, mobile charging distance, and vacation time.

3.
Introduces the concept of a renewable energy cycle in which the remaining energy level of a sensor node's battery exhibits periodicity over time. We present both the necessary and sufficient conditions for a renewable energy cycle and demonstrate that feasible solutions that meet these requirements can provide renewable energy cycles and, consequently, a long lifetime for sensor networks.
Section 2 refers to the work's related history. Section 3 presents the methodology, while in Section 4, we analyze the total energy consumption of the whole network. The strategy used and used algorithm is explained in Section 5, and in Section 6 the simulations carried out with the results are delivered. In Section 7, we conclude our work and express our work for the future.

Literature Review
Xie et al. [39,40] discussed the evolution and classification of wireless energy transmission technology and used it in WSNs for the first time by employing wireless mobile charging devices (WMCDs). Vehicle energy supply offers sensor nodes a stable and accurate energy supply, and this has recently attracted considerable scientific interest [41]. The sensor nodes are charged following the established charging planning using an intelligent wireless mobile charger carrying batteries, such as a mobile car, mobile machine or robot, or unmanned air vehicle [42,43]. The most important aspect of charging planning challenges for MC is determining the sequence in which sensor nodes should be charged and how much energy should be restored. To maximize the lifespan of the network, all network conditions, including sensor node deployment, energy consumption, and sensor node positions, must be taken into account. An adaptive fuzzy model was used to generate an efficient charging plan in [44] which increases the lifetime of the sensors in the WRSN. The suggested approach employs multi-node mobile charging capable of simultaneously charging numerous sensors. The MC received charging requests from low-energy sensors in this algorithm and got assigned a limited amount of visiting places to visit where one or more asking sensors are within the charging range of the visiting sites. As a fuzzy model, the Sugeno-fizzy inference method (S-FIS) was applied by considering the remaining energy in the node, node density, and distance from nodes to the mobile charger. Wireless mobile charging vehicles (WMCVs) challenges for route scheduling, such as excessive charging delay, poor energy consumption effectiveness, and small scalability, the authors in [45] proposed a new algorithm for planning more than one mobile charger using a hybrid technique to address these issues. The optimal characteristics of the cuckoo search and the genetic algorithm were combined to solve the path scheduling problem in the hybrid algorithm proposed.
Importance-different charging scheduling techniques were presented to maximize charging effectiveness while minimizing loss of information [46]. The distinguishing feature of this technique is that it differentiates nodes based on the relevance of data transmission. To attain their objectives, they employed the matroid theory. First, the matroid model determines two critical factors: the task's deadline and the task's penalty value. Furthermore, a greedy job classification method was created to reduce data loss. All jobs were separated into two categories: early tasks and delayed tasks, with the node with the higher priority and shorter deadline having a higher inclusion priority in the early task. Previous studies on periodic charging planning in WRSN made the incorrect assumption that a mobile WCV's traveling energy is enough for the charging trip and that the energy minimization rate for each sensor is the same [47]. To demonstrate that these assumptions are false, a hybrid particle swarm optimization genetic algorithm was presented as a solution to the problem. Extended calculations have been performed, and innovative results indicate that the suggested periodic charging strategy can eliminate node mortalities while maintaining the regular fluctuation of sensor node energy. The algorithm empirically outperformed both the genetic algorithm (GA) and the particle swarm optimization (PSO). Firefly algorithm was improved for handling the WCV deployment optimization problem [48].
The mayfly algorithm was used in wireless sensor networks (WSNs) to solve a variety of problems, such as detecting and repairing void holes caused by nodes deployment sparely imbalance in terms of the overall energy usage among sensor nodes and improper choice of relay nodes in underwater wireless sensor networks (UWSNs) [49]. The bicriteria mayfly optimization algorithm was implemented by minimizing the number of holes and packet data loss, thereby optimizing the network's effectiveness of service and energy efficiency. Numerous researchers have attempted to identify energy efficiency issues, but they have been unable to do so using an appropriate routing protocol. Cluster head (CH) selection is addressed in this study by a combination of the mayfly optimization algorithm and an energy-efficient routing protocol. Therefore, data delivery between the central head and base station (BS) occurs across the entire network. By rotating the selection of CH based on optimization, energy consumption is reduced redundantly, and the energy hole problem is resolved. Energy coherent mayfly optimization algorithm simulations are performed to determine the performance of the proposed mobile sensor node [50].
In this work, we present a mayfly algorithm that exploits the advantages of both existing systems while reducing the impact of their shortcomings, based on the concept of periodic charging across nodes. With the notion of nodes periodic charging within each round of selected tours, our approach decreases the charger trip distance by scheduling based on the Hamiltonian cycle, total energy consumption, and increasing the ratio of the mobile charger vacation time.

Methods
The model for MC's performance and the control approach in WSN are presented in this part. The primary abbreviations and notations used in this paper are listed in'Abbreviations.

MC and Travel Path
Assume we have a network with N nodes spread out over a 2D space, with each node's location i N known as (X i , Y i ) and that every sensor node produces sensing data at a rate R i (in bits per second), a stationary base station (BS) within the sensor network that serves as the sink node for all data generated by all sensor nodes. All data streams are routed to the base station using a single hope data routing, a rest station (RS) where the mobile charger may recharge its battery and prepare for the next cycle. A mobile charger is used to move around the network and charge the batteries of the sensor nodes. The MC departs out of its home station within the sensor network, traverses the region along a predetermined path, and then returns to its home station at the end of its journey. At certain locations along its path, the MC pauses to charge sensor nodes that are scheduled to be charged during the current cycle (see Figure 1). Before returning to the service station, we suppose that the MC has sufficient energy to sustain its journey, data collection, and nodes energy transfer. packet data loss, thereby optimizing the network's effectiveness of service and energy efficiency. Numerous researchers have attempted to identify energy efficiency issues, but they have been unable to do so using an appropriate routing protocol. Cluster head (CH) selection is addressed in this study by a combination of the mayfly optimization algorithm and an energy-efficient routing protocol. Therefore, data delivery between the central head and base station (BS) occurs across the entire network. By rotating the selection of CH based on optimization, energy consumption is reduced redundantly, and the energy hole problem is resolved. Energy coherent mayfly optimization algorithm simulations are performed to determine the performance of the proposed mobile sensor node [50].
In this work, we present a mayfly algorithm that exploits the advantages of both existing systems while reducing the impact of their shortcomings, based on the concept of periodic charging across nodes. With the notion of nodes periodic charging within each round of selected tours, our approach decreases the charger trip distance by scheduling based on the Hamiltonian cycle, total energy consumption, and increasing the ratio of the mobile charger vacation time.

Methods
The model for MC's performance and the control approach in WSN are presented in this part. The primary abbreviations and notations used in this paper are listed in Abbreviations.

MC and Travel Path
Assume we have a network with N nodes spread out over a 2D space, with each node's location known as ( , ) and that every sensor node produces sensing data at a rate Ri (in bits per second), a stationary base station (BS) within the sensor network that serves as the sink node for all data generated by all sensor nodes. All data streams are routed to the base station using a single hope data routing, a rest station (RS) where the mobile charger may recharge its battery and prepare for the next cycle. A mobile charger is used to move around the network and charge the batteries of the sensor nodes. The MC departs out of its home station within the sensor network, traverses the region along a predetermined path, and then returns to its home station at the end of its journey. At certain locations along its path, the MC pauses to charge sensor nodes that are scheduled to be charged during the current cycle (see Figure 1). Before returning to the service station, we suppose that the MC has sufficient energy to sustain its journey, data collection, and nodes energy transfer.  During each cycle (C), the MC will charge some sensor nodes in the cycle. In the Cth cycle, H n represents the nodes that must be charged while visited. MC passes thru the Hamiltonian cycle in the Cth cycle, MC passes through the smallest Hamiltonian cycle, which connects nodes in H n and BS. The shortest Hamiltonian cycle's traveling path is represented by P n . D n signifies the length of path P n , and t n represents the time spent across distance D n . The total time for the MC's tour cycle is marked by T, while the MC's vacation time in the Cth cycle is denoted by τ vac . The MC goes from RS to H n during the Cth cycle, visiting and charging sensor nodes before returning to RS for τ vac . The following formula is used to compute the cycle time T: where ∑ j∈h n t j is the total amount of time spent by the MC charging all nodes in H n .

Control Methodology
As previously stated, this paper employs a periodic strategy in which the MC is used to replenish the SN in a T-cycle. In order to supplement its energy consumption, every node should be regularly charged. Previous research [39,40] indicates that the MC enters the network and charges all nodes during each cycle. As some nodes close to the base station could use a few times less energy than nodes farther away, it is unnecessary to charge each node in the cycle. This paper employs the strategy used and is well explained in our previous work [19]. Equation (1) shows how the energy consumption of node i have to be equal to the MC's energy supply, according to the energy conservation principle [1].
where T i denotes node i's charging and visiting intervals time, and P i denotes node i's energy consumption rate. Our work goal is to resolve the WET by studying the charging request strategy. We use the same proposed energy levels from our previous work, which are e min , and e thresh [19] and are calculated using Equations (4) and (5). Normally maximum energy in the node is E max , while the minimum one is E min . When a node reaches the threshold energy, it communicates to the base station, the BS calculates all nodes that reached and went below threshold energy and then sends the mobile charger to charge them to the maximum energy as shown in Figure 2. Remember that the proposed minimum energy should always be more than the normal minimum energy in nodes to avoid the node from failing. The following are the formulas for calculating our three energy variables:

Total Energy Consumption Analysis
We present a periodic charging based on the mayfly algorithm where we first calculate the charging period for the sensor node i based on its energy consumption rate after accurately setting T. As a result, in each cycle, the MC must visit a few nodes to reduce its path distance. The total energy consumption is calculated as follows: Here X 1 and X 2 are two-position variables calculated with our mayfly algorithm.

Total Energy Consumption Analysis
We present a periodic charging based on the mayfly algorithm where we first calculate the charging period T i for the sensor node i based on its energy consumption rate P i after accurately setting T. As a result, in each cycle, the MC must visit a few nodes to reduce its path distance. The total energy consumption is calculated as follows: where λ is the non-radiative energy transfer's energy conversion efficiency. T total is the total amount of time, and D total is the total distance traveled by the MC overall cycles. The MC vacation time ratio τ vac , which is used as the optimization goal in [39,40,51]. In this study, we define ω vac as the mean percentage of time spent on vacation by the MC in each cycle, and it can be calculated as follows: where ∑ k τ vac is the total amount of vacation time spent by the MC across all cycles. The goal of this study is to lower the value of P total . We can see from Equation (7) that as ω vac increases, the mobile charger has a longer time frame to recharge its battery at a rest station which means better performance of the network.

Optimization with Flowing Rate and Data Routing
The implementation of our strategy lies in two basic parts. The optimization of the first part of P total is the first step, while the second one is to develop a cooperative scheme to shorten the MC's travel distance as explained in our previous work [19] where the flow balance limitation for each node i is shown in (Equation (8)).
Here, j =i ∑ j∈N w ij + w iB denotes the data flow rate of energy transmission from node i to j or the base station, and k =i ∑ k∈N w ki denotes the data flow rate of energy reception from node k to i. Each sensor node uses energy to transmit and receive data. In this work, we adopt the energy consumption model [52], which has been widely used in mentioned early studies, and the energy consumption of node i is shown in the following equations: With In this model, the purpose of optimization is to decrease node total energy consumption (i.e., ∑ i,i∈N p i ), which is the first portion of P total in Equation (6). Every node should World Electr. Veh. J. 2022, 13, 120 7 of 16 indeed fulfill the fundamental flow balancing constraint in Equation (8) and the energy consumption model in Equation (9). The optimal challenge can therefore be explained as a linear programming problem as follows: In this problem, the optimization variables are W ij , W iB , and p i , while the constants are R i , v ij , and v iB .

The Procedure of Joint Design
After solving the optimization problem in Equations (12) and (13), the energy consumption rate p i for each sensor node i can be calculated. In this section, we build a system that combines the charging period T i , the visiting set Cth in each cycle, and the MC traveling path.

Step 1
In Step 1, we fixed the number of sets that need to be classified and calculated the value of T for MC. If P max and P min are the maximum and minimum energy required by the node then the minimum and maximum charging time can be calculated as follows: It takes T min to send the first charging request when the node's batteries are full and T max to send the last charging request. To highlight the connection between the two difficulties, the proposed technique initially places the MC at the location of the base station. Indicate g as the number of seats to be categorized, which is structured as follows: Operations and are for rounding a number to the nearest integer and down to the nearest integer, respectively.

Step 2
During this phase, we define the charging period T i for each node i and classify the set Z k . To begin, we set the charging period T i of each node i (i ∈ N) as follows: Here, a is the estimated logarithm of the T i and T ratio, which may be calculated as follows: Define the set Z k (1 ≤ k ≤ g) and let (i ∈ s a ); the MC will visit node i during the n.2 a−1 th trip cycle. In this step, we obtain a set F j during the jth cycle and the design of the MC's trip path, which is the set of sensor nodes that should be charged during the jth cycle. j 1 ≤ j ≤ 2 g−1 can be expressed as j = n 2 c where n is an odd number, c an integer, and c ≥ 0. Denote F j as the set of nodes that should be visited and recharged during the jth cycle, and F j can be obtained as follows: Let P j represents MC's travel path during the jth cycle. It is self-evident that P j should be the shortest Hamilton cycle connecting all nodes in F j and the base station BS, i.e., As we stated earlier, Algorithm 1 was used in our previous work [19] and is summarized as follows:

Algorithm 1
Define the value of T and the number of the visits set Initialize P max and P min Initialize e min and e thresh Set g Set the recharging period of node i, T i and classify Z k Define Z 1 , Z 2 , . . . , Z g For i = 1,2 3, . . . , n do a= log 2 If j is odd, then Charge nodes n i to E max End for End for

Mayfly Algorithm
Mayfly is a newer heuristic algorithm for solving complex non-linear optimization problems that were developed in the year 2020 [53]. It was influenced by the behavior and reproduction process of mayflies. It has been dubbed a hybrid of PSO [54], GA [55], and FA [56] because it combines the best features of these algorithms. Male mayflies dance above the water in swarms to attract females for mating. The courted female mayflies fly randomly to the males, mate in the air, and then lay their eggs on the water surface [57]. Only the fittest mayflies survive after hatching. Each mayfly's position in the search space denotes a potential optimization solution, and the objective function's output determines how good a solution is. If the best solution is better than the initial global best solution, it becomes the global best solution, and iteration continues until all conditions are met. The algorithm works by: Initialization: At time step t, the mayflies' positions in a two-dimensional search space are initialized as a = (a 1 , . . . , a d ) T and b = (b 1 , . . . , b d ) T , respectively, and a velocity v = (v 1 , . . . , v d ) T is assigned to each mayfly.
Estimation of performance: The objective function (F) determines the mayfly's performance. During each iteration, the algorithm saves the best personal (pbest) and global positions (gbest). One cycle (Cyc) is the period between two charging demands and the sum of vacation, charging, and travel time for all visited nodes. Our fitness function goal is to minimize the number of cycles, system total power consumption, and MC's total distance traveled, which maximizes mobile charging vacation time.
s.t E min < e min < e thresh , E min = 0.05 × E max e max < e thresh < E max , E max = 10.8 kJ Velocity and position updates: Each mayfly's position is adjusted depending on its own and its neighbors' experiences. The following is the male mayfly's velocity and position update: However, because it must remain in its nuptial dance, the best male mayfly updates its velocity using Equation (25) for the algorithm's functionality.
The female mayfly's position and velocity are updated as follows: where x 1 and x 2 are individual learning variables. The inertia weight, distance sight coefficient, nuptial dance, and random flight are represented by g, β, m, and f l, respectively. The Cartesian distance is represented by n p and n g , and n is a random value Between −1 and 1. Male mayflies are thought to move at a low velocity during their nuptial dance, whereas female mayflies move at a high velocity during their random flight. Selection: Parent mayflies are chosen for mating based on their fitness values. As a result, the higher the fitness value, the greater the likelihood of selection.
Crossover: The crossover operator depicts the mating of two mayflies as follows: one parent is chosen from the male population and the other from the female population. Parents are chosen in the same way that females are attracted to males. Specifically, the selection can be either random or based on the fitness function of the organism. In the latter, the best female breeds with the best male, the second-best female with the second-best male, and so on. Two offspring (children) are produced as follows: Between −1 and 1. Male mayflies are thought to move at a low velocity during their nuptial dance, whereas female mayflies move at a high velocity during their random flight. Selection: Parent mayflies are chosen for mating based on their fitness values. As a result, the higher the fitness value, the greater the likelihood of selection.
Crossover: The crossover operator depicts the mating of two mayflies as follows: one parent is chosen from the male population and the other from the female population. Parents are chosen in the same way that females are attracted to males. Specifically, the selection can be either random or based on the fitness function of the organism. In the latter, the best female breeds with the best male, the second-best female with the second-best male, and so on. Two offspring (children) are produced as follows: represents the male and female parents, ɵ is a random number within a given range while the initial velocities of the children are set to zero.
Mutation: After evaluating the performance of the children, the mutation is introduced. By mutating the children, the algorithm is prevented from reaching a local minimum. To induce mutation in Equation (28), a uniformly distributed random number is added to selected children.
where and are the standard deviation and standard normal distributions, respectively. The mutated children are also evaluated in terms of performance.
Merge Population: The mutated children are merged with the non-mutated children, after which they are divided equally. This results in the formation of new children.
Survival Selection: Parent and child populations are sorted by performance to select Between −1 and 1. Male mayflies are thought to move at a low velocity during their nuptial dance, whereas female mayflies move at a high velocity during their random flight. Selection: Parent mayflies are chosen for mating based on their fitness values. As a result, the higher the fitness value, the greater the likelihood of selection.
Crossover: The crossover operator depicts the mating of two mayflies as follows: one parent is chosen from the male population and the other from the female population. Parents are chosen in the same way that females are attracted to males. Specifically, the selection can be either random or based on the fitness function of the organism. In the latter, the best female breeds with the best male, the second-best female with the second-best male, and so on. Two offspring (children) are produced as follows: represents the male and female parents, ɵ is a random number within a given range while the initial velocities of the children are set to zero.
Mutation: After evaluating the performance of the children, the mutation is introduced. By mutating the children, the algorithm is prevented from reaching a local minimum. To induce mutation in Equation (28), a uniformly distributed random number is added to selected children. = where and are the standard deviation and standard normal distributions, respectively. The mutated children are also evaluated in terms of performance.
Merge Population: The mutated children are merged with the non-mutated children, after which they are divided equally. This results in the formation of new children.
Survival Selection: Parent and child populations are sorted by performance to select Between −1 and 1. Male mayflies are thought to move at a low velocity during their nuptial dance, whereas female mayflies move at a high velocity during their random flight. Selection: Parent mayflies are chosen for mating based on their fitness values. As a result, the higher the fitness value, the greater the likelihood of selection.
Crossover: The crossover operator depicts the mating of two mayflies as follows: one parent is chosen from the male population and the other from the female population. Parents are chosen in the same way that females are attracted to males. Specifically, the selection can be either random or based on the fitness function of the organism. In the latter, the best female breeds with the best male, the second-best female with the second-best male, and so on. Two offspring (children) are produced as follows: represents the male and female parents, ɵ is a random number within a given range while the initial velocities of the children are set to zero.
Mutation: After evaluating the performance of the children, the mutation is introduced. By mutating the children, the algorithm is prevented from reaching a local minimum. To induce mutation in Equation (28), a uniformly distributed random number is added to selected children.
where and are the standard deviation and standard normal distributions, respectively. The mutated children are also evaluated in terms of performance.
Merge Population: The mutated children are merged with the non-mutated children, after which they are divided equally. This results in the formation of new children. Between −1 and 1. Male mayflies are thought to move at a low velocity during their nuptial dance, whereas female mayflies move at a high velocity during their random flight. Selection: Parent mayflies are chosen for mating based on their fitness values. As a result, the higher the fitness value, the greater the likelihood of selection.
Crossover: The crossover operator depicts the mating of two mayflies as follows: one parent is chosen from the male population and the other from the female population. Parents are chosen in the same way that females are attracted to males. Specifically, the selection can be either random or based on the fitness function of the organism. In the latter, the best female breeds with the best male, the second-best female with the second-best male, and so on. Two offspring (children) are produced as follows: represents the male and female parents, ɵ is a random number within a given range while the initial velocities of the children are set to zero.
Mutation: After evaluating the performance of the children, the mutation is introduced. By mutating the children, the algorithm is prevented from reaching a local minimum. To induce mutation in Equation (28), a uniformly distributed random number is added to selected children.
where and are the standard deviation and standard normal distributions, respectively. The mutated children are also evaluated in terms of performance.
Merge Population: The mutated children are merged with the non-mutated children, after which they are divided equally. This results in the formation of new children. Between −1 and 1. Male mayflies are thought to move at a low velocity during their nuptial dance, whereas female mayflies move at a high velocity during their random flight. Selection: Parent mayflies are chosen for mating based on their fitness values. As a result, the higher the fitness value, the greater the likelihood of selection.
Crossover: The crossover operator depicts the mating of two mayflies as follows: one parent is chosen from the male population and the other from the female population. Parents are chosen in the same way that females are attracted to males. Specifically, the selection can be either random or based on the fitness function of the organism. In the latter, the best female breeds with the best male, the second-best female with the second-best male, and so on. Two offspring (children) are produced as follows: represents the male and female parents, ɵ is a random number within a given range while the initial velocities of the children are set to zero.
Mutation: After evaluating the performance of the children, the mutation is introduced. By mutating the children, the algorithm is prevented from reaching a local minimum. To induce mutation in Equation (28), a uniformly distributed random number is added to selected children.
where and are the standard deviation and standard normal distributions, respectively. The mutated children are also evaluated in terms of performance.
is a random number within a given range while the initial velocities of the children are set to zero.
Mutation: After evaluating the performance of the children, the mutation is introduced. By mutating the children, the algorithm is prevented from reaching a local minimum. To induce mutation in Equation (28), a uniformly distributed random number is added to selected children.
where σ and N α are the standard deviation and standard normal distributions, respectively. The mutated children are also evaluated in terms of performance. Merge Population: The mutated children are merged with the non-mutated children, after which they are divided equally. This results in the formation of new children.
Survival Selection: Parent and child populations are sorted by performance to select the next generation of mayflies for optimization. The mayflies with the best performance results survive, while others die. Figure 3 depicts the mayfly stages.
represents the male and female parents, ɵ is a random number within a given range while the initial velocities of the children are set to zero.
Mutation: After evaluating the performance of the children, the mutation is introduced. By mutating the children, the algorithm is prevented from reaching a local minimum. To induce mutation in Equation (28), a uniformly distributed random number is added to selected children.
where and are the standard deviation and standard normal distributions, respectively. The mutated children are also evaluated in terms of performance.
Merge Population: The mutated children are merged with the non-mutated children, after which they are divided equally. This results in the formation of new children.
Survival Selection: Parent and child populations are sorted by performance to select the next generation of mayflies for optimization. The mayflies with the best performance results survive, while others die. Figure 3 depicts the mayfly stages.

Results and Discussion
This section presents mathematical results that demonstrate how the mayfly algorithm outperforms the other seven state-of-arts we compared with. We employed a network topology and parameter settings identical to those in [19,39,40,51] to test the performance of the used algorithm. MATLAB software was used to run the simulations on an Intel i5-5257U at 2.70 GHz, with 8 GB of RAM. For mayfly's current optimization algorithm, the inertia weight is set to be 1, and the distance sight coefficient is 2.0, while the random flight is 0.77, and the nuptial dance is 0.1. For the firefly algorithm (FA), the attractiveness coefficient is 0.2, while the absorption coefficient is 0.5. For the particle swarm optimization algorithm (PSO), we set both the social component and cognitive coefficient to 2 and inertia weight to 0.9. For the grey wolf optimization algorithm (GWO), the control parameter is set to decrease from 1 to 0.1, and in biogeographical based optimization algorithm (BBO), the probability of mutation is set to 0.1while the fish aggregating device FADs in marine predator algorithm is set to 0.2 and p is set to 0.5. In the invasive weed optimization algorithm (IWO), the maximum and the minimum number of seeds are 5 and 0, respectively, with a modulation index of 2, the initial standard deviation is 0.01, and the final standard deviation is 0.1. Table 1 shows the other parameters used in this study.  Figure 4 displays the results of the first step of MA optimization in terms of energy consumption. As can be shown, MA consumed less energy than other methods, especially from 100 to 500 m, except around the 600 m area, the MFO used less energy than MA. For this, it shows that MFO performs well around 600 m network size, but another place still MA is the best, which makes it the best among all of them. PSO is the second to consume less energy, followed by IWO, GWO, FA, and BBO, which consumed about the same energy.   Figure 5 gives a picture of the cycle number; each scheme has a network size ran from 100 to 1000 m. The mayfly algorithm ran few cycles compared to other algorit only where between 600 and 700 m the PSO ran few cycles than MA, while the MP the one to use made many cycles when the MC is charging sensor nodes.  Figure 5 gives a picture of the cycle number; each scheme has a network size ranging from 100 to 1000 m. The mayfly algorithm ran few cycles compared to other algorithms only where between 600 and 700 m the PSO ran few cycles than MA, while the MPA is the one to use made many cycles when the MC is charging sensor nodes.  Figure 5 gives a picture of the cycle number; each scheme has a network size ranging from 100 to 1000 m. The mayfly algorithm ran few cycles compared to other algorithms only where between 600 and 700 m the PSO ran few cycles than MA, while the MPA is the one to use made many cycles when the MC is charging sensor nodes.  Figure 5 shows that the cycle number that the MC is running increases according to how the network area increases and decreases. Finally, when the network gets to 800 m, it shows that some nodes already started to die. Therefore, the algorithms with a low number of cycles mean they also have a travel distance that is short compared to others, as shown in the next Figure 6.  Figure 5 shows that the cycle number that the MC is running increases according to how the network area increases and decreases. Finally, when the network gets to 800 m, it shows that some nodes already started to die. Therefore, the algorithms with a low number of cycles mean they also have a travel distance that is short compared to others, as shown in the next Figure 6. Because our method uses the MC's shortest route, distance is a critical challenge overcome due to it affects energy consumption. As the MC moves, energy is consum and vacation time decreases.
The MC vacation time ratio is represented in Figure 7, which decreases as the n work area expands in our strategy: for 500 m × 500 m, we reached 87.5%, compared 80.5% for PSO, 50.7% for FA, 80.9% for GWO, 80.6% for BBO, 81% for MPA, 79.3% MFO, and 80.4% for IWO. Because our method uses the MC's shortest route, distance is a critical challenge to overcome due to it affects energy consumption. As the MC moves, energy is consumed, and vacation time decreases.
The MC vacation time ratio is represented in Figure 7, which decreases as the network area expands in our strategy: for 500 m × 500 m, we reached 87.5%, compared to 80.5% for PSO, 50.7% for FA, 80.9% for GWO, 80.6% for BBO, 81% for MPA, 79.3% for MFO, and 80.4% for IWO. Because our method uses the MC's shortest route, distance is a critical challenge to overcome due to it affects energy consumption. As the MC moves, energy is consumed, and vacation time decreases.
The MC vacation time ratio is represented in Figure 7, which decreases as the network area expands in our strategy: for 500 m × 500 m, we reached 87.5%, compared to 80.5% for PSO, 50.7% for FA, 80.9% for GWO, 80.6% for BBO, 81% for MPA, 79.3% for MFO, and 80.4% for IWO.

Conclusions
This paper examined how a mobile charger wirelessly charges sensor nodes in a sensor network by looking at three metrics, which are the system's total energy consumption, the MC's travel distance, and its vacation time ratio. Mayfly algorithm was used to optimize these metrics, and this is the first time used in wireless energy transfer, especially in the area of nodes' on-demand charging. Two sets of energies in this strategy were introduced: energy minimum and threshold energy to charge nodes where the first node will inform the base station when it reaches our calculated energy minimum, and the base station will then calculate all nodes that fall under the threshold energy and send an MC to change them all in one cycle to the maximum energy level E max . A technique was used for joining each node's charging duration, the visiting set, and the traveling path during each cycle in work by first constructing a practical optimization problem with a flow rate to determine the energy consumption rate. Then, we demonstrated how the mayfly algorithm can optimally keep the network operational and can dramatically cut total energy consumption while maintaining vacation time ratio performance maximized according to simulations. For the future work to get more performance results, we will study how the nodes can also be charged partially without charging them to the maximum energy level, and we will make a dead node analysis to test which is a good algorithm in terms of how many nodes died according to different network area sizes.

Conflicts of Interest:
The authors declare no conflict of interest. Charging duration of node i P total System total energy consumption D total

Abbreviations Description
Total distance traveled over all cycles T total Total time spent overall cycles W ij , W iB Flow rate coefficient from node i to node j (or base station) V ij , V iB Energy consumption for transmitting a unit of data from node i to node j or base station ρ Constant coefficient α Path loss index d ij Distance between sensor i and sensor j (or base station B) β 1 and β 2 Constant coefficients in transmission energy modeling (X B , Y B ) Coordinates of the base station V Traveling speed of MCV U Energy transfer rate of MCV g The number of sets needing to be classified Z k The defined set that needs to be classified F j The set of nodes that should be visited during the jth cycle