Access path determination method and device, storage medium and quantum computing equipment
Through distributed VQE algorithm and parameterized quantum circuits, Hamiltonian of the cost function is split, and quantum entanglement and parallel search are used to solve the problem of high computational complexity in large-scale combination optimization problems, achieving fast and accurate optimization Path determination.
Patent Information
- Application Number
- CN202411414519.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-01-10
AI Technical Summary
In the field of combinatorial optimization, existing precise algorithms have high computational complexity when solving large-scale problems, making it difficult to find the optimal solution within a given time, especially because the solution space increases exponentially with the number of elements, resulting in computing resources and time Too much consumption.
Using distributed VQE algorithm and parameterized quantum circuit, the Hamiltonian of the cost function is constructed and split into sub-Hamiltonians. Quantum entanglement and parallel search are used, and distributed computing is combined to reduce the number of parameters to be optimized and improve the convergence speed. .
It realizes the rapid and accurate determination of the optimal access path of each node, reduces the computational complexity, reduces the use of qubit resources, and is suitable for solving large-scale problems.
Smart Images

Figure CN119294544A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of quantum technology, and in particular to a method, device, storage medium and quantum computing device for determining an access path. Background Art
[0002] In the field of combinatorial optimization, there is a class of problems whose goal is to find the best sequence or path that satisfies specific conditions in a given set of elements. For this type of problem, researchers have long been exploring effective solutions.
[0003] Traditional methods for solving such problems mainly rely on precise algorithms, such as dynamic programming and branch-and-bound. These algorithms can ensure that the optimal solution to the problem is found through systematic search and calculation. Dynamic programming algorithms improve the efficiency of solving problems by breaking down the problem into smaller sub-problems and saving the solutions to the sub-problems to avoid repeated calculations. Branch-and-bound algorithms further narrow the search scope by continuously breaking down the problem into smaller sub-problems and using boundary conditions to prune the search tree.
[0004] However, although exact algorithms have their unique advantages in solving such problems, they also face some challenges. Since the solution space of such problems usually grows exponentially with the number of elements, the computational complexity of exact algorithms also increases rapidly. When the problem scale is large, these algorithms need to consume a lot of computing resources and time to find the optimal solution, and may not even be able to complete the calculation within the given time. Summary of the invention
[0005] The technical problem to be solved by the present invention is to provide a method, device, storage medium and quantum computing device for determining an access path, which can quickly and accurately determine the optimal access path for each node. The specific scheme is as follows:
[0006] A method for determining an access path, comprising:
[0007] Obtain a node set to be visited, the node set including N nodes, where N is an integer greater than 2;
[0008] Constructing a cost function according to the weights between the M nodes in the node set and the access constraints of the M nodes; wherein M=N-1;
[0009] Generate a Hamiltonian corresponding to the cost function;
[0010] Splitting the Hamiltonian into M sub-Hamiltonians, and constructing a parameterized quantum circuit for each of the sub-Hamiltonians;
[0011] According to the parameterized quantum circuits of the M sub-Hamiltonians and the distributed VQE algorithm, M optimal eigenstates are obtained;
[0012] According to the M optimal eigenstates, optimal access paths of the N nodes are determined.
[0013] In the above method, optionally, constructing a cost function according to the weights between the M nodes in the node set and the access constraints of the M nodes includes:
[0014] Determine the weights between the M nodes in the node set and the access constraints of the M nodes;
[0015] A cost function C(X) is constructed according to the weights between the M nodes in the node set and the access constraints of the M nodes; the cost function C(X) is expressed as follows:
[0016]
[0017] Among them, W i,j represents the weight from node i to node j; x i,t is a binary variable, x i,t =1 means visiting the i-th city at time t, x j,t+1 is a binary variable, x j,t+1 =1 means visiting the jth city at time t+1, where i, j=1…M, t=1…M-1, M is the number of nodes; α1 is the first penalty coefficient, and α2 is the second penalty coefficient.
[0018] In the above method, optionally, generating the Hamiltonian corresponding to the cost function includes:
[0019] Mapping the binary variables in the cost function to a preset Pauli matrix Z and an identity matrix I to obtain a Hamiltonian corresponding to the cost function;
[0020] The Hamiltonian is expressed as:
[0021]
[0022] Among them, Z i,t represents the Pauli matrix Z acting on the (t-1)*m+i qubit, Z j,t+1 represents the Pauli matrix Z acting on the t*m+jth quantum bit.
[0023] In the above method, optionally, the step of constructing a parameterized quantum circuit for each sub-Hamiltonian comprises:
[0024] Get parameter gate U(θ0), parameter control NOT gate CU(θ0), parameter gate W l (θ start ,θ start+1 …,θfinal-1 ,θ final ) and parameter-controlled switching gates The parameter gate U(θ0) is composed of quantum gate X, quantum gate R y (θ0), quantum gate CZ, quantum gate R y (-θ0) and CNOT gates, θ0 is the first angle parameter; the parameter controlled NOT gate CU(θ0) is constructed by the quantum gate U(θ0±φ), φ is the second angle parameter; the parameter gate W l (θ start ,θ start+1 …,θ final-1 ,θ final ) parameter Parameter controlled switch gate By quantum gate Quantum gate CZ, quantum gate And CNOT gate construction to get, q a Represented as the ath bit, q b Indicates the b-th bit, a=1,2,…b; b=l; is the third angle parameter, Based on the parameter determination in the lth parameterized quantum circuit;
[0025] The parameter gate U(θ0) is configured to act on the first quantum bit and the second quantum bit of the first parameterized quantum circuit, and the parameter control switching gate is configured according to the number of nodes N in the node set. Acting on the qth a qubits and q b qubits to construct a first parameterized quantum circuit for obtaining the M sub-Hamiltonians;
[0026] The parameter control NOT gate CU(θ0) is configured to act on the first quantum bit and the second quantum bit of the second parameterized quantum circuit, and the parameter control switch gate is configured according to the number of nodes N in the node set. Acting on the qth a qubits and q b qubits to construct a second parameterized quantum circuit to obtain the M sub-Hamiltonians;
[0027] Configuration parameter gate W l=p (θ start ,θ start+1 …,θ final-1 ,θ final) acts on the p qubits of the pth parameterized quantum circuit, and configures the parameter control switching gate according to the number of nodes N in the node set Acting on the qth a qubits and q b qubits to construct the pth parameterized quantum circuit of the M sub-Hamiltonians, where M-1≥p≥3; M≥b≥p+1;
[0028] Configuration parameter gate W l=M (θ start ,θ start+1 …,θ final-1 ,θ final ) acts on the M quantum bits of the Mth parameterized quantum circuit to construct the Mth parameterized quantum circuit that obtains the M sub-Hamiltonians.
[0029] In the above method, optionally, obtaining M optimal eigenstates according to the parameterized quantum circuits of the M sub-Hamiltonians and the distributed VQE algorithm includes:
[0030] Acquire an initial quantum gate parameter set, and use the initial quantum gate parameter set as a target parameter set;
[0031] Distributing the parameters in the target parameter set to the parameterized quantum circuits of the M sub-Hamiltonians to obtain M target quantum circuits;
[0032] Applying M target quantum circuits to a preset initial state, M quantum states are obtained; the quantum states are represented as follows: Among them, |k> is the ωth quantum state The M-bit calculation basis vector, 1≤ω≤m; coefficient Satisfy normalization,
[0033] Determining an expected value of the Hamiltonian according to the M quantum states;
[0034] The target parameter set is updated according to the expected value to obtain a new target parameter set, and the step of allocating the parameters in the target parameter set to the parameterized quantum circuits of the M sub-Hamiltonians is returned to perform iteration until a preset iteration stop condition is satisfied; the iteration stop condition includes at least one of the expected value of the Hamiltonian converges and the number of iterations is greater than a preset number threshold;
[0035] Among the M quantum states obtained in the last iteration, the basis vector state with the largest amplitude is selected as the optimal eigenstate, and the length of the optimal eigenstate is M bits.
[0036] In the above method, optionally, determining the expected value of the Hamiltonian according to the M quantum states comprises:
[0037] Calculate the expected value of the Hamiltonian according to a preset expected value calculation formula and the M quantum states;
[0038] The expected value calculation formula is as follows:
[0039]
[0040] Among them, E r represents the expected value of the Hamiltonian, Denotes the Hamiltonian component H m The ω-th sub-Hamiltonian, H m represents the mth component of Hamiltonian H, c m is the coefficient corresponding to the mth component.
[0041] In the above method, optionally, determining the optimal access path of the N nodes according to the M optimal eigenstates includes:
[0042] Complementing the M optimal eigenstates to obtain M complemented optimal eigenstates, where the length of the complemented optimal eigenstates is N bits;
[0043] The optimal eigenstates after the M complement codes are supplemented by using the preset quantum state to obtain N optimal eigenstates of N bits;
[0044] The N N-bit optimal eigenstates are decoded to obtain optimal access paths of the N nodes.
[0045] A device for determining an access path, comprising:
[0046] An acquisition unit, used to acquire a node set to be accessed, wherein the node set includes N nodes, where N is an integer greater than 2;
[0047] A first construction unit is used to construct a cost function according to the weights between the M nodes in the node set and the access constraint conditions; wherein M=N-1;
[0048] A generating unit, used to generate a Hamiltonian corresponding to the cost function;
[0049] A second construction unit is used to split the Hamiltonian into M sub-Hamiltonians and construct a parameterized quantum circuit for each of the sub-Hamiltonians;
[0050] An execution unit, configured to obtain M optimal eigenstates according to the parameterized quantum circuits of the M sub-Hamiltonians and a distributed VQE algorithm;
[0051] A determination unit is used to determine the optimal access paths of the N nodes according to the M optimal eigenstates.
[0052] A storage medium includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the access path determination method as described above.
[0053] A quantum computing device includes a memory and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by one or more processors to perform the access path determination method as described above.
[0054] Based on the above-mentioned implementation of the present invention, a method, device, storage medium and quantum computing device for determining an access path are provided. The method includes: obtaining a node set to be accessed, wherein the node set includes N nodes, where N is an integer greater than 2; constructing a cost function according to the weights between the M nodes in the node set and the access constraints of the M nodes; wherein M=N-1; generating a Hamiltonian corresponding to the cost function; splitting the Hamiltonian into M sub-Hamiltonians, and constructing a parameterized quantum circuit for each sub-Hamiltonian; obtaining M optimal eigenstates according to the parameterized quantum circuits of the M sub-Hamiltonians and a distributed VQE algorithm; and determining the optimal access path of the N nodes according to the M optimal eigenstates. The method provided by the embodiment of the present invention can quickly and accurately determine the optimal access path of each node. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0056] Figure 1 A method flow chart of a method for determining an access path provided by the present invention;
[0057] Figure 2 An example diagram of a quantum circuit provided by the present invention;
[0058] Figure 3 Another example diagram of a quantum circuit provided by the present invention;
[0059] Figure 4 Another example diagram of a quantum circuit provided by the present invention;
[0060] Figure 5A diagram showing another example of a quantum circuit provided by the present invention;
[0061] Figure 6 Another example diagram of a quantum circuit provided by the present invention;
[0062] Figure 7 A flow chart of a process for obtaining an optimal eigenstate provided by the present invention;
[0063] Figure 8 An exemplary diagram of a decoding process provided by the present invention;
[0064] Fig. 9 A flow chart of a process for solving the traveling salesman problem provided by the present invention;
[0065] Fig.10 A schematic diagram of the structure of a device for determining an access path provided by the present invention;
[0066] Fig.11 A schematic diagram of the structure of a quantum computing device provided in this application. DETAILED DESCRIPTION
[0067] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0068] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0069] In the field of combinatorial optimization, there is a class of problems whose goal is to find the best sequence or path that satisfies specific conditions in a given set of elements. For this type of problem, researchers have long been exploring effective solutions.
[0070] The existing methods mainly use exact algorithms such as dynamic programming and branch-and-bound to solve the problem. However, the computational complexity of exact algorithms increases exponentially with the size of the problem.
[0071] In order to avoid the problem of high computational complexity, a feasible way is to design heuristic parameterized quantum circuits. Specifically, by constructing a specific quantum circuit structure, the search space can be limited to the range of all feasible solutions to the problem, thereby narrowing the search range and improving the efficiency of the solution. Specifically, quantum bits are used to encode potential solutions to the problem, and the parameters of the quantum gates are adjusted to explore different solutions. The advantage of this method is that it can use the parallelism of quantum computing to efficiently search among multiple possible solutions. However, although heuristic parameterized quantum circuits have shown potential in solving combinatorial optimization problems, the number of quantum bits required for this method will still increase exponentially with the increase in the size of the problem, which is not suitable for solving practical applications in the NISQ era. In order to avoid the problem of high computational complexity, a feasible way is to use a distributed computing method in the quantum heuristic algorithm and design a problem heuristic parameterized quantum circuit based on the problem. Specifically, a large-scale problem is divided into multiple small-scale problems and calculated using distributed computing. However, in this method, each quantum circuit is independent of each other, and the inherent connection and quantum entanglement of the problem are not fully utilized. In addition, there are a large number of parameters to be optimized, and there is room for further optimization and improvement.
[0072] Based on this, an embodiment of the present invention provides a method for determining an access path, which can be applied to a quantum computing device. The method flow chart of the method is as follows: Figure 1 As shown, specifically including:
[0073] S101: Obtain a node set to be visited, where the node set includes N nodes, where N is an integer greater than 2.
[0074] In this embodiment, the nodes included in the node set can be nodes of any type, for example, they can be location nodes, or they can be device nodes such as computer devices, network communication devices, storage devices, etc. in the network system; they can also be energy device nodes in the energy system, etc. This embodiment does not limit the type of nodes.
[0075] S102: Constructing a cost function according to the weights between the M nodes in the node set and the access constraint conditions; wherein M=N-1.
[0076] In this embodiment, the access constraint condition can be set by the user in advance according to actual needs. For example, it can be set as follows: all nodes are visited once, and one city is visited in each time period.
[0077] Optionally, a cost function may be constructed based on the weights between the first M nodes among the N nodes and the access constraints.
[0078] The constructed cost function is as follows:
[0079]
[0080] Among them, W i,j represents the weight from node i to node j; x i,t is a binary variable, x i,t =1 means visiting the i-th city at time t, x j,t+1 is a binary variable, x j,t+1 =1 means visiting the jth city at time t+1, where i, j=1…M, t=1…M-1, M is the number of nodes; α1 is the first penalty coefficient, and α2 is the second penalty coefficient.
[0081] Optionally, the weight between two nodes may represent the distance or cost between the two nodes.
[0082] S103: Generate a Hamiltonian corresponding to the cost function.
[0083] In this embodiment, the process of generating the Hamiltonian corresponding to the cost function may include: mapping the binary variables in the cost function to a preset Pauli matrix Z and an identity matrix I to obtain the QUBO Hamiltonian corresponding to the cost function.
[0084] Among them, the binary variable x in the cost function i,t =[x1,x 2,t …x N-1,t ] or x i,t =[x i,1 x i,2 …x i,N-1 ].
[0085] Optionally, the obtained Hamiltonian can be expressed as follows:
[0086]
[0087] Among them, Z i,t represents the Pauli matrix Z acting on the (t-1)*m+i qubit, Z j,t+1 represents the Pauli matrix Z acting on the t*m+jth quantum bit.
[0088] S104: Split the Hamiltonian into M sub-Hamiltonians, and construct a parameterized quantum circuit for each sub-Hamiltonian.
[0089] In this embodiment, the sub-Hamiltonian obtained by splitting the Hamiltonian can be expressed as follows:
[0090]
[0091] Among them, H mrepresents the mth component of Hamiltonian H, c m is the corresponding coefficient; Denotes the Hamiltonian component H m The ω-th sub-Hamiltonian of , 1≤ω≤m.
[0092] S105: Obtain M optimal eigenstates according to the parameterized quantum circuits of the M sub-Hamiltonians and the distributed VQE algorithm.
[0093] In this embodiment, the parameters of each parameterized quantum circuit may be optimized by a distributed VQE algorithm, and then M optimal eigenstates may be obtained through the optimized M parameterized quantum circuits.
[0094] S106: Determine optimal access paths of the N nodes according to the M optimal eigenstates.
[0095] In this embodiment, the optimal access path of N nodes is a path with the shortest distance or the lowest cost.
[0096] Optionally, after obtaining the optimal access path, the optimal access path may be output.
[0097] Through the method provided by the embodiment of the present invention, it is possible to utilize the inherent connection of solving the optimal path problem between nodes and use the parameters between quantum circuits to achieve quantum entanglement. It has the characteristics of a small number of parameters to be optimized, which can reduce the computational complexity and improve the convergence speed. Thus, the optimal access path for each node can be determined quickly and accurately. Furthermore, a distributed computing method can be used to reduce the use of quantum bit resources.
[0098] In an embodiment provided by the present invention, based on the above implementation process, optionally, the process of constructing a parameterized quantum circuit of each sub-Hamiltonian comprises the following steps:
[0099] S201: Obtain parameter gate U(θ0), parameter control NOT gate CU(θ0), parameter gate W l (θ start ,θ start+1 …,θ final-1 ,θ final ), parameter control switch gate
[0100] In this embodiment, the quantum circuit diagram of the parameter gate U(θ0) is as follows: Figure 2 As shown, the parameter gate U(θ0) can be composed of quantum gate X, quantum gate R y (θ0), quantum gate CZ, quantum gate R y (-θ0) and CNOT gates are constructed, θ0 is the first angle parameter. The function of the quantum parameter gate U(θ0) is:
[0101] U(θ0)|00〉=cos(θ0)|10〉+sin(θ0)|01〉
[0102] See also Figure 3 , is the quantum circuit diagram of the parameter-controlled NOT gate CU(θ0). The parameter-controlled NOT gate CU(θ0) is constructed by the quantum gate U(θ0±φ). The function of the parameter-controlled NOT gate CU(θ0) is as follows:
[0103] CU(θ0)|00〉=cos(θ0)|01〉+sin(θ0)|10〉
[0104] Among them, φ is the second angle parameter, specifically, It is a fixed parameter and does not participate in the update.
[0105] See also Figure 4 , is the parameter gate Wl(θstart,θstart +1 …,θfinal-1,θfinal), the quantum circuit diagram of the parameter gate W l (θ start ,θ start+1 …,θ final-1 ,θ final ) parameter
[0106] Specifically, taking l=3 as an example, the quantum circuit of parameter gate W3(θ1,θ2) is as follows Figure 5 As shown, the function of the parameter gate W3(θ1,θ2) is:
[0107] W3(θ1,θ2)|000>
[0108] =cos(θ1)|100〉+sin(θ1)cos(θ2)|010〉+sin(θ1)sin(θ2)|001〉
[0109] See also Figure 6 , is the parameter control switch gate Quantum circuit diagram of parameter-controlled switching gate By quantum gate Quantum gate CZ, quantum gate And CNOT gate construction, where q a represents the ath bit, q b Indicates the b-th bit, a=1,2,…b; b=l; is the third angle parameter, Based on the parameter determination in the lth parameterized quantum circuit.
[0110] S202: Configure the parameter gate U(θ0) to act on the first qubit and the second qubit, and configure the parameter control switch gate according to the number of nodes N in the node set. Acting on the qth a qubits and q b The parameters in the first parameterized quantum circuit control the exchange gates. b=3,4,…,M.
[0111] S203: configure the parameter control NOT gate CU(θ0) to act on the first quantum bit and the second quantum bit of the second parameterized quantum circuit, and configure the parameter control switch gate according to the number of nodes N in the node set. Acting on the qth a qubits and q b The parameters in the second parameterized quantum circuit control the exchange gates. b=3,4,…,M.
[0112] S204: Configuration parameter gate W l=p (θ start ,θ start+1 …,θ final-1 ,θ final ) acts on the p qubits of the pth parameterized quantum circuit and configures the parameters to control the switching gate according to the number of nodes N in the node set. Acting on the qth a qubits and q b On qubits, the pth parameterized quantum circuit with M sub-Hamiltonians is constructed, where M-1≥p≥3; M≥b≥p+1.
[0113] S205: Configuration parameter gate W l=M (θ start ,θ start+1 …,θ final-1 ,θ final ) acts on the M qubits of the Mth parameterized quantum circuit to construct the Mth parameterized quantum circuit with M sub-Hamiltonians.
[0114] In an embodiment provided by the present invention, based on the above implementation process, optionally, the process of obtaining M optimal eigenstates according to the parameterized quantum circuits of the M sub-Hamiltonians and the preset distributed VQE algorithm is as follows: Figure 7 As shown, including:
[0115] S701: Obtain an initial quantum gate parameter set, and use the initial parameter set as a target parameter set.
[0116] In this embodiment, the initial quantum gate parameter set includes parameters of each parameter gate in the parameterized quantum circuit.
[0117] S702: Allocate the parameters in the target parameter set to the parameterized quantum circuits of the M sub-Hamiltonians to obtain M target quantum circuits.
[0118] In this embodiment, the parameters in the target parameter set can be respectively allocated to corresponding parameterized quantum circuits to obtain various target quantum circuits.
[0119] S703: Applying M target quantum circuits to a preset initial state to obtain M quantum states.
[0120] In this embodiment, M target quantum circuits with assigned parameters can be respectively applied to the initial state On the top, generate M quantum states,
[0121]
[0122] Among them, |k> is the ωth quantum state The M-bit calculation basis vector of Satisfy normalization,
[0123] S704: Determine the expectation value of the Hamiltonian based on the M quantum states.
[0124] In this embodiment, the current target parameter set can be calculated according to the preset expected value calculation formula and M quantum states. The expected value of the lower Hamiltonian E r , the expected value calculation formula is as follows:
[0125]
[0126] S705: Determine whether the iteration stop condition is met; if not, execute S706; if satisfied, execute S707.
[0127] In this embodiment, the iteration stop condition includes at least one of the following: the expected value of the Hamiltonian converges and the number of iterations is greater than a preset number threshold.
[0128] Optionally, the expected value convergence may mean that the difference between two consecutive expected values obtained is not greater than a preset difference threshold.
[0129] S706: Update the target parameter set according to the expected value to obtain a new target parameter set, and return to execute S702 for iteration.
[0130] In this embodiment, the target parameter set can be updated using the gradient descent method Get the target parameter set for the new round of iteration
[0131] S707: Selecting the basis vector state with the largest amplitude from the M quantum states obtained in the last iteration as the optimal eigenstate, where the length of the optimal eigenstate is M bits.
[0132] In this embodiment, after the iteration stop condition is met, the current expected value E can be output. r+1 and M optimal eigenstates of M bits Where |k> is the amplitude The largest quantum state.
[0133] In an embodiment provided by the present invention, based on the above implementation process, optionally, determining the optimal access path of the N nodes according to the M optimal eigenstates includes:
[0134] Complementing the M optimal eigenstates to obtain M complemented optimal eigenstates, where the length of the complemented optimal eigenstates is N bits;
[0135] The optimal eigenstates after the M complement codes are supplemented by using the preset quantum state to obtain N optimal eigenstates of N bits;
[0136] The N N-bit optimal eigenstates are decoded to obtain optimal access paths of the N nodes.
[0137] In this embodiment, the last bit of the N-1 N-1-bit optimal eigenstates can be supplemented with '0' to obtain N-1 N-bit optimal eigenstates. Then, a quantum state is supplemented As the Nth N-bit optimal eigenstate; finally, decode the N N-bit optimal eigenstates respectively, where the ωth optimal eigenstate represents the ωth time point, the subscript value of bit 1 on the optimal eigenstate represents the node i, and the final decoding obtains the access to the i-th node at the ωth time point.
[0138] See also Figure 8, shows the process of decoding the optimal access path when N=4. The last bit of the three 3-bit optimal eigenstates |001>, |010>, |100> can be complemented with '0' to obtain three 4-bit optimal eigenstates, namely |0010>, |0100> and |1000>; then, a quantum state |0001> is supplemented as the fourth 4-bit optimal eigenstate; finally, the optimal access path obtained by decoding is to access node 3 at time 1, access node 2 at time 2, access node 1 at time 3, and access node 4 at time 4.
[0139] In this embodiment, the process of solving the optimal path of each node is specifically the process of solving the traveling salesman problem (TSP), see Fig. 9 , is a flowchart of a process for solving the traveling salesman problem provided by an embodiment of the present invention, which specifically includes the following steps:
[0140] Step 1: Construct the QUBO Hamiltonian based on the traveling salesman problem.
[0141] Step 2: Split the QUBO Hamiltonian into N-1 sub-Hamiltonians.
[0142] Step 3: Construct N-1 parameterized quantum circuits.
[0143] Step 4: Use the distributed VQE algorithm to obtain the optimal eigenvalues and N-1 optimal eigenstates of the QUBO Hamiltonian.
[0144] Step 5: Complement the N-1 optimal eigenstates and decode to obtain the optimal path.
[0145] By applying the solution provided by the embodiment of the present invention, a new parameterized quantum circuit can be constructed based on the distributed VQE algorithm. The quantum circuit uses the intrinsic connection of the traveling salesman problem and uses the parameters between quantum circuits to achieve quantum entanglement. It has the characteristics of a small number of parameters to be optimized, which effectively reduces the search space, can reduce the computational complexity, and improve the convergence speed. In addition, fewer quantum bit resources can be used to quickly and accurately determine the optimal path for each node. Specifically, in the traditional computing method, the traveling salesman problem of N cities requires a computer with N 2 However, according to the method provided in this embodiment, only a quantum computer with N-1 bits can be used to complete the calculation.
[0146] and Figure 1 Corresponding to the method described above, an embodiment of the present invention further provides an access path determination device, which is applied to a quantum computing device. The access path determination device can be used to Figure 1The specific implementation of the method is shown in the following diagram: Fig.10 As shown, including:
[0147] An acquisition unit 1001 is used to acquire a node set to be accessed, where the node set includes N nodes, where N is an integer greater than 2;
[0148] A first construction unit 1002 is used to construct a cost function according to the weights between the M nodes in the node set and the access constraint conditions; wherein M=N-1;
[0149] A generating unit 1003, used to generate a Hamiltonian corresponding to the cost function;
[0150] A second construction unit 1004 is used to split the Hamiltonian into M sub-Hamiltonians and construct a parameterized quantum circuit for each of the sub-Hamiltonians;
[0151] An execution unit 1005 is used to obtain M optimal eigenstates according to the parameterized quantum circuits of the M sub-Hamiltonians and the distributed VQE algorithm;
[0152] The determination unit 1006 is configured to determine the optimal access paths of the N nodes according to the M optimal eigenstates.
[0153] In an embodiment provided by the present invention, based on the above solution, optionally, the first construction unit 1002 includes:
[0154] A first determining subunit, used to determine weights between M nodes in the node set and access constraints of the M nodes;
[0155] The construction subunit is used to construct a cost function according to the weights between the M nodes in the node set and the access constraints of the M nodes.
[0156] In an embodiment provided by the present invention, based on the above solution, optionally, the generating unit 1003 includes:
[0157] The first execution subunit is used to map the binary variables in the cost function to a preset Pauli matrix Z and an identity matrix I to obtain a Hamiltonian corresponding to the cost function.
[0158] In an embodiment provided by the present invention, based on the above solution, optionally, the second construction unit 1004 includes:
[0159] The first acquisition subunit is used to acquire the parameter gate U(θ0), the parameter control NOT gate CU(θ0), the parameter gate W l (θ start ,θ start+1 …,θfinal-1 ,θ final ), parameter control switch gate The parameter gate U(θ0) is composed of quantum gate X, quantum gate R y (θ0), quantum gate CZ, quantum gate R y (-θ0) and CNOT gates, θ0 is the first angle parameter; the parameter controlled NOT gate CU(θ0) is constructed by the quantum gate U(θ0±φ), φ is the second angle parameter; the parameter gate W l (θ start ,θ start+1 …,θ final-1 ,θ final ) parameter The parameters control the switching gate By quantum gate Quantum gate CZ, quantum gate And CNOT gate construction to get, q a Represented as the ath bit, q b Indicates the b-th bit, a=1,2,…b; b=l; is the third angle parameter, Based on the parameter determination in the lth parameterized quantum circuit;
[0160] The first configuration subunit is used to configure the parameter gate U(θ0) to act on the first quantum bit and the second quantum bit of the first parameterized quantum circuit, and configure the parameter control switching gate according to the number of nodes N in the node set. Acting on the qth a qubits and q b qubits to construct a first parameterized quantum circuit for obtaining the M sub-Hamiltonians;
[0161] The second configuration subunit is used to configure the parameter control NOT gate CU(θ0) to act on the first quantum bit and the second quantum bit of the second parameterized quantum circuit, and configure the parameter control exchange gate according to the number of nodes N in the node set. Acting on the qth a qubits and q b qubits to construct a second parameterized quantum circuit to obtain the M sub-Hamiltonians;
[0162] The third configuration subunit is used to configure the parameter gate W l=p (θ start ,θ start+1 …,θ final-1 ,θ final) acts on the p qubits of the pth parameterized quantum circuit, and configures the parameter control switching gate according to the number of nodes N in the node set Acting on the qth a qubits and q b qubits to construct the pth parameterized quantum circuit of the M sub-Hamiltonians, where M-1≥p≥3; M≥b≥p+1;
[0163] The fourth configuration subunit is used to configure the parameter gate W l=M (θ start ,θ start+1 …,θ final-1 ,θ final ) acts on the M quantum bits of the Mth parameterized quantum circuit to construct the Mth parameterized quantum circuit that obtains the M sub-Hamiltonians.
[0164] In an embodiment provided by the present invention, based on the above solution, optionally, the execution unit 1005 includes:
[0165] A second acquisition subunit is used to acquire an initial quantum gate parameter set and use the initial quantum gate parameter set as a target parameter set;
[0166] an allocating subunit, configured to allocate the parameters in the target parameter set to the parameterized quantum circuits of the M sub-Hamiltonians to obtain M target quantum circuits;
[0167] A second execution subunit is used to apply the M target quantum circuits to a preset initial state to obtain M quantum states;
[0168] A second determining subunit, configured to determine an expected value of the Hamiltonian according to the M quantum states;
[0169] An updating subunit, configured to update the target parameter set according to the expected value, obtain a new target parameter set, and return to trigger the allocating subunit to execute a process of allocating the parameters in the target parameter set to the parameterized quantum circuits of the M sub-Hamiltonians, so as to iterate until a preset iteration stop condition is satisfied; the iteration stop condition includes at least one of the expected value of the Hamiltonian converges and the number of iterations is greater than a preset number threshold;
[0170] The third execution subunit is used to select the basis vector state with the largest amplitude as the optimal eigenstate from the M quantum states obtained in the last iteration, and the length of the optimal eigenstate is M bits.
[0171] In an embodiment provided by the present invention, based on the above solution, optionally, the second determining subunit includes:
[0172] A calculation module is used to calculate the expected value of the Hamiltonian according to a preset expected value calculation formula and the M quantum states.
[0173] In an embodiment provided by the present invention, based on the above solution, optionally, the determining unit 1006 includes:
[0174] A complement subunit is used to complement the M optimal eigenstates to obtain M complemented optimal eigenstates, where the length of the complemented optimal eigenstates is N bits;
[0175] A fourth execution subunit is used to supplement the M optimal eigenstates after complementation by using a preset quantum state to obtain N optimal eigenstates of N bits;
[0176] The decoding subunit is used to decode the N N-bit optimal eigenstates to obtain the optimal access path of the N nodes.
[0177] The specific principles and execution processes of each unit and module in the access path determination device disclosed in the above embodiment of the present invention are the same as the access path determination method disclosed in the above embodiment of the present invention. Please refer to the corresponding parts of the access path determination method provided in the above embodiment of the present invention, and will not be repeated here.
[0178] An embodiment of the present invention further provides a storage medium, which includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above-mentioned method for determining the access path.
[0179] The embodiment of the present invention further provides a quantum computing device, the structural diagram of which is shown in FIG. Fig.11 As shown, it specifically includes a memory 1101 and one or more instructions 1102, wherein the one or more instructions 1102 are stored in the memory 1101 and are configured to be executed by one or more processors 1103 to perform the following operations:
[0180] Obtain a node set to be visited, the node set including N nodes, where N is an integer greater than 2;
[0181] Constructing a cost function according to the weights between the M nodes in the node set and the access constraints of the M nodes; wherein M=N-1;
[0182] Generate a Hamiltonian corresponding to the cost function;
[0183] Splitting the Hamiltonian into M sub-Hamiltonians, and constructing a parameterized quantum circuit for each of the sub-Hamiltonians;
[0184] According to the parameterized quantum circuits of the M sub-Hamiltonians and the distributed VQE algorithm, M optimal eigenstates are obtained;
[0185] According to the M optimal eigenstates, optimal access paths of the N nodes are determined.
[0186] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0187] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.
[0188] For the convenience of description, the above device is described as being divided into various units according to their functions. Of course, when implementing the present invention, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0189] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a 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 the various embodiments of the present invention or certain parts of the embodiments.
[0190] The above is a detailed introduction to a method for determining an access path provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for determining an access path, characterized in that: include: Obtain a node set to be visited, the node set including N nodes, where N is an integer greater than 2; Constructing a cost function according to the weights between the M nodes in the node set and the access constraints of the M nodes; wherein M=N-1; Generate a Hamiltonian corresponding to the cost function; Splitting the Hamiltonian into M sub-Hamiltonians, and constructing a parameterized quantum circuit for each of the sub-Hamiltonians; According to the parameterized quantum circuits of the M sub-Hamiltonians and the distributed VQE algorithm, M optimal eigenstates are obtained; According to the M optimal eigenstates, optimal access paths of the N nodes are determined.
2. The method according to claim 1, characterized in that The constructing a cost function according to the weights between the M nodes in the node set and the access constraints of the M nodes comprises: Determine the weights between the M nodes in the node set and the access constraints of the M nodes; A cost function C(X) is constructed according to the weights between the M nodes in the node set and the access constraints of the M nodes; the cost function C(X) is expressed as follows: Among them, W i,j represents the weight from node i to node j; x i,t is a binary variable, x i,t =1 means visiting the i-th city at time t, x j,t+1 is a binary variable, x j,t+1 =1 means visiting the jth city at time t+1, where i, j=1…M, t=1…M-1, M is the number of nodes; α1 is the first penalty coefficient, and α2 is the second penalty coefficient.
3. The method according to claim 2, characterized in that The generating of the Hamiltonian corresponding to the cost function comprises: Mapping the binary variables in the cost function to a preset Pauli matrix Z and an identity matrix I to obtain a Hamiltonian corresponding to the cost function; The Hamiltonian is expressed as: Among them, Z i,t represents the Pauli matrix Z acting on the (t-1)*m+i qubit, Z j,t+1 represents the Pauli matrix Z acting on the t*m+jth quantum bit.
4. The method according to claim 1, characterized in that: The step of constructing a parameterized quantum circuit for each sub-Hamiltonian comprises: Get parameter gate U(θ0), parameter control NOT gate CU(θ0), parameter gate W l (θ start ,θ start+1 …,θ final-1 ,θ final ) and parameter-controlled switching gates The parameter gate U(θ0) is composed of quantum gate X, quantum gate R y (θ0), quantum gate CZ, quantum gate R y (-θ0) and CNOT gates, θ0 is the first angle parameter; the parameter controlled NOT gate CU(θ0) is constructed by the quantum gate U(θ0±φ), φ is the second angle parameter; the parameter gate W l (θ start ,θ start+1 …,θ final-1 ,θ final ) parameter Parameter controlled switch gate By quantum gate Quantum gate CZ, quantum gate And CNOT gate construction to get, q a Represented as the ath bit, q b Indicates the b-th bit, a=1,2,…b; b=l; is the third angle parameter, Based on the parameter determination in the lth parameterized quantum circuit; The parameter gate U(θ0) is configured to act on the first quantum bit and the second quantum bit of the first parameterized quantum circuit, and the parameter control switching gate is configured according to the number of nodes N in the node set. Acting on the qth a qubits and q b qubits to construct a first parameterized quantum circuit for obtaining the M sub-Hamiltonians; The parameter control NOT gate CU(θ0) is configured to act on the first quantum bit and the second quantum bit of the second parameterized quantum circuit, and the parameter control switch gate is configured according to the number of nodes N in the node set. Acting on the qth a qubits and q b qubits to construct a second parameterized quantum circuit to obtain the M sub-Hamiltonians; Configuration parameter gate W l=p (θ start ,θ start+1 …,θ final-1 ,θ final ) acts on the p qubits of the pth parameterized quantum circuit, and configures the parameter control switching gate according to the number of nodes N in the node set Acting on the qth a qubits and q b qubits to construct the pth parameterized quantum circuit of the M sub-Hamiltonians, where M-1≥p≥3; M≥b≥p+1; Configuration parameter gate W l=M (θ start ,θ start+1 …,θ final-1 ,θ final ) acts on the M quantum bits of the Mth parameterized quantum circuit to construct the Mth parameterized quantum circuit that obtains the M sub-Hamiltonians.
5. The method according to claim 1, characterized in that The method of obtaining M optimal eigenstates according to the parameterized quantum circuits of the M sub-Hamiltonians and the distributed VQE algorithm includes: Acquire an initial quantum gate parameter set, and use the initial quantum gate parameter set as a target parameter set; Distributing the parameters in the target parameter set to the parameterized quantum circuits of the M sub-Hamiltonians to obtain M target quantum circuits; Apply the M target quantum circuits to the preset initial state to obtain M quantum states; the quantum states are represented as follows: Among them, |k> is the ωth quantum state The M-bit calculation basis vector, 1≤ω≤m; coefficient Satisfy normalization, Determining an expected value of the Hamiltonian according to the M quantum states; The target parameter set is updated according to the expected value to obtain a new target parameter set, and the step of allocating the parameters in the target parameter set to the parameterized quantum circuits of the M sub-Hamiltonians is returned to perform iteration until a preset iteration stop condition is satisfied; the iteration stop condition includes at least one of the expected value of the Hamiltonian converges and the number of iterations is greater than a preset number threshold; Among the M quantum states obtained in the last iteration, the basis vector state with the largest amplitude is selected as the optimal eigenstate, and the length of the optimal eigenstate is M bits.
6. The method according to claim 5, characterized in that Determining the expected value of the Hamiltonian according to the M quantum states includes: Calculate the expected value of the Hamiltonian according to a preset expected value calculation formula and the M quantum states; The expected value calculation formula is as follows: Among them, E r represents the expected value of the Hamiltonian, Denotes the Hamiltonian component H m The ω-th sub-Hamiltonian, H m represents the mth component of Hamiltonian H, c m is the coefficient corresponding to the mth component.
7. The method according to claim 1, characterized in that The determining the optimal access path of the N nodes according to the M optimal eigenstates includes: Complementing the M optimal eigenstates to obtain M complemented optimal eigenstates, where the length of the complemented optimal eigenstates is N bits; The optimal eigenstates after the M complement codes are supplemented by using the preset quantum state to obtain N optimal eigenstates of N bits; The N N-bit optimal eigenstates are decoded to obtain optimal access paths of the N nodes.
8. A device for determining an access path, characterized in that: include: An acquisition unit, used to acquire a node set to be accessed, wherein the node set includes N nodes, where N is an integer greater than 2; A first construction unit is used to construct a cost function according to the weights between the M nodes in the node set and the access constraint conditions; wherein M=N-1; A generating unit, used to generate a Hamiltonian corresponding to the cost function; A second construction unit is used to split the Hamiltonian into M sub-Hamiltonians and construct a parameterized quantum circuit for each of the sub-Hamiltonians; An execution unit, configured to obtain M optimal eigenstates according to the parameterized quantum circuits of the M sub-Hamiltonians and a distributed VQE algorithm; A determination unit is used to determine the optimal access paths of the N nodes according to the M optimal eigenstates.
9. A storage medium, characterized in that: The storage medium includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the method for determining the access path according to any one of claims 1 to 7.
10. A quantum computing device, characterized in that The system comprises a memory and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by one or more processors to perform the method for determining an access path as claimed in any one of claims 1 to 7.