## 3 The Hybrid PSOCS Algorithm
### The Proposed Algorithm  
There is no algorithm that can effectively solve all optimization problems. Merging the existing algorithms is one way to ensure that a global optimum solution can be achieved [13]. The PSO is one of the most widely used algorithms in hybrid methods due to its simplicity and convergence speed. It has also been proven that the CS is able to search for the global optimum, but it suffers from a slow convergence rate. In order to resolve the aforementioned problem, a hybrid algorithm of PSO and CS (PSOCS) is proposed. Basically, the hybrid PSOCS combines the ability of social communication in PSO with the local search capability of CS. The aim of this combination is to inform cuckoo birds of their positions; this, in turn, helps cuckoo birds to move to a better position. In each iteration, the positions of cuckoo birds are updated as follows:  
\\[v_{i}^{t+1}=v\\times v_{i}^{t}+c_{1}\\times rand\\times\\left(\\textit{{pbest}}_{i} -x_{i}^{t}\\right)+c_{2}\\times rand\\times\\left(\\textit{{gbest}}-x_{i}^{t}\\right) \\tag{7}\\]  
\\[x_{i}^{t+1}=x_{i}^{t}+v_{i}^{t+1} \\tag{8}\\]  
where \\(v_{i}^{t}\\) is the velocity of cuckoo \\(i\\) at iteration \\(t\\), \\(c^{\\prime}{}_{1}\\) and \\(c^{\\prime}{}_{2}\\) are acceleration coefficients, and \\(x_{i}^{t}\\) is the current position of the cuckoo.  
In the hybrid PSOCS algorithm, eggs in the host nests are randomly initialized. Each egg in a nest is considered a candidate solution. After initialization, the quality of a solution is calculated and evaluated. After updating the best solution so far, the velocities of all cuckoos are calculated by Equation (5), the positions of cuckoos are then updated using Equation (6). The remaining steps are similar to those of the CS. In the proposed algorithm, each cuckoo considers the best personal experience to be _pbest_; the best _pbest_ among all the cuckoos is _gbest_. The communication is established through both the _pbest_ and _gbest_.  
In order to improve the performance, another modification was also made to the PSOCS. The values of \\(p^{t}{}_{a}\\) and \\(\\alpha^{\\prime}{}\\) at iteration \\(t\\) are calculated as follows:  
\\[p_{a}^{t}=p_{a\\max}-\\frac{t}{N}\\left(p_{a\\max}-p_{a\\min}\\right) \\tag{9}\\]  
\\[\\alpha^{\\prime}=\\alpha_{\\max}\\exp(k\\,t) \\tag{10}\\]  
where \\(k=\\frac{1}{N}\\ln\\left(\\frac{\\alpha_{\\min}}{\\alpha_{\\max}}\\right)\\) and \\(N\\) is the number of iterations. The values of \\(p^{t}{}_{a}\\) and \\(\\alpha^{\\prime}{}\\) are gradually decreased from the first generation until the final generation.  
The hybrid PSOCS algorithm has the following remarks:  
* The cuckoos near good solutions try to communicate with the other cuckoos that are exploring a different part of the search space.
* When all cuckoos are near good solutions, they move slowly. Under the circumstances, _gbest_ helps them to exploit the global best.
* The algorithm uses _gbest_ to memorize the best solution found so far, and it can be accessed at any time.  
* Each cuckoo can see the best solution (_gbest_) and has the tendency to go toward it.
* The abilities of local searching and global searching can be balanced by adjusting \\(c^{\\prime}\\)1 and \\(c^{\\prime}\\)2.
* Finally, by adjusting the values of \\(p_{a}\\) and \\(\\alpha\\) in each iteration, the convergence rates of the PSOCS are improved.  
The proposed hybrid algorithm has the advantage of being comprised of two algorithms, which is reflected in the aforementioned remarks. In this proposed algorithm, the interactive information among solutions is improved to encourage a global search. In the following sections, the proposed hybrid algorithm is evaluated in training the neural network.