## 4 Algorithm
### Discrete Particle Swarm Optimization
#### 4.2.3 Fitness Function
 \tag{21}\]  
**Definition 9** (Fitness Function F(i)): _The fitness of a given particle \(F(i)\) can be defined as follows:_  
\[F\left(i\right)=\left(1+D\left(i\right)\right)\times\left(1+N\left(i\right)\right) \tag{22}\]  
However, problem (10) is more than a nonlinear constrained multi-objective optimization problem. The actual energy consumption of some particles after decoding may exceed the energy consumption constraint, so here we further introduce the penalty function combined with the phenotype sharing function to convert it into a non-constrained one. **Definition 10** (Penalty Function P(i, Q)): \(P(i,Q)=T(i)+Q\times S(i)\)_, where \(Q\times S(i)\) is a penalty item and \(Q\) is a penalty factor whose limit is \(\infty\). The penalty function method is a widely used and effective optimization method. Its basic idea is to greatly punish those iteration points which attempt to violate constraints during the process of solving the constrained optimization problem, thus converting the constrained one to the non-constrained one. Due to the energy consumption constraint, in this paper we further combine the penalty function to evaluate the merits of particles. In order to achieve more Pareto feasible solutions and improve the convergence speed, here we propose four different penalty functions, indicated as follows, which are all constructed by the additional method and have different effect. _Penalty Function 1 (P1)_: In this penalty function, as shown in Equation (23), the penalty factor is a 2-based exponential function, whose index is the ratio between the current solution (energy consumption of the particle) and the feasible solution (maximal permissible energy consumption). While \(T(i)\) and \(S(i)\) are both set as \(F(i)\). The more the obtained solution deviates from a feasible solution, the greater the degree of punishment will be. It grows exponentially with the intensity deviation:  
\[F\,\text{'}\left(i\right)=\left(1+2^{\mathit{pr}}\right)\times F\left(i\right) \tag{23}\]  
where \(T(i)=F(i)=S(i)\), \(Q=2^{\mathit{pr}}\), \(\mathit{pr}=\left|\dfrac{E\left(G\,\text{'}\right)}{\varepsilon E\left(G\, \text{'}\right)}\right|\). _Penalty Function 2 (P2)_: In this penalty function, as shown in Equation (24), we directly select the difference between the current solution and the feasible solution as the penalty item when energy consumption exceeds the constraint, while _T(i)_ is set as _F(i)_:  
\[F\,\text{'}\left(i\right)=F(i)+\left[\max\left(\mathit{pr},0\right)\right]^{2} \tag{24}\]  
where \(S(i)=\left[\max\left(\mathit{pr},0\right)\right]^{2}\), \(\mathit{pr}=E\left(G\,\text{'}\right)-\varepsilon E\left(G\,\text{'}\right)\) and \(T(i)=F(i)\). _Penalty Function 3 (P3)_: In this penalty function, as shown in Equation (25), the penalty factor is a quadratic function, whose cardinal number is the ratio between the current solution and the feasible solution. \(T(i)\) and \(S(i)\) are both set as \(F(i)\). Compared to P1, the growth trend of this kind of punishment is relatively stable with the degree of deviation:  
\[F\,\text{'}\left(i\right)=\left(1+\mathit{pr}^{2}\right)\times F\left(i\right) \tag{25}\]  
where \(T(i)=F(i)=S(i)\), \(Q=\mathit{pr}^{2}\), \(\mathit{pr}=\left|\dfrac{E\left(G\,\text{'}\right)}{\varepsilon E\left(G\, \text{'}\right)}\right|\). _Penalty Function 4 (P4)_: This penalty function, as shown in Equation (26), takes a logarithmic function method to construct the penalty factor. \(T(i)\) and \(S(i)\) are both set as \(F(i)\). What the difference between the P1 and P3 is the extent of punishment. The punishment to the particle grows slowly by the deviation of the current solution:  
\[F\,\text{'}\left(i\right)=\left(1+\ln(1+pf)\right)\times F\left(i\right) \tag{26}\]  
where \(T(i)=F(i)\), \(S(i)=F(i)\), \(Q=\ln(1+pf)\) and \(pf=\left\lfloor\dfrac{E\left(G\,\text{'}\right)}{\varepsilon E\left(G\,\text{'} \right)}\right\rfloor\). Although the energy consumption of some particles after decoding exceeds the permitted range, they may carry some optimal information.