# Artificial-Intelligence-Based Charger Deployment in Wireless Reshargeable Sensor Networks
## 4 Proposed Scheme
### TS-Based Charging Algorithm  
The concept of the TS is that the best solution will be recorded in the tabu list [36]. Therefore, the solution will be better than those before each iteration. The tabu list can avoid some solutions which were found repeatedly. In other words, the main principle of TS using the tabu list is to record the best solution of each iteration. However, we can find better solutions via a comparison with all the previous experiences. We used this concept to design the charger deployment algorithm called the TS-based charging algorithm (TSBC). In the beginning of TSBC, candidate chargers are chosen randomly. The deployed status of candidate chargers will be changed in each iteration. The solution can be evaluated by _f(x)_. We can find the current best solution and record it in the tabu list. Note that if the currently found solution is the same as the solution recorded in the tabu list, we cannot accept it, even if it is better. This is like human memory; information will be stored in the memory for a long time. The size of the tabu list will affect the quality of solutions and the computational cost, as too much storage will increase the time spent on checking the TS list, thereby increasing the computational time. With too little storage, past experience cannot be completely recorded. In view of this, the storage of the tabu list should be changed according to environmental factors. This is an important parameter in TS.  
The first step creates \(N_{c}\) bits; the value of each bit will be randomly set as 1 or 0. A value of 1 means that the candidate charger is able to deploy in this specified position, and a value of 0 represents that the charger cannot be deployed in this position. To ensure the fairness in comparing algorithms, we set up the experimental group and control group. We copied the \(L\) neighbor solution as the experimental group. Then, \(C_{i}\) was chosen randomly, and the status of \(C_{i}\) was reversed. The next step was calculating the _f(x)_ of the solution. If the solution was better than before and was not the same as a solution on the tabu list, the experimental group was replaced; this process was repeated until the termination criterion was met.  
In the first step, we randomly create the initial solution \(N_{c}\) and empty the tabu list, as shown in lines 1-2 of Algorithm 2. To compare the quality of the experimental group and control group, \(f(x)\), as shown in line 3, is calculated. The next step is to randomly choose \(C_{i}\), change the status of \(C_{i}\) and compare their _f(x)_, as shown in lines 5-6. We can replace the solution if another one's _f(x)_ is better and the solution is not the same as a solution on the tabu list, as shown in lines 7-9. The last step is to update the tabu list. If the size of the tabu list is exceeded, we use first-in first-out (FIFO) as the main process to record the next solution. Finally, this algorithm will repeat until the termination criterion is met.  
```
Input: \(V_{c},V_{s}\)  Output: \(V_{E}\)
1. Empty the tabu list
2. Create the initial solution \(N_{c}\) randomly
3. Calculate the _f(x)_
4. While the termination criterion is not met
5. choice \(C_{i}\) randomly
6. Fitness Function(N\({}_{c}\), C\({}_{i}\))
7. If f(x) is better and didn't same with tabu list
8. replace the solution
9. end if
10. Update tabu list by FIFO
```  
**Algorithm 2** TS-based charging algorithm (TSBC).