# Optimizing Crosstalk in Optical NoC through Heuristic Fusion Mapping
## 3 Realization of Heuristic Fusion Mapping Algorithm for Crosstalk Optimization  
As a classical heuristic mapping algorithm, the essence of particle swarm optimization is to use the three messages of the current solution, individual optimal solution and global optimal solution to guide particles to optimize and update, among which balancing individual experience and group experience is the key to the optimization of the algorithm. The particle swarm optimization (PSO) algorithm has the advantages of fast searching speed, high efficiency and convenient adjustment of related parameters, but it is prone to premature convergence, resulting in local optimal solution. The simulated annealing algorithm described above has a great advantage in solving the problem of falling into the local optimal solution. It will accept the deteriorating solution with a certain probability, and this probability will gradually decrease with the decrease in temperature parameters. By introducing the deteriorating solution, the local optimal can be effectively avoided.  
Considering that the simulated annealing algorithm can make up for the particle swarm optimization algorithm, the two algorithms can be combined in the design of network mapping algorithm on chip. The operation flow of our heuristic fusion mapping algorithm (Algorithm 1) is shown in Figure 5, and can be summarized into nine steps.  
Step 1: Generate some mapping schemes randomly.  
Figure 4: Optimal particle mapping adjustment.  
Step 2: Initialize the minimum crosstalk and optimal mapping of each particle. Compare to get the global and historical minimum crosstalk and optimal mapping. Mark the optimal particle.  
Step 3: Choose different optimization methods according to whether it is the optimal particle. If it is the optimal particle, skip to step 6, otherwise step 4.  
Step 4: Update the particle's speed and position with reference to the above rules.  
Figure 5: Crosstalk optimization process.  
Step 5: Calculate crosstalk noise of each particle, update the minimum crosstalk noise of each particle, record the mapping mode at the same time, skip to step 8.  
Step 6: Randomly exchange the mapping positions of two tasks in the optimal particle. If the crosstalk at this time is less than the minimum crosstalk of the particle, update the minimum crosstalk and mapping of the particle, otherwise update with a certain probability.  
Step 7: Determine whether all particles in the particle swarm have been updated. If yes, perform step 9. Otherwise, go to step 3.  
Step 8: Update the global minimum crosstalk noise and mapping mode, and relabel the optimal particles. If the global minimum crosstalk is less than the historical minimum crosstalk, update the historical minimum crosstalk and historical optimal mapping mode.  
Step 9: At the end of the iteration, the optimal solution is returned. Otherwise, the inertia factor \(\omega\) of PSO and the temperature parameters t of SA are updated according to the above rules and the third step is executed.  
Below is the pseudo code:  
```
Input: Iteration number: \(\mathrm{I}_{\mathrm{T}}\); Population size: \(\mathrm{N}_{\mathrm{P}}\) Parameter: Inertia factor: \(\omega\); Learning factor: \(\mathrm{C}_{1}\), \(\mathrm{C}_{2}\); Random value: \(\mathrm{R}_{1}\), \(\mathrm{R}_{2}\); Temperature control value: \(\mathrm{T}\); Individual minimum crosstalk: \(\mathrm{C}_{\mathrm{P}}\); Global minimum crosstalk: \(\mathrm{C}_{\mathrm{G}}\); Current iteration number: \(\mathrm{I}_{\mathrm{C}}\); Number of traversed particles: \(\mathrm{N}_{\mathrm{C}}\); Individual optimal mapping: \(\mathrm{M}_{\mathrm{P}}\); Global optimal mapping: \(\mathrm{M}_{\mathrm{G}}\); Current particle label: \(\mathrm{I}_{\mathrm{C}}\); Optimal particle label: \(\mathrm{L}_{\mathrm{O}}\) Output: Historical minimum crosstalk: \(\mathrm{C}_{\mathrm{H}}\); Historical optimal mapping: \(\mathrm{M}_{\mathrm{H}}\)
```  
**Algorithm 1**.