# Multi-Controller Deployment in SDN-Enabled 6G Space-Air-Ground Integrated Network
## 2 Problem Formulation and Solution
### Problem Solution  
Multi-Controller Deployment Algorithm Based on Simulated Annealing  
In order to find the global optimal solution of the optimization model, avoid falling into the local optimal solution, flexibly control the iteration speed, and quickly obtain the global optimal solution, this strategy draws on the idea of a simulated annealing algorithm, accepts the poor solution space with a certain probability, and presents the local optimal solution. The next solution space is randomly generated and has good robustness. The cooling rate is controllable, and the search results can be obtained faster. The pseudo-code of Algorithm 1 outlines the framework of the multi-controller deployment strategy. The inputs include the controller (ground station) longitude and latitude matrix \(C\), satellite longitude and latitude matrix \(S\), height matrix \(S_{H}\), traffic of switch nodes \(SF\), and the maximum controller capacity \(CF\). The initialization parameters include the relation matrix of the satellite corresponding controller \(R\), initial temperature \(t\), and descending speed step and final temperature \(e\). First, the data plane, that is, the satellite node latitude and longitude data, is transformed into the Cartesian coordinate data by Formula (1). Then, after a certain number of iterations, the temperature is increased. In the next iteration, the following is carried out:  
* First, a new solution space is randomly generated, which is the controller's new latitude and longitude, and is converted to Cartesian coordinates according to Formula (2). * Second, the propagation delay from the satellite node to the controller is solved according to Formula (3). * In the third step, the satellite node is assigned to the target controller with the goal of minimum time delay, and then the load of the controller is calculated; if a controller load is greater than \(\rho\in(0,1)\) times the maximum load, the part of the controller controlled by the current controller is transferred to the controller with the least load, and the relation matrix \(R\) between the satellite node and the controller is obtained. * The fourth step is to calculate the loss function value according to Formula (8). if the loss value is less than the previous loss value, the new solution space generated in the first step is accepted, or the new solution space can be accepted with some probability calculated by Formula (10). Finally, the relation matrix \(R\), and the solution space, i.e., the final latitude and longitude of the controller, the propagation delay and the load of the controller are saved. \[p(i)=e^{-\frac{\delta(i)-\delta(i-1)}{i}} \tag{10}\]where \(p(i)\) is the probability of accepting the current solution space, \(\theta(i)\) is the loss value of the current iteration, \(\theta(i-1)\) is the loss value of the previous iteration, and \(t\) is the rate at which the temperature decreases. ```
0: Controller(Ground station) longitude and latitude matrix \(C\), Satellite longitude and latitude matrix \(S\), height matrix \(S_{H}\), Traffic of switch nodes \(SF\), and the maximum controller capacity \(CF\). 0: Number of controllers and longitude and latitude matrix \(C_{best}\), relation matrix of satellite corresponding controller \(R\), propagation delay \(L\) and controller load \(B\). 1:Initialize The relation matrix of the satellite corresponding controller is \(R\), initial temperature \(t\), descending speed \(step\) and final temperature \(e\).