## 4 MODECP Approach
### Controller Placement Module
In addition, the ownership of switches and controllers is also limited by the capacity of the controllers. If these conditions are not met, the mutated individuals are regenerated in the candidate controller set randomly. The pseudocode of the mutation process is described in Algorithm 3. ```
Input \(k\), population size: \(np\), chromosome length: \(cl\), \(Ca\), \(\lambda_{i}\) Output  Initial population 1 Randomly generate \(k\) values in the range [0, \(cl\)\(-\)1] as controller_set 2 Initial \(P\)\(\leftarrow\)null for\(i<np\)do for\(j<cl\)do \(P_{ij}\)\(\leftarrow\)randomly choose a value from controller_set endfor  Calculate the load of each controller  if the load of each controller exceeds capacity constraints then  reproduce \(P_{ij}\) endif endfor  endfor  return Initial population and the set of controllers
```  
**Algorithm 2** Initialization of the population  
In order to enhance the diversity of the population, the new population is crossed to generate a variety of progeny vectors. For each individual in the population, the \(g\)-th generation population is crossed with its mutated new population based on the given crossover factor. By comparing with the crossover factor, the alleles of the new population are selected from the unmutated population and the mutant population. The pseudocode for the crossover process is described in Algorithm 4. ```
Input  Population, mutation population, crossover parameter: \(\sigma\)  New population 1  Initial \(Ps\leftarrow\)null  2  Randomly generate _jrand_ and a real number \(r\) of size (\(np\), \(cl\)) between 0 and 1. 3 for\(i<np\)do  4  for\(j<cl\)do  5  if\(r(i,j)<cr\) or \(j\)=_jrand_then  6 \(U_{i,j}^{S}\gets V_{i,j}^{S}\)  7  else  8 \(U_{i,j}^{S}\gets P_{i,j}^{S}\)  9  end if  10 \(Ps\leftarrow U_{i,j}^{S}\)  11  end for  12  end for  13 return crossover population
```  
**Algorithm 4** Crossover  
Finally, to select the optimal individual from the population, we utilize the greedy algorithm to select the population according to the evaluation result of the fitness function. The fitness function of each individual in the population is compared, and the individual with the best fitness function is selected and stored in the candidate optimal solution set. The best performance result in the candidate solution set is ultimately selected as the solution in the controller placement module, which effectively completes the selection of the controller position and the management of the switch. The pseudocode for the population selection process is described in Algorithm 5. ```
Input  Population, crossover population  the better solution 1  Initial \(Ps\leftarrow\)null  2  Calculate the fitness of all individuals in the population  3  if\(f(U_{i}^{S})<f(P_{i}^{S})\)then  4 \(Ps_{i}^{S}\leftarrow U_{i}^{S}\)  5  else  6 \(Ps_{i}^{S}\leftarrow P_{i}^{S}\)  7  end if  8 return the better solution
```  
**Algorithm 5** Selection  
In the differential evolution process, the evaluation of the fitness function is a critical step. The fitness of each individual distribution in each generation is calculated for the purpose of comparing the approximate optimal results. The pseudocode for the calculation process of the fitness function is described in Algorithm 6. ```
Input  Chromosome, _controller_set_ Output  Fitness 1  Calculate \(D\), \(S\), \(C\) and \(L\) by Equations (5), (8), (10) and (13)  2  The fitness is calculated by normalizing to Equation (22)  3 return the fitness of chromosome
```  
**Algorithm 6** Fitness Calculation  
Through the above-mentioned operations of population initialization, mutation, crossover, selection, and fitness evaluation, the population can evolve repeatedly and cyclically. The algorithm stops running when the iteration reaches the maximum iteration times.