# Heuristic Routing Algorithms for Time-Sensitive Networks in Smart Factories
###### Abstract
In our previous studies [16; 17; 18], we contributed to the traffic shaping mechanisms along with real-time secure communication methods for joint OPC UA-TSN IoT-based intelligent industrial production lines; however, the depth of discussion around routing for TSNs has much room for improvement. In both mainstream studies and our previous studies, the network topologies were not complicated, routes of all kinds of traffic were determined using spanning tree protocols and shortest path routing algorithms, and port queuing and time slot allocation in frame transmission were performed. However, the composite routing problem for multiple flows within large-scale networks is difficult to solve in polynomial time, so online routing algorithms can hardly meet the growing needs of TSNs [19]. Researchers have turned to developing offline routing methods, which aim to generate a reasonable network routing list in an offline manner through exploiting the characteristics of TSN deterministic communication. During actual communication, data flows are scheduled according to the preset routing list. Compared to online algorithms, this approach avoids the strict computing time limits and can perform more iterations to obtain a better approximate optimal solution. Therefore, we propose an offline TSN routing method that covers both TT flow and non-TT flow routing problems, based on heuristic algorithms. The main contributions of our study are as follows:  
1. We proposed an improved genetic algorithm to solve the TT flow routing problem (GATTRP). We modeled the TT flow routing problem in the TSN systems of smart factories and transformed the problem into a multiple traveling salesmen problem (MTSP) to solve. Based on the existing genetic algorithms, we optimized the design of the genetic evolution operators and algorithm processes and finally, formed an improved genetic algorithm with faster convergence speed and better results;2. We proposed an adversarial ant colony optimization (AACO) algorithm to solve the non-TT flow routing problem. We modeled the non-TT flow routing problem in the TSN systems of smart factories and transformed the problem into a load balancing pathfinding problem for multiple priority flows within a directed graph. Based on existing ACO algorithms, we designed a novel pheromone update rule to balance the impacts of higher priority tasks and path length on pathfinding. The algorithm could effectively equalize the non-TT network load and reduce the network latency;
3. We established a simulation experiment platform for the smart factory TSN communication system and evaluated the performance of the proposed algorithm through experiments. The results showed that both algorithms produced a certain improvement in the corresponding evaluation indicators, which matched our expectations. The remainder of this paper is organized as follows. In Section 2, we list the results of our survey on related works. In Section 3, we parse and mathematically model the actual problems. In Section 4, we propose the TT routing algorithm, named GATTRP. In Section 5, we propose the non-TT routing algorithm, named AACO. In Section 6, we establish an experimental environment and discuss performance evaluation. Finally, we conclude this paper in Section 7.