# Synchronous Remote Calibration for Electricity Meters: Application and Optimization
## 3 Methods
### Algorithm
#### 3.2.4 Description of the Hybrid Gene Algorithm  
The Algorithm 2 first obtains a feasible task scheduling scheme, encoded into the initial individual P and the initial optimal solution \(P_{0}\). Subsequently, a number of different solutions are obtained by randomly changing the individuals to form the initial population M. Thereafter, the client-side and server-side queues are altered to produce a wide range of solutions while avoiding local convergence by means of a device-based optimization,which will be described in a later section. Further, the local search algorithm is used to optimize each sub-solution to find the optimal task scheduling order for each sub-solution. Finally, the fitness of the individual populations is calculated, the populations are ranked and updated using a population management approach, and the solution with the highest fitness is set as the optimal solution \(P_{0}\). The table (Lines 4-11) describes the device-based optimization, where the required tuning parts are the client device and the server device, and the tuning process is designed to generate as many different solutions as possible to avoid local convergence. The strategy consists of two parts: chromosome crossover and mutation. The number of individuals in the population to be processed is NUM(M), where NUM(M) is even. The solution is expanded using various crossover techniques. On the one hand, select from population M two adjacent feasible solutions \(P_{i}\) and \(P_{i+1}\), randomly exchanging the gene segments at corresponding positions in the client cohort (Lines 4-5). On the other hand, select from population M two feasible solutions \(P_{i}\) and \(P_{i+NUM(M)/2}\) separated by NUM(M)/2 (Lines 6-8), randomly exchanging the gene segments at corresponding positions in the server-side queue. Furthermore, chromosome mutation is applied to both the client and server sides. To reduce execution time while obtaining a more reasonable solution, the mutation range is limited to servers and clients capable of performing the task type. ```
0: Detection points set \(\mathcal{N}_{K}\), Central laboratory nodes set \(\mathcal{N}_{G}\), All tasks set \(\mathcal{N}_{X}\)
0: Minimum task completion time
1: Generate initial feasible solution and convert it into chromosome individuals, set as initial best solution \(P_{0}\)
2: Initialize population \(M\)
3:for\(j=0\) to \(IT_{\max}\)do
4:for\(k=0\) to \(NUM(M)-1\) by 2 do
5: Swap client gene segments between \(Chrom[k]\) and \(Chrom[k+1]\)
6:for\(k=0\) to \(NUM(M)/2-1\)do
7: Swap server gene segments between \(Chrom[k]\) and \(Chrom[k+NUM(M)/2]\)
8:for\(k=0\) to \(NUM(M)-1\)do
9: Randomly mutate genes in \(Chrom[k]\)
10:for\(k=0\) to \(NUM(M)-1\)do
11: Initialize task order queue
12:for\(i=0\) to \(IP_{\max}\)do
13: Alter order queue \(P\)
14: Obtain fitness using Algorithm 1
15:if the fitness is higher then
16: Update the individual solution
17: Sort population individuals by fitness
18:if Fittest individual is better than the best solution then
19: Update the best solution
20:return Solution in population \(M\) with the minimum completion time
```  
**Algorithm 2** Hybrid Genetic Algorithm  
Following the device-based optimization, a solution consisting of different client and server assignments is obtained. However, for specific client and server assignments, variations in the task execution order lead to differences in task completion time, necessitating the identification of the optimal task execution order through a local search strategy. If a solution has optimization potential, i.e., if the theoretical minimum completion time (excluding task conflicts) is less than the current best solution, a sequence-based optimization is employed to adjust the task execution order. The search strategy first establishes the initial execution order based on task types and then cross-orders tasks of different typesas the starting execution order. Subsequently, a new execution order is generated through random swapping.