# An AC/DC Distribution Network DG Planning Problem: A Genetic-Ant Colony Hybrid Algorithm Approach
## 5 Model Solving
### Ant Colony Algorithm Solving  
(1) Pheromone Initialization  
According to the location selection of the DGs, assuming that there are \(N\) installable DGs nodes, and the DGs capacity that may be installed on the node \(i\) is \(n_{i}\), then a similar matrix as shown in Figure 7 can be generated.  
After \(T\) generation genetic optimization by genetic algorithm, \(m\) better solutions are obtained. Then the \(m\) preferred solutions are converted into the location and capacity of the ant colony algorithm, as shown in Figure 8. These location capacities are connected to form \(m\) paths, and update the pheromones on those paths. The number of ants is also set to \(m\). \(M\) slaves are placed on \(m\) paths and the previous update pheromone are used as the initial value of the pheromone.  
Figure 8: Genetic algorithm result conversion.  
Figure 7: Ant colony algorithm search path diagram.  
Loop Iteration  
In each iteration, ant \(k\) (\(k\) = 1, 2, 3,..., \(m\)) determines the direction of their transition based on the pheromone on each path. The tabu table, \(tabu_{k}\) is used to record the location capacity of the ants. The ant determines the transition probability based on the pheromone and path heuristic information on each path. \(P_{ij}(t)\) represents the probability that ant \(k\) is transferred from position \(i\) to position \(j\) at time \(t\):  
\[p_{ij}^{k}=\left\{\begin{array}{cc}\frac{[\tau_{ij}(t)]^{a}[\eta_{ij}]^{ \beta}}{\sum\limits_{sallowed_{k}}[\tau_{is}(t)]^{a}[\eta_{is}]^{\beta}}&j\in allowed _{k}\\ 0&\\ \end{array}\right. \tag{26}\]  
where \(allowed_{k}=\left\{C-tabu_{k}\right\}\) (\(k\) = 1, 2, 3,..., \(m\)) represents the position that the ant \(k\) next allows to select. \(\alpha\) is a heuristic information factor, and represents the importance of the motion trajectory, that denotes the role that information accumulated by ants during exercise plays in the selection of ant movements. \(\alpha\) has a value range of (0,5). \(\beta\) is the heuristic factor of expectation, which is the importance of characterizing the visibility of the path, that is, the role that the ant plays in the ant selection path during the movement. The value range of \(\beta\) is (0,5).  
\(\tau_{ij}(t)\) represents the pheromone strength on the path (\(i\), \(j\)) at time \(t\). Where \(i\) is the beginning location and \(j\) is the end location. \(\eta_{ij}(t)\) is a heuristic function, which is generally the reciprocal of the sum of the DG installation cost at location \(j\) and the distributed power source operating cost.  
Pheromone Update  
According to the expected value of each capacity of each node and the pheromone concentration value on the path, the transition probability of the \(n\)-th ant at each capacity point on the node is calculated, and then the path is selected.  
In order to prevent excessive heuristic pheromone and flooding the heuristic information, the residual pheromone is updated after the ant completes an ergodic operation on all \(m\) position capacities. According to Equations (27) and (28), adjusting the amount of information on the path \((i,j)\) at time \(t\)+1  
\[\tau_{ij}(t+1)=(1-\rho)\tau_{ij}(t)+\Delta\tau_{ij}(t) \tag{27}\]  
\[\Delta\tau_{ij}(t)=\sum\limits_{k=1}^{m}\Delta\tau_{ij}^{k}(t) \tag{28}\]  
where \(\rho\) is the pheromone volatilization coefficient, \(1-\rho\) is the pheromone residual coefficient, and \(\rho\) is in the range of (0, 1). \(\Delta\tau_{ij}(t)\) represents the pheromone increment on the path (\(i\), \(j\)) during the current cycle, \(\Delta\tau_{ij}(t)\)=0 at the initial time. \(\Delta\tau_{ij}^{k}(t)\) represents the number of pheromones left by the \(k\)-th ant in the path (\(i\), \(j\)).  
\[\Delta\tau_{ij}^{k}(t)=\left\{\begin{array}{cc}Q/L_{k}&\mbox{ if the kth ant passes the path (i,j)}\\ 0&\mbox{ else}\\ \end{array}\right. \tag{29}\]  
where \(Q\) represents the pheromone strength, and its value affects the convergence speed of the algorithm. \(L_{k}\) represents the total cost of the path taken by the \(k\)-th ant in this cycle.