Glass search based on kd-tree and its optical system mixed variable optimization method
By constructing a KD tree and combining it with a local optimization algorithm, the problems of large computational cost and slow convergence speed in the mixed optimization of continuous and discrete variables in optical systems are solved, achieving efficient one-step optimization and significantly improving the optimization efficiency of optical systems.
Patent Information
- Application Number
- CN202311586663.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-24
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-11-24
AI Technical Summary
Existing optical system optimization methods involve large computational loads when dealing with mixed optimization of continuous and discrete variables, resulting in slow convergence speed. Furthermore, traditional methods require traversing the entire glass database when mapping continuous variables to discrete variables, which increases time complexity.
A KD-tree-based glass search method is adopted. A KD-tree is constructed to optimize the glass library. The nearest neighbor algorithm of the KD-tree is used to quickly find discrete variables. Combined with local optimization algorithms such as damped least squares method, mixed variable optimization is performed, which reduces the process of mapping continuous variables to discrete variables.
It achieves one-step optimization of continuous and discrete variables of optical systems, significantly reducing time complexity and improving convergence speed and optimization efficiency.
Smart Images

Figure CN117590585B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of optical system optimization, specifically relating to a glass search based on KD trees and a hybrid variable optimization method for optical systems. Background Technology
[0002] The first consideration in optimizing glass is how to characterize a specific piece of glass, typically using the refractive index n. d And Abbe coefficient v d These two dimensions are used to represent the design, but for the optimized design of apochromatic optical systems, these two variables alone are clearly insufficient to characterize the system. Therefore, the relative partial dispersion deviation value dP of the glass must also be considered. g,f .
[0003] Reflectivity refers to the ratio of the speed of light in a vacuum to the speed of light in a specific material at a specific wavelength. The refractive index of optical glass depends on the wavelength and the type of glass, but it is usually quasi-continuously distributed between 1.45 and 1.9.
[0004]
[0005] Where γ is the incident angle and β is the exit angle.
[0006] The Abbe number of a material quantifies the amount of dispersion (dispersion rate change) within a specific spectral range. The Abbe number of existing optical materials is generally discretely distributed between 25 and 70.
[0007]
[0008] Where n d n F and n C These are the refractive indices of the d-ray, F-ray, and C-ray, respectively.
[0009] Relative dispersion deviation represents the deviation from the Abbe linear formula, and is discretely distributed between -0.01 and 0.05, with a nearly quasi-continuous distribution in the range of -0.01 to 0.
[0010] A KD-tree is a balanced binary search tree used to find the d nodes closest to the target value in k-dimensional space. In optical system optimization, each node represents a glass element from a glass material library, and the storage method is as follows:
[0011] Node(feature coordinates, split axis, label, left child node, right child node, parent node)
[0012] 1) The feature coordinates are in an n-dimensional linear feature space R. n The point (x1, x) in 2,...), which in an optical system corresponds to a three-dimensional feature vector (n d ,v d ,dP g,f ).
[0013] 2) The dividing axis is to divide along the r-th dimension in the n-dimensional space, where 1 <= r <= n. In the optical system, this corresponds to dividing along one of the dimensions of refractive index, Abbe coefficient, and relative dispersion deviation, which is used to construct the kd-tree and query nodes.
[0014] 3) The label refers to the sample S i The remarks label corresponds to the specific model name of the glass in the optical system.
[0015] 4) The left child node is divided by the slicing axis and points to the node whose characteristic component of the slicing axis is smaller than that node. In the optical system, this corresponds to a piece of glass whose refractive index, Abbe coefficient, or relative dispersion deviation is smaller than that of the glass.
[0016] 5) The right child node is divided by the slicing axis and points to the node that is greater than the node in the characteristic component of the slicing axis. In the optical system, this corresponds to a piece of glass that is greater than the glass in one of the dimensions of refractive index, Abbe coefficient, or relative dispersion deviation.
[0017] 6) The parent node is the Node that points to this node. In an optical system, this means finding the previous glass on the path that points to this glass.
[0018] Mixed-variable optimization refers to an optimization problem that involves finding the extreme values of both continuous and discrete variables under certain constraints. Its mathematical model is as follows:
[0019] minF(x)
[0020] stG(x)>=0
[0021] x∈D
[0022] Where x represents the decision variables, specifically in optical system optimization including continuous variables such as thickness and curvature, and discrete variables such as refractive index, Abbe coefficient, and relative dispersion deviation; F(x) represents the objective function, specifically in optical system optimization the evaluation function value MeritFunction; G(x) represents the constraints, specifically in optical system optimization the various operands in the evaluation function, such as constraints on focal length, conjugate distance, etc.; D represents the decision space, specifically in optical systems the thickness, curvature, reflectivity, Abbe coefficient, and the range of relative partial dispersion deviation.
[0023] There are three main types of optimization methods for discrete variables in glass:
[0024] ① One approach is to sort the glass in the glass library according to a certain characteristic component, such as sorting by refractive index from smallest to largest. Then, during the optimization process, the glass is replaced sequentially. If the replacement glass causes the MeritFunction of the optical system to decrease, then the search continues downwards. Conversely, if it increases, then the glass selection is reversed. The advantage of this method is that the algorithm is simple and converges quickly, but the disadvantages are also very obvious. First, the glass is still treated as a discrete variable, so it cannot be optimized together with continuous variables of the optical system such as thickness and curvature. Glass replacement can only be performed after the continuous variables are optimized and fixed. Second, there is the issue of the selection of characteristic components. The different priorities between sorting by refractive index and sorting by Abbe coefficient may lead to inconsistent final results.
[0025] ② The second type is based on metaheuristic algorithms, which use the idea of random solutions to optimize the glass in a discrete glass space. It determines the optimal direction of the solution vector in the multidimensional variable space and iterates continuously. Essentially, it treats each dimension of the glass as a discrete variable. Examples include particle swarm optimization (PSO), bee colony optimization (BSO), ant colony optimization (ASO), and annealing algorithms that mimic animal behavior, as well as genetic algorithms, evolutionary algorithms, and chord algorithms based on encoded genotypes. The advantage of these metaheuristic algorithms is that they do not depend on the system's starting point and can obtain the global optimum after a sufficient number of iterations. The disadvantage is that these algorithms generally start from random solutions, requiring random sampling during initialization, resulting in poorer local search capabilities compared to traditional optimization algorithms.
[0026] ③ The third approach treats the various characteristic components representing the glass as continuous variables and optimizes them simultaneously using algorithms for continuous variables, such as damped least squares. A KD tree is constructed for the glass material library to obtain the optimized refractive index, Abbe coefficient, and relative partial dispersion deviation values. These are then mapped to the discrete actual glass material library using the nearest neighbor algorithm of the KD tree. The glass with the smallest evaluation function value is selected for replacement, and optimization continues until convergence. This method overcomes the shortcomings of the second approach, enabling mixed optimization of continuous and discrete variables to obtain a globally optimal solution. However, it adds the process of finding the corresponding glass in the glass library after each optimization, i.e., mapping from continuous to discrete variables. The traditional method is brute-force search, requiring each mapping to traverse all glasses in the glass database, calculate and store the distance to each glass in the library, and repeat the traversal to obtain the minimum distance. This traditional traversal method significantly increases the computational load and time complexity of the optimization. Summary of the Invention
[0027] To address the problems existing in the prior art, the purpose of this invention is to provide a glass search and optical system hybrid variable optimization method based on KD tree, which greatly reduces the process of mapping continuous variables to discrete variables, thus accelerating the convergence speed of the third method.
[0028] This invention relates to glass search based on KD trees and its hybrid variable optimization of optical systems, the steps of which include:
[0029] 1) Based on the optical system design requirements, set an evaluation function for each glass to be optimized in the system. Set the variable dimensions to be optimized, including thickness, curvature, refractive index, Abbe coefficient, and relative partial dispersion deviation value.
[0030] 2) Construct a KD tree for the candidate glass material library. The construction method is to first calculate the variance of all glasses in the glass material library in the directions of refractive index, Abbe coefficient and relative partial dispersion deviation value, select the feature with the largest variance as the hyperplane for splitting, sort all glass samples in ascending order according to the feature with the largest variance, take the middle sample to generate the node, all glasses smaller than the middle sample are located in the left subtree, and glasses larger than the middle sample are located in the right subtree. Then the left and right subtrees recursively call themselves and return to the root node of the subtree, and finally build a KD tree for a specific glass library.
[0031] 3) Select the local optimization algorithm to use, such as damped least squares, orthogonal descent, adaptive method, or global optimization algorithm, such as various adaptive algorithms. Treat the above variables as continuous variables for optimization, and finally obtain M optimized values, denoted as (x m,1 ,x m,2 ,x m,3 ,x m,4 ,x m,5 ), where m = 1 to M, representing the number of glass elements to be optimized in the optical system, x m,1 x represents the ideal thickness of the optimized glass. m,2 x represents the ideal curvature of the optimized glass. m,3 x represents the optimized ideal refractive index of the glass. m,4 x represents the ideal Abbe coefficient of the optimized glass. m,5 This represents the ideal relative partial dispersion deviation value after the glass has been optimized.
[0032] 4) Based on the KD-tree, find the K closest glass nodes to node p(x3,x4,x5) in the glass material library. The distance di between node p(x3,x4,x5) and the i-th glass in the glass material library is represented as di = [(x3-n...]]. i ) 2 +(x4-v i ) 2 +(x5-dpgi ) 2 ] 1 / 2 ,n i v i dpg i Let the refractive index, Abbe coefficient, and relative partial dispersion deviation of the i-th glass in the glass material library be represented. A list L of length K is constructed to store the final K glass nodes. The search process is as follows:
[0033] ① Search downwards based on the feature coordinates of node p and the splitting axis. If the value of node p in the splitting axis direction is less than the current node value, search to the left subtree; otherwise, search to the right subtree.
[0034] ② After reaching a leaf node, mark the leaf node as visited. Let s be the maximum distance between node p and all nodes in L. If there are less than K glass blocks in L, add the current node to L and execute ③. If there are more than K glass blocks and the distance between the current leaf node and node p is less than s, replace the farthest glass node with the current leaf node and execute ③. If the distance between the current leaf node and node p is greater than s, execute ③.
[0035] ③ If the current node is the root node, exit the algorithm and return L; otherwise, execute ④.
[0036] ④ Find the parent node. If the node has not been visited, mark it as visited and then execute ⑤. If the node has been visited, continue executing ④.
[0037] ⑤ If L has fewer than K glass nodes, add the node to L and execute ⑥. If L is full and the distance between the node and node p is less than s, replace the farthest glass node with the node and execute ⑥. If the distance is not greater than s, execute ⑥.
[0038] ⑥ Calculate the distance between node p and the feature hyperplane of the current node, denoted as s'. If s' ≥ s and L is full, it proves that there is definitely no glass node closer on the other side of the hyperplane, so execute ③. Otherwise, it means that there may be, so execute ①.
[0039] 5) Calculate the MeritFunction for each of the K glasses and select the glass with the minimum value to replace the optimized value obtained in step 3).
[0040] 6) Iterate through steps 3) to 4) until the set number of optimization rounds or the set convergence condition is reached.
[0041] A server is characterized by comprising a memory and a processor, the memory storing a computer program configured to be executed by the processor, the computer program including instructions for performing the steps of the methods described above.
[0042] A computer-readable storage medium having a computer program stored thereon, characterized in that the computer program, when executed by a processor, implements the steps of the above-described method.
[0043] The advantages of this invention are as follows:
[0044] The optimization of continuous and discrete variables of an optical system can be integrated into a one-step optimization, replacing the previous two-step operation of first optimizing the continuous variables and then replacing the glass.
[0045] Compared to the previous operation of traversing the entire glass library, this invention greatly shortens the time of mapping from continuous space to discrete space, reduces time complexity, and better supports the performance of mixed variable optimization algorithms. The comparison results are shown in Table 1.
[0046] Table 1 Comparison of search time between traversal search and KD-tree based search
[0047] Attached Figure Description
[0048] Figure 1 This is a flowchart of the method of the present invention.
[0049] Figure 2 A schematic diagram of a KD tree constructed from 10 pieces of glass. Detailed Implementation
[0050] The following description and introduction, using charts and an implementation example, further illustrates and introduces the KD-tree-based glass search and its hybrid variable optimization for optical systems. The example given is only for explaining the present invention and is not intended to limit the scope of the present invention.
[0051] Taking CDGM's glass library (which contains 273 pieces of glass) as an example, the experiment in this paper is implemented using the Python language, and the hardware environment is mainly supported by an Intel(R) Core(TM) i9-10900 CPU and 16GB of host memory.
[0052] To simplify the entire description process, only 10 glass samples from the CDGM library are selected to construct the KD tree, and the name and parameters of each glass sample are shown in Table 2 below:
[0053] Table 2 lists the names and parameters of the glass.
[0054]
[0055]
[0056] The representation and data structure of each node are as follows:
[0057] def__init__(self, item=None, label=None, dim=None, parent=None, left_child=None, right_child=None):
[0058] self.item = item#node value, i.e. (refractive index, Abbe coefficient, relative partial deviation dispersion)
[0059] self.label = label#node label, i.e., glass name
[0060] self.dim = dim # The dimension of the node's division, which is one of the three dimensions: refractive index, Abbe coefficient, and relative partial deviation dispersion.
[0061] self.parent = parent #parent node
[0062] self.left_child=left_child#left subtree
[0063] self.right_child=right_child#right subtree
[0064] Ultimately, the KD tree constructed from the aforementioned 10 pieces of glass is... Figure 2 As shown:
[0065] For example, if the refractive index, Abbe coefficient, and relative partial dispersion of the glass node to be searched are (1.762, 48.2, -0.009), the specific search process for finding the nearest glass node (K=1) is as follows:
[0066] Step 1: Find the root node H-LAF53 according to the division of each hyperplane layer, mark the node as visited, calculate the distance as 1.0201714022653212, and record it as the minimum distance.
[0067] Step 2: Visit the parent node D-LAF050-25 and mark it as visited. Calculate the distance to it. If the distance is 1.0000130789644703, which is less than the minimum distance, mark this node as the nearest glass node.
[0068] Step 3: Continue to visit the parent node H-LAF0LA, mark it as visited, calculate the distance as 0.7104762416858155, replace it with the minimum distance, and calculate the distance to the current node's split line as 0.71. Therefore, the left subtree of this node may have a point that is closer. So, find the node H-ZLAF69 again according to the split line division.
[0069] Step 4: Mark the node as visited, calculate the distance 1.6508834755972386, which is greater than the minimum distance, find the parent node H-ZLAF50D, mark it as visited, calculate the distance 1.620544352987605, which is greater than the minimum distance, and continue to find the parent node H-LAF0LA.
[0070] Step 5: Since the node has been visited, continue to visit the parent node D-LAF53-25 and mark it as visited. The distance is calculated to be 1.050188559259714, which is greater than the minimum distance. The distance to the split line is also calculated to be 1.05, which is greater than the minimum distance. Therefore, there is no need to query the right subtree. At the same time, it is determined to be the root node, and the query ends.
[0071] Step 6: Return the glass closest to (1.762, 48.2, -0.009) as H-LAF0LA.
[0072] Although specific embodiments of the invention have been disclosed for illustrative purposes and to aid in understanding and implementing the invention, those skilled in the art will understand that various substitutions, variations, and modifications are possible without departing from the spirit and scope of the invention and the appended claims. Therefore, the invention should not be limited to the content disclosed in the preferred embodiments, and the scope of protection claimed by the invention is defined by the claims.
Claims
1. A method for glass search and hybrid variable optimization of optical systems based on KD-trees, comprising the following steps: 1) Set the evaluation function and the parameters to be optimized for each glass in the optical system according to the design requirements of the optical system; The parameters include thickness, curvature, refractive index, Abbe coefficient, and relative partial dispersion deviation value; 2) Construct a KD tree for the candidate glass material library; each glass in the glass material library corresponds to a glass node in the KD tree; 3) Select either a local optimization algorithm or a global optimization algorithm to calculate the optimized value for each glass element to be optimized; where the optimized values of each parameter for the m-th glass element to be optimized are denoted as (x... m,1 ,x m,2 ,x m,3 ,x m,4 ,x m,5 ), x m,1 x represents the ideal thickness of the m-th glass to be optimized. m,2 Let x represent the ideal curvature of the m-th glass to be optimized. m,3 Let x represent the ideal refractive index of the m-th glass to be optimized. m,4 Let x represent the ideal Abbe coefficient of the m-th glass to be optimized. m,5 This represents the ideal relative partial dispersion deviation value of the m-th glass to be optimized; m = 1 to M, where M is the total number of glasses to be optimized in the optical system. 4) For each glass to be optimized, based on the KD tree, find the K glass nodes closest to node p from the glass material library, and construct a list L of length K to store the final K glass nodes; where node p is determined according to the ideal refractive index x3, ideal Abbe coefficient x4, and ideal relative partial dispersion deviation value x5 of the glass to be optimized obtained in step 3); the method for finding the K glass nodes closest to node p is as follows: ① Search downwards according to the characteristic coordinate values (x3, x4, x5) of node p and the split axis of the KD tree. If the value of node p in the current split axis direction is less than the current node value, search to the left subtree; otherwise, search to the right subtree; ② After reaching a leaf node, mark the leaf node as visited; during the traversal, each time a glass node is added to list L, calculate the maximum distance s between node p and all nodes in the current list L. If there are no nodes in the current list L, the maximum distance s is calculated. If there are K glass nodes, add the current node to list L and execute ③; if the current list L exceeds K glass nodes and the distance between the current leaf node and node p is less than s, replace the glass node with the largest distance with the current leaf node and execute ③; if the distance between the current leaf node and node p is greater than s, execute ③; ③ If the current node is the root node, end the search and return to list L, otherwise execute ④; ④ Find the parent node. If the parent node has not been visited, mark it as visited and execute ⑤. If the parent node has been visited, continue executing ④; ⑤ If L has fewer than K glass nodes, add the current node to L and execute ⑥; if L is full and the distance between the current node and node p is less than s, replace the glass node with the largest distance with the current node and execute ⑥; if the distance between the current node and node p is not greater than s, execute ⑥; ⑥ Calculate the distance between node p and the feature hyperplane of the current node, denoted as s'. If s' If L is full, then execute ③; otherwise, execute ①. 5) Calculate the evaluation values of the K glass nodes corresponding to the m-th glass to be optimized based on the evaluation function of the m-th glass to be optimized, and replace the parameters of the glass with the minimum evaluation value with the corresponding parameter optimization value of the m-th glass to be optimized in step 3), m=1~M; 6) Iterate through steps 3) to 5) until the set number of optimization rounds is reached or the set convergence condition is met.
2. The method according to claim 1, characterized in that, The method for constructing the KD tree is as follows: First, calculate the variance of all glasses in the glass material library in the directions of refractive index, Abbe coefficient, and relative partial dispersion deviation value. Select the feature with the largest variance as the hyperplane for splitting. Then, sort all glasses in the glass material library in ascending order according to the feature with the largest variance. Take out the glass in the middle to generate the root node. All glasses with variance less than the variance of the middle glass are located in the left subtree, and glasses with variance greater than the variance of the middle glass are located in the right subtree. Then, the left and right subtrees recursively call themselves and return to the root node of the subtree, and finally construct the KD tree.
3. The method according to claim 2, characterized in that, The distance di between node p and the i-th glass in the glass material library is: di = [(x3-n)] i ) 2 +(x4-v i ) 2 +(x5-dpg i ) 2 ] 1 / 2 ; where n i v represents the refractive index of the i-th glass in the glass material library. i dpg represents the Abbe coefficient of the i-th glass in the glass material library. i This represents the relative partial dispersion deviation value of the i-th glass in the glass material library.
4. The method according to claim 1, 2, or 3, characterized in that, The local optimization algorithms mentioned are damped least squares method, orthogonal descent method, or adaptive method.
5. The method according to claim 1, 2, or 3, characterized in that, The global optimization algorithm is an adaptive algorithm.
6. A server, characterized in that, It includes a memory and a processor, the memory storing a computer program configured to be executed by the processor, the computer program including instructions for performing each step of the method of any one of claims 1 to 5.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Method for generating initial structure of optical system
CN110764257A
Athermalized and achromatized multispectral optical systems and methods of designing same
US20180067280A1
