# A Quantum-Behaved Neurodynamic Approach for Nonconvex Optimization with Constraints
## 3 Quantum-Behaved Neurodynamic Swarm Approach
: _The fitness value of the QNSO algorithm could be different from the energy function of the neural network. A large \(\gamma\) may bring a better performance as it effectively restricts particles to diverge beyond the feasible region._  
QNSO can always find the accurate local minimum of each particle within one iteration. Compared with general global optimization algorithms (such as PSO), when the number of local minimum is small, QNSO is extremely insensitive to heuristic parameters; when the number of local minimum is large, the QNSO algorithm needs sufficient divergence ability of heuristic parameters to jump out of local minimum. In other words, appropriately larger \(\beta\) in QPSO can be more suitable for the QNSO algorithm. Detailed steps of the QNSO algorithm are given in Algorithm 1. During local search process, the feedback neural network in the algorithm is applied to solve the local optimization problem with constraints. The QPSO algorithm is applied to perform global search process. Therefore, the advantages of the QPSO algorithm and the feedback neural network can complement each other. The flow chart of QNSO is shown in Figure 1.  
```
1: Set the swarm size \(q\), parameter \(\beta\), tolerance error precision \(\varepsilon\), the maximum number \(K_{\max}\) of iterations, the expected cost function value \(E_{e}\), the lower bound of cost function \(M_{1}\) and the initial step \(k=0\). 2: Initialize the position \(X_{i}\in\mathbb{R}^{n}\) of particles, \(i=1,2,\cdots,q\), using uniform random distribution, and get the initial individual best positions and global best position. 3: Carry out the following feedback neural network to obtain a local optimal solution for each particle: \[\varepsilon\dot{x}=-\
abla F(x,M_{1})-\gamma\partial\sum\limits_{i=1}^{q} \big{(}\max\big{\{}0,g_{i}(x)\big{\}}\big{)},\] where \(\varepsilon>0\) is a scaling parameter which is introduced to accelerate the convergence rate of the neural network. 4: Update the individual best position \(P_{i}\) of the \(i\)th particle, \(i=1,2,\cdots,q\) and the global best position \(P_{g}\) of the particle swarm using \[P_{i}(k)=\left\{ \begin{array}{ll}X_{i}(k),&\text{when }E(X_{i}(k))<E(P_{i}(k-1)),\\ P_{i}(k-1),&\text{when }E(X_{i}(k))\geq E(P_{i}(k-1)),\end{array} \right.\] and \[P_{g}(k):=(G_{1},G_{2},\cdots,G_{n})=\min_{1\leq i\leq q}\{E(P_{i}(k))\}.\]
5: Update the position \(X_{i}(k+1)\) of each particle, that is, the initial conditions of the feedback neural network, using the following the renewal equations: \[p_{ij}(k) =\alpha_{j}(k)P_{ij}(k)+[1-\alpha_{j}]G_{j}(k),\] \[C(k) =\frac{1}{q}\sum\limits_{i=1}^{q}P_{i}(k),\] \[X_{ij}(k+1) =p_{ij}(k)\pm\beta|C_{j}(k)-X_{ij}(k)|\ \ln\frac{1}{\eta_{ij}(k)},\] where \(i=1,2,\cdots,q,j=1,2,\cdots,n\) and \(\alpha_{j}(k)\sim U(0,1)\), \(\eta_{ij}(k)\sim U(0,1)\). 6: The iteration stops if one of the following conditions is satisfied: 1. The algorithm reaches the maximum iteration value \(K_{\max}\). 2. \(|E(P_{g})-E_{e}|<\varepsilon\). 3. \(P_{g}\) stops updating for five consecutive iterations. Otherwise, set \(k:=k+1\) and go to step 3. ```  
**Algorithm 1** QNSO Algorithm.