# Artificial-Intelligence-Based Charger Deployment in Wireless Reshargeable Sensor Networks
## 4 Proposed Scheme
### GA-Based Charging Algorithm  
The concept of the GA [37; 38], as mentioned above, originated from the theory of evolution. The GA-based charging algorithm (GABC) based on this concept was used to design the deployment problem. In this paper, the chromosome represents the solution. The gene represents the candidate position and whether or not it will be deployed. GABC is composed of three steps. The first step is selection. We can choose a better solution according to _f(x)_. This is an important mechanism for convergence. The better solution will be selected, and the worse one will be eliminated. The second step is crossover. Chromosomes can exchange genes with each other. In this way, the solution will be better because the better chromosomes will be chosen in the selection. The third step is mutation. The gene has an opportunity to change the status of genes in each chromosome so that the solution will have the ability to avoid fall into a local optimum through mutation. The GA's greatest difference from SA and TS is that they are single-solution methods, whereas the GA is a multi-solution method. This means that the GA has a large solution space to expand and find the best solution, although it will require more computational time.  
The first step is to create \(L\) chromosomes. A difference from SA and TS is that the GA needs different chromosomes to evolve, so genes of the chromosomes have different statuses. In the second step, we need to calculate fitness function _f(x)_. The third step is selection, which can choose a better solution by _f(x)_. The fourth step is crossover. The fifth step is mutation. All of the above steps will repeat until the termination criterion is met.  
This part shows the GABC algorithm by its pseudocode. The first step is to randomly create the initial chromosomes whose length is \(N_{c}\), as shown in line 1 of Algorithm 3. Note that each status of the gene will be created randomly, ensuring biological diversity. Each chromosome will then calculate the _f(x)_, as shown in line 3. The next step is selection: randomly choosing two chromosomes to compare them with _f(x)_ and then saving the better one, as shown in line 4. The following step is crossover: randomly choosing two chromosomes and then exchanging the genes randomly, as shown in line 5. The next step is mutation: randomly choosing genes to exchange their status. For example, a candidate charger will change its status from \"to be deployed\" to \"not to be deployed\", as shown in line 6. This process is repeated until the termination criterion is met so that the best chromosome will be found.  
```
\(\mathrm{GA}\)-Based Charging Algorithm Input: \(V_{c},V_{s}\) Output: \(V_{E}\)
1. Randomly create the initial chromosome which length is \(\mathrm{N_{c}}\)
2. While the termination criterion is not met
3. Fitness Function(chromosome)
4. Selection
5. Crossover
6. Mutation
7. End
8. Find the best solution
9. Randomly create the initial chromosome which length is \(\mathrm{N_{c}}\)
10. While the termination criterion is met
```  
**Algorithm 3** GA-based charging algorithm.