# An Improvement of a Mapping Method Based on Ant Colony Algorithm Applied to Smart Cities
## 1 Introduction
As they lack global information and have no backtracking mechanism, they cannot provide a good mapping scheme [12; 13]. Heuristic algorithms are widely studied in the global optimization literature and have become an effective method for solving complex optimization problems. When applied for many-to-one topological mapping, the traditional methods are limited by the node capacity, and it is difficult to carry out the corresponding combinatorial selection step. Therefore, to overcome these issues, a mapping method based on the ant colony algorithm is proposed here and is verified through simulation analysis and alignment. The design purpose of the mapping algorithm is to study the optimal mapping scheme, which can effectively reduce the cost of solving problems. The core of the mapping algorithm is to design the objective function of the algorithm optimization. At present, the common optimization objective functions and evaluation indicators are summarized as follows [14]. Average hop count. In the logical network, the communication between the connected neurons is realized by pulses. Due to the capacity limitation of the physical network nodes, the connected neurons often cannot be deployed on the same physical node. Therefore, the pulse generated by the source neuron needs to be transmitted to the destination neuron through the routing algorithm and forwarded by the communication unit. When the source neuron and the destination neuron are on the same node, the number of forwarding times required for the impulse data, that is, the number of hops, is 0. When the source neuron and the destination neuron are on adjacent nodes, the impulse data needs to be transmitted. The number of times is 1 [14]. When the source neuron is farther from the physical node where the destination neuron is located, the number of hops required for the impulse data to reach the destination neuron will naturally increase. The increase in the average hop count of pulse data means that the power consumption of the system increases, and the congestion problem that the system is faced with may be aggravated. Therefore, it is one of the optimization goals to choose an appropriate mapping method to reduce the average hop count of the pulse. More specifically, the average hop count of the system is expressed as:  
\[\mathrm{N_{hops-avg}}=\frac{\sum_{i\in\mathrm{Net}}n_{i}p_{i,j}}{\sum_{i,j\in \mathrm{Net}}P_{i,j}} \tag{1}\]  
\(\mathrm{N_{hops-avg}}\) is the average hop count, \(n_{i,j}\) is the number of hops between the i-th neuron and the j-th neuron, as well as the number \(p_{i,j}\) of pulse data packets sent by the i-th neuron to the j-th neuron per unit time. There is no connection from the i-th neuron to the j-th neuron [15]; then \(p_{i,j}=0\). In the case of multicast, this expression is different because when the forwarding direction required by the destination neuron is the same, only one forwarding is required. Therefore, the expression becomes:  
\[\mathrm{N_{hops-avg-MC}}=\frac{\sum_{i\in\mathrm{Net}}n_{i}p_{i}}{\sum_{i\in \mathrm{Net}}P_{i}} \tag{2}\]  
Here, \(n_{i}\) is the number of times the pulse sent for the i-th neuron needs to be retransmitted. Link load balancing. Balancing the link load can effectively alleviate congestion, thereby reducing the waiting time of pulse packets on each node. The evaluation index of link load balancing is the link load variance:  
\[\mathrm{VAR(L)}=\frac{\sum_{i=1}^{M}\left(\mathrm{l_{i}-\bar{l}}\right)^{2}}{M} \tag{3}\]  
\(\mathrm{VAR(L)}\) is the link load variance, \(\mathrm{l_{i}}\) is the load on the i-th link, \(\bar{l}\) is the average link load, and \(M\) is the total number of links. Node load balancing. Node load balancing refers to the number of neurons deployed on each physical node. Balancing the node load can avoid a large number of neurons on the same physical node, resulting in excessive computing pressure and communication pressure on this node. This may lead to problems such as excessive delay and loss of pulse data packets.