## 3 Method
Initialization of parameters: the maximum number of iteration as \(T_{\max}\), the initial iteration counter \(t=0\), the number of ants \(M_{\text{ant}}\), the number of ant groups \(S\), and other parameters \(\alpha\), \(\beta\), \(\rho\), \(F\), \(\sigma\), \(q_{0}\). 2. Initialization of ants: divide the whole ant colony into different ant groups; record the number of ants in each groups as \(n_{1}\), \(n_{2}\),... and \(n_{S}\); set the initial pheromone matrix \(\tau_{ij}^{s}(0)=\tau_{0}\), \(s=1,2\),..., \(n_{S}\) for all arcs \(a_{ij}\); set \(G^{+}\) to be an empty graph. 3. \(t=t+1\); \(s=1\). 4. Perform the mutation and crossover operations to the initial pheromone matrix \(\mathbf{\tau}^{s}(t)\) of each ant group using Equations (13) and (14), and generate the trial pheromone matrix \(\mathbf{v}^{s}(t)\). 5. \(s=s+1\); if \(s\leq S\), return to Step 4. 6. \(s=1\), \(k=1\). 7. The \(k\)-th ant constructs the BN \(G_{k}(\mathbf{\tau}^{s})\) using the pheromone matrix \(\mathbf{\tau}^{s}\) according to the codes from Line 8 to Line 12 in Algorithm 2. 8. The \(k\)-th ant constructs the BN \(G_{k}(\mathbf{v}^{s})\) using the pheromone matrix \(\mathbf{v}^{s}\) according to the codes from Line 8 to Line 12 in Algorithm 2. 9. \(k=k+1\); if \(k\leq n_{s}\), return to Step 7. 10. Compute the BIC score for \(G_{k}(\mathbf{\tau}^{s})\), \(k=1\), \(2\),..., \(n_{s}\), choose the best BN with the maximum score and set the maximum score as the fitness \(f(\mathbf{\tau}^{s}(t))\) for \(\mathbf{\tau}^{s}\). 11. Compute the BIC score for \(G_{k}(\mathbf{v}^{s})\), \(k=1\), \(2\),..., \(n_{s}\), choose the best BN with the maximum score and set the maximum score as the fitness \(f(\mathbf{v}^{s}(t))\) for \(\mathbf{v}^{s}\). 12. Compare \(f(\mathbf{\tau}^{s}(t))\) and \(f(\mathbf{v}^{s}(t))\), select the better pheromone matrix according to (15), and select the corresponding BN for the ant group. 13. \(s=s+1\); if \(s\leq S\), \(k=k+1\) and return to Step 7. 14. Select the BN with maximum score from all ant groups, which is recorded as \(G_{t}\). 15. If \(G_{t}\) has the larger BIC score than \(G^{+}\), then \(G^{+}=G_{t}\). 16. Update the pheromone matrix \(\mathbf{\tau}^{s}\), \(s=1\), \(2\),..., \(S\), for each ant group according to (8) and (12) based on \(G^{+}\). 17. Return to Step 3 until \(t>T_{\max}\). Figure 3: The crossover process of the pheromone matrix. Step 18. Terminate and output the best BN structure, namely \(G^{+}\). The above steps of the coACO algorithm applied to learning BN structure can also be presented as the pseudocode in Algorithm 3. ```
/* Initialization */
1 Set the iteration counter \(t=0\);
2 Generate \(M_{\text{ant}}\) ants and divide them to \(n_{S}\) groups;
3 Initialize the pheromone matrix \(\tau^{s}(0)\), \(s=1,2,\,\ldots,\,n_{S}\): for all arcs \(a_{ij}\), set \(\tau_{ij}(0)=\tau_{0}\);
4 Set \(G^{+}\) be an empty graph;
5 //* Iterative search */
6 while termination criteria are not satisfied do
7 iteration counter \(t=t+1\)
8 for\(s=1\):Sdo /* Mutation */
9 Choose \(r_{1}\), \(r_{2}\), \(r_{3}\) from [1, 2,..., \(S\)] s.t. \(r_{1}\
eq r_{2}\
eq r_{3}\
eq s\), and generate the donor pheromone matrix \(u^{s}\) via (13).