# A Method for Degenerate Primer Design Based on Artificial Bee Colony Algorithm
## 3 The Proposed Algorithm
### Design of Foraging Strategy  
According to the search space representation in Figure 3, each candidate food source corresponds to a path from the start node to the exit node. Therefore, the degenerate primer design problem can be treated as a path optimization problem, and ant colony optimization is an effective means for dealing with such problems. In order to represent all kinds of bees in Figure 3 for effective search, in this paper, the concept of pheromones is introduced into the artificial bee colony optimization model in order to solve the problem of the variable lengths of food sources, and by means of the pheromone record, all kinds of bees are able to access quality information in the process of searching for the food source, guiding their subsequent foraging process. A global pheromone matrix is added to the DPD-HABC optimization model algorithm to record the current information on the search state and guide the subsequent foraging process of the employed bees. In addition, each employed bee is equipped with a pheromone matrix to record the state information of foraging around the food source and to guide the foraging process of onlooker bees attracted by the food source. The foraging strategies and pheromone renewal strategies of the employed, onlooker and scout bees will be introduced below. In the DPD-HABC algorithm, each employed bee constructs a candidate food source in accordance with the current global pheromone matrix, the pheromones in its own saved local pheromone matrix, and heuristic information. Heuristic information is embodied in the form of heuristic factors, which can guide the selection of the next node. When employed bee \(l\) generates a candidate food source at the \(j\)-th node of layer \(i\), the selection probability formula used to select node \(k\) of the next layer is calculated as shown in Formula (13). \[P_{ij}^{k}=\left\{ \begin{array}{ll}\frac{[\tau^{S}_{ij\text{+}}+\tau^{l}_{ ijk\text{+}}]^{*}[\eta_{ijk\text{+}}]^{S}}{\sum\limits_{h\in allowd_{h}}[\tau^{S}_{ij \text{+}}+\tau^{l}_{ijk\text{+}}]^{*}[\eta_{ijk\text{+}}]^{S}}&if\;k\in allowed _{h}\\ 0&Otherwise\end{array} \right. \tag{13}\]  
where \(\tau^{S}_{ijk\text{ and }}\tau^{l}_{ijk\text{ are the pheromone values from the }j\text{-th node in the }i\text{-th layer to the }k\text{-th node in the next layer, respectively, stored in the global pheromone matrix and the local pheromone matrix of \(l\); \(\alpha\), \(\beta\) respectively represent the corresponding weights of the pheromone factor and the heuristic factor; _allowed\({}_{h}\)_ is the set of nodes that can be accessed by the next layer; \(\eta_{ijk}\) is a heuristic factor. The calculation method is shown in Formula (14). \[\eta_{ijh}=\frac{Converse_{ijh}}{Degeneracy_{ijh}} \tag{14}\]  
where _Degeneracy\({}_{ijh}\)_ represents the degeneracy of the current partial path after the \(j\)-th node of layer \(i\) is selected in the node \(h\) of the next layer, and _Converse\({}_{ijh}\)_ represents the coverage of the current partial path after the \(j\)-th node of layer \(i\) is selected in the node \(h\) of the next layer. Because we are aiming for degenerate primer design with maximum coverage, when the degeneracy is certain, the larger the coverage, the better, and the value of the heuristic factor will increase accordingly. Because the onlooker bee is mainly responsible for local searching around the food source, in the DPD-HABC algorithm, after each onlooker bee selects a given employed bee, the construction of its candidate food source is mainly based on the information in the local pheromone matrix saved by the employed bee. For an onlooker bee that chooses employed bee \(l\) for the follow-up search, when it is at the \(j\)-th node of layer \(i\) in the process of constructing the candidate food source, the selection probability formula used to select the node \(k\) of the next layer is calculated as shown in Formula (15). \[P_{ij}^{k}=\left\{