# Multi-Constraint and Multi-Policy Path Hopping Active Defense Method Based on SDN
## 4 Design of Multi-Constraint Multi-Strategy Hopping Algorithm  
### Generation of Path Hopping Space  
To maximize the path switching space within limited transmission paths, enhance the diversity and unpredictability of path switching, and reduce the time complexity of path generation, it is necessary to explore as many communication paths between two points as possible. Therefore, in this section, this paper utilizes DFS traversal to explore all paths between two points. Most existing research employs constraint satisfaction methods for solving, such as the approach used by [PERSON] [2], where constraints are imposed on link capacity and overlap in the path switching space generation, significantly limiting the potential path switching space. Link capacities are dynamic, and constraints on overlap restrict the diversity of path switching. Constraints related to paths can be addressed during the path selection stage to maintain path switching diversity and unpredictability, aiming to expand the switching space as much as possible. However, while expanding the switching space, it is essential to ensure communication quality requirements. Excessive delays during data transmission can impact user experience and degrade communication quality. Additionally, insufficient remaining node capacity in a path may result in new traffic being unable to match corresponding flow table rules, leading to forwarding failures, packet loss, or service unavailability. Therefore, constraints on transmission delays and remaining node capacities should be considered during the path switching space generation process. Insufficient remaining node capacity in a path can result in new traffic being unable to match corresponding flow table rules, leading to forwarding failures, packet loss, or service unavailability. Therefore, it is necessary to impose constraints on both transmission delays and remaining node capacities during the generation of path switching spaces. The constraint formula is as follows:  
\[L_{S\to D}^{i}\leq L \tag{1}\]  
Since the transmission delay is proportional to the path length, the delay constraint can be expressed in the form of Equation (1), where \(L_{S\to D}^{i}\) represents the length of path \(i\), and \(L\) represents the maximum allowable path length. Not only does constraining the path length effectively reduce the delay but also, in complex network topologies with the possibility of loops, not constraining the path length may lead to cyclic searches in DFS, increasing the time complexity and performance overhead generated by the discontinuous spatial search. The formula for constraining the remaining node capacity of a path is shown in Equation (2), where \(NC_{k}\) represents the remaining capacity of node \(k\), and \(NC\) represents the node capacity required for data forwarding. \[NC_{k}\geq NC \tag{2}\]  
During the generation of discontinuous spatial jumps in the path, when the current node expands to its child node, if the child node satisfies the above two constraint conditions, the child node is included in the current path, and the expansion continues from that node as the root node to its child nodes. When the path length reaches L-1, the algorithm checks if the child node of the current node is the destination node; if it is not, the algorithm backtracks to the previous node to avoid unnecessary searches. If the child node of the current node does not meet constraint condition Equation (2), the algorithm backtracks to search other child nodes and removes the current node. During this process, the algorithm also checks if the node is the destination node, and if it is, the search ends. To prevent looping, nodes are marked during traversal. In terms of time complexity, this method imposesconstraints on two factors during traversal using the SMT constraint solving method with a time complexity of \(O(n^{2})\)[20], where \(n\) is the number of nodes.