# Optimizing Crosstalk in Optical NoC through Heuristic Fusion Mapping
## 2 Design of Heuristic Fusion Mapping Algorithm for Crosstalk Optimization  
The general idea of our mapping algorithm is to integrate particle swarm optimization and simulated annealing algorithm (SA) [26; 27; 28] and combine the expansibility of PSO with the avoidance of local optimality of SA. The purpose of the mapping algorithm is to map the application tasks to the topology nodes. The relationship between the tasks is represented by the communication graph, and the relationship between the topology nodes is represented by the topology graph [29]. Our mapping algorithm is mainly for two-dimensional topological networks. Firstly, the two-dimensional topological network of M * N is transformed into the arrangement of straight lines. The topological nodes are numbered as 1, 2, 3,..., M * N - 1, M * N, as shown in Figure 2. The final mapping scheme needs to place the task in a grid in the graph. Figure 1: Application mapping diagram. Figure 2: Two-dimensional topological line arrangement. The mapping algorithm needs to constantly adjust the task position in the topology structure, through which the crosstalk of optical network-on-chip is gradually reduced. Therefore, the method to adjust the task location is very important in the mapping algorithm. The mapping algorithm we designed includes two parts--one is to use particle swarm optimization, the other is to use simulated annealing optimization. In particle swarm optimization, each dimension of particle velocity and position corresponds to a task in an application. The update mode of particle speed and position is shown in Equations (2) and (3). \[\mathrm{v_{i}}=\omega\mathrm{v_{i}}+\mathrm{c_{1}}\times\mathrm{r_{1}}\times \left(\mathrm{pb_{i}}-\mathrm{x_{i}}\right)+\mathrm{c_{2}}\times\mathrm{r_{2}} \times\left(\mathrm{gb-x_{i}}\right) \tag{2}\]  
\[\mathrm{x_{i}}=\mathrm{x_{i}}+\mathrm{v_{i}} \tag{3}\]  
where \(\mathrm{v_{i}}\) and \(\mathrm{x_{i}}\) are the velocity and position of particles, respectively; \(\omega\) is the inertia factor; \(\mathrm{c_{1}}\) and \(\mathrm{c_{2}}\) are individual and whole learning factors respectively, equal to 1; \(\mathrm{r_{1}}\) and \(\mathrm{r_{2}}\) are random numbers between 0 and 1; \(\mathrm{pb_{i}}\) is the current optimal solution of a particle; and \(\mathrm{gb}\) is the global optimal solution of particle swarm. The adjustment of \(\omega\) is in accordance with Equation (4). \[\omega=\mathrm{e}^{-30\times\left(\frac{\mathrm{nm}}{\mathrm{nm}_{\mathrm{ max}}}\right)^{\mathrm{s}}},\;\mathrm{s}\in[1,30] \tag{4}\]  
where run is the current number of iterations; \(\mathrm{run_{max}}\) is the total number of iterations; and \(\mathrm{s}\) is equal to 15 when the algorithm is designed. Each dimension of particle speed and position corresponds to a task in the application. When an application mapping is completed, each task corresponds to a labeled topology node. When the speed of the corresponding dimension of a task in an application is greater than 0, the mapping position of the task moves to the right end of the line topology. Otherwise, the mapping position of the task moves to the left end of the line topology, and moves a certain distance according to the absolute value of the speed. Two points need to be paid attention to during the implementation of the actual algorithm:  
1. when the positions coincide, move to the right end and left end, respectively, according to the positive and negative speed until the idle topology node is found;
2. when the left and right sides are out of bounds, find the mapping position by modulus value. Figure 3 shows the movement adjustment of a nine-task application map. Suppose that the initial task mapping relationship of the application is task 1 corresponding to topology node 1, task 2 corresponding to topology node 2, and so on. Task 9 corresponding to topology node 9, and the speeds of task 1 to task 9 are +2, +1, -3, +5, -1, -3, +2, +1, +4, respectively. Figure 3: Task mapping move.