A quantum computing method and apparatus, electronic device and storage medium

By dividing a large-scale undirected graph into sub-undirected graphs and iteratively solving and merging them, a quantum approximation optimization algorithm is used to solve the problem of limited application scope due to the limited resources of quantum computers, and to achieve an efficient solution to large-scale combinatorial optimization problems.

CN116306951BActive Publication Date: 2025-10-21JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310237325.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-06
Publication Date
2025-10-21
Estimated Expiration
2043-03-06

AI Technical Summary

Technical Problem

The limited resources of existing quantum computers restrict the application scope of quantum algorithms, especially in large-scale combinatorial optimization problems, where the number of qubits far exceeds the upper limit of existing quantum computers.

Method used

A large-scale undirected graph is divided into multiple sub-undirected graphs. A quantum computer is used to solve the local solutions of each sub-undirected graph. The global solution is obtained by merging the local solutions. A quantum approximation optimization algorithm is used to iteratively divide, solve, and merge the sub-undirected graphs until the number of sub-undirected graphs does not exceed the upper limit of qubits.

Benefits of technology

By using a quantum computer with a finite number of qubits, problems far exceeding the upper limit of qubits can be solved efficiently, realizing the solution of large-scale combinatorial optimization problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116306951B_ABST
    Figure CN116306951B_ABST
Patent Text Reader

Abstract

The present disclosure provides a quantum computing method and device, an electronic device and a storage medium, the method comprising: generating an initial undirected graph from a problem description, taking the initial undirected graph as a current undirected graph, in a case where a number of vertices of the current undirected graph exceeds a threshold, performing partitioning on the current undirected graph to obtain a plurality of current sub-undirected graphs; inputting each current sub-undirected graph into a quantum computer for solving to obtain a local solution of each current sub-undirected graph; merging the local solutions of the plurality of current sub-undirected graphs to generate a next-level undirected graph taking the merged current sub-undirected graph as a vertex; taking the next-level undirected graph as the current undirected graph, in a case where a number of vertices of the current undirected graph exceeds the threshold, continuing to perform partitioning, solving and merging, and in a case where a number of vertices of the current undirected graph does not exceed the threshold, obtaining a global solution of the current undirected graph through a quantum approximate optimization algorithm based on the local solutions of the current sub-undirected graphs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of quantum computing technology, and in particular to a quantum computing method and device, an electronic device, and a storage medium. Background Art

[0002] Quantum computers are about to enter the Noisy Intermediate-Scale Quantum (NISQ) phase, enabling them to solve some problems, including combinatorial optimization and machine learning. Current research in quantum computing focuses on how to efficiently and effectively use quantum computers to solve classical computing problems. Combinatorial optimization, a core issue in logistics, transportation, and financial investment, has long been widely studied. Quantum computing offers computational advantages in solving such problems that surpass traditional algorithms.

[0003] In the existing technology, taking the maximum cut problem as an example, for a graph with N vertices, the number of quantum bits required by the quantum algorithm is N. However, when the problem size increases to 10 3 The number of qubits required for quantum algorithms far exceeds the upper limit of existing quantum computers. As the computing resources required by quantum algorithms increase, the limited number of qubits in existing quantum computers greatly restricts the scope of application of quantum algorithms. Summary of the Invention

[0004] The present disclosure provides a quantum computing method and apparatus, an electronic device, and a storage medium to address the defect in the prior art that the limited resources of quantum computers restrict the application scope of quantum algorithms.

[0005] The present disclosure provides a quantum computing method, comprising:

[0006] An initial undirected graph is generated based on the problem description, and the initial undirected graph is used as the current undirected graph. When it is determined that the number of vertices in the current undirected graph exceeds a threshold, the following steps are performed:

[0007] Splitting: splitting the current undirected graph to obtain multiple current sub-undirected graphs;

[0008] Solving: Inputting each current sub-undirected graph into a quantum computer for solving, and obtaining a local solution of each current sub-undirected graph;

[0009] Merge: Merge the local solutions of the multiple current sub-undirected graphs to generate a next-level undirected graph with the merged current sub-undirected graphs as vertices;

[0010] Taking the next-level undirected graph as the current undirected graph, and if it is determined that the number of vertices of the current undirected graph exceeds a threshold, continuing to perform the steps of splitting, solving, and merging until it is determined that the number of vertices of the current undirected graph does not exceed the threshold, and obtaining a global solution of the current undirected graph based on the local solution of the current sub-undirected graph through a quantum approximate optimization algorithm;

[0011] The threshold is the upper limit of the quantum bit input into the quantum computer.

[0012] According to a quantum computing method provided by the present disclosure, the current undirected graph is split to obtain multiple current sub-undirected graphs, including:

[0013] The current undirected graph is divided to obtain a plurality of current sub-undirected graphs whose number of vertices reaches the set threshold, wherein the vertices of the current sub-undirected graphs are in a one-to-one correspondence with the vertices of the current undirected graph.

[0014] According to a quantum computing method provided by the present disclosure, each current sub-undirected graph is input into a quantum computer for solving, and a local solution of each current sub-undirected graph is obtained, including:

[0015] For each current sub-undirected graph, construct its target unitary transformation function, and build the corresponding quantum circuit based on the target unitary transformation function;

[0016] By measuring the function value of the target unitary transformation function, an output state of the quantum circuit is obtained according to the function value;

[0017] According to the output state of the quantum circuit, the optimal quantum output state for each output is calculated according to the target loss function of the predefined maximum cut problem;

[0018] The probability distribution of the optimal quantum output state is calculated, and the optimal quantum output state with the largest probability is used as the local solution of the current sub-undirected graph.

[0019] According to a quantum computing method provided by the present disclosure, a corresponding quantum circuit is constructed based on the target unitary transformation function, including:

[0020] Two target unitary transformation functions with adjustable parameters are placed alternately as circuit modules to build the corresponding quantum circuit.

[0021] According to a quantum computing method provided by the present disclosure, two target unitary transformation functions with adjustable parameters are alternately placed as circuit modules to build a corresponding quantum circuit, including:

[0022] U B (β p )U D (γ p )…U B(β1)U D (γ1)

[0023] Among them, U B (β) and U D (γ) are two different target unitary transformation functions;

[0024] H D is the first Hamiltonian;

[0025] H B is the second Hamiltonian;

[0026] β1~β p is the first variable parameter, γ1~γ p It is the second variable parameter.

[0027] According to a quantum computing method provided by the present disclosure, by measuring the function value of a target unitary transformation function, an output state of a quantum circuit is obtained according to the function value, including:

[0028]

[0029] Among them, U B (β) and U D (γ) are two different target unitary transformation functions;

[0030] H D is the first Hamiltonian;

[0031] H B is the second Hamiltonian;

[0032] β1~β p is the first variable parameter, γ1~γ p is the second variable parameter;

[0033] s is the initial state of the quantum circuit, n indicates that the output state is a value of n bits.

[0034] According to a quantum computing method provided by the present disclosure, the optimal quantum output state for each output is calculated based on a predefined target loss function of the maximum cut problem, including:

[0035]

[0036] Among them, Fp is the target loss function;

[0037] H D is the first Hamiltonian, H D =-∑ (u,v)∈E Zu Z v ;

[0038] Each clause corresponds to an edge (u,v) in the current sub-undirected graph, Z u and Z v A clause requires the values ​​of the two vertices connected by its corresponding edge;

[0039] Statistical probability distribution of the optimal quantum output state, including:

[0040]

[0041] is the first variable parameter, is the second variable parameter;

[0042] z is the probability of the optimal quantum output state.

[0043] According to a quantum computing method provided by the present disclosure, a plurality of local solutions of the current sub-undirected graphs are merged to generate a next-level undirected graph having the merged current sub-undirected graphs as vertices, including:

[0044] Merging the local solutions of the current sub-undirected graphs with opposite values ​​to obtain a merged local solution;

[0045] Each merged local solution is used as the corresponding vertex to generate a next-level undirected graph with the merged current sub-undirected graph as the vertex.

[0046] According to a quantum computing method provided by the present disclosure, based on the local solution of the current sub-undirected graph, a global solution of the current undirected graph is obtained by a quantum approximate optimization algorithm, including:

[0047] For the current undirected graph, construct its target unitary transformation function, and build the corresponding quantum circuit based on the target unitary transformation function;

[0048] By measuring the function value of the target unitary transformation function, an output state of the quantum circuit is obtained according to the function value;

[0049] According to the output state of the quantum circuit, the optimal quantum output state for each output is calculated according to the target loss function of the predefined maximum cut problem;

[0050] The probability distribution of the optimal quantum output state is calculated, and the optimal quantum output state with the largest probability is used as the global solution of the current undirected graph.

[0051] The present disclosure provides a quantum computing device, comprising:

[0052] An undirected graph generation module is used to generate an initial undirected graph from the problem description and use the initial undirected graph as the current undirected graph;

[0053] A splitting module is used to split the current undirected graph into multiple current sub-undirected graphs when it is determined that the number of vertices of the current undirected graph exceeds a threshold;

[0054] A solution module, configured to input each of the current sub-undirected graphs into a quantum computer for solution, to obtain a local solution of each of the current sub-undirected graphs;

[0055] a merging module, configured to merge the local solutions of the multiple current sub-undirected graphs to generate a next-level undirected graph having the merged current sub-undirected graphs as vertices;

[0056] Taking the next level undirected graph as the current undirected graph, and continuing to execute the segmentation module, the solution module and the merging module when it is determined that the number of vertices of the current undirected graph exceeds the threshold;

[0057] A global solution generation module is used to obtain a global solution of the current undirected graph through a quantum approximate optimization algorithm based on the local solution of the current sub-undirected graph, when it is determined that the number of vertices of the current undirected graph does not exceed a threshold; wherein the threshold is the upper limit of the quantum bits input to the quantum computer.

[0058] The present disclosure also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of any of the above-described quantum computing methods are implemented.

[0059] The present disclosure also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above-described quantum computing methods.

[0060] The quantum computing method and device provided by the present disclosure generate an initial undirected graph from a problem description, use the initial undirected graph as the current undirected graph, and when it is determined that the number of vertices of the current undirected graph exceeds a threshold, perform the steps of splitting, solving, and merging to obtain the merged current sub-undirected graph as the next-level undirected graph with the vertices. The steps of splitting, solving, and merging are repeated for the next-level undirected graph until it is determined that the number of vertices of the current undirected graph does not exceed the threshold. Based on the local solution of the current sub-undirected graph, a global solution of the current undirected graph is obtained through a quantum approximate optimization algorithm, thereby enabling a quantum computer with limited bits to solve problems whose scale far exceeds the quantum bit upper limit. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] In order to more clearly illustrate the technical solutions in the present disclosure or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0062] Figure 1 This is one of the flowcharts of the quantum computing method provided by the embodiment of the present disclosure;

[0063] Figure 2 is a schematic diagram of an undirected graph provided by an embodiment of the present disclosure;

[0064] Figure 3 This is the second flow chart of the quantum computing method provided by the embodiment of the present disclosure;

[0065] Figure 4 is a schematic diagram of a quantum circuit provided by an embodiment of the present disclosure;

[0066] Figure 5 This is the third flow chart of the quantum computing method provided by the embodiment of the present disclosure;

[0067] Figure 6 is one of the undirected graphs processed by the quantum computing method provided by the embodiments of the present disclosure;

[0068] Figure 7 This is the second undirected graph processed by the quantum computing method provided by the embodiment of the present disclosure;

[0069] Figure 8 This is the third undirected graph processed by the quantum computing method provided by the embodiment of the present disclosure;

[0070] Figure 9 is a flowchart of a quantum computing method provided by another embodiment of the present disclosure;

[0071] Figure 10 is a schematic structural diagram of a quantum computing device provided by an embodiment of the present disclosure;

[0072] Figure 11 It is a structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0073] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present disclosure without making any creative efforts shall fall within the scope of protection of the embodiments of the present disclosure.

[0074] The following combination Figures 1-11 The present invention describes a quantum computing method and apparatus, an electronic device, and a non-transitory computer-readable storage medium according to embodiments of the present invention.

[0075] The present disclosure provides a quantum computing method. Figure 1 , including the following steps 101 to 106:

[0076] Step 101: Generate an initial undirected graph from the problem description, and use the initial undirected graph as the current undirected graph.

[0077] In this embodiment, the problem description is based on the maximum cut problem, and an initial undirected graph is generated in a mathematical expression, for example, G(N, V), where V represents the number of edges in the initial undirected graph and N represents the number of vertices in the initial undirected graph.

[0078] See also Figure 2 , Figure 2 The format of an undirected graph is shown. The undirected graph includes 4 vertices, then N={0,1,2,3}, V={(0,1),(1,2),(2,3),(3,0)}.

[0079] Step 102, segmentation: when it is determined that the number of vertices of the current undirected graph exceeds a threshold, segment the current undirected graph to obtain a plurality of current sub-undirected graphs.

[0080] The threshold is the upper limit of the quantum bit input into the quantum computer.

[0081] Specifically, in this embodiment, the segmentation step includes: dividing the current undirected graph to obtain multiple current sub-undirected graphs whose number of vertices reaches the set threshold, wherein the vertices of the current sub-undirected graph are in a one-to-one correspondence with the vertices of the current undirected graph.

[0082] For example, if the current undirected graph includes 100 vertices and the quantum bit threshold of the quantum computer is 5, the current undirected graph needs to be split, and the number of vertices included in each sub-undirected graph after the split is at most 5. In one splitting method, the current undirected graph is split into 20 sub-undirected graphs.

[0083] Through the segmentation in step 102 , the size of each sub-undirected graph generated does not exceed a threshold value, so that each sub-undirected graph can be input into a quantum computer for solution in subsequent steps.

[0084] Step 103: Solving: Input each of the current sub-undirected graphs into a quantum computer for solving, and obtain a local solution of each of the current sub-undirected graphs.

[0085] In this embodiment, each current sub-undirected graph is converted into a maximum cut problem, and then each maximum cut problem is solved by a quantum approximate optimization algorithm to obtain a local solution for each current sub-undirected graph.

[0086] The process of converting an undirected graph into a maximum cut problem is to Figure 2 For example, assuming that the input graph G = (V, E) has n = |V| vertices and m = |E| edges, then we can describe the maximum cut problem as a combinatorial optimization problem of n bits and m clauses. Figure 2 There are 4 vertices and 4 edges in total. Each bit corresponds to Figure 2 A vertex v in the v is 0 or 1, corresponding to the vertex belonging to set S0 or S1, so each value of these n bits z corresponds to a cut. Each clause corresponds to Figure 1 For an edge (u, v) in , a clause requires that the values ​​of the two vertices connected by the corresponding edge are different, that is, z u ≠z v , indicating that the edge is cut. That is, when the two vertices connected by the edge are cut and divided into different sets, we say that the clause is satisfied. Therefore, for Figure 2 Each edge (u,v) in is realized by the following formula (1):

[0087] C (u,v) (z)=z u +z v -2z u z v (1)

[0088] Among them C (u,v) (z) = 1 if and only if the edge is cut. Otherwise, the function is equal to 0. The objective function of the entire combinatorial optimization problem is shown in the following formula (2):

[0089] C(z)=∑ (u,v)∈E C (u,v) (z)=∑ (u,v)∈E z u +z v -2z u z v (2)

[0090] Therefore, solving the maximum cut problem is to find a value z that maximizes the objective function in formula (2).

[0091] In order to transform the maximum cut problem into a quantum problem, we need to use n quantum bits, each of which corresponds to Figure 2 A vertex in . A qubit is in the quantum state |0> or |1>, indicating that its corresponding vertex belongs to the set S0 or S1. It is worth noting that |0> and |1> are the two eigenstates of the Pauli Z gate, and their eigenvalues ​​are 1 and -1, respectively, as shown in the following equations (3) and (4):

[0092] Z|0>=|0> (3)

[0093] Z|1>=-|1> (4)

[0094] Therefore, we can use the Pauli Z gate to construct the Hamiltonian H for the maximum cut problem C Because -1 can be mapped to 0 and 1 can still be mapped to 1 by mapping f(x):x→(x+1) / 2, we can replace z in equation (2) with (Z+I) / 2 (I is the identity matrix) to obtain the Hamiltonian corresponding to the objective function of the original problem, see the following equation (5):

[0095]

[0096]

[0097] The expectation value of the Hamiltonian with respect to a quantum state |ψ> is given by the following equation (6):

[0098] <ψ|H C |ψ>=<ψ|∑ (u,v)∈E (IZ u Z v ) / 2|ψ>

[0099] =<ψ|∑ (u,v)∈E (I / 2)|ψ>-<ψ|∑ (u,v)∈E Z u Z v / 2|ψ>

[0100] =|E| / 2-<ψ|∑ (u,v)∈E Z u Z v |ψ> / 2 (6)

[0101] If we denote the first Hamiltonian H D is the following formula (7):

[0102] H D =-∑ (u,v)∈E Zu Z v (7)

[0103] Then find the quantum state |ψ> such that <ψ|H C |ψ> is equivalent to finding a quantum state |ψ> such that <ψ|H D |ψ>maximum.

[0104] Figure 2 In the first Hamiltonian H D is the following formula (8):

[0105] H D =-Z0Z1-Z1Z2-Z2Z3-Z3Z0 (8)

[0106] Step 104: Merge: Merge the local solutions of the multiple current sub-undirected graphs to generate a next-level undirected graph with the merged current sub-undirected graphs as vertices.

[0107] Specifically, in this embodiment, step 104 includes:

[0108] S141 , merging the local solutions of the current sub-undirected graphs that are opposite in value to obtain a merged local solution.

[0109] S142. Use each merged local solution as a corresponding vertex to generate a next-level undirected graph with the merged current sub-undirected graph as a vertex.

[0110] It should be noted that due to Z2 symmetry, when merging local solutions, each solution can be selected either as itself or as its negation. Z2 symmetry refers to the algebraic property that all flips of a binary string remain unchanged. For example, the maximum cut value (maxcut) obtained for the binary strings 0110 and 1001 is the same; for another example, the maximum cut value (maxcut) obtained for the binary strings 0000 and 1111 is the same. Therefore, it is necessary to merge local solutions of the current sub-undirected graph that have opposite values.

[0111] For example, if the current undirected graph includes 100 vertices and the quantum computer's qubit threshold is 5, the current undirected graph is split into 20 sub-undirected graphs in the aforementioned step. Then, in step 104, the 20 sub-undirected graphs are used as the corresponding 20 vertices to generate the next level of undirected graph.

[0112] Step 105 : Take the next level undirected graph as the current undirected graph. If it is determined that the number of vertices of the current undirected graph exceeds the threshold, continue to execute step 102 ; if it is determined that the number of vertices of the current undirected graph does not exceed the threshold, execute step 106 .

[0113] Taking the next-level undirected graph with 20 vertices generated by the above steps as an example, in the next cycle of splitting, solving and merging, it is split into 4 next-level sub-undirected graphs, each of which is locally solved, and the 4 next-level sub-undirected graphs are used as the corresponding 4 vertices to generate a next-level undirected graph.

[0114] Step 106: When it is determined that the number of vertices of the current undirected graph does not exceed a threshold, a global solution of the current undirected graph is obtained by a quantum approximate optimization algorithm based on the local solution of the current sub-undirected graph.

[0115] In step 106 , the process of solving the global solution of the current undirected graph is consistent with the process of solving the local solution of each current sub-undirected graph by using the quantum approximate optimization algorithm in the aforementioned step 103 .

[0116] It should be noted that in each partition, the correspondence between the vertices in the sub-undirected graph and the vertices in the initial undirected graph needs to be preserved, so that in the process of continuous iterative partitioning and merging, the corresponding global solution can eventually be obtained based on the local solution of the partitioned sub-undirected graph.

[0117] The quantum computing method provided by the embodiment of the present disclosure generates an initial undirected graph according to a problem description, uses the initial undirected graph as the current undirected graph, and when it is determined that the number of vertices of the current undirected graph exceeds a threshold, performs the steps of splitting, solving and merging to obtain the merged current sub-undirected graph as the next-level undirected graph with the vertices. The steps of splitting, solving and merging are repeated for the next-level undirected graph until it is determined that the number of vertices of the current undirected graph does not exceed the threshold. Based on the local solution of the current sub-undirected graph, a global solution of the current undirected graph is obtained through a quantum approximate optimization algorithm, thereby achieving the goal of solving problems whose scale far exceeds the quantum bit upper limit by using a quantum computer with limited bits.

[0118] Further, see Figure 3 The method for solving the local solution of each current sub-undirected graph in step 103 of the embodiment of the present disclosure is obtained by a quantum approximate optimization algorithm, and specifically includes the following steps 301 to 304:

[0119] Step 301: For each current sub-undirected graph, construct its target unitary transformation function, and build a corresponding quantum circuit based on the target unitary transformation function.

[0120] Specifically, in this embodiment, two target unitary transformation functions with adjustable parameters are alternately placed as circuit modules to build a corresponding quantum circuit.

[0121] For quantum approximate optimization algorithms, quantum circuits are generally used to solve them. Specifically, it is necessary to transform the two parameter-adjustable target unitary transformation functions U D (γ) and U B(β) are placed alternately as circuit modules to build the corresponding quantum circuit.

[0122] Specifically, the constructed quantum circuit includes the following formula (9):

[0123] U B (β p )U D (γ p )…U B (β1)U D (γ1)(9)

[0124] Among them, U B (β) and U D (γ) are two different target unitary transformation functions;

[0125] H D is the first Hamiltonian;

[0126] H B is the second Hamiltonian;

[0127] β1~β p is the first variable parameter, γ1~γ p It is the second variable parameter.

[0128] The integer p represents the U used C 、U B The number of layers, that is, U C and U B Acting alternately on the initial state |s> p times. In this embodiment, a layer of unitary transformation U is realized. B (β)U D The quantum circuit of (γ) is as follows Figure 4 As shown. Among them, R z (γ') is U D (γ) circuit implementation, R x (β') is U B Circuit implementation of (β).

[0129] Step 302: Measure the function value of the target unitary transformation function and obtain the output state of the quantum circuit according to the function value.

[0130] Specifically, step 302 is implemented by the following formula (10):

[0131]

[0132] Among them, U B (β) and U D (γ) are two different target unitary transformation functions;

[0133] H D is the first Hamiltonian;

[0134] H B is the second Hamiltonian;

[0135] β1~β p is the first variable parameter, γ1~γ p is the second variable parameter;

[0136] s is the initial state of the quantum circuit, n means the output state is a value of n bits;

[0137] The integer p represents the U used C 、U B The number of layers, that is, U C and U B Alternately act on the initial state |s> p times.

[0138] Step 303: According to the output state of the quantum circuit and the target loss function of the predefined maximum cut problem, the optimal quantum output state for each output is calculated.

[0139] Specifically, the objective loss function in step 303 is implemented by the following formula (11):

[0140]

[0141] Among them, F p is the target loss function;

[0142] H D is the first Hamiltonian, H D =-∑ (u,v)∈E Z u Z v ;

[0143] Each clause corresponds to an edge (u,v) in the current sub-undirected graph, Z u and Z v A clause requires the values ​​of the two vertices connected by its corresponding edge.

[0144] Maximizing the objective function is equivalent to minimizing -Fp. Therefore, in this embodiment, we define is the loss function, that is, the function to be minimized, and then the optimal parameters are found using the classic optimization algorithm

[0145] Step 304: Calculate the probability distribution of the optimal quantum output state, and use the optimal quantum output state with the highest probability as the local solution of the current sub-undirected graph.

[0146] When the minimum value of the loss function and the corresponding set of parameters are obtained After that, the task is not yet completed. In order to further obtain the approximate solution of the Max-Cut problem, it is necessary to obtain the output quantum state The answer to the classic optimization problem can be decoded from . Physically, decoding the quantum state requires measuring the quantum state and then statistically analyzing the probability distribution of the measurement results:

[0147] Specifically, the probability distribution of the statistically optimal quantum output state is given by the following formula (12):

[0148]

[0149] is the first variable parameter, is the second variable parameter;

[0150] z is the probability of the optimal quantum output state.

[0151] Generally speaking, the greater the probability of a bit string appearing, the greater the possibility that it corresponds to the optimal quantum output state of the maximum cut problem.

[0152] For example, for an undirected graph containing 4 vertices, the final optimal quantum output state is 0101. It is noted that the vertices with corresponding bit values ​​of 0 in the bit string belong to set S0 and the vertices with corresponding bit values ​​of 1 belong to set S1. The edge between these two vertex sets is a possible maximum cut solution for the undirected graph.

[0153] See also Figure 5 In the embodiment of the present disclosure, obtaining a global solution of the current undirected graph by using a quantum approximate optimization algorithm in step 106 includes:

[0154] Step 501: For the current undirected graph, construct its target unitary transformation function, and build a corresponding quantum circuit based on the target unitary transformation function.

[0155] Step 502: Measure the function value of the target unitary transformation function and obtain the output state of the quantum circuit according to the function value.

[0156] Step 503: According to the output state of the quantum circuit and the target loss function of the predefined maximum cut problem, the optimal quantum output state for each output is calculated.

[0157] Step 504: Calculate the probability distribution of the optimal quantum output state, and use the optimal quantum output state with the highest probability as the global solution of the current undirected graph.

[0158] It should be noted that the process of steps 501-504 is similar to the process of steps 301-304 described above, and the specific calculation process will not be repeated in this embodiment. The difference is that steps 501-504 process the current undirected graph and ultimately obtain a global solution, while steps 301-304 process the current sub-undirected graph and ultimately obtain a local solution.

[0159] In order to facilitate the understanding of the technical solutions of the embodiments of the present disclosure, the embodiments of the present disclosure are Figures 6 to 8 Provide a schematic description.

[0160] See also Figure 6 , the initial undirected graph corresponding to the problem description includes 8 vertices, and it is assumed that the maximum quantum bit of the quantum computer is 4.

[0161] See also Figure 9 , the quantum computing method of the embodiment of the present disclosure includes:

[0162] 901. Generate an initial undirected graph based on the problem description, and use the initial undirected graph as the current undirected graph.

[0163] 902. Determine whether the number of vertices of the current undirected graph exceeds a threshold. If so, execute step 903; if not, directly output the global solution of the current undirected graph.

[0164] 903. Split the current undirected graph to obtain multiple current sub-undirected graphs.

[0165] In this embodiment, by splitting the initial undirected graph, two current sub-undirected graphs are obtained: sub-undirected graph a consisting of vertices 1, 2, 7 and 8, and sub-undirected graph b consisting of vertices 3, 4, 5 and 6.

[0166] 904. Input each of the current sub-undirected graphs into a quantum computer for solving, and obtain a local solution of each of the current sub-undirected graphs according to a quantum approximate optimization algorithm.

[0167] like Figure 7 As shown in the figure, according to the quantum approximate optimization algorithm, the local solution of sub-undirected graph a is 1010, that is, vertices 1 and 7 are a group, and vertices 2 and 8 are a group; the local solution of sub-undirected graph b is 0101, that is, vertices 3 and 5 are a group, and vertices 4 and 6 are a group.

[0168] From a geometric perspective, the above grouping can maximize the sum of the number of edges connecting the four groups of vertices in the undirected graph to be grouped.

[0169] 905. Merge the local solutions of the multiple current sub-undirected graphs to generate a next-level undirected graph with the merged current sub-undirected graphs as vertices.

[0170] See also Figure 8 , Figure 8 The next level undirected graph includes 4 vertices, corresponding to the local solution composed of vertices 1 and 7, the local solution composed of vertices 2 and 8, the local solution composed of vertices 3 and 5, and the local solution composed of vertices 4 and 6.

[0171] 906. Take the next level undirected graph as the current undirected graph, and determine whether the number of vertices of the current undirected graph exceeds a threshold. If so, return to step 903; if not, execute step 907.

[0172] In this embodiment, Figure 8 If the number of vertices in is 4 and does not exceed the threshold, there is no need to split the next level of sub-undirected graph, and step 907 is directly executed.

[0173] 907. Based on the local solution of the current sub-undirected graph, the global solution of the current undirected graph is obtained through the quantum approximate optimization algorithm.

[0174] Finally, the global solution obtained is 1010, that is, vertices 1, 7, 4 and 6 and vertices 2, 8, 3 and 5 are the optimal global solutions to the corresponding maximum cut problem.

[0175] The following describes a quantum computing device provided by an embodiment of the present disclosure. The quantum computing device described below and the quantum computing method described above can be referenced to each other.

[0176] The present disclosure provides a quantum computing device. Figure 10 ,include:

[0177] An undirected graph generation module 1001 is used to generate an initial undirected graph from the problem description, and use the initial undirected graph as the current undirected graph;

[0178] A splitting module 1002 is configured to split the current undirected graph into multiple current sub-undirected graphs when it is determined that the number of vertices of the current undirected graph exceeds a threshold.

[0179] A solution module 1003 is configured to input each current sub-undirected graph into a quantum computer for solution, thereby obtaining a local solution for each current sub-undirected graph;

[0180] A merging module 1004 is configured to merge the local solutions of the multiple current sub-undirected graphs to generate a next-level undirected graph having the merged current sub-undirected graphs as vertices;

[0181] An iterative module 1005 is configured to use the next level undirected graph as the current undirected graph, and if it is determined that the number of vertices in the current undirected graph exceeds a threshold, continue to execute the segmentation module 1002, the solution module 1003, and the merging module 1004;

[0182] The global solution generation module 1006 is used to obtain the global solution of the current undirected graph through a quantum approximate optimization algorithm based on the local solution of the current sub-undirected graph when it is determined that the number of vertices of the current undirected graph does not exceed a threshold value; wherein the threshold value is the upper limit of the quantum bits input to the quantum computer.

[0183] Optionally, the segmentation module 1002 is specifically used to: divide the current undirected graph to obtain multiple current sub-undirected graphs whose number of vertices reaches the set threshold, wherein the vertices of the current sub-undirected graphs are in a one-to-one correspondence with the vertices of the current undirected graph.

[0184] Optionally, the solution module 1003 includes:

[0185] A preprocessing unit, configured to construct a target unitary transformation function for each current sub-undirected graph, and to build a corresponding quantum circuit based on the target unitary transformation function;

[0186] an output state determination unit, configured to obtain an output state of the quantum circuit according to a function value of a target unitary transformation function by measuring the function value;

[0187] a loss calculation unit, configured to calculate an optimal quantum output state for each output according to the output state of the quantum circuit and a predefined target loss function of the maximum cut problem;

[0188] The local solution determination unit is used to calculate the probability distribution of the optimal quantum output state and take the optimal quantum output state with the largest probability as the local solution of the current sub-undirected graph.

[0189] Optionally, the preprocessing unit is specifically configured to:

[0190] Two target unitary transformation functions with adjustable parameters are placed alternately as circuit modules to build the corresponding quantum circuit.

[0191] Optionally, the preprocessing unit is specifically configured to:

[0192] U B (β p )U D (γ p )…U B (β1)U D (γ1)

[0193] Among them, U B (β) and U D (γ) are two different target unitary transformation functions;

[0194] H D is the first Hamiltonian;

[0195] H B is the second Hamiltonian;

[0196] β1~β p is the first variable parameter, γ1~γ p It is the second variable parameter.

[0197] Optionally, the output state determining unit is specifically configured to:

[0198]

[0199] Among them, U B (β) and U D (γ) are two different target unitary transformation functions;

[0200] H D is the first Hamiltonian;

[0201] H B is the second Hamiltonian;

[0202] β1~β p is the first variable parameter, γ1~γ p is the second variable parameter;

[0203] s is the initial state of the quantum circuit, n indicates that the output state is a value of n bits.

[0204] Optionally, the loss calculation unit is specifically configured to:

[0205]

[0206] Among them, Fp is the target loss function;

[0207] H D is the first Hamiltonian, H D =-∑ (u,v)∈E Z u Z v ;

[0208] Each clause corresponds to an edge (u,v) in the current sub-undirected graph, Z u and Z v A clause requires the values ​​of the two vertices connected by its corresponding edge;

[0209] The local solution determination unit is specifically configured to:

[0210]

[0211] is the first variable parameter, is the second variable parameter;

[0212] z is the probability of the optimal quantum output state.

[0213] Optionally, the merging module 1004 is specifically configured to:

[0214] Merging the local solutions of the current sub-undirected graphs with opposite values ​​to obtain a merged local solution;

[0215] Each merged local solution is used as the corresponding vertex to generate a next-level undirected graph with the merged current sub-undirected graph as the vertex.

[0216] Optionally, the global solution generating module 1006 is specifically configured to:

[0217] For the current undirected graph, construct its target unitary transformation function, and build the corresponding quantum circuit based on the target unitary transformation function;

[0218] By measuring the function value of the target unitary transformation function, an output state of the quantum circuit is obtained according to the function value;

[0219] According to the output state of the quantum circuit, the optimal quantum output state for each output is calculated according to the target loss function of the predefined maximum cut problem;

[0220] The probability distribution of the optimal quantum output state is calculated, and the optimal quantum output state with the largest probability is used as the global solution of the current undirected graph.

[0221] The quantum computing device provided by the present disclosure generates an initial undirected graph based on a problem description, uses the initial undirected graph as the current undirected graph, and when it is determined that the number of vertices of the current undirected graph exceeds a threshold, performs the steps of splitting, solving, and merging to obtain the merged current sub-undirected graph as the next-level undirected graph with the vertices. The steps of splitting, solving, and merging are repeated for the next-level undirected graph until it is determined that the number of vertices of the current undirected graph does not exceed the threshold. Based on the local solution of the current sub-undirected graph, a global solution of the current undirected graph is obtained through a quantum approximate optimization algorithm, thereby enabling a quantum computer with limited bits to solve problems whose scale far exceeds the quantum bit upper limit.

[0222] Figure 11 An example of a physical structure diagram of an electronic device is shown below. Figure 11As shown, the electronic device may include: a processor 1110, a communication interface 1120, a memory 1130, and a communication bus 1140, wherein the processor 1110, the communication interface 1120, and the memory 1130 communicate with each other via the communication bus 1140. The processor 1110 may call logic instructions in the memory 1130 to execute a quantum computing method, which includes: generating an initial undirected graph from a problem description, using the initial undirected graph as a current undirected graph, and executing the following steps when it is determined that the number of vertices in the current undirected graph exceeds a threshold:

[0223] Splitting: splitting the current undirected graph to obtain multiple current sub-undirected graphs;

[0224] Solving: Inputting each current sub-undirected graph into a quantum computer for solving, and obtaining a local solution of each current sub-undirected graph;

[0225] Merge: Merge the local solutions of the multiple current sub-undirected graphs to generate a next-level undirected graph with the merged current sub-undirected graphs as vertices;

[0226] Taking the next-level undirected graph as the current undirected graph, and if it is determined that the number of vertices of the current undirected graph exceeds a threshold, continuing to perform the steps of splitting, solving, and merging until it is determined that the number of vertices of the current undirected graph does not exceed the threshold, and obtaining a global solution of the current undirected graph based on the local solution of the current sub-undirected graph through a quantum approximate optimization algorithm;

[0227] The threshold is the upper limit of the quantum bit input into the quantum computer.

[0228] In addition, the logic instructions in the above-mentioned memory 1130 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the embodiment of the present disclosure is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0229] On the other hand, the present disclosure further provides a computer program product, comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions. When the program instructions are executed by a computer, the computer is capable of performing the quantum computing method provided by the above methods, the method comprising: generating an initial undirected graph from a problem description, using the initial undirected graph as a current undirected graph, and, upon determining that the number of vertices in the current undirected graph exceeds a threshold, performing the following steps:

[0230] Splitting: splitting the current undirected graph to obtain multiple current sub-undirected graphs;

[0231] Solving: Inputting each current sub-undirected graph into a quantum computer for solving, and obtaining a local solution of each current sub-undirected graph;

[0232] Merge: Merge the local solutions of the multiple current sub-undirected graphs to generate a next-level undirected graph with the merged current sub-undirected graphs as vertices;

[0233] Taking the next-level undirected graph as the current undirected graph, and if it is determined that the number of vertices of the current undirected graph exceeds a threshold, continuing to perform the steps of splitting, solving, and merging until it is determined that the number of vertices of the current undirected graph does not exceed the threshold, and obtaining a global solution of the current undirected graph based on the local solution of the current sub-undirected graph through a quantum approximate optimization algorithm;

[0234] The threshold is the upper limit of the quantum bit input into the quantum computer.

[0235] In yet another aspect, the present disclosure further provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program is implemented to perform the aforementioned quantum computing methods, the method comprising: generating an initial undirected graph from a problem description, using the initial undirected graph as a current undirected graph, and upon determining that the number of vertices in the current undirected graph exceeds a threshold, performing the following steps:

[0236] Splitting: splitting the current undirected graph to obtain multiple current sub-undirected graphs;

[0237] Solving: Inputting each current sub-undirected graph into a quantum computer for solving, and obtaining a local solution of each current sub-undirected graph;

[0238] Merge: Merge the local solutions of the multiple current sub-undirected graphs to generate a next-level undirected graph with the merged current sub-undirected graphs as vertices;

[0239] Taking the next-level undirected graph as the current undirected graph, and if it is determined that the number of vertices of the current undirected graph exceeds a threshold, continuing to perform the steps of splitting, solving, and merging until it is determined that the number of vertices of the current undirected graph does not exceed the threshold, and obtaining a global solution of the current undirected graph based on the local solution of the current sub-undirected graph through a quantum approximate optimization algorithm;

[0240] The threshold is the upper limit of the quantum bit input into the quantum computer.

[0241] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0242] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.

[0243] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present disclosure.

Claims

1. A quantum computing method, characterized in that: include: An initial undirected graph is generated based on the problem description, and the initial undirected graph is used as the current undirected graph. When it is determined that the number of vertices in the current undirected graph exceeds a threshold, the following steps are performed: Splitting: splitting the current undirected graph to obtain multiple current sub-undirected graphs; Solving: Inputting each current sub-undirected graph into a quantum computer for solving, and obtaining a local solution of each current sub-undirected graph; Merge: Merge the local solutions of the multiple current sub-undirected graphs to generate a next-level undirected graph with the merged current sub-undirected graphs as vertices; Taking the next-level undirected graph as the current undirected graph, and if it is determined that the number of vertices of the current undirected graph exceeds a threshold, continuing to perform the steps of splitting, solving, and merging until it is determined that the number of vertices of the current undirected graph does not exceed the threshold, and obtaining a global solution of the current undirected graph based on the local solution of the current sub-undirected graph through a quantum approximate optimization algorithm; Wherein, the threshold is the upper limit of the quantum bit input to the quantum computer; The current undirected graph is split to obtain multiple current sub-undirected graphs, including: Dividing the current undirected graph to obtain a plurality of current sub-undirected graphs whose number of vertices reaches the set threshold, wherein the vertices of the current sub-undirected graphs are in a one-to-one correspondence with the vertices of the current undirected graph; Merge multiple local solutions of the current sub-undirected graphs to generate a next-level undirected graph with the merged current sub-undirected graph as a vertex, including: merging the local solutions of the current sub-undirected graphs with opposite values ​​to obtain a merged local solution; and using each merged local solution as a corresponding vertex to generate a next-level undirected graph with the merged current sub-undirected graph as a vertex.

2. The quantum computing method according to claim 1, characterized in that Inputting each current sub-undirected graph into a quantum computer for solving, and obtaining a local solution of each current sub-undirected graph, including: For each current sub-undirected graph, construct its target unitary transformation function, and build the corresponding quantum circuit based on the target unitary transformation function; By measuring the function value of the target unitary transformation function, an output state of the quantum circuit is obtained according to the function value; According to the output state of the quantum circuit, the optimal quantum output state for each output is calculated according to the target loss function of the predefined maximum cut problem; The probability distribution of the optimal quantum output state is calculated, and the optimal quantum output state with the largest probability is used as the local solution of the current sub-undirected graph.

3. The quantum computing method according to claim 2, characterized in that Building a corresponding quantum circuit based on the target unitary transformation function includes: Two target unitary transformation functions with adjustable parameters are placed alternately as circuit modules to build the corresponding quantum circuit.

4. The quantum computing method according to claim 3, characterized in that The two parameter-adjustable target unitary transformation functions are placed alternately as circuit modules to build the corresponding quantum circuit, including: U B (b p )U D (c p )…U B (β1)U D (c1) Among them, U B (β) and U D (γ) are two different target unitary transformation functions; U D (γ)=e -iγHD , H D is the first Hamiltonian; U B (β)=e -iβHB , H B is the second Hamiltonian; β1~β p is the first variable parameter, γ1~γ p It is the second variable parameter.

5. The quantum computing method according to claim 4, characterized in that By measuring the function value of the target unitary transformation function, an output state of the quantum circuit is obtained according to the function value, including: Among them, U B (β) and U D (γ) are two different target unitary transformation functions; U D (γ)=e -iγHD , H D is the first Hamiltonian; U B (β)=e -iβHB , H B is the second Hamiltonian; β1~β p is the first variable parameter, γ1~γ p is the second variable parameter; s is the initial state of the quantum circuit, n indicates that the output state is a value of n bits.

6. The quantum computing method according to claim 2, characterized in that According to the predefined objective loss function of the maximum cut problem, the optimal quantum output state for each output is calculated, including: Among them, Fp is the target loss function; H D is the first Hamiltonian, H D =-∑ (u,v)∈E Z u Z v ; Each clause corresponds to an edge (u,v) in the current sub-undirected graph, Z u and Z v A clause requires the values ​​of the two vertices connected by its corresponding edge; Statistical probability distribution of the optimal quantum output state, including: is the first variable parameter, is the second variable parameter; z is the probability of the optimal quantum output state.

7. The quantum computing method according to claim 1, characterized in that Based on the local solution of the current sub-undirected graph, the global solution of the current undirected graph is obtained through the quantum approximate optimization algorithm, including: For the current undirected graph, construct its target unitary transformation function, and build the corresponding quantum circuit based on the target unitary transformation function; By measuring the function value of the target unitary transformation function, an output state of the quantum circuit is obtained according to the function value; According to the output state of the quantum circuit, the optimal quantum output state for each output is calculated according to the target loss function of the predefined maximum cut problem; The probability distribution of the optimal quantum output state is calculated, and the optimal quantum output state with the largest probability is used as the global solution of the current undirected graph.

8. A quantum computing device, characterized in that include: An undirected graph generation module is used to generate an initial undirected graph from the problem description and use the initial undirected graph as the current undirected graph; A splitting module is used to split the current undirected graph into multiple current sub-undirected graphs when it is determined that the number of vertices of the current undirected graph exceeds a threshold; A solution module, configured to input each of the current sub-undirected graphs into a quantum computer for solution, to obtain a local solution of each of the current sub-undirected graphs; a merging module, configured to merge the local solutions of the multiple current sub-undirected graphs to generate a next-level undirected graph having the merged current sub-undirected graphs as vertices; Taking the next level undirected graph as the current undirected graph, and continuing to execute the segmentation module, the solution module and the merging module when it is determined that the number of vertices of the current undirected graph exceeds the threshold; A global solution generation module is configured to obtain a global solution of the current undirected graph using a quantum approximate optimization algorithm based on the local solution of the current sub-undirected graph, provided that the number of vertices of the current undirected graph does not exceed a threshold value; wherein the threshold value is the upper limit of the quantum bits input to the quantum computer; The segmentation module is specifically configured to: partition the current undirected graph to obtain a plurality of current sub-undirected graphs whose number of vertices reaches the set threshold, wherein the vertices of the current sub-undirected graphs are in a one-to-one correspondence with the vertices of the current undirected graph; The merging module is specifically used to: merge the local solutions of the current sub-undirected graphs with opposite values ​​to obtain a merged local solution; use each merged local solution as a corresponding vertex to generate a next-level undirected graph with the merged current sub-undirected graph as a vertex.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the quantum computing method according to any one of claims 1 to 7 are implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the quantum computing method according to any one of claims 1 to 7 are implemented.