# A Quantum-Behaved Neurodynamic Approach for Nonconvex Optimization with Constraints
## 4 Function Tests
\(\psi_{0}\) and \(\varphi_{0}\) correspond to the position angles of the rocker and the crank respectively when the rocker is in the right limit position. The minimum transmission angle \(\gamma_{min}\) is greater than \(45^{\circ}\). The crank-rocker mechanism is required to be designed when the crank is transferred from \(\varphi_{0}\) to \(\varphi_{0}+\frac{\pi}{2}\) and the output angle \(\psi\) of the rocker meets the following predetermined motion rules \(\psi_{s}\): \(\psi_{s}=\psi_{0}+\frac{1}{6}(\varphi-\varphi_{0})^{2}\). It is shown in Figure 11 that the lengths of the four shafts are marked as \(l_{1},l_{2},l_{3}\) and \(l_{4}\), respectively. \(l_{1}\) is the length of short shaft. Set \(l_{1}\) be the unit length that is, \(l_{1}=1\). Set the decision variable \(x:=[l_{2},l_{3},l_{4}]^{\top}\). It follows from the cosine theorem that  
\[\psi_{0} =\pi-\arccos\frac{l_{4}^{2}+l_{3}^{2}-(l_{1}+l_{2})^{2}}{2l_{4}l_ {3}},\] \[\varphi_{0} =\arccos\frac{l_{4}^{2}+(l_{1}+l_{2})^{2}-l_{3}^{2}}{2l_{4}(l_{1} +l_{2})}.\]  
According to the design requirements, the optimization goal is to minimize  
\[f(x)=\int_{\varphi_{0}}^{\varphi_{0}+\pi/2}(\psi-\psi_{s})^{2}.\]  
To numerically minimize \(f(x)\), discretizing the cost function by dividing the interval \([\varphi_{0},\varphi_{0}\ +\ \pi/2]\) into 50 parts yields  
\[f(x)=\sum_{p=0}^{p=50}(\psi_{p}-\psi_{sp})^{2}.\]  
The actual output angle of the crank-rocker mechanism is \(\psi_{p}\) which can be calculated by  
\[\psi_{p} =\left\{ \begin{array}{l}\pi-\alpha_{p}-\beta_{p},\ \ \ \ \ 0\leq \varphi_{p}\leq\pi,\\ \pi-\alpha_{p}+\beta_{p},\ \ \ \pi\leq\varphi_{p}\leq 2\pi,\\ \varphi_{p}=\varphi_{0}+\frac{\pi}{2}\frac{p}{50},\ p=1,2,\cdots,50,\end{array} \right.\]  
Figure 11: Crank–rocker mechanism. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \(f(x^{*})\) & \(x_{1}^{*}\) & \(x_{2}^{*}\) & \(g_{1}(x^{*})\) & \(g_{2}(x^{*})\) & \(g_{3}(x^{*})\) & \(g_{4}(x^{*})\) \\ \hline
7049.2493 & 182.0179 & 295.6012 & \(-82.01787\) & \(-117.9821\) & \(-113.5834\) & \(-104.3988\) \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Optimization results in Application 2.  
where  
\[r_{p} =\sqrt{l_{1}^{2}+l_{4}^{2}-2l_{1}l_{4}\cos\varphi_{p}},\] \[\alpha_{p} =\arccos\frac{r_{p}^{2}+l_{3}^{2}-l_{2}^{2}}{2l_{3}r_{p}},\] \[\beta_{p} =\arccos\frac{r_{p}^{2}+l_{4}^{2}-l_{1}^{2}}{2l_{4}r_{p}}.\]  
The minimum transmission angle constraints are given by  
\[\cos\gamma=\left\{ \begin{array}{l}\frac{l_{2}^{2}+l_{3}^{2}-(l_{4}-l_{1})^{2 }}{2l_{2}l_{3}}\leq\cos 45^{\circ},\delta\leq 90^{\circ},\\ \frac{(l_{4}+l_{1})^{2}-l_{2}^{2}-l_{3}^{2}}{2l_{2}l_{3}}\leq\cos 45^{\circ}, \delta>90^{\circ},\end{array} \right.\]  
which are equivalent to  
\[l_{2}^{2}+l_{3}^{2}-(l_{4}-l_{1})^{2}-\sqrt{2}l_{2}l_{3}\leq 0,\] \[(l_{4}+l_{1})^{2}-l_{2}^{2}-l_{3}^{2}-\sqrt{2}l_{2}l_{3}\leq 0.\]  
The length constraints are given by  
\[l_{2} \geq l_{1},l_{3}\geq l_{1},l_{4}\geq l_{1},\] \[l_{1}+l_{4}\leq l_{2}+l_{3},\] \[l_{1}+l_{2}\leq l_{4}+l_{3},\] \[l_{1}+l_{3}\leq l_{2}+l_{4}.\]  
Following the above analysis, we summarize the optimization problem as follows:  
\[\min f(x) =\sum_{p=0}^{p=50}(\psi_{p}(x)-\psi_{sp}(x))^{2},\] (14) subject to \[g_{1}(x) =x_{1}^{2}+x_{2}^{2}-(x_{3}-1)^{2}-\sqrt{2}x_{1}x_{2}\leq 0,\] \[g_{2}(x) =(x_{3}+1)^{2}-x_{1}^{2}-x_{2}^{2}-\sqrt{2}x_{1}x_{2}\leq 0,\] \[g_{3}(x) =1-x_{1}\leq 0,\] \[(l_{4}+l_{1})^{2}-l_{2}^{2}-l_{3}^{2}-\sqrt{2}l_{2}l_{3}\leq 0.\]0 \[(l_{4}+l_{1})^{2}-l_{2}^{2}-l_{3}^{2}-\sqrt{2}l_{2}l_{3}\leq 0.\]1 \[(l_{4}+l_{1})^{2}-l_{2}^{2}-l_{3}^{2}-\sqrt{2}l_{2}l_{3}\leq 0.\]2 \[(l_{4}+l_{1})^{2}-l_{2}^{2}-l_{3}^{2}-\sqrt{2}l_{2}l_{3}\leq 0.\]3 \[(l_{4}+l_{1})^{2}-l_{2}^{2}-l_{3}^{2}-\sqrt{2}l_{2}l_{3}\leq 0.\]4  
where  
\[(l_{4}+l_{1})^{2}-l_{2}^{2}-l_{3}^{2}-\sqrt{2}l_{2}l_{3}\leq 0.\]5 \[\psi_{p}(x) =\left\{ \begin{array}{l}\pi-\alpha_{p}(x)-\beta_{p}(x),\ \ \ 0\leq \varphi_{p}\leq\pi,\\ \pi-\alpha_{p}(x)+\beta_{p}(x),\ \ \ \pi\leq\varphi_{p}\leq 2\pi,\end{array}