Genetic annealing algorithm-based fiber bragg grating reverse design method

By using the dynamic switching mechanism of the genetic annealing algorithm, combined with the genetic algorithm and the simulated annealing algorithm, the problems of low efficiency and difficulty in convergence in the inversion design of fiber Bragg grating structural parameters are solved, realizing fast and accurate inversion design of FBG parameters and expanding the application scenarios of fiber Bragg gratings.

CN121881827APending Publication Date: 2026-04-17SHANGHAI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI UNIV
Filing Date
2025-12-31
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

In the existing design of fiber Bragg grating structure parameters, genetic algorithms and simulated annealing algorithms each have their own problems of varying global search capabilities and sensitivity to parameter settings, resulting in low design efficiency and difficulty in convergence.

Method used

The genetic annealing algorithm is adopted, which combines the genetic algorithm and the simulated annealing algorithm through a dynamic switching mechanism. The genetic algorithm's global search capability is used to quickly locate the approximate optimal solution, and when it stalls, it switches to the simulated annealing algorithm for local refinement and convergence, thus achieving efficient reverse design of FBG parameters.

Benefits of technology

It enables rapid and accurate reverse design of FBG parameters, broadens the application scenarios of fiber Bragg gratings, and improves design efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121881827A_ABST
    Figure CN121881827A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of optical device simulation, in particular to a fiber bragg grating reverse design method based on a genetic annealing algorithm, which comprises global search and local convergence, the global search is a parameter-adaptive real value coding genetic algorithm, and the local convergence is a parameter-adjustable simulated annealing algorithm. Firstly, a genetic algorithm is operated, population parallelism and genetic manipulation of the genetic algorithm are utilized to perform global exploration, and an approximate optimal solution region is preliminarily positioned; when the genetic algorithm optimization process stops, switching to a simulated annealing algorithm; and then starting from the optimal solution range obtained by the GA algorithm by the SA algorithm, continuously performing deep local development and refining by utilizing a controllable local search mechanism based on cooling scheduling, and finally realizing reliable convergence to a high-precision optimal solution. The method solves the problems of difficulty in later convergence of a genetic algorithm and high dependency of a simulated annealing algorithm on an initial value, and has the advantages of rapidness, accuracy and high efficiency when facing the design problem of the structural parameters of the fiber Bragg grating.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of optical device simulation technology, specifically involving a reverse design method for fiber Bragg gratings based on genetic annealing algorithm. According to the actual requirements of the fiber Bragg grating reflection spectrum, the structural parameters of the fiber Bragg grating are reverse designed to better meet the actual application requirements. Background Technology

[0002] Fiber Bragg gratings (FBGs), as a core passive fiber optic device, have always been a key research focus in optical engineering and sensing technologies. Research primarily focuses on optimizing their grating structure design (such as period, length, and refractive index modulation depth), exploring high-sensitivity doped fiber materials, improving the stability and efficiency of fabrication processes such as ultraviolet writing, and developing novel packaging technologies to enhance their long-term reliability in complex environments. Benefiting from their unique advantages such as high sensitivity, electrical insulation, intrinsic safety, and resistance to electromagnetic interference, FBGs have wide applications in sensing, industrial process monitoring, biomedical monitoring, optical communication, and laser technology. The importance of FBG lies in the following: it represents an outstanding example of all-fiber devices, can be directly embedded in intelligent structures, and can achieve truly distributed or multi-point quasi-distributed sensing, which can greatly reduce system complexity and cost, and improve monitoring coverage and information acquisition efficiency; its inherent safety characteristics make it an ideal choice for monitoring harsh industrial environments such as flammable and explosive environments; at the same time, its high precision and high stability characteristics have driven the development of multiple industries towards intelligence and high reliability. The continuous deepening and application expansion of FBG technology has irreplaceable strategic value for promoting the development of intelligent sensing networks, advanced communications, and future photonic integration technologies.

[0003] When designing an optical system, if a grating frame (FBG) is needed for filtering and the shape of the reflection spectrum is required, there are two design strategies: one is to design a cascaded system based on existing FBGs; the other is to customize a special FBG structure based on the reflection spectrum. The former often has limited freedom, and cascading multiple FBGs increases system complexity. If conditions permit, algorithms can be used to deduce the required grating structure parameters from the reflection spectrum. Commonly used algorithms for this problem include search algorithms such as genetic algorithms, simulated annealing, and particle swarm optimization, which search the specified search space for the FBG parameters that best match the expected output.

[0004] Inspired by Darwin's theory of natural selection, the Genetic Algorithm (GA) is a stochastic global search algorithm. It simulates the crossover and mutation phenomena in natural selection and heredity. Starting from a randomly initialized population, it gradually generates superior new individuals through crossover and mutation. In the selection process, superior individuals are retained, eventually converging to the individual best adapted to the environment, thus obtaining a high-quality solution to the problem. Due to the randomness of mutation, the GA algorithm has extremely strong global search capabilities. Finding chromosomes with high fitness is very easy in the entire search space, and it can quickly converge to a location with high fitness. While the GA algorithm has strong global search capabilities, its local search capabilities are relatively weak. It is also sensitive to parameter settings; a large or small number of mutated genes makes it difficult to mutate to a better individual, and it is highly dependent on the quality of the initial population. Furthermore, the GA algorithm itself is relatively complex, with each iteration taking a relatively long time. However, the GA algorithm is also highly scalable and easily combined with other algorithms.

[0005] Simulated Annealing (SA) is a general optimization algorithm inspired by the increased stability of solid particles as temperature decreases during the annealing process of solid materials. It compares a new solution with the current solution; if the new solution is better, it is selected with a probability of 1; otherwise, the new solution is accepted with a temperature-dependent probability. At high temperatures, the iteration direction is highly random and does not converge towards the currently considered optimal solution, thus SA has the ability to escape local optima. At low temperatures, the iteration direction is in the direction of decreasing loss function, avoiding stagnation similar to that in the Global Algorithm (GA), thus SA has strong local search capabilities. Furthermore, the algorithm is simple, only requiring a decision on whether to accept a new solution based on the Metropolis criterion, making it easy to implement. However, its global search capability is relatively weak. If the perturbation of the new solution is small, but the initial solution loss is large, the entire algorithm will struggle to converge; in other words, it will take a very long time to converge to the global optimum. Meanwhile, the SA algorithm is also sensitive to parameter settings. If the high-temperature time is not long enough, it will not be able to escape local minima, and if the low-temperature time is not long enough, it will be difficult to converge to the optimal solution.

[0006] As can be seen from the above, the existing technologies for inverting the design of fiber Bragg grating structural parameters using a single genetic algorithm or simulated annealing algorithm have various problems and defects. Therefore, it is necessary to conduct further research and improvement on the existing fiber Bragg grating design methods. Summary of the Invention

[0007] To address the problem of FBG parameter inversion, this invention provides a fast and accurate FBG parameter search algorithm. Given the aforementioned deficiencies in existing technologies, this invention aims to solve the problem of how to quickly and accurately design FBGs in reverse, thereby broadening the application scenarios based on FBGs. This invention employs the genetic annealing algorithm, and through a dynamic switching mechanism, effectively integrates the complementary advantages of two algorithms while avoiding their respective disadvantages.

[0008] To achieve the above objectives, the fiber Bragg grating reverse design method based on the genetic annealing algorithm provided by this invention employs a hybrid strategy that combines genetic algorithms and simulated annealing algorithms through a dynamic algorithm switching mechanism; the overall steps are as follows: S1. First, run the genetic algorithm to perform an efficient global search operation using its population parallelism and genetic and chromosome parameter sets to initially locate the approximate optimal solution region. S2. When the optimization process of the genetic algorithm stalls, it indicates that it has fallen into a local optimum or that the exploration motivation is insufficient. At this time, it will automatically switch to the simulated annealing algorithm according to the algorithm dynamic switching mechanism. S3. The simulated annealing algorithm starts from the near-optimal solution range obtained by the genetic algorithm, and uses its controllable local search mechanism based on cooling scheduling to continue to carry out in-depth local development and refinement, and finally achieves reliable convergence to a high-precision optimal solution. Furthermore, the genetic algorithm in step S1 above is a global search method, and its specific steps include: S11. Input the parameters in the genetic algorithm, including the number of genes, the number of chromosomes, the parameter search range, the number of new chromosomes generated by mutation, the number of mutated genes when chromosomes are mutated, the number of new chromosomes generated by exchange, and the number of exchanged genes when exchange is performed. The number of genes, chromosomes, the number of new chromosomes generated by mutation, and the number of new chromosomes generated by exchange should be selected in combination with the performance of the computing device. The parameter search range should be set considering the possible values ​​of the actual FBG parameters. The selection of the number of mutated genes when chromosomes perform mutation and the number of exchanged genes when performing exchange affects the algorithm's search efficiency. S12. Then, a global search for FBG parameters is started using a genetic algorithm.

[0009] Furthermore, the algorithm dynamic switching mechanism in step S2 above is an algorithm iteration criterion, the specific steps of which include: S21. Calculate the loss function and determine whether the FBG parameter inversion has stalled. S22. If stagnation occurs, exit the genetic algorithm and enter the simulated annealing algorithm to perform a local search; S23. Otherwise, return to step S12 and continue the global search.

[0010] Furthermore, the simulated annealing algorithm in step S3 above is a local search method, and its specific steps include: S31. Input the initial temperature, the expression and parameters for temperature decrease, the convergence step size, and the termination condition parameters in the simulated annealing algorithm; S32. Use simulated annealing algorithm to perform local search of FBG parameters; S33. Calculate the loss function and determine whether the FBG parameter inversion has converged. S34. If convergence occurs, exit the simulated annealing algorithm and output the inversion parameters; S35. Otherwise, return to step S32 and continue the local search.

[0011] Furthermore, the global search method includes: defining "genes"; defining "chromosomes"; defining "populations"; having "exchange" operations; having "mutation" operations; having "sorting" operations; having "heredity" operations; and having the ability to calculate the degree of stagnation.

[0012] Furthermore, the local search method includes: defining "temperature"; having a "cooling" operation; defining "perturbation"; and defining termination conditions.

[0013] Furthermore, the algorithm iteration criteria include: defining a loss function related to the target reflectance spectrum, whose output value serves as a standard for judging the quality of data, and having the ability to stop the algorithm.

[0014] Furthermore, the "gene" includes a data structure for storing genes and a mapping relationship between the fiber Bragg grating parameter set and genes; wherein, the fiber Bragg grating parameter set includes grating period, effective refractive index, relative refractive index difference, grating length, chirp parameter, apodization function parameter, and phase shift; the "chromosome" includes an array-like data structure for storing the gene set of a single sample; the "population" includes an array-like data structure for storing the chromosome set; the "exchange" refers to the chromosome exchange probability and the number of exchanged genes; the "mutation" refers to the chromosome mutation probability, the number of mutated genes, and the range of mutation values; the "sorting" refers to sorting the chromosomes in the population according to their quality using the target reflectance spectrum loss function; the "heredity" refers to screening the sorted population for chromosomes, keeping the number of chromosomes in the population the same as the original population, and discarding chromosomes with large loss function values; the ability to determine stagnation refers to judging whether the algorithm has stagnated based on the loss value, and if the algorithm is confirmed to have stagnated, the genetic algorithm returns and outputs.

[0015] Furthermore, the "temperature" includes the retention probability used to calculate the result of each iteration using the Metropolis criterion; the "cooling down" means that the temperature value must decrease according to a certain criterion in each iteration, which can be a linear decrease, an exponential decrease, or other forms; the "perturbation" refers to the criterion used to generate a new round of results in each iteration, which is generally a value that does not change much near the result of the previous round; the defined termination condition refers to ending the simulated annealing algorithm according to a certain criterion, which can be based on the temperature value, the number of iterations, the loss function value, the running time, etc.

[0016] The reverse design method for fiber Bragg gratings (FBGs) based on the genetic annealing algorithm provided in this invention considers the advantages and disadvantages of genetic algorithms and simulation algorithms, and how they complement each other to a certain extent, thus offering some inspiration for this problem. Initially, using the SA algorithm, it is difficult to find the approximate location of the target parameters, but the GA algorithm can quickly search using its global search capability. However, due to the shortcomings of the GA algorithm in local search, it needs to be improved. There are two approaches: one is to make the relevant parameters in the algorithm (mutation frequency, range of new mutation values) variables related to the number of iterations or the loss function value, i.e., adaptive; the other is to exit the GA algorithm when the parameter iteration stagnates and switch to other algorithms with stronger convergence capabilities, such as the SA algorithm. In this way, the advantages of the two algorithms complement each other, effectively solving the shortcomings of each algorithm. Therefore, this invention chooses to use the genetic annealing algorithm for FBG parameter search.

[0017] The entire algorithm consists of two parts. The first part is a genetic algorithm that quickly searches for the approximate optimization position. Considering the nature of FBG parameter data, it does not use conventional binary encoding, but rather real values. The number of genes, chromosomes, parameter search range, number of new chromosomes generated by mutation, number of mutated genes when chromosomes undergo mutation, number of new chromosomes generated by exchange, and number of exchanged genes when performing exchange are parameters input by the user. Different parameter inputs result in different convergence speeds. To overcome the stagnation phenomenon of the GA algorithm, the mutation range can be reduced with the number of iterations or the loss value, but a more effective method is to switch to the next algorithm.

[0018] The second part involves the simulated annealing algorithm for continuous convergence. Since the GA algorithm can stall, and the traditional search process often takes several hours, the SA algorithm can play a crucial role. The initial temperature, the expression and parameters for temperature decrease, the convergence step size, and the termination condition are all user-inputted parameters. Different parameter inputs result in different running times and ultimately different inversion accuracy. To improve accuracy, the high-temperature phase can be prolonged, meaning the temperature is sufficiently high. This avoids getting trapped in local minima, thus allowing for more optimized convergence.

[0019] The present invention also includes other components that enable its normal use, all of which are conventional means in the art. In addition, any devices or components not limited in the present invention adopt the prior art in the art.

[0020] The beneficial effects of this invention are as follows: Given that the Genetic Algorithm (GA) exhibits strong initial wide-area exploration (global search) capabilities, effectively locating potential solution regions, but its ability to refine and converge within the neighborhood of the optimal solution is relatively weak; while the Simulated Annealing Algorithm (SA), although relatively inefficient in wide-area search (global exploration) and dependent on parameter settings, possesses excellent local refinement convergence capabilities after obtaining a good initial solution, considering the advantages and disadvantages of both the Genetic Algorithm and the Simulated Annealing Algorithm, the respective shortcomings of the GA and SA algorithms can be addressed by complementing each other's strengths.

[0021] This invention employs a dynamic switching mechanism of the Genetic Annealing (GA) algorithm, perfectly integrating the advantages of both algorithms while avoiding their respective disadvantages: First, the GA algorithm is run, utilizing its population parallelism and genetic operations for efficient global exploration to locate regions close to the optimal solution. When the optimization process of the GA algorithm stagnates (usually determined by detecting that the loss function fails to achieve significant improvement over several consecutive generations), it indicates that it may have fallen into a local optimum or lacks sufficient exploration motivation. At this point, the algorithm switches to the SA algorithm. The SA algorithm starts from the optimal or near-optimal solution obtained by the GA algorithm and utilizes its controllable local search mechanism based on cooling scheduling to perform in-depth local development and refinement, ultimately achieving reliable convergence towards a high-precision optimal solution.

[0022] The fiber Bragg grating inversion design method based on the genetic annealing algorithm provided by this invention designs the algorithm from the perspective of fast search and accurate convergence, effectively solving the problems of difficult convergence in the later stage of the GA algorithm and high dependence on initial values ​​in the SA algorithm. When facing the design problem of actual fiber Bragg grating structure parameters, this method has the advantages of being fast, accurate and efficient, and provides a fast and accurate FBG parameter search algorithm for the problem of FBG parameter inversion. Attached Figure Description

[0023] Figure 1 This is a flowchart of the genetic annealing algorithm used in this invention to solve the FBG parameter inversion problem; Figure 2 This is a flowchart illustrating the genetic algorithm (GA algorithm) in this invention. Figure 3 This is a flowchart illustrating the simulated annealing algorithm (SA algorithm) in this invention; Figure 4 (a)-(d) are comparison charts showing the differences between the spectra generated by the parameters obtained by FBG inversion using only the genetic algorithm and the target spectra in the comparative examples; Figure 5 (a) shows the curve of the loss function as a function of generations when only the genetic algorithm is used in the comparative example; Figure 5 (b) is a graph showing the evolution of the spectrum with each generation when only the genetic algorithm is used in the comparative example; Figure 6 (a) is the curve showing the change of the loss function of the GA algorithm step with the number of generations in the genetic annealing algorithm used in this invention; Figure 6 (b) is the curve showing the change of the loss function of the SA algorithm step in the genetic annealing algorithm used in this invention as a function of the number of generations; Figure 6 (c) is a graph showing the evolution of the spectrum of the GA algorithm steps with the number of generations in the genetic annealing algorithm used in this invention; Figure 6 (d) is a graph showing the evolution of the spectrum of the SA algorithm steps in the genetic annealing algorithm used in this invention with the number of generations; Figure 7 (a) is the curve showing the change of the loss function of the entire search process with the number of generations in the genetic annealing algorithm used in this invention; Figure 7 (b) is the curve of the loss function over time in the entire search process of the genetic annealing algorithm used in this invention; Figure 7 (c) is a comparison diagram of the spectrum generated by the FBG parameters output by the genetic annealing algorithm used in this invention and the target spectrum; Figure 8 This is a comparison diagram showing the difference between the spectrum generated by the actual phase-shifted FBG inversion parameters and the original spectrum. Detailed Implementation

[0024] The present invention will now be clearly described with reference to the accompanying drawings and specific embodiments. Any modifications, equivalent substitutions, improvements, etc., made by those skilled in the art based on the embodiments of the present invention without creative effort to obtain all other embodiments should be included within the scope of protection of the present invention.

[0025] Example The fiber Bragg grating reverse design method based on the genetic annealing algorithm provided in this invention employs a hybrid strategy that combines genetic algorithms and simulated annealing algorithms through a dynamic switching mechanism. In this embodiment, the programming language used to develop the algorithm is Python, and the integrated development environment is PyCharm.

[0026] like Figure 1As shown in the figure, the algorithm instance is modularized. According to the figure, the core of the whole instance is the construction of the genetic algorithm and simulated annealing algorithm modules. Therefore, it is necessary to write the genetic algorithm and simulated annealing algorithm separately first.

[0027] The loss function involved in the entire process is generally the error between the spectral data generated by the output FBG parameters and the target spectral data:

[0028] The method for generating spectral data based on FBG parameters originates from the linear mode coupling equations of FBG, which is a numerical problem and can be generated using the finite difference method or the transfer matrix method. Furthermore, the loss function is not necessarily derived from the reflectance spectrum; it can also be the group delay spectrum or other parameters.

[0029] like Figure 2 As shown, the genetic algorithm (GA) module in the algorithm example will be written. The specific steps are as follows: (1) Input search space parameters, encode and normalize the search space of actual problem parameters; (2) Select randomly using a random function A population composed of chromosomes In this embodiment It is 7; (3) The range of variation can be adaptively adjusted based on the number of iterations and the loss value, or the entire search space, which is the entire search space in this embodiment; (4) Perform mutation and exchange operations on the population to generate a total of A new chromosome, in this embodiment The total number is 7, of which 5 new chromosomes are generated through mutation and 2 new chromosomes are generated through exchange. (5) The loss function of each individual is calculated and sorted. (6) Select those with high adaptability Each chromosome as a new population ; (7) Determine whether the termination condition is met. If it is met, decode and return; otherwise, go to (3).

[0030] It's important to note that the mutation range in genetic operations can be an adaptive parameter, which can alleviate stagnation to some extent. Additionally, a flag variable needs to be set; when stagnation is detected, the flag variable changes, and the algorithm returns an output.

[0031] like Figure 3 As shown, the simulated annealing algorithm module in the algorithm example will be written in the following steps: (1) Determine the initial (parameter) temperature Cooling rate Lower limit of temperature Loss function Acceptance coefficient (Generally, the value is 1). In this embodiment... 10 4 , It is 0.99. 10 -8 ; (2) Randomly initialize a sample as the initial solution. ; (3) A new solution is obtained based on the perturbation (all gene parameters are perturbed with a fixed step size, and the probability of parameter increase or decrease is 0.5). ; (4) Determine whether to accept the new solution based on the Metropolis criterion. If the new solution is not accepted, then... ; (5) Cooling according to certain rules, such as or ; (6) Determine if the temperature is below the lower limit of the temperature. Or other termination conditions (in the example, the loss function) If the value is less than 10, return the solution if the problem ends; otherwise, proceed to (3).

[0032] The Metropolis criterion is as follows:

[0033] The calculation result represents the probability of whether the new solution is accepted.

[0034] like Figure 4 and Figure 5 As shown, this study investigates the FBG parameter inversion problem solved solely using a genetic algorithm. The target FBG parameter data and search space are shown in the table below: Target FBG parameters

[0035] Search space

[0036] The generated spectrum is output at each iteration during the operation. Figure 4 Four of the spectra were selected to reflect the spectral changes. Finally, in the 116th generation, a parameter loss of 17.06 was obtained, taking approximately 95.25 seconds. The final result was obtained by... Figure 4 (d) and the table below: GA algorithm FBG inversion parameters

[0037] By saving and plotting the loss function value for each iteration, we can obtain... Figure 5 (a) The spectrum can be plotted by changing with algebra. Figure 5 (b). According to Figure 5 Analysis shows that the convergence speed is relatively fast in the early stages, but stagnates in the later stages. This is because the genetic algorithm uses global random mutation, which can quickly obtain small values, but to obtain even smaller values... The value then needs to be constantly mutated. The lower the value, the more new mutations are obtained. The value is higher than the original The probability of a low value is much lower, and according to common biological knowledge, most mutations are not accepted by nature. Observing the evolution of the spectrum, we find that it is quite fragmented, which indicates that the spectrum of the generation of the higher-quality gene is not continuously changing with the spectrum of the original gene, and the more generations there are, the longer the stagnation time tends to be.

[0038] Figure 6 and Figure 7 This study investigates the FBG parameter inversion problem solved by the genetic annealing algorithm in this invention example, with the target FBG parameter data and search space remaining unchanged. The entire process takes 72.22 seconds, and the final result is obtained from... Figure 7 (c) and the table below: Genetic annealing algorithm FBG inversion parameters

[0039] Figure 6 (a) and Figure 6 (c) shows the loss function curve and spectral evolution plot during the genetic algorithm steps. Figure 6 (b) and Figure 6 (d) shows the loss function curve and spectral evolution plot during the simulated annealing algorithm steps. Figure 7 (a) and Figure 7 (b) shows the loss function curves as a function of algebra and time throughout the process. Analysis of the inversion process and results reveals that the main function of the genetic algorithm is rapid localization; it immediately exits the genetic algorithm upon encountering stagnation and begins simulated annealing. Simulated annealing also consists of two stages: a high-temperature stage, The value will increase because it allows for the acceptance of worsening solutions; its purpose is to escape local minima. If the high-temperature period is long enough, a global minimum can definitely be found; in the low-temperature stage, The value gradually decreases and tends to stabilize, without exhibiting a stagnation phenomenon similar to that of genetic algorithms. However, the entire algorithm process is too time-consuming, although the time is stabilized at around two minutes. A trade-off can be made to shorten the high-temperature phase. If it is easier to converge to the vicinity of the global minimum, then the shorter the high-temperature phase, the higher the time efficiency of the algorithm. However, the existence of the high-temperature phase is meaningful because it is for finding the global minimum and escaping local minimums.

[0040] Figure 8 For the sake of reality The parameter inversion result diagram of the phase-shifting grating, in which the chirped apodization FBG used in the genetic annealing algorithm is introduced. By shifting the phase and setting the chirp coefficient to 0, the phase-shifted grating can be reconstructed. If the phase shift is unknown, it can be used as one of the search parameters. The inversion results are shown in the table below: Genetic annealing algorithm for inverting parameters of phase-shifted FBG

[0041] final The value is below the preset value of 30.

[0042] The FBG parameter inversion method based on the genetic annealing algorithm provided by this invention has been described in detail above. Specific examples have been used to illustrate the structure and working principle of this invention. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this invention. It should be noted that those skilled in the art can make several improvements and modifications to this invention without departing from the principles of this invention, and these improvements and modifications also fall within the scope of protection of the claims of this invention.

Claims

1. A reverse design method for fiber Bragg gratings based on genetic annealing algorithm, comprising a genetic algorithm and a simulated annealing algorithm, characterized in that, The genetic annealing algorithm is a hybrid strategy that combines genetic algorithms and simulated annealing algorithms through a dynamic switching mechanism; its steps are as follows: S1. First, run the genetic algorithm to perform an efficient global search operation using its population parallelism and genetic and chromosome parameter sets to initially locate the approximate optimal solution region. The genetic algorithm is a global search method, and its specific steps include: S11. Input of genetic algorithm parameters; S12. Use a genetic algorithm to perform a global search for FBG parameters; S2. When the optimization process of the genetic algorithm stalls, it indicates that it has fallen into a local optimum or that the exploration motivation is insufficient. At this time, it will automatically switch to the simulated annealing algorithm according to the algorithm dynamic switching mechanism. The algorithm's dynamic switching mechanism is an algorithm iteration criterion, and the specific steps include: S21. Calculate the loss function and determine whether the FBG parameter inversion has stalled; S22. If stagnation occurs, exit the genetic algorithm and enter the simulated annealing algorithm for local search; S23. Otherwise, return to step S12 and continue the global search; S3. The simulated annealing algorithm starts from the near-optimal solution range obtained by the genetic algorithm, and uses its controllable local search mechanism based on cooling scheduling to continue to carry out in-depth local development and refinement, and finally achieve reliable convergence to a high-precision optimal solution. The simulated annealing algorithm is a local search method, and its specific steps include: S31. Input the initial temperature, the expression and parameters for temperature decrease, the convergence step size, and the termination condition parameters in the simulated annealing algorithm; S32. Local search of FBG parameters using simulated annealing algorithm; S33. Calculate the loss function and determine whether the FBG parameter inversion has converged; S34. If convergence occurs, exit the simulated annealing algorithm and output the inversion parameters; S35. Otherwise, return to step S32 and continue the local search.

2. The fiber Bragg grating reverse design method based on genetic annealing algorithm according to claim 1, characterized in that, The genetic algorithm parameters input in step S11 include the number of genes, the number of chromosomes, the parameter search range, the number of new chromosomes generated by mutation, the number of mutated genes when chromosomes are mutated, the number of new chromosomes generated by exchange, and the number of exchanged genes when exchange is performed. The number of genes, chromosomes, the number of new chromosomes generated by mutation, and the number of new chromosomes generated by exchange should be selected in conjunction with the performance of the computing device. The parameter search range should be set considering the possible values ​​of the actual FBG parameters. The selection of the number of mutated genes when chromosomes perform mutation and the number of exchanged genes when performing exchange affects the algorithm's search efficiency.

3. The fiber Bragg grating reverse design method based on genetic annealing algorithm according to claim 1, characterized in that, The global search method includes: defining "gene"; defining "chromosome"; defining "population"; having "exchange" operation; having "mutation" operation; having "sorting" operation; having "heredity" operation; and having the ability to calculate the degree of stagnation.

4. The fiber Bragg grating reverse design method based on genetic annealing algorithm according to claim 1, characterized in that, The local search method includes: defining "temperature"; having a "cooling" operation; defining "perturbation"; and defining termination conditions.

5. The fiber Bragg grating reverse design method based on genetic annealing algorithm according to claim 1, characterized in that, The algorithm iteration criteria include: defining a loss function related to the target reflectance spectrum, whose output value serves as the standard for judging the quality of data, and having the ability to stop the algorithm.

6. The fiber Bragg grating reverse design method based on genetic annealing algorithm according to claim 3, characterized in that, The "gene" includes a data structure for storing genes and a mapping relationship between the fiber Bragg grating parameter set and the gene; wherein the fiber Bragg grating parameter set includes grating period, effective refractive index, relative refractive index difference, grating length, chirp parameter, apodization function parameter, and phase shift. The "chromosome" mentioned includes an array-like data structure for storing the set of genes of a single sample; The “population” includes an array-like data structure for storing a set of chromosomes; The term "exchange" refers to the probability of chromosome exchange and the number of exchanged genes; The term "mutation" refers to the probability of chromosome mutation, the number of mutated genes, and the range of mutation values. The "sorting" mentioned refers to using the target reflectance spectrum loss function to rank the quality of chromosomes in the population; The term "heredity" refers to chromosome screening of the sorted population, keeping the number of chromosomes in the population the same as the number of chromosomes in the original population, and discarding chromosomes with large loss function values. The ability to determine the degree of stagnation refers to judging whether the algorithm has stalled based on the loss value. If the algorithm is confirmed to have stalled, the genetic algorithm returns and outputs the result.

7. The fiber Bragg grating reverse design method based on genetic annealing algorithm according to claim 4, characterized in that, The "temperature" mentioned includes the retention probability used to calculate the result of each iteration of the Metropolis criterion; The "cooling down" refers to the temperature value decreasing linearly or exponentially in each iteration; The "perturbation" mentioned above refers to the criteria used to generate a new round of results in each iteration; The defined termination condition refers to ending the simulated annealing algorithm according to a certain criterion, which is based on the temperature value, the number of iterations, the loss function value, and the running time.