# A Method for Degenerate Primer Design Based on Artificial Bee Colony Algorithm
## 3 The Proposed Algorithm
### Update of the Pheromone Matrix  
In order to construct candidate food sources with variable lengths, the pheromone concept employed in ant colony optimization is used in the artificial bee colony algorithm. The DPD-HABC algorithm contains two kinds of pheromone matrix: the global pheromone matrix and the local pheromone matrix.  
The global pheromone matrix mainly identifies the preferred search area of the current employed bee group and represents information on the current group's search experience. Each employed bee sets up a local information matrix to record the individual search experience information it has obtained so far. In this way, each bee is able to forage according to the current search experience information of the whole population or the search experience information of individual employed bees. In the process of constructing candidate food sources, the greater the number of pheromones on a given side of the search space, the greater the probability of that side being selected.  
In the DPD-HABC algorithm, when all employed bees have generated candidate food sources, the value of each element in the global pheromone matrix, that is, pheromone concentration, will be reduced in the same proportion to simulate pheromone volatilization. Then, _CBEST_, the best quality food source among these newly generated candidate food sources, is used to enhance the pheromones on the edges. For the pheromone \(\tau_{ijk}\) on the edge between the \(j\)-th vertex of layer \(i\) and the \(k\)-th vertex of layer \(i+1\), the updated pheromone value is calculated as shown in Formula (11).  
\[\tau_{ijk}\leftarrow(1-\rho)\tau_{ijk}+\Delta\tau_{ijk}^{chest} \tag{11}\]  
where \(\rho\)\(\in\)(0,1) represents the volatilization rate of the pheromone. If an edge arc is included in the _Cbest_ path, set the increment \(\Delta\tau_{ijk}^{chest}\) of pheromone on the edge to the reciprocal of the fitness function value of \(CBEST\). In the process of algorithm solution, Formula (1) is used as the fitness function of candidate primers, and its calculation is shown as Formula (12).  
\[\Delta\tau_{ijk}^{best}=\begin{cases}\frac{1}{7(CBSEST)}&if<(i,j),(i+1,k)>\in CBEST \\ 0&otherwise\end{cases} \tag{12}\]  
The updating of the local pheromone matrix for each employed bee is mainly carried out on the basis of the quality of the candidate food source constructed by the attracted onlooker bees. In this paper, the local pheromone matrix is updated using the best candidate path information generated by onlooker bees attracted by each employed bee in each evolution process. The calculation method for the value of each element in the local pheromone matrix is the same as that in the global pheromone matrix. In this paper, the pheromone values in the pheromone matrix change between \([\tau_{\text{min}},\,\tau_{\text{max}}]\), and the calculation method of \(\tau_{\text{min}}\) and \(\tau_{\text{max}}\) is the same as that in the MMAS algorithm [21].  
Furthermore, for the current best food source F recorded by an employed bee, each update means that a better food source F' has been found than F. By comparing the corresponding paths of these two food sources, we can identify what changes in F can be transformed into food source F', and these changes are the fundamental reason for the food source becoming better. To this end, the DPD-HABC algorithm configures an identity matrix LMark of a binary type for each pheromone matrix to record side arcs contained in F' but not contained in F.