# An Optimization Routing Algorithm Based on Segment Routing in Software-Defined Networks
## 3 Algorithm Design
### Proposed Optimization Algorithm for Link Weight
In this paper, three improvements are put forward based on the AMOPSO algorithm:  
(1) The solution distribution entropy at the \(t\)th iteration is calculated by the probability distribution function of the cell with non-dominated solutions in the archive. The variation in distribution entropy determines the evolutionary tendency of the population. However, the method is only suitable for the optimization of two goals. We use a parallel cell coordinate system (PCCS) [27] to calculate the distribution entropy, which can be used for multi-dimensional data analysis and visualization. The difference in entropy represents the change in the approximate Pareto front redistribution, which is then used to assess the diversity and convergence and thus infer the potentiality of finding a new solution to the current population. The Pareto entropy and the difference in entropy change greatly, indicating that the new solution dominates a large number of old solutions in the external archive. So, this leads to a wide range of approximate Pareto front changes, and the convergence of the approximate Pareto front needs to be enhanced. The smaller the difference in entropy, the smaller the range of the approximate Pareto front redistribution. The diversity of the Pareto front needs to be enhanced. (2) In [26], the convergence degree is evaluated by the dominate strength of the \(t\)th solution at the \(t\)th iteration and the difference between solution and dominated solutions. In our algorithm, we use a more intuitive way to evaluate the convergence of solutions. The essence of convergence performance is to calculate the average distance of the target vector from the optimal Pareto front to the real Pareto; thus, the average distance obtained is used to measure the degree of proximity of the final solution and the non-dominated optimal solution. So, we evaluate the convergence of solutions by finding the distance between each solution and the optimal Pareto frontier. (3) The authors in [26] do not evaluate the diversity of solutions in detail. In this paper, we use the distribution of indicators, namely, the variance of the distance between adjacent target vectors, to measure the diversity of non-dominated solutions obtained. The smaller the variance is, the better the diversity. \(f_{k,m}\) denotes the \(m\)-th target value of the \(k\)-th non-dominant solution in the Pareto optimal solution set, and \(f_{k,m}\) can be mapped into a two-dimensional planar grid with \(K\times M\) cells according to (1):  
\[L_{k,m}=\left[ \begin{array}{c}K\frac{f_{k,m}-f_{m}^{\min}}{f_{m}^{\max}-f_{ m}^{\min}}\end{array} \right] \tag{1}\]  
where \(\left\lceil x\right\rceil\) is the rounding function; \(k=1,\,2,\,...,\,K,\,K\) is the number of members in the current iteration for external archive. \(m=1,\,2,\,...,\,M,\,M\) is the problem of the number of goals to be optimized;\(L_{k,m}\in\{1,2,\ldots,K\}\) is an integer number in which \(f_{k,m}\) is mapped to PCCS. The data set on the Pareto front can all be mapped into the PCCS by using (1), as shown in Figure 1. \(P_{k,m}\) represents the \(m\)-th cell coordinate component of the \(k\)th target vector. Figure 2 shows the parallel cell coordinate system of five cell coordinates and three objective functions. During the \(t\)-th iteration, the Pareto entropy \(Ent(t)\) of the approximate Pareto front stored in the external archive can be calculated according to (2):  
\[Ent(t)=-\sum_{k=1}^{K}\sum_{m=1}^{M}\frac{C_{k,m}(t)}{KM}\log\frac{C_{k,m}(t)}{ KM} \tag{2}\]  
where \(C_{k,m}(t)\) denotes the number of cell coordinate components falling to the \(m\) column of the \(k\)-th row after the approximate Pareto front is mapped to the PCCS. In the two adjacent iterations \(t-1\) and \(t\), \(\Delta E(t)\) denotes the difference in entropy, which indicates the degree of change in the approximate Pareto front. \(\Delta E(t)\) can be calculated by (3):  
\[\Delta E(t)=E(t)-E(t-1) \tag{3}\]  
The global optimal solution is given as:  
\[\text{gbest}(t)=\left\{