Optimization problem solving method and device
By using the probability characteristics of Metropolis algorithm based on quantum states and energy in quantum computing, the problem of implementing Metropolis algorithm to solve optimization problems in quantum computing is solved, and efficient optimization problem solving is achieved.
Patent Information
- Application Number
- CN202311064539.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-22
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2043-08-22
AI Technical Summary
In quantum computing, how to implement the Metropolis algorithm for solving optimization problems, especially when the scale of the problem to be optimized has become an urgent problem.
A particular eigenstate and a first energy are obtained based on the first quantum state, and then a third quantum state including the first energy and the second energy is obtained using these quantum states and energy. The first measurement result is used to determine whether the second quantum state is retained, and in quantum computing, due to the inaccurate principle, there is a certain probability that the renewal of the reserved state will be updated, thereby realizing the application of the Metropolis algorithm in quantum computing.
It realizes the effective use of Metropolis algorithm to solve optimization problems in quantum computing, and uses the probability characteristics of quantum states to overcome the irreversibility of state conversion and measurement in quantum computing, and improves the solution efficiency of optimization problems.
Smart Images

Figure CN119514712A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of quantum computing technology, and in particular to a method and device for solving optimization problems. Background Art
[0002] Simulated Annealing (SA) is a general optimization algorithm. Its starting point is based on the similarity between the annealing process of solid materials in physics and general optimization problems. Starting from a certain initial temperature, as the temperature continues to drop, it combines the probabilistic jump characteristics to randomly search for the global optimal solution in the solution space.
[0003] The classic Metropolis algorithm is the core of the simulated classical annealing algorithm. When simulating quantum systems to solve optimization problems, it fails directly due to the famous sign problem in the quantum Monte Carlo method. However, with the increasing scale of the problems to be optimized and the development of quantum computing technology, how to implement the Metropolis algorithm in quantum computing to solve optimization problems has become an urgent problem to be solved. Summary of the invention
[0004] The purpose of this application is to provide a method and device for solving optimization problems, aiming to use the Metropolis algorithm to solve optimization problems in quantum computing.
[0005] An embodiment of the present application provides a method for solving an optimization problem, the method comprising:
[0006] Based on a first quantum state, a specific eigenstate and a first energy are obtained, wherein the first quantum state is a quantum state including a feasible solution to the problem to be optimized, the specific eigenstate is an eigenstate of the Hamiltonian of the problem to be optimized, and the first energy is the energy of the specific eigenstate;
[0007] Using the specific eigenstate and the first energy, a third quantum state including the first energy and a second energy is obtained, wherein the second quantum state is a quantum state including a feasible solution to the problem to be optimized based on the specific eigenstate, and the second energy is the energy of the eigenstate of the second quantum state;
[0008] When it is determined by the first measurement result that the second quantum state is retained but the iteration is not terminated, the second quantum state is used as a new first quantum state, and the step of obtaining a specific eigenstate and a first energy based on the first quantum state is returned to be executed, wherein the first measurement result is a measurement result obtained based on the third quantum state;
[0009] When the iteration is terminated, the target solution of the problem to be optimized is determined based on the current second quantum state.
[0010] Optionally, obtaining a specific eigenstate and a first energy based on the first quantum state includes:
[0011] A QPE operation is performed on the first quantum state, and the operation result is measured to obtain a specific eigenstate and a first energy.
[0012] Optionally, the using the specific eigenstate and the first energy to obtain a third quantum state including the first energy and the second energy comprises:
[0013] Performing a target state transfer operation on the specific eigenstate to obtain a second quantum state, wherein the target state transfer operation is selected from a set of state transfer operations preset for the problem to be optimized;
[0014] The QPE operation is performed on the second quantum state to obtain a third quantum state including the first energy and the second energy.
[0015] Optionally, when it is determined by the first measurement result that the second quantum state is retained but the iteration is not terminated, taking the second quantum state as a new first quantum state comprises:
[0016] Using a target quantum logic gate acting on a third quantum register, the third quantum state is converted into a superposition state including a quantum state representing retention and a quantum state representing rejection, wherein the target quantum logic gate is controlled by a first quantum register and a second quantum register; the first quantum register currently stores the second energy, and the second quantum register currently stores the first energy;
[0017] measuring the third quantum register to obtain a first measurement result;
[0018] When the first measurement result is a preset value representing retention, the second quantum state is used as a new first quantum state.
[0019] Optionally, the target quantum logic gate is a W gate;
[0020] The W gate is:
[0021]
[0022] in, β=1 / T, T is the current annealing temperature, E k is the first energy, E i is the second energy.
[0023] Optionally, when the first measurement result is not the preset value, the method further includes:
[0024] Performing a target operation on the first quantum register, the second quantum register, the third quantum register, and a fourth quantum register, wherein the fourth quantum register currently stores a second quantum state, and the target operation is an inverse operation determined by an operation between obtaining the first measurement result based on the specific eigenstate;
[0025] measuring the first quantum register and the second quantum register to obtain a second measurement result and a third measurement result, respectively;
[0026] In response to the second measurement result being the same as the third measurement result, the quantum state currently stored in the fourth quantum register is used as the first quantum state, and the step of obtaining a specific eigenstate and a first energy based on the first quantum state is returned to be executed.
[0027] Optionally, the method further comprises:
[0028] In response to the second measurement result being different from the third measurement result, the quantum state currently stored in the fourth quantum register is used as the specific eigenstate, and the step of obtaining a third quantum state including the first energy and the second energy by using the specific eigenstate and the first energy is returned to be executed.
[0029] Another embodiment of the present application provides an optimization problem solving device, the device comprising:
[0030] A first obtaining module is used to obtain a specific eigenstate and a first energy based on a first quantum state, wherein the first quantum state is a quantum state including a feasible solution to the problem to be optimized, the specific eigenstate is an eigenstate of the Hamiltonian of the problem to be optimized, and the first energy is the energy of the specific eigenstate;
[0031] A second obtaining module is used to obtain a third quantum state including the first energy and a second energy by using the specific eigenstate and the first energy, wherein the second quantum state is a quantum state including a feasible solution of the problem to be optimized obtained based on the specific eigenstate, and the second energy is the energy of the eigenstate of the second quantum state;
[0032] A retaining module, used for, when it is determined by the first measurement result to retain the second quantum state but the iteration is not terminated, taking the second quantum state as a new first quantum state and returning to execute the first obtaining module, wherein the first measurement result is a measurement result obtained based on the third quantum state;
[0033] A determination module is used to determine a target solution of the problem to be optimized based on the current second quantum state when the iteration is terminated.
[0034] An embodiment of the present application provides a storage medium, in which a computer program is stored, wherein the computer program is configured to implement any of the above methods when running.
[0035] An embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement any of the above methods.
[0036] Compared with the prior art, the present application first obtains a specific eigenstate and a first energy based on the first quantum state, and then uses the specific eigenstate and the first energy to obtain a third quantum state including the first energy and the second energy; when the first measurement result is used to determine whether to retain the second quantum state but the iteration has not terminated, the second quantum state is used as the new first quantum state, and the step of obtaining a specific eigenstate and the first energy based on the first quantum state is returned to execute; finally, when the iteration terminates, the target solution of the problem to be optimized is determined based on the current second quantum state. In the present application, the first measurement result is used to determine whether to retain the state update, and in quantum computing, due to the uncertainty principle, the first measurement result is measured with a certain probability, that is, there is a certain probability of retaining the second quantum state, thereby realizing the use of the Metropolis algorithm to solve the optimization problem in quantum computing. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is a network block diagram of an optimization problem solving system provided in an embodiment of the present application;
[0038] Figure 2 A flowchart of a method for solving an optimization problem provided in an embodiment of the present application;
[0039] Figure 3 A flowchart of another optimization problem solving method provided in an embodiment of the present application;
[0040] Figure 4 A schematic diagram of the structure of an optimization problem solving device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0041] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and should not be construed as limiting the present application.
[0042] Figure 11 is a network block diagram of an optimization problem solving system provided by an embodiment of the present application. The optimization problem solving system may include a network 110, a server 120, a wireless device 130, a client 140, a storage unit 150, a classical processing system 160, a quantum processing system 170, and may also include additional memories, classical processors, quantum processors, and other devices not shown.
[0043] The network 110 is a medium for providing communication links between various devices and computers connected together in the optimization problem solving system, including but not limited to the Internet, corporate intranets, local area networks, mobile communication networks and combinations thereof. The connection method may be wired, wireless communication links or optical fiber cables, etc.
[0044] The server 120 and the client 140 are conventional data processing systems that may contain data and applications or software tools that perform conventional computing processes. The client 140 may be a personal computer or a network computer, so the data may also be provided by the server 120. The wireless device 130 may be a smart phone, a tablet, a laptop, a smart wearable device, etc. The storage unit 150 may include a database 151, which may be configured to store data such as quantum bit parameters, quantum logic gate parameters, quantum circuits, quantum programs, etc.
[0045] The classical processing system 160 (quantum processing system 170) may include a classical processor 161 (quantum processor 171) for processing classical data (quantum data) and a memory 163 (memory 172) for storing classical data (quantum data). The classical data (quantum data) may be a boot file, an operating system image, and an application 162 (application 173). The application 162 (application 173) may be used to implement a quantum algorithm compiled according to the optimization problem solving method provided in an embodiment of the present application.
[0046] Any data or information stored or generated in the classical processing system 160 (quantum processing system 170) can also be configured to be stored or generated in another classical (quantum) processing system in a similar manner, and any application program executed by it can also be configured to be executed in another classical (quantum) processing system in a similar manner.
[0047] It should be noted that a true quantum computer is a hybrid structure, which includes at least Figure 1 There are two major parts in it: the classical processing system 160, which is responsible for performing classical calculations and control; and the quantum processing system 170, which is responsible for running quantum programs and thus realizing quantum calculations.
[0048] The classical processing system 160 and the quantum processing system 170 may be integrated into one device or distributed in two different devices. For example, the first device including the classical processing system 160 runs a classical computer operating system, on which quantum application development tools and services are provided, as well as storage and network services required for quantum applications. Users develop quantum applications through the quantum application development tools and services thereon, and send quantum programs to the second device including the quantum processing system 170 through the network services thereon. The second device runs a quantum computer operating system, parses the code of the quantum program through the quantum computer operating system, and compiles it into instructions that can be recognized and executed by the quantum computer measurement and control system. The quantum processor 170 implements the quantum algorithm corresponding to the quantum program according to the instructions.
[0049] In the classic processing system 160 based on silicon chips, the unit of the classic processor 161 is a CMOS tube. This computing unit is not limited by time and coherence, that is, this computing unit is not limited by the length of use and is available at any time. In addition, in silicon chips, the number of such computing units is also sufficient. Currently, the number of computing units in a classic processor is tens of thousands. The number of computing units is sufficient and the computing logic that can be selected by the CMOS tube is fixed, for example: AND logic. When calculating with the help of CMOS tubes, a large number of CMOS tubes are combined with limited logic functions to achieve the calculation effect.
[0050] Unlike this logic unit in the classical processing system 160, the basic computing unit of the quantum processor 171 in the quantum processing system 170 is a quantum bit, and the input of the quantum bit is limited by coherence and coherence time, that is, the quantum bit is limited by the use time and is not available at any time. Making full use of the quantum bit within the available use time of the quantum bit is a key problem in quantum computing. In addition, the number of quantum bits in a quantum computer is one of the representative indicators of the performance of a quantum computer. Each quantum bit realizes the computing function through the logical function configured on demand. In view of the limited number of quantum bits, the logical functions in the field of quantum computing are diverse, such as: Hadamard gate (Hadamard gate, H gate), Pauli-X gate (X gate), Pauli-Y gate (Y gate), Pauli-Z gate (Z gate), X gate, RY gate, RZ gate, CNOT gate, CR gate, iSWAP gate, Toffoli gate, etc. In quantum computing, it is necessary to use limited quantum bits combined with a variety of logical functions to achieve the computing effect.
[0051] Based on these differences, the design of the logical function acting on quantum bits (including the design of whether the quantum bits are used or not and the design of the efficiency of the use of each quantum bit) is the key to improving the computing performance of quantum computers, and requires special design. The above-mentioned design for quantum bits is a technical problem that ordinary computing devices do not need to consider or face. Based on this, in order to implement the Metropolis algorithm to solve optimization problems in quantum computing, this application proposes a method and device for solving optimization problems, aiming to use the Metropolis algorithm to solve optimization problems in quantum computing.
[0052] See also Figure 2 , Figure 2 A flowchart of a method for solving an optimization problem provided in an embodiment of the present application may include the following steps:
[0053] S201: Based on a first quantum state, a specific eigenstate and a first energy are obtained, wherein the first quantum state is a quantum state including a feasible solution to the problem to be optimized, the specific eigenstate is an eigenstate of the Hamiltonian of the problem to be optimized, and the first energy is the energy of the specific eigenstate.
[0054] The first quantum state is determined based on the problem to be optimized. Different problems to be optimized may correspond to different first quantum states. The first quantum state can be a superposition state of all feasible solutions to the problem to be optimized, or it can include a single feasible solution. A feasible solution can be a guessed solution to the problem to be optimized, or it can be a known solution to the problem to be optimized obtained based on experience, and so on. Based on the first quantum state, an evolution operation is performed to obtain a specific eigenstate and a first energy. The Hamiltonian of the problem to be optimized can be obtained in advance, specifically, it can be obtained based on the mapping relationship between the optimization problem and the Hamiltonian, or it can be constructed by analyzing the problem to be optimized.
[0055] In some possible implementations of the present application, obtaining a specific eigenstate and a first energy based on the first quantum state may include:
[0056] A QPE operation is performed on the first quantum state, and the operation result is measured to obtain a specific eigenstate and a first energy.
[0057] The quantum state can be stored in a quantum register, which can include multiple quantum bits. The number of quantum bits in each quantum register can be determined based on the stored data. The quantum phase estimation is performed on the quantum register storing the first quantum state and the first quantum register, and the first quantum state |ψ> becomes The initial state of the first quantum register is 0, and the operation result is measured. At this time, Collapse to That is, the quantum state stored in the quantum register storing the first quantum state becomes The quantum state of the first quantum register becomes |E k >.
[0058] QPE (quantum phase estimation) is a quantum computing operation based on quantum Fourier transform, which can give a certain accuracy estimate of the phase of a target quantum state. For a quantum state of n qubits, phase estimation requires an additional r qubits as auxiliary bits, and its specific size is related to the required accuracy. According to relevant theoretical derivations, in general:
[0059]
[0060] Where ε is the required estimation accuracy. The phase estimation operation acts on these n+r qubits, storing the phase information of the original n-bit quantum state in the calculation basis of the auxiliary bit.
[0061] Specifically, QPE can evolve |ψ>|0<. Specifically, the unitary gate e is constructed using the quantum simulation of the Hamiltonian H of the problem to be optimized. iHθ , |ψ> can be a superposition state of several H eigenstates, and the phase estimation is Where E j Actually, E j The binary representation of θ / 2π. After measurement, we get a specific At this time, E k Consider it a classic message.
[0062] When the quantum state of the first quantum register changes from |0> to |E k >, then E k Backing up from the first quantum register to the second quantum register, since the information stored in the first quantum register is classical after measurement, it can be backed up to the second quantum register through simple quantum bit operations, and this process does not violate the principle that quantum states cannot be cloned. At this time, in order to store other energy, it is necessary to reset the first quantum register so that the quantum state of the first quantum register becomes the initial state, that is, the 0 state. The backup operation can be a SWAP operation, or other operations that can transfer the first energy from the first quantum register to the second quantum register.
[0063] S202: Using the specific eigenstate and the first energy, obtain a third quantum state including the first energy and the second energy, wherein the second quantum state is a quantum state including a feasible solution to the problem to be optimized based on the specific eigenstate, and the second energy is the energy of the eigenstate of the second quantum state.
[0064] An evolution operation is performed on a specific eigenstate, and the specific eigenstate is updated once to obtain a second quantum state, where the second quantum state can be a superposition state, and the difference between the first quantum state and the second quantum state can be that the feasible solutions included are different. Then, an operation is performed based on the second quantum state and the first energy to obtain a third quantum state. In the embodiment of the present application, as long as the third quantum state can be obtained using the specific eigenstate and the first energy, the specific implementation method can be various.
[0065] In some possible implementations of the present application, the step of using the specific eigenstate and the first energy to obtain a third quantum state including the first energy and the second energy includes:
[0066] Performing a target state transfer operation on the specific eigenstate to obtain a second quantum state, wherein the target state transfer operation is selected from a set of state transfer operations preset for the problem to be optimized;
[0067] The QPE operation is performed on the second quantum state to obtain a third quantum state including the first energy and the second energy.
[0068] The state transfer operation set is a known unitary positive operation set {S}, {S} needs to satisfy the detailed balance condition of the state transfer, which is the detailed balance condition of the Markov chain. The specific unitary positive operation is related to the Hamiltonian of the problem to be optimized, but the only requirement is that the probability of selecting S must be equal to the probability of selecting Unitary positive operations are different for different problems to be optimized. For example, for the coloring problem, the unitary positive operation can be to flip the state of a specific quantum bit in a specific eigenstate, and evolve the specific eigenstate into a second quantum state; for the molecular docking problem, the unitary positive operation can be to transform a specific eigenstate representing a docking method into a second quantum state containing multiple docking methods. In the embodiment of the present application, a state transfer operation can be selected randomly or by other methods that meet the detailed balance conditions as the target state transfer operation, acting on the quantum register storing the specific eigenstate, so that the specific eigenstate Updated to That is, the quantum state stored in the quantum register storing a specific eigenstate changes from the eigenstate Updated to
[0069] Performing a QPE operation on the quantum register storing the second quantum state and the first quantum register to obtain a third quantum state, which may include
[0070] One of the difficulties in quantum generalization of the classical Metropolis algorithm occurs in the step of retaining / rejecting the newly generated state. Taking the optimal configuration of a molecule as an example, in the classical algorithm, from a system configuration C old Departure, through C old The new configuration C is obtained by operation new After that, a copy of the old configuration can still be retained. After comparing the energy difference between the new and old configurations, the new configuration is accepted with a certain probability based on the energy difference weight. However, for quantum computing, C old It must be stored in a group of quantum bits, and the new configuration C is obtained after the state transfer operation on the configuration new After that, if energy measurement is to be performed, it will inevitably lead to irreversible collapse, thereby losing the information of the old configuration. In the present application, the old configuration information obtains the second energy through state transfer operation and QPE operation without measurement, thereby retaining the information of the old configuration, making it possible to return from the new configuration to the old configuration.
[0071] S203: When it is determined by the first measurement result to retain the second quantum state but the iteration is not terminated, the second quantum state is used as the new first quantum state, and the process returns to execute S201, wherein the first measurement result is a measurement result obtained based on the third quantum state.
[0072] The first energy is obtained through measurement. For quantum computing, different measurement results correspond to different probabilities. The QPE operation is used to measure the intrinsic energy of the second quantum state to obtain the second energy. There is a certain probability for what kind of second energy is obtained. On this basis, the first measurement result is used to determine whether to retain the second quantum state. There is also a certain probability, which meets the basic principle of the Metropolis algorithm, that is, using the Metropolis criterion to determine whether to retain the state update.
[0073] Determining whether to retain the second quantum state using the first measurement result can be to use the magnitude relationship between the first energy and the second energy to determine whether to accept the state update. What is important here is how to determine the magnitude relationship between the first energy and the second energy. The specific judgment method can be various, and only the magnitude relationship is used. When it is determined to retain the second quantum state based on the magnitude relationship, it is necessary to determine whether to terminate the iteration. If the iteration is not terminated, the second quantum state is used as the new quantum state and S201 is executed. Using the second quantum state as the new first quantum state is from the perspective of the quantum program. From the perspective of the quantum register, the quantum state of the quantum register evolves with different operations. Directly performing the QPE operation on the second quantum state in the quantum register can obtain a new specific eigenstate and a new first energy.
[0074] In some possible implementations of the present application, when the first measurement result is used to determine that the second quantum state is retained but the iteration is not terminated, taking the second quantum state as the new first quantum state may include:
[0075] Using a target quantum logic gate acting on a third quantum register, the third quantum state is converted into a superposition state including a quantum state representing retention and a quantum state representing rejection, wherein the target quantum logic gate is controlled by a first quantum register and a second quantum register; the first quantum register currently stores the second energy, and the second quantum register currently stores the first energy;
[0076] measuring the third quantum register to obtain a first measurement result;
[0077] When the first measurement result is a preset value representing retention, the second quantum state is used as a new first quantum state.
[0078] In order to ensure that the quantum state has a chance to return to the state before the update, the second quantum register cannot be measured. The method that can be adopted is to split the third quantum state based on the extra bits of the third quantum register, and divide it into a superposition state of two states: representation retention and representation rejection.
[0079] The specific method is to use a multi-controlled single-bit gate to act on the M register to complete the following unitary transformation:
[0080]
[0081] in, It happens to be the state transition probability scale required by the classic Metropolis algorithm, so the first term on the right side of the above equation corresponds to the retention update, which is updated to The probability of |x is exactly what the algorithm requires i | 2 f i .
[0082] According to the above unitary transformation, the single-bit gate of the target quantum logic gate acting on the third register should be a W gate, and the matrix corresponding to the W gate can be:
[0083]
[0084] The W gate is related to the specific form of the problem to be optimized and the required estimation accuracy, and is controlled by the first quantum register and the second quantum register.
[0085] In an embodiment of the present application, the third quantum register may include only one quantum bit, and the first measurement result is either 1 or 0, 1 represents retention and 0 represents rejection. When the first measurement result is 1, it means that the second quantum state is retained, and the second quantum state can be used as the new first quantum state.
[0086] After retaining the second quantum state, before the next round of QPE operation, because the second quantum state is retained, it is still a superposition state, that is, ∑ i x i |ψ i >|E i >|E k >. In order to ensure the feasibility of the operation, it is hoped that from this ∑ i x i |ψ i > to estimate the phase and obtain a and the corresponding energy E k′ Then, the unitary operation S is performed, so the first quantum register, the second quantum register and the third quantum register need to be reset to make the first quantum register, the second quantum register and the third quantum register become the initial state.
[0087] S204: When the iteration is terminated, a target solution of the problem to be optimized is determined based on the current second quantum state.
[0088] In the embodiment of the present application, an iteration at an annealing temperature is used as a basic iteration unit. In a basic iteration unit, when the number of times the second quantum state is retained reaches a preset threshold, the annealing temperature is then increased to perform the operation of the next basic iteration unit. In a basic iteration unit, the second quantum states obtained for several consecutive times (which can be set according to actual conditions) are the same or not much different, indicating that the second quantum state includes the optimal solution or approximate optimal solution to the problem to be optimized. At this time, the iteration can be terminated, or when the iteration of a basic iteration unit ends and the annealing temperature reaches a preset temperature, the iteration is terminated; of course, there may be other conditions for terminating the iteration, as long as they meet the characteristics of the classical simulated annealing algorithm, which will not be described one by one here.
[0089] After the iteration is terminated, there is a certain relationship between the second quantum state and the target solution. How to process the second quantum state to obtain the target solution is different for different optimization problems. For some optimization problems, the solution corresponding to the eigenstate with the highest probability in the second quantum state can be used as the target solution of the problem to be optimized; for other optimization problems, the second quantum state can be measured, and the target solution can be determined based on the energy obtained by the measurement. For example, the second quantum state is measured multiple times to obtain multiple energies, and the solution corresponding to the eigenstate corresponding to the minimum energy is selected as the target solution.
[0090] In some possible implementations of the present application, when the first measurement result is not the preset target value, the method further includes:
[0091] Performing a target operation on the first quantum register, the second quantum register, the third quantum register, and a fourth quantum register, wherein the fourth quantum register currently stores a second quantum state, and the target operation is an inverse operation determined by an operation between obtaining the first measurement result based on the specific eigenstate;
[0092] measuring the first quantum register and the second quantum register to obtain a second measurement result and a third measurement result, respectively;
[0093] In response to the second measurement result being the same as the third measurement result, the quantum state currently stored in the fourth quantum register is used as the first quantum state, and the process returns to execute step S201.
[0094] In an embodiment of the present application, if the first measurement result is 0, it means that the update is rejected, and the fourth register (the register storing the quantum state of the quantum system to be optimized) needs to be rolled back to the quantum state before the update. To return to the original state in classical computing, it is only necessary to keep the original state backup, but this method is limited by the principle that quantum states cannot be cloned in quantum computing, and it is necessary to perform the inverse operation of the entire state update, that is, to perform the target operation, and the target operation includes the target state transfer operation, the QPE operation, and the inverse operation of the controlled W gate operation. After the execution is completed, the quantum state may return to the state at the time of the target state transfer operation, and the corresponding energy information is stored in the first quantum register and the second quantum register. If the two quantum registers are measured, when the energy of the two registers measured is consistent, it means that the original state has been returned, and the next basic iteration process can be performed.
[0095] In some possible implementations of the present application, the method further includes:
[0096] In response to the second measurement result being different from the third measurement result, the quantum state currently stored in the fourth quantum register is used as the specific eigenstate, and the process returns to step S202.
[0097] When the second measurement result is inconsistent with the third measurement result, the quantum state currently stored in the fourth quantum register is used as the specific eigenstate, and the step of obtaining the second quantum state through the target state transfer operation based on the specific eigenstate is returned to be executed until the results are consistent.
[0098] It can be seen that the present application first obtains a specific eigenstate and a first energy based on the first quantum state, and then uses the specific eigenstate and the first energy to obtain a third quantum state including the first energy and the second energy; then when the first measurement result is used to determine whether to retain the second quantum state but the iteration has not terminated, the second quantum state is used as the new first quantum state, and the step of obtaining a specific eigenstate and the first energy based on the first quantum state is returned to execute; finally, when the iteration terminates, the target solution of the problem to be optimized is determined based on the current second quantum state. In the present application, the first measurement result is used to determine whether to retain the state update, and in quantum computing, due to the uncertainty principle, the first measurement result is measured with a certain probability, that is, there is a certain probability of retaining the second quantum state, thereby realizing the use of the Metropolis algorithm to solve the optimization problem in quantum computing.
[0099] Figure 3 A flow chart of another optimization problem solving method provided in an embodiment of the present application, wherein the fourth quantum register is used to store the quantum state of the quantum system under study (problem to be optimized), the second quantum register is used to store state energy information required for the phase estimation process, the third quantum register is used to back up state energy information, the fourth quantum register may contain only one quantum bit, the measurement result of the quantum bit determines whether to retain the updated state, and the fourth quantum register is a key part for realizing the retention / rejection of state transfer, and may also be referred to as the Metropolis register, or M register for short. By performing corresponding operations on the four quantum registers, the quantum states stored in the four quantum registers also change accordingly. At the end of the first link, the quantum states of the four quantum registers change from |ψ>|0>|0>|0> to After the QPE operation is performed in the second stage, the quantum states of the four quantum registers become According to the measurement result of the fourth quantum register, a corresponding retaining operation is performed or an updating operation is rejected.
[0100] See also Figure 4 , Figure 4 A schematic diagram of a device for solving an optimization problem provided in an embodiment of the present application, and Figure 2 Corresponding to the process shown, the device includes:
[0101] A first obtaining module 401 is used to obtain a specific eigenstate and a first energy based on a first quantum state, wherein the first quantum state is a quantum state including a feasible solution to the problem to be optimized, the specific eigenstate is an eigenstate of the Hamiltonian of the problem to be optimized, and the first energy is the energy of the specific eigenstate;
[0102] A second obtaining module 402 is used to obtain a third quantum state including the first energy and a second energy by using the specific eigenstate and the first energy, wherein the second quantum state is a quantum state including a feasible solution to the problem to be optimized obtained based on the specific eigenstate, and the second energy is the energy of the eigenstate of the second quantum state;
[0103] A retaining module 403, used for retaining the module, is used to, when it is determined by the first measurement result to retain the second quantum state but the iteration is not terminated, use the second quantum state as a new first quantum state, and return to execute the first obtaining module 401, wherein the first measurement result is a measurement result obtained based on the third quantum state;
[0104] The determination module 404 is used to determine the target solution of the problem to be optimized based on the current second quantum state when the iteration is terminated.
[0105] In some possible implementations of the present application, the first obtaining module 401 may be specifically used to:
[0106] A quantum phase estimation (QPE) operation is performed on the first quantum state, and the operation result is measured to obtain a specific eigenstate and a first energy.
[0107] In some possible implementations of the present application, the second obtaining module 402 may be specifically used to:
[0108] Performing a target state transfer operation on the specific eigenstate to obtain a second quantum state, wherein the target state transfer operation is selected from a set of state transfer operations preset for the problem to be optimized;
[0109] The QPE operation is performed on the second quantum state to obtain a third quantum state including the first energy and the second energy.
[0110] In some possible implementations of the present application, the reservation module 403 may include:
[0111] a conversion unit, configured to convert the third quantum state into a superposition state including a quantum state representing retention and a quantum state representing rejection by using a target quantum logic gate acting on a third quantum register, wherein the target quantum logic gate is controlled by a first quantum register and a second quantum register; the first quantum register currently stores the second energy, and the second quantum register currently stores the first energy;
[0112] A measuring unit, configured to measure the third quantum register to obtain a first measurement result;
[0113] A determination unit is used to use the second quantum state as a new first quantum state when the first measurement result is a preset value representing retention.
[0114] In some possible implementations of the present application, the target quantum logic gate may be a W gate;
[0115] The W gate may be:
[0116]
[0117] in, β=1 / T, T is the current annealing temperature, E k is the first energy, E i is the second energy.
[0118] In some possible implementations of the present application, the device may further include:
[0119] an inverse operation module, configured to, when the first measurement result is not the preset value, perform a target operation on the first quantum register, the second quantum register, the third quantum register, and the fourth quantum register, wherein the fourth quantum register currently stores a second quantum state, and the target operation is an inverse operation determined by an operation between obtaining the first measurement result based on the specific eigenstate;
[0120] A measuring module, used to measure the first quantum register and the second quantum register to obtain a second measurement result and a third measurement result respectively;
[0121] The first responding module is used for, in response to the second measurement result being the same as the third measurement result, taking the quantum state currently stored in the fourth quantum register as the first quantum state, and returning to execute the first obtaining module 401.
[0122] In some possible implementations of the present application, the device may further include:
[0123] A second responding module is used for, in response to the second measurement result being different from the third measurement result, taking the quantum state currently stored in the fourth quantum register as the specific eigenstate, and returning to execute the second obtaining module.
[0124] It can be seen that the present application first obtains a specific eigenstate and a first energy based on the first quantum state, and then uses the specific eigenstate and the first energy to obtain a third quantum state including the first energy and the second energy; then when the first measurement result is used to determine whether to retain the second quantum state but the iteration has not terminated, the second quantum state is used as the new first quantum state, and the step of obtaining a specific eigenstate and the first energy based on the first quantum state is returned to execute; finally, when the iteration terminates, the target solution of the problem to be optimized is determined based on the current second quantum state. In the present application, the first measurement result is used to determine whether to retain the state update, and in quantum computing, due to the uncertainty principle, the first measurement result is measured with a certain probability, that is, there is a certain probability of retaining the second quantum state, thereby realizing the use of the Metropolis algorithm to solve the optimization problem in quantum computing.
[0125] An embodiment of the present application further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to implement the steps of any of the above method embodiments when executed.
[0126] Specifically, in this embodiment, the above storage medium may be configured to store a computer program for implementing the following steps:
[0127] S201: Based on a first quantum state, a specific eigenstate and a first energy are obtained, wherein the first quantum state is a quantum state including a feasible solution to the problem to be optimized, the specific eigenstate is an eigenstate of the Hamiltonian of the problem to be optimized, and the first energy is the energy of the specific eigenstate;
[0128] S202: using the specific eigenstate and the first energy, obtaining a third quantum state including the first energy and a second energy, wherein the second quantum state is a quantum state including a feasible solution to the problem to be optimized based on the specific eigenstate, and the second energy is the energy of the eigenstate of the second quantum state;
[0129] S203: when it is determined by the first measurement result to retain the second quantum state but the iteration is not terminated, the second quantum state is used as a new first quantum state, and the process returns to S201, wherein the first measurement result is a measurement result obtained based on the third quantum state;
[0130] S204: When the iteration is terminated, a target solution of the problem to be optimized is determined based on the current second quantum state.
[0131] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the steps in any one of the above method embodiments.
[0132] Specifically, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0133] Specifically, in this embodiment, the processor may be configured to implement the following steps through a computer program:
[0134] S201: Based on a first quantum state, a specific eigenstate and a first energy are obtained, wherein the first quantum state is a quantum state including a feasible solution to the problem to be optimized, the specific eigenstate is an eigenstate of the Hamiltonian of the problem to be optimized, and the first energy is the energy of the specific eigenstate;
[0135] S202: using the specific eigenstate and the first energy, obtaining a third quantum state including the first energy and a second energy, wherein the second quantum state is a quantum state including a feasible solution to the problem to be optimized based on the specific eigenstate, and the second energy is the energy of the eigenstate of the second quantum state;
[0136] S203: when it is determined by the first measurement result to retain the second quantum state but the iteration is not terminated, the second quantum state is used as a new first quantum state, and the process returns to S201, wherein the first measurement result is a measurement result obtained based on the third quantum state;
[0137] S204: When the iteration is terminated, a target solution of the problem to be optimized is determined based on the current second quantum state.
[0138] The present application also provides a computer program product comprising instructions, which, when executed by a computer, enables the computer to solve the optimization problem in any of the above-mentioned embodiments.
[0139] It can be understood that in the various implementations of this specification, the size of the serial number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the implementation methods of this specification.
[0140] It can be understood that the various embodiments described in this specification can be implemented individually or in combination, and the embodiments of this specification are not limited to this.
[0141] Unless otherwise specified, all technical and scientific terms used in the embodiments of this specification have the same meaning as those generally understood by those skilled in the art of the technical field of this specification. The terms used in this specification are only for the purpose of describing specific embodiments and are not intended to limit the scope of this specification. The term "and / or" used in this specification includes any and all combinations of one or more related listed items. The singular forms of "a", "above", and "the" used in the embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0142] It can be understood that the processor of the embodiment of this specification can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method implementation can be completed by the hardware integrated logic circuit or software instructions in the processor. The above processor can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiment of this specification can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of this specification can be directly embodied as a hardware decoding processor to perform, or the hardware and software modules in the decoding processor are combined and executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0143] It is understood that the memory in the embodiments of this specification may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (programmable ROM, PROM), an erasable programmable read-only memory (erasablePROM, EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory may be a random access memory (RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0144] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this specification.
[0145] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method implementation methods and will not be repeated here.
[0146] In the several embodiments provided in this specification, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0147] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0148] In addition, each functional unit in each embodiment of the present specification may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0149] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this specification, 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. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of this specification. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0150] The above is only a specific implementation of this specification, but the protection scope of this application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in this specification, which should be included in the protection scope of this specification. Therefore, the protection scope of this application should be based on the protection scope of the claims.
Claims
1. A method for solving an optimization problem, characterized in that: The method comprises: Based on a first quantum state, a specific eigenstate and a first energy are obtained, wherein the first quantum state is a quantum state including a feasible solution to the problem to be optimized, the specific eigenstate is an eigenstate of the Hamiltonian of the problem to be optimized, and the first energy is the energy of the specific eigenstate; Using the specific eigenstate and the first energy, a third quantum state including the first energy and a second energy is obtained, wherein the second quantum state is a quantum state including a feasible solution to the problem to be optimized based on the specific eigenstate, and the second energy is the energy of the eigenstate of the second quantum state; When it is determined by the first measurement result that the second quantum state is retained but the iteration is not terminated, the second quantum state is used as a new first quantum state, and the step of obtaining a specific eigenstate and a first energy based on the first quantum state is returned to be executed, wherein the first measurement result is a measurement result obtained based on the third quantum state; When the iteration is terminated, the target solution of the problem to be optimized is determined based on the current second quantum state.
2. The method according to claim 1, characterized in that The step of obtaining a specific eigenstate and a first energy based on the first quantum state includes: A quantum phase estimation (QPE) operation is performed on the first quantum state, and the operation result is measured to obtain a specific eigenstate and a first energy.
3. The method according to claim 2, characterized in that The step of using the specific eigenstate and the first energy to obtain a third quantum state including the first energy and the second energy comprises: Performing a target state transfer operation on the specific eigenstate to obtain a second quantum state, wherein the target state transfer operation is selected from a set of state transfer operations preset for the problem to be optimized; The QPE operation is performed on the second quantum state to obtain a third quantum state including the first energy and the second energy.
4. The method according to any one of claims 1 to 3, characterized in that: When it is determined by the first measurement result that the second quantum state is retained but the iteration is not terminated, taking the second quantum state as a new first quantum state comprises: Using a target quantum logic gate acting on a third quantum register, the third quantum state is converted into a superposition state including a quantum state representing retention and a quantum state representing rejection, wherein the target quantum logic gate is controlled by a first quantum register and a second quantum register; the first quantum register currently stores the second energy, and the second quantum register currently stores the first energy; measuring the third quantum register to obtain a first measurement result; When the first measurement result is a preset value representing retention, the second quantum state is used as a new first quantum state.
5. The method according to claim 4, characterized in that The target quantum logic gate is a W gate; The W gate is: in, β=1 / T, T is the current annealing temperature, E k is the first energy, E i is the second energy.
6. The method according to claim 5, characterized in that When the first measurement result is not the preset value, the method further includes: Performing a target operation on the first quantum register, the second quantum register, the third quantum register, and a fourth quantum register, wherein the fourth quantum register currently stores a second quantum state, and the target operation is an inverse operation determined by an operation between obtaining the first measurement result based on the specific eigenstate; measuring the first quantum register and the second quantum register to obtain a second measurement result and a third measurement result, respectively; In response to the second measurement result being the same as the third measurement result, the quantum state currently stored in the fourth quantum register is used as the first quantum state, and the step of obtaining a specific eigenstate and a first energy based on the first quantum state is returned to be executed.
7. The method according to claim 6, characterized in that The method further comprises: In response to the second measurement result being different from the third measurement result, the quantum state currently stored in the fourth quantum register is used as the specific eigenstate, and the step of obtaining a third quantum state including the first energy and the second energy by using the specific eigenstate and the first energy is returned to be executed.
8. An optimization problem solving device, characterized in that: The device comprises: A first obtaining module is used to obtain a specific eigenstate and a first energy based on a first quantum state, wherein the first quantum state is a quantum state including a feasible solution to the problem to be optimized, the specific eigenstate is an eigenstate of the Hamiltonian of the problem to be optimized, and the first energy is the energy of the specific eigenstate; A second obtaining module is used to obtain a third quantum state including the first energy and a second energy by using the specific eigenstate and the first energy, wherein the second quantum state is a quantum state including a feasible solution of the problem to be optimized obtained based on the specific eigenstate, and the second energy is the energy of the eigenstate of the second quantum state; A retaining module, used for, when it is determined by the first measurement result to retain the second quantum state but the iteration is not terminated, taking the second quantum state as a new first quantum state and returning to execute the first obtaining module, wherein the first measurement result is a measurement result obtained based on the third quantum state; A determination module is used to determine a target solution of the problem to be optimized based on the current second quantum state when the iteration is terminated.
9. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to implement the method according to any one of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Enhancing simulated annealing with quantum annealing
CN108701262A
Quantum Monte-Carlo method for implementing full topological class sampling for quantum dimer model
CN109859807A
Quantum recommendation method, device and system based on parallel quantum intrinsic solver
CN113988303A
Quantum computing method and related device
CN115545210A
Method and device for obtaining eigenstate of to-be-tested system based on quantum gate
CN115564051A