Method and system for approximately solving traveling salesman problem based on quantum computing

By dividing the undirected fully weighted graph and searching for quantum optimal paths, combining quantum condensation hierarchical clustering and convex hull search algorithms, the large-scale travel dealer problem under the limitations of quantum computing hardware is solved, and the stability and approximate ratio of efficiently solving travel dealer problems under limited resources are achieved.

CN120373487APending Publication Date: 2025-07-25ZHEJIANG UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510478687.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

Under the limitations of existing quantum computing hardware, it is difficult to effectively solve the problem of large-scale travel merchants. The existing quantum algorithms are inefficient in solving large-scale travel merchants problems in real life.

Method used

The quantum computing approximate solution method is used to divide the undirected fully weighted graph, and the quantum optimal path search algorithm is used to find the shortest Hamiltonian path, and combined with the quantum condensation hierarchical clustering and convex hull search algorithm, the sub-graph connection order and boundary points are determined, and the final solution to the travel dealer problem is integrated.

Benefits of technology

Under limited quantum hardware conditions, it can effectively solve travel dealers' problems at any scale, reduce quantum resource requirements, improve solution stability and approximate ratio, and enhance application availability in real problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120373487A_ABST
    Figure CN120373487A_ABST
Patent Text Reader

Abstract

The invention discloses a method and a system for approximately solving a traveling salesman problem based on quantum computing. The method comprises the following steps: acquiring an undirected completely weighted graph G; the graph G is divided into a plurality of sub-graphs, and the number of nodes in each sub-graph is smaller than or equal to a threshold value; determining a connection sequence of each sub-graph and a connection edge between the adjacent sub-graphs; taking two end points of a connecting edge between the adjacent sub-graphs as a starting point and an end point in the adjacent sub-graphs respectively, and searching a shortest Hamiltonian path in each sub-graph by utilizing a quantum optimal path search algorithm; and integrating the connection sequence of the sub-graphs and the shortest Hamiltonian paths of all the sub-graphs to obtain a Hamiltonian loop about the whole graph G, namely the final solution of the traveling salesman problem. According to the method, the constraint of quantum hardware equipment on the problem scale is eliminated, the required quantum resources are greatly reduced, the large-scale traveling salesman problem can be solved by using the existing quantum computer, and the solving stability and approximation ratio are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the cross technical field of combinatorial optimization problems and quantum computing, and particularly relates to a method and system for approximately solving the Traveling Salesman Problem (TSP) based on quantum computing. Background Art

[0002] The Traveling Salesman Problem (TSP) is one of the classical combinatorial optimization problems. This problem describes that a traveling salesman needs to visit a series of cities, and each city must be visited and only visited once. The task of the traveling salesman is to find a path that enables him to visit all cities and finally return to the starting point, and the sum of the total weights of this path is the smallest. In graph theory, we call such a circuit a Hamiltonian circuit. Correspondingly, a Hamiltonian path refers to a path where, after determining the starting point and the ending point, the traveling salesman visits all cities once and only once, but does not return to the starting point at the end.

[0003] The Traveling Salesman Problem has a very wide range of applications in practice, mainly reflected in fields such as logistics and transportation, manufacturing, genomics, urban planning, etc. For example, an express delivery company needs to deliver packages to multiple different addresses. By solving the Traveling Salesman Problem, the shortest delivery path can be found, thereby reducing transportation costs and time. By solving the TSP, the goods distribution and vehicle scheduling paths can be optimized, and the transportation costs can be reduced; in production scheduling and electronics manufacturing, it helps to reduce the processing time; in genomics, the TSP helps to reconstruct DNA sequences; and in urban waste collection, tourist route planning, and drone path optimization, the TSP is used to plan the optimal route to improve efficiency and save resources.

[0004] However, the NP-hard nature of the Traveling Salesman Problem makes the solution space grow exponentially with the problem scale, which makes classical algorithms inefficient in solving the Traveling Salesman Problem. Quantum computing is a revolutionary paradigm in computing technology and has the potential to greatly exceed the traditional computing speed in specific computing tasks. It provides a new method for solving complex optimization problems, especially NP-hard problems. Currently, the quantum algorithms used to solve the Traveling Salesman Problem are mainly divided into two categories. The first category is quantum approximation algorithms including quantum annealing, variational quantum algorithms (VQA), and quantum approximate optimization algorithms (QAOA); the second category is quantum exact algorithms evolved from the Grover algorithm, aiming to exactly solve the Traveling Salesman Problem and find its optimal solution. However, due to the inevitable and ineliminable noise interference of current quantum devices, and the number of qubits is still at a medium scale, this Noisy Intermediate-Scale Quantum (NISQ) characteristic makes both of the above two algorithms unable to solve the relatively large-scale Traveling Salesman Problem that actually exists in daily life.

[0005] In summary, when using quantum computing to solve combinatorial optimization problems, how to achieve exponential acceleration while adapting to the current hardware conditions of quantum computing, so that quantum computing can be applied to practical problems as soon as possible, has become the main challenge in solving the traveling salesman problem.

[0006] Next, a brief introduction to the basic knowledge of quantum computing is given: A quantum bit (i.e., Qubit) is the basic unit of quantum computing. Similar to classical bits, the computational basis states of a quantum bit can be represented as |0> and |1> (using Dirac notation), or can also be represented as state vectors (1,0) T and (0,1) T . A fundamental difference is that a quantum bit has superposition. That is to say, the state of a single quantum bit can be mathematically represented as where α and β are the complex coefficients of the states |0> and |1> respectively, and they have the relationship shown in the formula: |α| 2 +|β| 2 = 1. After measurement, the quantum bit probabilistically collapses to |0> or |1>, with probabilities |α| 2 and |β| 2 respectively. Further, a quantum bit has two attributes, amplitude and phase, both of which will affect the quantum state. Therefore, in order to naturally reflect these two degrees of freedom of a single quantum bit, it is intuitively represented using spherical coordinates (Bloch sphere) as Figure 1 shown.

[0007] In the Bloch sphere, any single quantum state represents a point on the sphere, and only two angles are needed to uniquely determine a single quantum state |ψ>. These two angles are: the angle between the vector and the Z-axis, which is called the polar angle θ; and the angle between the projection of the vector on the XY plane and the X-axis, which is called the azimuthal angle φ. Since the position of the quantum state only moves on the surface of the Bloch sphere, only these two angles are needed to uniquely determine a single quantum state. Specifically, the coefficients α and β can be expressed as: α = cos(θ), β = e iφ sin(θ), where the polar angle θ affects the amplitude size; the azimuthal angle φ determines the phase size.

[0008] For quantum bits, they are similar to classical logic gates. Quantum gate operations are also a basic computational unit that produces outputs based on inputs. However, different from classical logic gates, quantum circuits require that each quantum gate has a corresponding inverse operation that can restore the system from the post-operation state to the pre-operation state. This is because: ① To ensure that information is not lost. In quantum computing, information is stored and processed in the form of quantum states. Reversibility ensures that no information is lost during the computing process, that is, it can be fully restored to the state before the computation. ② To maintain the normalization of probability amplitudes. The probability amplitudes of quantum states need to maintain normalization, which is one of the basic principles of quantum mechanics. Reversible operations maintain the normalization of probability amplitudes, ensuring that the sum of probabilities in the system remains 1. ③ Reverse execution of quantum algorithms. Reversibility allows us to reverse the execution of gate operations in a quantum algorithm, thereby implementing the inverse transformation of the algorithm. This is necessary in some quantum algorithms. ④ Initialization and resetting of quantum bits. Reversibility allows us to reset the state of a quantum bit when needed, that is, restore it to its initial state without introducing additional irreversible changes.

[0009] In quantum computing, quantum gates are generally classified into single-qubit gates and multi-qubit gates. A single-qubit gate is a gate that affects only a single quantum bit, such as the quantum NOT gate; a multi-qubit gate is a gate that affects multiple quantum bits simultaneously, such as the controlled-NOT gate. Applying a multi-qubit gate can generate a quantum entangled state. Two commonly used single-qubit gates will be introduced first below. The first is the quantum NOT gate, whose function is to swap the amplitudes of |0> and |1> of a single quantum bit, that is, to swap the probabilities of 0 and 1. The second is the Hadamard gate, whose function is to convert a single quantum pure state (where the probability of only the 0 state is 1 or the probability of only the 1 state is 1) to a quantum superposition state, or to convert a quantum superposition state to a quantum pure state. Its formula is as follows:

[0010]

[0011]

[0012] A common multi-qubit gate is the controlled gate, where one or more quantum bits serve as control bits and the remaining quantum bits are target bits. When all the quantum bits of the control bits show 1, the state of the target bit is transformed according to the function of the gate.

[0013] For a quantum circuit, it is a sequence of quantum gates arranged in a specific order and is the specific implementation of a quantum algorithm. A quantum circuit exists in a quantum computer and is a circuit that uses quantum bits instead of classical bits, with the aim of performing specific computational tasks in quantum computing. A quantum circuit is a multi-quantum system, and there must be information exchange between quantum bits. However, once a quantum bit is observed, its state collapses and it cannot be used continuously, which results in the inability to transmit quantum information interaction through classical media. In this case, the quantum entanglement state and entanglement theory provide a way of information communication.

[0014] Quantum entanglement describes a strong correlation between two or more quantum systems such that their states cannot be described independently; when two or more quantum bits are entangled, there is a special relationship between their states, that is, the measurement of one bit will immediately affect the states of other entangled bits. This definition description of quantum entanglement can be said to be extremely profound, but specifically, when quantum entanglement occurs, each quantum bit in the entangled state shares the information of all other entangled bits, which is why the entangled state can only be described in an overall form. And when changing the state of one of the quantum bits in the entangled state, since it stores the state information of other bits, the states of other quantum bits in the entangled state will also be affected during the process of modifying the state. In a quantum circuit, multi-quantum gate operations can achieve the purpose of quantum entanglement, and the information exchange between quantum bits is realized through this information sharing.

[0015] In addition to the fact that this information transmission method is different from classical circuits, quantum circuits also have some characteristics that are different from classical circuits: ① Quantum circuits use quantum gate operations to implement instructions. Different from classical circuits where instructions are issued by a control unit to an arithmetic logic unit, there are no highly modular and clearly divided functional modules in quantum circuits. The instructions received by a quantum computer are complex gate instructions, and only by decomposing the complex gates written by users or programmers into a series of basic gate operations can they be applied to qubits. ② Quantum circuits are dynamically constructed during the algorithm implementation process, while the various functional unit structures in classical circuits are fixed, and the gate circuits are also fixed. This is because information transmission in quantum circuits is relatively difficult. Limited by the no-cloning theorem, information replication is even more impossible to achieve. Therefore, dynamically constructed quantum circuits can better fit quantum characteristics without wasting the performance of quantum computers on the state replication of qubits. This characteristic of quantum circuits makes them highly customizable and can be highly matched with algorithms. ③ Quantum circuits ensure their parallelism at the physical level. As mentioned before, this parallelism is not achieved by increasing the number of physical processors like GPU acceleration, but is an exponential parallel acceleration based on quantum superposition states. ④ Current-stage quantum circuits are noisy. The existing quantum computers are called noisy intermediate-scale quantum computers (NISQ), which means that current quantum computers cannot handle large-scale computing tasks with long running times, which limits the depth of quantum circuits; moreover, due to the interaction between qubits, each execution of a quantum gate operation will introduce some computational errors and noise, making the calculation results less reliable. Therefore, a large number of operations are usually required for quantum error correction or noise suppression. Summary of the Invention

[0016] The purpose of the present invention is to provide a method and system for approximately solving the traveling salesman problem based on quantum computing in view of the deficiencies of the prior art.

[0017] The purpose of the present invention is achieved through the following technical solutions: In the first aspect of the embodiments of the present invention, a method for approximately solving the traveling salesman problem based on quantum computing is provided, including the following steps:

[0018] (1) Obtain an undirected complete weighted graph G, and the positions of each node in the graph are calibrated using two-dimensional coordinates;

[0019] (2) Divide the undirected complete weighted graph G to divide the undirected complete weighted graph G into multiple clusters so that the number of nodes in each cluster is less than or equal to the threshold t limit ; where a cluster is a subgraph;

[0020] (3) Based on the multiple subgraphs obtained after the division in step (2), determine the connection order of the subgraphs and the connection edges between adjacent subgraphs;

[0021] (4) Use the two endpoints of the connecting edges between adjacent subgraphs obtained in step (3) as the starting point and the ending point in the adjacent subgraphs respectively, and use the quantum optimal path search algorithm to find the shortest Hamiltonian path in each subgraph;

[0022] (5) Integrate the connection order of the subgraphs obtained in step (3) and the shortest Hamiltonian paths of all subgraphs obtained in step (4) to obtain a Hamiltonian cycle for the entire undirected complete weighted graph G, that is, the final solution to the traveling salesman problem.

[0023] Furthermore, the criterion for partitioning the undirected complete weighted graph G is Theorem 1, and its specific content includes:

[0024] Given an undirected complete weighted graph G and the number of subgraphs K, when the K subgraphs (G1, G2,..., G i ,..., G K ) obtained after partitioning satisfy the following conditions, the approximate solution to the traveling salesman problem finally obtained has the minimum cost:

[0025]

[0026] In the formula, (G1, G2,..., G i ,..., G K ) * represents the value of the independent variable (G1, G2,..., G i ,..., G K ) corresponding to the minimum value obtained by the function , G i represents the i-th subgraph, and vol in (G i ) represents the sum of the costs of the paths between all internal nodes in the subgraph G i , c mn represents the cost of the path between the node v i and the node v m in the subgraph G n .

[0027] Furthermore, step (2) includes the following sub-steps:

[0028] (2.1) According to the distances between the nodes in the undirected complete weighted graph G, use the Q-means algorithm to partition the undirected complete weighted graph G into K subgraphs; where, the Q-means algorithm is the quantum K-means algorithm;

[0029] (2.2) Check the number of nodes in all subgraphs. For subgraphs with the number of nodes greater than the threshold t limit , repeat step (2.1) until the number of nodes in all subgraphs is less than or equal to the threshold tlimit ;

[0030] (2.3) Calculate the average position of all nodes in each sub - graph to obtain the center point of the corresponding sub - graph, and represent the corresponding sub - graph by the center point; among them, the average position of all nodes is obtained by calculating the average value of the x - coordinates of all nodes and the average value of the y - coordinates of all nodes.

[0031] Furthermore, in the step (3), to determine the connection order of the sub - graphs, it specifically includes the following sub - steps:

[0032] (3.1.1) Based on the multiple sub - graphs obtained after the division in step (2), according to the distances between the center points of the sub - graphs, use the quantum agglomerative hierarchical clustering algorithm to merge the center points of the sub - graphs in pairs into a higher - level center point, so as to merge the sub - graphs corresponding to the center points of the sub - graphs in pairs into a higher - level sub - graph, and gradually form a hierarchical tree - like structure until the number of nodes in the remaining higher - level sub - graph after the merger is reduced to less than or equal to the threshold t. limit ;

[0033] (3.1.2) Use the quantum optimal path search algorithm to find the shortest Hamiltonian cycle containing the higher - level center point in the corresponding higher - level sub - graph.

[0034] (3.1.3) Execute the reverse process of step (3.1.1). According to the hierarchical tree structure obtained in step (3.1.1), deconstruct the merged higher - level sub - graphs hierarchically. Each time, decompose a higher - level sub - graph into two lower - level sub - graphs until all the higher - level sub - graphs are restored to the original sub - graphs after the graph division; in this deconstruction process, use the two lower - level sub - graphs after deconstruction to replace the position of the decomposed higher - level sub - graph in the shortest Hamiltonian cycle obtained in step (3.1.2) to obtain a complete Hamiltonian cycle for all the original sub - graphs.

[0035] Furthermore, the quantum agglomerative hierarchical clustering algorithm specifically includes the following sub - steps:

[0036] (3.1.1.1) Calculate the distances between the center points of each pair of sub - graphs, and maintain a cost matrix for all the center points of the sub - graphs.

[0037] (3.1.1.2) Find the two center points of the sub - graphs with the closest distance, merge these two center points of the sub - graphs into a higher - level center point, and at the same time, the corresponding two sub - graphs are also merged into a higher - level sub - graph.

[0038] (3.1.1.3) Update the cost matrix.

[0039] (3.1.1.4) Repeat steps (3.1.1.2) - (3.1.1.3) until the number of nodes in the higher - level sub - graph is reduced to less than or equal to the threshold t.limit 。

[0040] Further, in the step (3), determining the connecting edges between adjacent subgraphs is supported by Theorem 2, and its specific content includes:

[0041] When selecting the connecting edge and the corresponding connecting nodes between adjacent subgraphs G i and G i+1 to minimize the cost of the solution to the traveling salesman problem, in 92.7% of the cases, if 's two endpoints respectively belong to the convex hull point sets of adjacent subgraphs G i and G i+1 ,such a selection will obtain a solution to the traveling salesman problem with a smaller cost than selecting non-convex hull nodes as endpoints.

[0042] Further, in the step (3), determining the connecting edges between adjacent subgraphs specifically includes the following sub-steps:

[0043] (3.2.1) Use the quantum convex hull search algorithm to find the convex hull point sets in each subgraph, respectively, as the candidate point sets for the two endpoints of the bridge; where the bridge refers to the connecting edge between adjacent subgraphs;

[0044] (3.2.2) For two adjacent subgraphs, find the nodes that are the closest and respectively belong to the convex hull point sets of the two adjacent subgraphs as the endpoints of the bridge;

[0045] (3.2.3) Repeat step (3.2.2) until all the bridges of adjacent subgraphs are determined.

[0046] Further, the quantum convex hull search algorithm specifically includes the following sub-steps:

[0047] (3.2.1.1) Find the node v i in subgraph G st with the minimum y coordinate value, include this node in the convex hull point set, and use this node as the starting point to find the next convex hull point;

[0048] (3.2.1.2) Construct the basis vector vec base ,and the basis vector vec base is the unit vector parallel to the X-axis with v st as the starting point;

[0049] (3.2.1.3) Traverse the remaining nodes v i in subgraph G st except v next ,and construct the vector

[0050] (3.2.1.4) Calculate the vector and the angle between the basis vector vec base and determine the node v corresponding to the minimum angle next as the next convex hull point v′ next ;

[0051] (3.2.1.5) Update v st to v′ next , update the basis vector vec base to the unit vector in the connecting direction of the previous convex hull point and v′ next ;

[0052] (3.2.1.6) Repeat steps (3.2.1.3) - (3.2.1.5) until no new convex hull points are found.

[0053] Furthermore, the quantum optimal path search algorithm specifically includes the following sub - steps:

[0054] (4.1) Perform normalization on the adjacency cost matrix A in the input undirected complete weighted graph G to obtain the normalized cost matrix A norm ;

[0055] (4.2) Perform the initialization of the quantum circuit, construct quantum registers, and encode all candidate Hamiltonian solutions in the graph G into the quantum circuit in a new quantum encoding manner;

[0056] (4.3) Use an effective solution screening quantum operator to find and label all candidate solutions that satisfy the Hamiltonian criterion;

[0057] (4.4) Use a shortest Hamiltonian solution screening quantum operator to find and label all candidate solutions whose cost is less than the cost threshold t cost ;

[0058] (4.5) Use a diffusion quantum operator to amplify the probability amplitude of the labeled candidate solutions;

[0059] (4.6) Repeat steps (4.3) - (4.5) until the probability amplitude of the labeled candidate solutions is amplified to be close to 1;

[0060] (4.7) Perform a measurement operation on the quantum circuit to obtain the candidate solution with the maximum probability;

[0061] (4.8) Decrease the cost threshold t cost to the cost of the new candidate solution;

[0062] (4.9) Repeat steps (4.2) - (4.8) until no shorter Hamiltonian solutions are found;

[0063] (4.10) Consider the shortest Hamiltonian solution found in step (4.9) as the global optimal solution, and output this solution as the final solution output by the quantum optimal path search algorithm, which is the shortest Hamiltonian path or the shortest Hamiltonian cycle.

[0064] In the second aspect of the embodiments of the present invention, a system for implementing the above method for approximately solving the traveling salesman problem based on quantum computing is provided, including:

[0065] A data input module for obtaining an undirected complete weighted graph G, and the position of each node in the graph is calibrated using two-dimensional coordinates;

[0066] A graph partitioning module for partitioning the undirected complete weighted graph G to divide the undirected complete weighted graph G into multiple clusters, so that the number of nodes in each cluster is less than or equal to a threshold t limit ; where a cluster is a subgraph;

[0067] A subgraph problem planning module for determining the connection order of the subgraphs and the connection edges between adjacent subgraphs based on the multiple subgraphs obtained by the graph partitioning module;

[0068] A subgraph solving module for using the two endpoints of the connection edges between adjacent subgraphs obtained by the subgraph problem planning module as the starting point and the ending point in the adjacent subgraphs respectively, and using the quantum optimal path search algorithm to find the shortest Hamiltonian path in each subgraph; and

[0069] A path merging module for integrating the connection order of the subgraphs obtained by the subgraph problem planning module and the shortest Hamiltonian paths of all subgraphs obtained by the subgraph solving module to obtain a Hamiltonian cycle for the entire undirected complete weighted graph G, that is, the final solution of the traveling salesman problem.

[0070] The beneficial effects of the present invention are as follows: The present invention proposes a quantum-classical hybrid modular method for approximately solving the traveling salesman problem. By using the divide-and-conquer idea, it breaks through the limitations of existing quantum hardware conditions and can solve traveling salesman problems of any scale under limited quantum hardware conditions (limited number of quantum bits, limited quantum circuit depth), greatly reducing the quantum resources required to solve the traveling salesman problem; The present invention provides a reliable theoretical basis for correctly solving the traveling salesman problem by proposing two theorems (Theorem 1, Theorem 2); The present invention can accurately solve the shortest Hamiltonian cycle and the shortest Hamiltonian path in a small-scale graph through the quantum optimal path search (QUOTA) algorithm, improving the stability and approximation ratio, thereby improving the usability in the face of real problems at the current stage. Description of the Drawings

[0071] Figure 1 It is an intuitive diagram of two degrees of freedom of a single qubit in spherical coordinates;

[0072] Figure 2 It is a calculation process diagram of the quantum inner product of the quantum state of the present invention;

[0073] Figure 3 It is a regional diagram of the present invention;

[0074] Figure 4 It is an overall flowchart of the method for approximately solving the traveling salesman problem based on quantum computing of the present invention;

[0075] Figure 5 It is an overall data flow diagram of the method for approximately solving the traveling salesman problem based on quantum computing of the present invention;

[0076] Figure 6 It is a quantum circuit flowchart of the QUOTA algorithm of the present invention. Detailed implementation manners

[0077] Here, exemplary embodiments will be described in detail, and examples thereof are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present invention. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.

[0078] The terms used in the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The singular forms "a", "the" and "said" used in the present invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more of the associated listed items.

[0079] It should be understood that although the terms first, second, third, etc. may be used in the present invention to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present invention, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while" or "in response to determining".

[0080] The present invention will be described in detail below with reference to the drawings. Without conflict, the features in the following embodiments and implementation manners can be combined with each other.

[0081] In order to adapt to the current hardware conditions of quantum computing and utilize the exponential acceleration advantage of quantum computing, the present invention provides an approximate solution scheme for the traveling salesman problem through an innovative quantum-classical hybrid framework. First, to approximate real-world application scenarios, the framework uses an undirected complete weighted graph as input data. Second, to reduce errors, the functional modules of the framework are distinguished, and various quantum components are embedded into the corresponding modules with the goals of different modules to jointly solve the traveling salesman problem. At the same time, the theorems required in the process are proposed and demonstrated, fully demonstrating the correctness and effectiveness of the framework. In addition, a Quantum Optimal path search (QUOTA) algorithm is proposed based on the Grover algorithm. After a given undirected complete weighted graph is provided, it can accurately find the shortest Hamiltonian cycle (i.e., find the optimal solution to the traveling salesman problem) in the graph and can also accurately find the shortest Hamiltonian path in the graph. After embedding the quantum optimal path search algorithm into the quantum-classical hybrid framework, with the help of the divide-and-conquer idea, the optimal solution to each sub-problem can be accurately found.

[0082] The method for approximately solving the traveling salesman problem based on quantum computing in the present invention specifically includes the following steps:

[0083] (1) Obtain an undirected complete weighted graph G, and the position of each node in the graph is calibrated using two-dimensional coordinates (x, y).

[0084] (2) Divide the undirected complete weighted graph G to divide it into multiple clusters so that the number of nodes in each cluster is less than or equal to the threshold t limit . Among them, t limit represents the number of nodes that can be directly solved for the shortest Hamiltonian solution by the quantum device and the quantum optimal path search algorithm under the existing limited quantum hardware conditions; one cluster is a subgraph.

[0085] It should be understood that the existence of the threshold t limit can ensure that after the graph is divided, all subgraphs (clusters) of the undirected complete weighted graph G are adapted to the current quantum device and can be solved independently, ensuring the independence of the solution of all subgraphs.

[0086] Furthermore, the standard for dividing the undirected complete weighted graph G is Theorem 1, and its specific content includes: Given the undirected complete weighted graph G and the number of subgraphs K, when the K subgraphs (G1, G2,..., G i ,..., G K ) obtained after division satisfy the following conditions, the approximate solution to the traveling salesman problem finally obtained has the minimum cost (path length):

[0087]

[0088] where (G1, G2, …, G i , …, G K ) * represents the independent variable corresponding to when the function obtains the minimum value (G1, G2, …, G i , …, G K ), and G i represents the i-th subgraph, and vol in (G i ) represents the sum of the costs of the paths between all internal nodes in the subgraph G i . c mn represents the cost (weight) of the path between the node v i and the node v m in the subgraph G n . The meaning of Theorem 1 is that when the subgraphs are partitioned, when the sum of the internal costs of all subgraphs is minimized, this subgraph partitioning method will lead to a better approximate solution to the Traveling Salesman Problem.

[0089] Proof of Theorem 1 above: After graph partitioning, the solution to the Traveling Salesman Problem consists of two parts: ① The sub-paths Path inter connecting between subgraphs, with a total of K; ② The sub-paths Path intra inside the subgraphs, with a total of (N - K). Assuming that the weights (costs) of the N sub-paths included in the optimal solution to the Traveling Salesman Problem are approximately equal, then since (N - K) > K, the sub-paths Path intra inside the subgraphs dominate the final result. Therefore, minimizing ∑vol in (G i ) can obtain a final approximate solution to the Traveling Salesman Problem with a smaller cost by restricting the sum of the costs of the paths inside the subgraphs, thereby reducing the approximation ratio of the approximate solution and making it closer to the optimal solution.

[0090] It should be understood that Theorem 1 above illustrates the criterion for graph partitioning when solving the Traveling Salesman Problem using the divide-and-conquer idea. Under this criterion, the quantum K-means algorithm is selected to perform graph partitioning, which is specifically implemented through the following steps (2.1) - step (2.3); among them, the quantum K-means algorithm is also called the Q-means algorithm.

[0091] (2.1) According to the distances between the nodes in the undirected complete weighted graph G, use the Q-means algorithm to partition the undirected complete weighted graph G into K subgraphs. Among them, the Q-means algorithm is the quantum K-means algorithm.

[0092] Furthermore, the specific process of the Q-means algorithm is as follows:

[0093] (2.1.1) Initialize the subgraph (cluster) centers, randomly select K initial cluster centers, and use them as the starting point of the Q-means algorithm. The size of K is determined by the number of nodes in the undirected complete weighted graph G and the threshold t limit It is calculated that when the undirected complete weighted graph G contains N nodes and the existing quantum hardware resources can undertake the calculation task of the shortest Hamiltonian solution of t limit nodes, at least subgraphs need to be divided. denotes rounding up the internal expression, that is, returning the smallest integer greater than or equal to the internal expression.

[0094] (2.1.2) Encode the coordinate information of the nodes and the cluster center points into the quantum state. By calculating the quantum inner product of these quantum states, as Figure 2 shown, obtain the distances of the paths between all nodes and the cluster center points.

[0095] Specifically, in the process of calculating the quantum inner product above, use the quantum circuit as Figure 2 shown to execute the calculation process. Among them, the quantum state |ψ0> is an auxiliary qubit, which is initialized to the quantum ground state |0> and is used to assist in the implementation of the calculation process and store the calculation results; the quantum states |ψ1> and |ψ2> store the data points and the cluster center points respectively. In order to encode the coordinate information of the nodes into the quantum states |ψ1> and |ψ2>, it is necessary to map the x and y coordinates of the nodes to two angles of the quantum state, which are respectively expressed as:

[0096]

[0097] In the formula, θ and φ are the Bloch sphere coordinate representations of the quantum state. θ represents the polar angle, that is, the angle between the quantum state vector and the Z coordinate axis in the spherical coordinates, which determines the latitude of the quantum state on the Bloch sphere. φ represents the azimuth angle, that is, the angle between the projection of the quantum state vector on the XY plane and the X coordinate axis in the spherical coordinates, which determines the longitude of the quantum state on the Bloch sphere. θ and φ jointly determine the unique position of the quantum state on the Bloch sphere; x min is the minimum x coordinate among all points, representing the lower bound of the input graph data on the x-axis; Δx is the difference between the maximum x coordinate and the minimum x coordinate, representing the interval range of the input graph data on the x-axis; y min is the minimum y coordinate among all points, representing the lower bound of the input graph data on the y-axis; Δy is the difference between the maximum y coordinate and the minimum y coordinate, representing the interval range of the input graph data on the y-axis. Through the above formula, the coordinate information of the nodes and the subgraph center points can be encoded into |ψ1> and |ψ2> respectively.

[0098] After that, in the construction Figure 2In the shown quantum circuit, the first gate and the third gate both represent Hadamard gate operations; the second gate represents a controlled-swap gate operation (CSWAP), whose function is: when the control bit |ψ0> = |1>, swap the states of |ψ1> and |ψ2>; the fourth gate represents a measurement operation, and through observation, convert |ψ0> into a readable classical state. Before the measurement, the state of the quantum system composed of these three qubits at the dotted line is as follows:

[0099]

[0100] In the formula, the symbol represents the tensor product, and |ψ0ψ1ψ2> represents the quantum system composed of three qubits |ψ0>, |ψ1>, and |ψ2>. In the final measurement operation, the probability that the measurement of |ψ0> is |0> is expressed as:

[0101]

[0102] In the formula, P(<0|ψ0>) represents the probability that |ψ0> is |0>, and |<ψ1|ψ2>| 2 represents the inner product between the quantum states |ψ1> and |ψ2>. In the process of encoding the coordinate information of the nodes into the quantum state, the nodes on the two-dimensional plane have been mapped to the unit vectors on the Bloch sphere. At this time, the inner product between the unit vectors reflects the similarity between the nodes: the larger the inner product value, the closer the nodes are. To further make the inner product value have a direct correspondence with the distance between the nodes, the inner product value is mapped to a quantity proportional to the distance between the nodes through appropriate mathematical transformations (such as taking the inverse function of the inner product).

[0103] (2.1.3) Find the clustering center point closest to each node and assign the node to the subgraph where the center point is located.

[0104] (2.1.4) Update the clustering center point to the average coordinate position of all points in the subgraph.

[0105] (2.1.5) Repeat steps (2.1.2) - (2.1.4) until the center point no longer changes significantly or reaches the preset number of iterations.

[0106] (2.1.6) Output the partitioning result generated by the last iteration and use this result as the final result of the Q-means algorithm, which is the final partitioned K subgraphs.

[0107] (2.2) Check the number of nodes in all subgraphs. For subgraphs with the number of nodes greater than the threshold t kimit , repeat step (2.1) until the number of nodes in all subgraphs is less than or equal to the threshold t limit .

[0108] (2.3) Calculate the average position (average x, average y) of all nodes in each sub - graph to obtain the center point of the corresponding sub - graph. Represent the corresponding sub - graph by the center point, which is beneficial to compressing the data volume and improving the algorithm efficiency in the subsequent sub - graph solution planning process. Among them, the average position of all nodes is obtained by calculating the average value of the x - coordinates of all nodes and the average value of the y - coordinates of all nodes.

[0109] (3) Based on the multiple sub - graphs obtained after the division in step (2), determine the connection order of the sub - graphs and the connection edges between adjacent sub - graphs, so as to prepare for the sub - graph solution in the subsequent step (4) and the path merging in step (5). That is, in the current step (3), there are two sub - tasks to be completed: Sub - task one is to determine the connection order of the sub - graphs, and its specific process is shown in the following steps (3.1.1) - step (3.1.3); Sub - task two is to determine the connection edges between adjacent sub - graphs, and its specific process is shown in the following steps (3.2.1) - step (3.2.3).

[0110] Furthermore, to determine the connection order of the sub - graphs, it specifically includes the following sub - steps:

[0111] (3.1.1) Based on the multiple sub - graphs obtained after the division in step (2), according to the distance between the center points of the sub - graphs, use the Quantum Agglomerative Hierarchical Clustering Algorithm (QAHCA) to merge the center points of the sub - graphs in pairs into a high - level center point, so as to merge the sub - graphs corresponding to the center points of the sub - graphs in pairs into a high - level sub - graph, and gradually form a hierarchical tree - like structure until the number of nodes in the remaining high - level sub - graph after the merger is reduced to less than or equal to the threshold t. limit 。

[0112] It should be noted that the Agglomerative Hierarchical Clustering (AHC) algorithm is an existing bottom - up hierarchical clustering method. It starts from individual data points and gradually merges the most similar clusters until all data points are aggregated into a complete cluster or reach the termination condition; when it is applied to quantum computing, it is called the Quantum Agglomerative Hierarchical Clustering (QAHCA) algorithm, and its specific implementation method steps are the same as those of the Agglomerative Hierarchical Clustering algorithm.

[0113] Furthermore, in Sub - task one, use the QAHCA algorithm to construct a hierarchical tree structure. The specific sub - steps of the QAHCA algorithm are as follows:

[0114] (3.1.1.1) Use Figure 2 the quantum circuit shown to calculate the distance between the center points of each pair of sub - graphs and maintain a cost matrix about all the center points of the sub - graphs.

[0115] (3.1.1.2) Find the two subgraph center points with the closest distance, merge these two subgraph center points into a high-level center point, and at the same time, the corresponding two subgraphs are also merged into a high-level subgraph.

[0116] (3.1.1.3) Update the cost matrix.

[0117] (3.1.1.4) Repeat steps (3.1.1.2) - (3.1.1.3) until the number of nodes in the high-level subgraph is reduced to less than or equal to the threshold t limit .

[0118] It should be noted that the quantum condensation hierarchical clustering algorithm is to prepare for finding the Hamiltonian circuit that contains all subgraphs (i.e., determining the connection order between subgraphs) in step (3.1.2). The reason for using the quantum condensation hierarchical clustering algorithm instead of other clustering algorithms such as Q-means here is that the quantum condensation hierarchical clustering algorithm has advantages that other clustering algorithms do not have:

[0119] First of all, the quantum condensation hierarchical clustering algorithm has more strict decision rules. It only merges the two subgraphs (clusters) with the closest distance each time, and the distance calculation also uses the position information of the subgraph itself. In contrast, the Q-means algorithm integrates the information of multiple subgraphs (usually more than two) into a high-level subgraph center point, and this iterative clustering will make the information that the subgraph center point can describe less and less. For example, in graph partitioning, the Q-means algorithm can use a subgraph center point to represent the information of 5 nodes. According to Theorem 1, these 5 nodes are close enough and the distance from other nodes is scattered enough, so the process of using this one center point to represent 5 data points will not ignore too much information. However, if the Q-means algorithm is used again in determining the connection order of subgraphs, then in the above example, a high-level subgraph center point will represent the information of 5 low-level subgraphs, and each low-level subgraph contains 5 nodes, which means that this one high-level subgraph center point will represent the information of 25 nodes. Then, at this time, Theorem 1 no longer works because the positions of these 25 nodes are not so dense. Therefore, using this one subgraph center point to represent them will lose too much position information, especially the boundary point information in the subgraph. However, in the process of determining the connection of subgraphs, the boundary point information of the subgraph should be the content that cannot be ignored the most, because the connection of subgraphs is the process of traversing boundary points and connecting boundary points to form bridges. To sum up, the Q-means algorithm has a worse effect due to ignoring too much key information required.

[0120] Secondly, using the Q-means algorithm cannot strictly control the number of nodes in each subgraph. Similar to graph partitioning, it is necessary to judge whether the number of nodes in all subgraphs is less than the threshold t limitSimilarly, if the Q-means algorithm is used here, such a judgment also needs to be made. This undoubtedly increases the complexity of the algorithm.

[0121] In addition, in step (3.1.3), the reverse process of step (3.1.1) needs to be executed to restore and obtain the original subgraph. When using the quantum agglomerative hierarchical clustering algorithm, two subgraphs are strictly merged at each layer, which makes the formed hierarchical tree structure easier to be deconstructed, thus making the execution of step (3.1.3) smoother.

[0122] The reason for not using the quantum agglomerative hierarchical clustering algorithm in graph partitioning is that the complexity of this algorithm is much higher than that of Q-means. In graph partitioning, when facing so many nodes in the original graph, on the one hand, using the Q-means algorithm will make the complexity of the whole method a little lower; on the other hand, according to Theorem 1, the Q-means algorithm is already sufficient to meet the criteria proposed by Theorem 1.

[0123] Finally, in step (2), the graph G is first partitioned into multiple smallest subgraphs, and then in step (3), the subgraphs are merged in order to find the connection order of all subgraphs. There is an assumption here: wouldn't it be simpler to directly partition into a small number of large subgraphs in step (2) and then directly find their connection order? The answer is no, because when using the QUOTA algorithm to find the connection order in step (3), the central points of the subgraphs are also used. However, for large subgraphs, using a single central point of the subgraph to represent all points in the subgraph will also lose a lot of key position information. The position information of many points on the boundary of the subgraph will be lost. However, as described before, these boundary points are exactly the key to connecting with other subgraphs. Therefore, the connection order found at this time will have a large error.

[0124] Regarding the fact that the central points of the subgraphs lose a lot of position information of the boundary points as mentioned above, the quantum agglomerative hierarchical clustering algorithm will also have such a problem, but due to its more strict clustering (merging) criteria, the resulting error will be smaller.

[0125] (3.1.2) Use the quantum optimal path search (QUOTA) algorithm to find the shortest Hamiltonian circuit containing the high-level central point in the corresponding high-level subgraph. Among them, the specific implementation process of the QUOTA algorithm is shown in the following step (4).

[0126] (3.1.3) Perform the reverse process of step (3.1.1). According to the hierarchical tree structure obtained in step (3.1.1), hierarchically decompose the merged high-level subgraphs. Each time, decompose a high-level subgraph (high-level center point) into two lower-level subgraphs (lower-level center points) until all high-level subgraphs are restored to the original subgraphs after graph partitioning; during this decomposition process, use the two decomposed lower-level subgraphs to replace the position of the decomposed high-level subgraph in the shortest Hamiltonian cycle obtained in step (3.1.2), so as to obtain a complete Hamiltonian cycle for all original subgraphs at the end of the current step (3.1.3).

[0127] Further, after obtaining the connection order of subgraphs through subtask one, determine the unique connection edge connecting adjacent subgraphs in subtask two, which is called a "bridge". Determining the connection edge between adjacent subgraphs specifically includes the following sub-steps:

[0128] (3.2.1) Use the Quantum Convex Hull Search Algorithm (QCHSA) to find the convex hull point sets in each subgraph, which are respectively used as the candidate point sets for the two endpoints of the bridge. Here, the bridge refers to the connection edge between adjacent subgraphs.

[0129] It should be noted that in subtask two, the Quantum Convex Hull Search Algorithm is used to screen the candidate endpoint sets for the bridges connecting all subgraphs, which are called convex hull point sets. Among them, convex hull points refer to the points located on the outermost layer of a point set. These points form a smallest convex polygon (convex hull) that can contain all points in the entire point set. In other words, the convex hull point set is composed of the points in the point set that cannot be "surrounded" by other points, and they are located on the boundary of the point set. In a two-dimensional plane, given a set of points, the convex hull is like the boundary formed by wrapping these points with a rubber band, and the points located on the boundary are the convex hull points. For a subgraph G i , the specific process of the Quantum Convex Hull Search Algorithm is as follows:

[0130] (3.2.1.1) Find the node v i in subgraph G st with the minimum y-coordinate value, include this node in the convex hull point set, and use this node as the starting point to find the next convex hull point.

[0131] (3.2.1.2) Construct the basis vector vec base , and the basis vector vec base is the unit vector parallel to the X-axis with v st as the starting point.

[0132] (3.2.1.3) Traverse the remaining nodes v i in subgraph G st except v next , and construct the vector

[0133] (3.2.1.4) Use a quantum circuit as shown in Figure 2 to calculate the angle between the vector and the basis vector vec base , and determine the node v next corresponding to the minimum angle as the next convex hull point v' next .

[0134] (3.2.1.5) Update v st to v' next , and update the basis vector vec base to the unit vector in the connection direction between the previous convex hull point and v' next .

[0135] (3.2.1.6) Repeat steps (3.2.1.3) - (3.2.1.5) until no new convex hull points are found.

[0136] (3.2.2) For two adjacent subgraphs, find the nodes that are closest and belong to the convex hull point sets of the two adjacent subgraphs respectively as the endpoints of the bridge.

[0137] (3.2.3) Repeat step (3.2.2) until all the bridges between adjacent subgraphs are determined.

[0138] It should be noted that in steps (3.2.1) and (3.2.2) of subtask two, based on Theorem 2, the following conclusion is clearly proven: when choosing convex hull points as the endpoints of the bridge, the final solution obtained is better than the case of choosing non - convex hull points as the endpoints of the bridge.

[0139] Furthermore, determining the connection edges between adjacent subgraphs is supported by Theorem 2. Its specific content includes: when choosing the connection edge and the connection nodes between the corresponding adjacent subgraphs G i and G i+1 to minimize the cost of the solution to the traveling salesman problem, in 92.7% of the cases, if has two endpoints belonging to the convex hull point sets of the adjacent subgraphs G i and G i+1 respectively, then such a choice will result in a solution to the traveling salesman problem with a smaller cost than choosing non - convex hull nodes as the endpoints.

[0140] Proof of the above Theorem 2: Consider a simplified problem scenario: One endpoint of the bridge i connecting G i+1 is fixed in G , denoted as v i+1 ∈G f ∈G i+1, while the other endpoint has two choices, namely the non-convex hull point v n , and v n , a convex hull point v c that is the closest to it. In the subgraph G i , v n is the node closest to v f . Then the sum of the path costs C(G i ) in the subgraph G i is expressed as:

[0141]

[0142] wherein, represents the cost (i.e., the cost) of the Hamiltonian path starting from the node v n but not including the node v c , represents the additional cost of incorporating v c into the corresponding path , represents the cost of the connecting edge between the nodes v f and v n , represents the sum of the path costs in the subgraph G n when the other endpoint is selected as the non-convex hull point v i ; represents the cost of the Hamiltonian path starting from the node v c but not including the node v n , represents the additional cost of incorporating v n into the corresponding path , represents the cost of the connecting edge between the nodes v f and v c . It should be noted that: The formed by the above process does not need to be the exact shortest Hamiltonian path, and this simplification will not affect the subsequent proof process.

[0143] In all scenarios, the distribution of the nodes in G i is completely random, resulting in the randomness of the formed Hamiltonian path. Under the influence of this randomness, and will also show great randomness with different node distributions in G i . Therefore, considering all these infinite node distribution cases, it can be considered that and have equal expected values, that is:

[0144]

[0145] In the formula, E() represents the expected value of the cost. Furthermore, through the Manhattan distance, The costs of these three paths are calculated as:

[0146]

[0147] In the formula, d(·) represents the Manhattan distance between two internal nodes; Δx n , Δy n respectively represent the difference in the abscissa and the difference in the ordinate between nodes v f and v n . For example, Δx n = x n - x f , Δy n = y n - y f , x n and y n respectively represent the abscissa and the ordinate of node v n , x f and y f respectively represent the abscissa and the ordinate of node v f . Δx c , Δy c respectively represent the difference in the abscissa and the difference in the ordinate between nodes v f and v c . For example, Δx c = x c - x f , Δy c = y c - y f , x c and y c respectively represent the abscissa and the ordinate of node v c ; represents the cost of the connecting edge between nodes v n and v c .

[0148] For the operation When node v c is inserted into the path , traverse all possible insertion positions, calculate the additional cost generated by inserting v c between each pair of adjacent nodes, and finally select the insertion point with the minimum cost as the insertion position of v c , and define this minimum cost as . For example, if node v c is inserted between node v i and node v i+1 to make is minimized, the additional cost incurred is: adding v c and v i the cost of the connected edge, v c and v i+1 the cost of the connected edge, minus the cost of the original v i and v i+1 the cost of the connected edge (since this edge will be deleted), and the formula is as follows:

[0149]

[0150] Assume that nodes v n and node v n+1 are connected in the path then the additional cost incurred by inserting node v c between these two nodes is not less than Therefore, this case can be used as the upper bound of:

[0151]

[0152] According to the triangle inequality, it can be known that:

[0153]

[0154] It can be known that the expectation of is:

[0155]

[0156] Similarly, for if node v n is inserted between adjacent nodes v and v c in the path c+1 assuming that nodes v n and v c are the nearest neighbors, then node v c+1 should be located in the region shown in Figure 3 The area shown in

[0157] By analyzing the region in Figure 3 it can be known that the additional cost incurred by inserting node v n between v c and v c+1 is:

[0158]

[0159] This cost also represents the upper bound of. Therefore the expectation of is:

[0160]

[0161] Thus, the goal of the proof evolves into proving that the following inequality holds:

[0162]

[0163] To prove that the above inequality holds, first, conduct a first-level classification discussion:

[0164]

[0165] Immediately afterwards, for each case, conduct a second-level and third-level classification discussion again:

[0166]

[0167] Through the above three-level classification discussion, a total of 1536 cases are generated, among which only 112 cases are proven not to satisfy the above inequality, and they all have the following constraints:

[0168]

[0169] Therefore, the probability that Theorem 2 holds is 92.7%, to support the conclusion - choosing convex hull points to construct a bridge is more cost-saving in terms of path in general cases. It is worth mentioning that, under the preconditions stipulated by Theorem 2, the probability that Theorem 2 holds being 92.7% holds in all experiments and has universality.

[0170] (4) Take the two endpoints of the connecting edge between adjacent subgraphs obtained in step (3) as the starting point and the ending point in the adjacent subgraphs respectively, and use the Quantum Optimal Path Search (QUOTA) algorithm to find the shortest Hamiltonian path in each subgraph.

[0171] It should be noted that in the current step (4), the QUOTA algorithm is used to find the shortest Hamiltonian path in all subgraphs. At the same time, the QUOTA algorithm is also used in step (3) to find the shortest Hamiltonian cycle containing all subgraphs. To enable the QUOTA algorithm to handle both situations simultaneously, the present invention proposes a new quantum coding method to encode the Hamiltonian cycle and the Hamiltonian path into the quantum circuit in a unified format, so as to ensure the unity and consistency of the QUOTA algorithm to the greatest extent while meeting all requirements. When finding the shortest Hamiltonian solution (whether it is a Hamiltonian cycle or a Hamiltonian path) of graph G, the main process of the QUOTA algorithm is as follows:

[0172] (4.1) Perform normalization on the adjacency cost matrix A in the input undirected complete weighted graph G to obtain the normalized cost matrix A norm .

[0173] Among them, the role of normalization is to convert all elements in the cost matrix into binary form, so that the cost can be represented by several qubits in the MCPS operator, avoiding errors caused by the inability to represent the decimal cost as binary. Specifically, the normalization process is as follows:

[0174] (4.1.1) Find the largest N elements in the cost matrix A, where N is the number of sub-paths that make up the Hamiltonian solution; and take the sum of these N elements as the normalization factor.

[0175] (4.1.2) Scale the normalization factor to the largest binary number less than 1. For example, in a quantum circuit, when using p qubits to store the cost of the candidate solution, scale the normalization factor to

[0176] (4.1.3) Normalize all other elements in the cost matrix A according to the above scaling ratio, so as to realize the construction of matrix A norm of the construction.

[0177] (4.2) Perform the initialization of the quantum circuit, construct the quantum register, and encode all candidate Hamiltonian solutions in the graph G into the quantum circuit in a new quantum encoding method.

[0178] Specifically, first describe the candidate Hamiltonian circuit and the candidate Hamiltonian path in the same mathematical way, and then encode them into the quantum circuit. Specifically, a candidate solution is represented by a unique sequence, which is defined by a permutation function σ(i), where σ(i) specifies the city visited by the traveling salesman at the i-th step. According to this sequence, the Hamiltonian circuit is represented as (σ(1), σ(2), …, σ(N)), and the Hamiltonian path is represented as (σ(1), σ(2), …, σ(N - 1)). This is because in the Hamiltonian circuit, the traveling salesman starts from the default starting city v1, arrives at the city σ(1) in the first step, then visits each city in turn, and finally returns to the city v1 in the N-th step to complete a closed circuit. While in the Hamiltonian path, there is no need to return to the starting point, so the sequence of the Hamiltonian path does not have σ(N).

[0179] Through this mathematical description method, the Hamiltonian path and the Hamiltonian circuit are represented by a unified permutation function σ(i). During the encoding process, organize the candidate solutions according to the steps of the traveling salesman. For example, in the first step of the traveling salesman, σ(1) has N possible options, that is, there are N possible target cities for the traveling salesman to choose, and use the superposition state of qubits to store them. All subsequent steps are encoded in the same way, so that the candidate solutions are stored in the quantum circuit according to the steps.

[0180] (4.3) Use a valid solution screening (VPS) quantum operator to find and label all candidate solutions that meet the Hamiltonian criteria, thereby realizing the judgment of the effectiveness of the Hamiltonian solution.

[0181] It should be noted that the VPS operator is used to screen valid Hamiltonian solutions. Specifically, during the process of encoding candidate solutions in step (4.2), some invalid solutions will be stored in the quantum circuit, such as v1→v1→v1. This solution does not meet the Hamiltonian criteria because the city v1 is visited multiple times. The role of the VPS operator is to judge the effectiveness of all candidate solutions and avoid interference from invalid solutions on the algorithm results.

[0182] During the implementation of the VPS operator, N quantum bits are set to represent the situation of N cities being visited. These N quantum bits correspond one-to-one with N cities and are all initialized to the state |0>. When in the i-th step, the traveling salesman visits the j-th city, then the corresponding j-th quantum bit is flipped. For example, the j-th quantum bit is set from the state |0> to the state |1>; or from the state |1> to the state |0>. Finally, the states of these N quantum bits are judged. According to the definition of the solution of the traveling salesman problem, if the states of these N quantum bits are all |1>, it means that the candidate solution being checked is valid; otherwise, if the states of these N quantum bits are not all |1>, it means that the candidate solution is invalid.

[0183] (4.4) Use a minimum Hamiltonian solution screening (MCPS) quantum operator to find and label all candidate solutions whose cost is less than the cost threshold t cost to realize the screening of better solutions.

[0184] It should be noted that the MCPS operator is used to judge whether the cost of the candidate solution is less than the threshold t cost . In the specific implementation process, the MCPS operator first calculates the sum of the costs of all sub-paths in the candidate solution through the quantum phase estimation (QPE) algorithm, and then uses a quantum comparator to judge the size relationship between this cost sum and the threshold t cost . Among them, the quantum phase estimation algorithm is used to determine the eigenvalue c of a certain matrix C under a given eigenvector , and its role is shown in the following formula:

[0185]

[0186] Replace the matrix C with the diagonal matrix composed of the costs c of the traveling salesman arriving at each city in the i-th step σ(i-1),σ(i) which is expressed as: as follows:

[0187]

[0188] Thus, through the quantum phase estimation algorithm, the cost c corresponding to a certain quantum state can be obtained. In each step, since there is no relationship between the diagonal matrices , they will not affect each other. Therefore, the quantum phase estimation algorithm can be executed for each step in the candidate solution, and the obtained eigenvalues (i.e., the costs of the paths traveled by the traveling salesman in each step) will be added up until the cost sum of the complete candidate solution is finally obtained.

[0189] (4.5) Use a diffusion quantum operator to amplify the probability amplitude of the marked candidate solution.

[0190] (4.6) Repeat steps (4.3) - (4.5) until the probability amplitude of the marked candidate solution is amplified to be close to 1, that is, the probability amplitude is amplified to 0.87 - 1.

[0191] (4.7) Perform a measurement operation on the quantum circuit to obtain the candidate solution with the highest probability.

[0192] (4.8) Decrease the cost threshold t cost to the cost of this new candidate solution.

[0193] (4.9) Repeat steps (4.2) - (4.8) until no shorter Hamiltonian solution is found.

[0194] (4.10) Consider the shortest Hamiltonian solution found in step (4.9) as the global optimal solution and output this solution as the final solution output by the QUOTA algorithm, which is the shortest Hamiltonian path or the shortest Hamiltonian cycle.

[0195] (5) Integrate the connection order of the subgraph obtained in step (3) and the shortest Hamiltonian paths of all subgraphs obtained in step (4) to obtain a Hamiltonian cycle for the entire undirected complete weighted graph G, which is the final solution to the traveling salesman problem.

[0196] It is worth mentioning that the embodiment of the present invention also provides a system for approximately solving the traveling salesman problem based on quantum computing to implement the method for approximately solving the traveling salesman problem based on quantum computing in the above embodiment. The system includes a data input module, a graph partitioning module, a subgraph problem planning module, a subgraph solving module, and a path merging module, as Figure 4As shown. These modules are all quantized, and several quantum algorithms contained therein run on a quantum computer; while the classical computer is responsible for implementing the following three tasks: ① Storage and use of data: including data such as graph data, the running results of quantum algorithms, and intermediate results of each module. ② Control of the framework process: including the transition of tasks between modules, the call of sub-processes, data transmission, the construction of quantum circuits, and interaction with the quantum computer. ③ Data analysis: including the analysis of the running results of quantum algorithms and the running results of sub-processes. By using different quantum algorithms to achieve different goals in different modules, it is coordinated to reduce errors and improve the approximation ratio of the finally obtained approximate solution.

[0197] In this embodiment, the data input module is used to obtain an undirected complete weighted graph G as the input data of the system, and the position of each node in the graph is calibrated using two-dimensional coordinates (x, y).

[0198] In this embodiment, the graph partitioning module is used to partition the undirected complete weighted graph G to divide the undirected complete weighted graph G into multiple clusters, so that the number of nodes in each cluster is less than or equal to the threshold t limit . Among them, t limit represents the number of nodes that can be directly solved for the shortest Hamiltonian solution by a quantum device and a quantum optimal path search algorithm under the existing limited quantum hardware conditions; one cluster is a subgraph.

[0199] In this embodiment, the subgraph problem planning module is used to determine the connection order of the subgraphs and the connection edges between adjacent subgraphs based on the multiple subgraphs obtained by the graph partitioning module, so as to prepare for the subsequent subgraph solving module and path merging module. That is, in this subgraph problem planning module, there are two sub-tasks to be completed: sub-task one is to determine the connection order of the subgraphs, and sub-task two is to determine the connection edges between adjacent subgraphs.

[0200] In this embodiment, the subgraph solving module is used to use the two endpoints of the connection edge between adjacent subgraphs obtained by the subgraph problem planning module as the starting point and the ending point in the adjacent subgraphs respectively, and use the quantum optimal path search (QUOTA) algorithm to find the shortest Hamiltonian path in each subgraph.

[0201] In this embodiment, the path merging module is used to integrate the connection order of the subgraphs obtained by the subgraph problem planning module and the shortest Hamiltonian paths of all subgraphs obtained by the subgraph solving module to obtain a Hamiltonian cycle for the entire undirected complete weighted graph G, that is, the final solution of the traveling salesman problem.

[0202] In summary, the system described in the present invention is composed of multiple modular quantum components, which respectively implement processes such as problem decomposition, sub-problem solving, and merging. The method described in the present invention proposes a quantum algorithm that can accurately solve the small-scale traveling salesman problem and is applied as the core algorithm to multiple quantum modules. By using a modular quantum framework, the quantum advantage is utilized to accelerate the solution of the traveling salesman problem, and the constraint of the quantum hardware device on the problem scale is eliminated, significantly reducing the required quantum resources, and enabling the use of existing quantum computers to solve large-scale traveling salesman problems. The method uses theorems as the theoretical basis to provide theoretical support for the feasibility of the framework. The core algorithm is used to accurately solve sub-problems, improving the stability and approximation ratio of the algorithm.

[0203] The method and system for approximately solving the traveling salesman problem based on quantum computing according to the present invention will be described in detail below with reference to the embodiments, and the objectives and effects of the present invention will become more obvious.

[0204] Embodiment 1

[0205] As Figure 4 shown, first, the system described in the present invention receives an undirected complete weighted graph G as the input data of the traveling salesman problem. Then, the graph partitioning module is executed in sequence to decompose the input large-scale traveling salesman problem into several sub-problems; the sub-graph problem planning module is executed to determine the connection order between sub-problems and the bridges connecting the connected sub-graphs; the sub-graph solving module is executed to solve the shortest Hamiltonian path in each sub-problem; the path merging module is executed to merge the results of the sub-graph problem planning module and the sub-graph solving module, and connect the solutions of the sub-problems in the determined order to form a solution for the undirected complete weighted graph G. Finally, this solution is output, which is the final approximate solution of the traveling salesman problem.

[0206] Throughout the process, the quantum computer is used to execute various quantum algorithms in each module, while the classical computer is used to execute operations such as process control, data storage, analysis, and processing. The quantum device and the classical device give full play to their respective advantages to jointly implement the overall process of the present invention.

[0207] Embodiment 2

[0208] As Figure 5 shown, the present invention will Figure 5The undirected complete weighted graph G shown is input into the system. In the graph partitioning module, graph G is partitioned into multiple subgraphs, and each subgraph is represented by a colored central point. Subsequently, the data is transmitted to the subgraph problem planning module. In this subgraph problem planning module, first, the connection order of each subgraph represented by the central point is determined, that is: in subtask one, a Hamiltonian circuit including all subgraphs is determined, and then the connected subgraphs are connected, that is: in subtask two, the unique bridge connecting the connected subgraphs and its endpoints are determined. Then, the data is transmitted to the subgraph solving module, which determines the node connection order in all subgraphs, that is, the shortest Hamiltonian path. Finally, in the path merging module, the node connection orders within the subgraphs are connected in the determined order to combine and obtain the final Hamiltonian circuit for all nodes.

[0209] Embodiment 3

[0210] Figure 6 The quantum circuit flowchart of the QUOTA algorithm of the present invention is given under the given cost threshold t cost In the quantum circuit, the QUOTA algorithm uses the quantum register |CS> to store all possible candidate solutions; uses the auxiliary quantum register |Anc> to assist in the implementation of quantum operators; uses the quantum register |R> to store the intermediate results of quantum operators. Among them, the quantum bit |R VPs > is used to save the calculation result of the VPS operator; the quantum bit |R MCPS > is used to save the calculation result of the MCPS operator; the quantum bit |R final > is used to save the final results of the above two operators.

[0211] After experiencing the initialization of the quantum state, the QUOTA algorithm successively executes the VPS operator and the MCPS operator, and saves the results into |R final >. In order to restore the initial state of the quantum register |Anc> for subsequent reuse, the QUOTA algorithm executes the inverse processes of the MCPS operator and the VPS operator (i.e., MCPS T and VPS T ). Then, the QUOTA algorithm executes the Diffusion operator to amplify the probability amplitudes of the candidate solutions marked by the VPS operator and the MCPS operator. After that, the QUOTA repeats the above operations (i.e., Figure 6 all the quantum operators enclosed by the dashed box), so that the probability amplitudes of the marked solutions reach the maximum, and a measurement operation is performed. The candidate solution with the highest measured probability is the better solution found by the QUOTA algorithm under the given cost threshold t cost .

[0212] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A method for approximately solving the Traveling Salesman Problem based on quantum computing, characterized in that, The steps include the following: (1) Obtain an undirected complete weighted graph G, and the positions of each node in the graph are calibrated using two-dimensional coordinates; (2) Partition the undirected complete weighted graph G to divide the undirected complete weighted graph G into multiple clusters such that the number of nodes in each cluster is less than or equal to the threshold t limit ; where a cluster is a subgraph (3) Based on the multiple subgraphs obtained after the division in step (2), determine the connection order of the subgraphs and the connection edges between adjacent subgraphs; (4) Take the two endpoints of the connection edges between adjacent subgraphs obtained in step (3) as the starting point and the ending point in the adjacent subgraphs respectively, and use the quantum optimal path search algorithm to find the shortest Hamiltonian path in each subgraph; (5) Integrate the connection order of the subgraphs obtained in step (3) and the shortest Hamiltonian paths of all subgraphs obtained in step (4) to obtain a Hamiltonian cycle for the entire undirected complete weighted graph G, that is, the final solution to the traveling salesman problem.

2. The method for approximately solving the traveling salesman problem based on quantum computing according to claim 1, wherein, The criterion for dividing the undirected complete weighted graph G is Theorem 1, and its specific content includes: Given an undirected complete weighted graph \(G\) and the number of subgraphs \(K\), when the \(K\) subgraphs \((G_1, G_2, \ldots, G i , \ldots, G K ) obtained after partitioning satisfy the following conditions, the approximate solution of the traveling salesman problem finally obtained has the minimum cost: where (G1, G2, …, G i , …, G K ) * represents the values of the independent variables (G1, G2, …, G corresponding to when the function i , …, G K ) obtains the minimum value, G i represents the i-th subgraph, and vol in (G i ) represents the sum of the costs of the paths between all internal nodes in the subgraph G i , c mn represents the cost of the path between the node v i and the node v m in the subgraph G n .

3. The method for approximately solving the traveling salesman problem based on quantum computing according to claim 1, wherein Step (2) includes the following sub-steps: (2.1) According to the distances between the nodes in the undirected complete weighted graph G, use the Q-means algorithm to divide the undirected complete weighted graph G into K subgraphs; where the Q-means algorithm is the quantum K-means algorithm; (2.2) Check the number of nodes in all subgraphs. For subgraphs with the number of nodes greater than the threshold t limit repeat step (2.1) until the number of nodes in all subgraphs is less than or equal to the threshold t limit ; (2.3) Calculate the average position of all nodes in each subgraph to obtain the center point of the corresponding subgraph, and represent the corresponding subgraph through the center point; where the average position of all nodes is obtained by calculating the average value of the x coordinates of all nodes and the average value of the y coordinates of all nodes.

4. The method for approximately solving the traveling salesman problem based on quantum computing according to claim 1, wherein, In step (3), to determine the connection order of the subgraphs, it specifically includes the following sub-steps: (3.1.1) Based on the multiple subgraphs obtained after the division in step (2), according to the distances between the central points of the subgraphs, the central points of the subgraphs are pairwise merged into a high-level central point by using the quantum agglomerative hierarchical clustering algorithm, so as to pairwise merge the subgraphs corresponding to the central points of the subgraphs into a high-level subgraph, gradually forming a hierarchical tree structure until the number of nodes in the high-level subgraph left after the merger is reduced to less than or equal to the threshold t limit ; (3.1.2) Use the quantum optimal path search algorithm to find the shortest Hamiltonian cycle containing the high-level center point in the corresponding high-level subgraph; (3.1.3) Execute the reverse process of step (3.1.1). According to the hierarchical tree structure obtained in step (3.1.1), hierarchically deconstruct the merged high-level subgraphs. Each time, decompose a high-level subgraph into two lower-level subgraphs until all high-level subgraphs are restored to the original subgraphs after the graph division; during this deconstruction process, use the two lower-level subgraphs after deconstruction to replace the position of the decomposed high-level subgraph in the shortest Hamiltonian cycle obtained in step (3.1.2) to obtain a complete Hamiltonian cycle for all original subgraphs.

5. The method for approximately solving the traveling salesman problem based on quantum computing according to claim 4, wherein, The quantum agglomerative hierarchical clustering algorithm specifically includes the following sub-steps: (3.1.1.1) Calculate the distances between the center points of each pair of subgraphs, and maintain a cost matrix for all subgraph center points; (3.1.1.2) Find the two subgraph center points with the closest distance, merge these two subgraph center points into a high-level center point, and at the same time, the corresponding two subgraphs are also merged into a high-level subgraph; (3.1.1.3) Update the cost matrix; (3.1.1.4) Repeat steps (3.1.1.2) - (3.1.1.3) until the number of nodes in the high-level subgraph is reduced to less than or equal to the threshold t limit .

6. The method for approximately solving the traveling salesman problem based on quantum computing according to claim 1, characterized in that In step (3), the determination of the connection edges between adjacent subgraphs is supported by Theorem 2, and its specific content includes: When selecting the connecting edges and the corresponding adjacent subgraphs G i and G i+1 to minimize the cost of the solution to the traveling salesman problem, in 92.7% of the cases, if the two endpoints of which belong to the convex hull point sets of the adjacent subgraphs G i and G i+1 respectively, then such a selection will result in a solution to the traveling salesman problem with a smaller cost than selecting non-convex hull nodes as endpoints.

7. The method for approximately solving the traveling salesman problem based on quantum computing according to claim 1, wherein In step (3), to determine the connection edges between adjacent subgraphs, it specifically includes the following sub-steps: (3.2.1) Use the quantum convex hull search algorithm to find the convex hull point sets in each subgraph, and use them as the candidate point sets for the two endpoints of the bridge respectively; where the bridge refers to the connection edge between adjacent subgraphs; (3.2.2) For two adjacent subgraphs, find the nodes that are closest in distance and belong to the convex hull point sets of the two adjacent subgraphs respectively as the endpoints of the bridge; (3.2.3) Repeat step (3.2.2) until the bridges of all adjacent subgraphs are determined.

8. The method for approximately solving the traveling salesman problem based on quantum computing according to claim 7, wherein The quantum convex hull search algorithm specifically includes the following sub-steps: (3.2.1.1) Search for subgraph G i Find the node v with the minimum y - coordinate value in st Include this node in the convex hull point set and use this node as the starting point to find the next convex hull point; (3.2.1.2) Construction basis vector vec base , basis vector vec base is a unit vector starting from v st and parallel to the X-axis; (3.2.1.3) Traverse the subgraph G i except for v st among the remaining nodes v next to construct a vector (3.2.1.4) Calculate the vector and the base vector vec base to find the included angle, and determine the node vv next corresponding to the minimum included angle as the next convex hull point v' next ; (3.2.1.5) Update v st to v' next , update the basis vector vec base to the unit vector in the connecting direction of the previous convex hull point and v' next ; (3.2.1.6) Repeat step (3.2.1.3) - step (3.2.1.5) until no new convex hull points are found.

9. The method for approximately solving the traveling salesman problem based on quantum computing according to claim 1, wherein The quantum optimal path search algorithm specifically includes the following sub-steps: (4.1) Perform normalization on the adjacency cost matrix A in the input undirected complete weighted graph G to obtain the normalized cost matrix A norm ; (4.2) Perform the initialization of the quantum circuit, construct quantum registers, and encode all candidate Hamiltonian solutions in graph G into the quantum circuit in a new quantum encoding manner; (4.3) Use an effective solution screening quantum operator to find and label all candidate solutions that meet the Hamiltonian criterion; (4.4) Use a shortest Hamiltonian solution to screen quantum operators, find and label all candidate solutions whose cost is less than the cost threshold t cost ; (4.5) Use a diffusion quantum operator to amplify the probability amplitude of the labeled candidate solutions; (4.6) Repeat steps (4.3) - (4.5) until the probability amplitude of the labeled candidate solutions is amplified to be close to 1; (4.7) Perform a measurement operation on the quantum circuit to obtain the candidate solution with the maximum probability; (4.8) Reduce the cost threshold t cost is the cost of this new candidate solution; (4.9) Repeat steps (4.2) - (4.8) until no shorter Hamiltonian solution is found; (4.10) Consider the shortest Hamiltonian solution found in step (4.9) as the global optimal solution and output this solution as the final solution output by the quantum optimal path search algorithm, which is the shortest Hamiltonian path or the shortest Hamiltonian cycle.

10. A system for implementing the method for approximately solving the traveling salesman problem based on quantum computing according to any one of claims 1-9, characterized in that, It includes: A data input module for obtaining an undirected complete weighted graph G, and the position of each node in the graph is calibrated using two-dimensional coordinates; A graph partitioning module, configured to partition an undirected complete weighted graph G to divide the undirected complete weighted graph G into multiple clusters, such that the number of nodes in each cluster is less than or equal to a threshold t limit ; where one cluster is a subgraph A subgraph problem planning module for determining the connection order of subgraphs and the connection edges between adjacent subgraphs based on the multiple subgraphs obtained by the graph partitioning module; A subgraph solution module for using the two endpoints of the connection edges between adjacent subgraphs obtained by the subgraph problem planning module as the starting point and the ending point in the adjacent subgraphs respectively, and using the quantum optimal path search algorithm to find the shortest Hamiltonian path in each subgraph; and A path merging module for integrating the connection order of the subgraphs obtained by the subgraph problem planning module and the shortest Hamiltonian paths of all subgraphs obtained by the subgraph solution module to obtain a Hamiltonian cycle for the entire undirected complete weighted graph G, which is the final solution to the traveling salesman problem.