SAT problem processing method and device

By converting the SAT problem to the XOR SAT problem and leveraging the advantages of quantum computing, the problem of inefficient initial text assignment selection in the existing SAT problem processing methods is solved, and the effect of improving the SAT problem solving efficiency is achieved.

CN119539111APending Publication Date: 2025-02-28BENYUAN TIANGONG (ZHENGZHOU) QUANTUM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311102840.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-30
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

The existing SAT problem handling methods have inefficient problems in the initial literal assignment selection, resulting in a large number of learning clauses that conflicts, and these clauses are of low quality, affecting the solution efficiency.

Method used

By obtaining the linear equations of the XOR SAT problem corresponding to the target SAT problem and its initial solutions, an initial quantum state containing all solutions of the XOR SAT problem is prepared, and the quantum search line is used for evolution and measurement operations, the target measurement results are obtained, and the solution to the target SAT problem is finally determined.

Benefits of technology

This method uses the advantages of quantum computing to accelerate search, improves the solution efficiency of SAT problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119539111A_ABST
    Figure CN119539111A_ABST
Patent Text Reader

Abstract

The invention discloses an SAT problem processing method and device, and the method comprises the steps: obtaining a linear equation set corresponding to an XOR SAT problem corresponding to a target SAT problem and an initial solution of the linear equation set: preparing an initial quantum state composed of all solutions of the XOR SAT problem according to the initial solution; performing evolution and measurement operation on the initial quantum state by using a quantum search line to obtain a target measurement result; and determining a target solution of the target SAT problem based on the initial solution and the target measurement result. According to the embodiment of the invention, the solving efficiency of the SAT problem is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of quantum computing technology, and in particular to a method and device for processing a SAT problem. Background Art

[0002] The Satisfiability Problem (SAT problem for short) originates from the concept of formula satisfiability in classical propositional logic in mathematical logic. It is an important problem in theoretical computer science and the first NP (Non-deterministic Polynomial)-complete problem to be proven. The SAT problem is one of the most basic problems in the field of computer science. It has a wide range of applications in both application fields (such as task scheduling, scheduling, resource allocation, traveling salesman problem, etc.) and academic fields, and has vital practical application value.

[0003] The SAT problem is to give a propositional logic formula expressed in the conjunctive normal form format, and infer whether there is one or more groups of assignments that make the formula expressed in the conjunctive normal form satisfyable. At present, the most commonly used algorithm for dealing with SAT problems is the CDCL (conflict driven clause learning) algorithm. The SAT solver improved based on the CDCL algorithm framework has achieved great results in the SAT problem. However, the selection of literal assignments in the existing methods directly affects the entire search process. Although a large number of conflicts will be generated during the solution process if the initial literal assignments are not selected well, the learned clauses are usually of low quality and will be deleted in the clause library deletion operation, so a large number of operations are required to obtain the solution to the SAT problem, which makes the efficiency of solving such problems relatively low. Summary of the invention

[0004] The purpose of this application is to provide a SAT problem processing method and device, aiming to improve the efficiency of solving SAT problems.

[0005] An embodiment of the present application provides a SAT problem processing method, the method comprising:

[0006] Obtain a linear equation system corresponding to the XOR SAT problem corresponding to the target SAT problem and an initial solution of the linear equation system;

[0007] According to the initial solution, preparing an initial quantum state consisting of all solutions to the XOR SAT problem;

[0008] Using a quantum search circuit, executing evolution and measurement operations on the initial quantum state to obtain a target measurement result;

[0009] A target solution to the target SAT problem is determined based on the initial solution and the target measurement result.

[0010] Optionally, the initial solution includes a basic solution and a special solution;

[0011] The initial quantum state comprises:

[0012]

[0013] Where |ψ> is the initial quantum state, k is the number of basic solutions, and v i is the coefficient of the ith basic solution, satisfying v i ={0,1},ξ i is the i-th basic solution, and ξ is the special solution.

[0014] Optionally, the system of linear equations includes a coefficient matrix and a vector, the coefficient matrix is ​​determined by the characters in the first clause, the vector is determined by the number of negative characters in the first clause and the number of characters whose values ​​are target values ​​in the first clause, and the first clause is a clause of the XOR SAT problem.

[0015] Optionally, the quantum search circuit includes a quantum circuit constructed based on the Grover algorithm.

[0016] Optionally, the using a quantum search circuit to perform evolution and measurement operations on the initial quantum state to obtain a target measurement result includes:

[0017] Using the Oracle subcircuit, a target eigenstate is determined from the initial quantum state, and the target eigenstate is marked so that the initial quantum state evolves into a new quantum state;

[0018] Using the Graver amplification operator circuit, the probability of the marked eigenstate in the new quantum state is amplified;

[0019] The target quantum state obtained after the Graver amplifier circuit acts is measured to obtain a target measurement result.

[0020] Optionally, the using an Oracle subcircuit to determine a target eigenstate from an initial quantum state comprises:

[0021] The Oracle subcircuit is used to obtain the judgment result of each second clause in the target SAT problem; based on the judgment result of each second clause, the target eigenstate is determined from the initial quantum state.

[0022] Optionally, the Oracle sub-line includes a first line unit, a first counter corresponding to each second clause, a second counter, and a second line unit;

[0023] The first line unit is used to determine whether the value of the text in the second clause is a target value;

[0024] The first counter is used to update the count when the first line unit determines that the value of a character is the target value;

[0025] The second counter is used to update the count when the count of a first counter reaches a specified value, wherein the specified value is the number of characters assigned to the target value in a preset second clause;

[0026] The second circuit unit is used to determine the target eigenstate from the initial quantum state according to the count of the second counter that meets the preset condition, and mark it, so that the initial quantum state evolves into a new quantum state.

[0027] Optionally, the first counter includes [log2(p+1)] qubits for counting, where p is the number of literals in a second clause;

[0028] The second counter includes [log2(m+1)] quantum bits for counting, where m is the number of clauses in the target SAT problem.

[0029] Optionally, determining the target eigenstate from the initial quantum state according to the count of the second counter includes:

[0030] obtaining a binary representation of the count of the second counter;

[0031] According to the quantum state corresponding to the obtained value, the target eigenstate is determined from the initial quantum state.

[0032] Optionally, the target SAT problem is a Hamiltonian circuit problem.

[0033] Optionally, the target SAT problem is a task assignment problem.

[0034] Another embodiment of the present application provides a device for processing a SAT problem, the device comprising:

[0035] A first obtaining module is used to obtain a linear equation system corresponding to an XOR SAT problem corresponding to a target SAT problem and an initial solution of the linear equation system;

[0036] A preparation module, used for preparing an initial quantum state consisting of all solutions of the XOR SAT problem according to the initial solution;

[0037] A second acquisition module is used to use a quantum search circuit to perform evolution and measurement operations on the initial quantum state to obtain a target measurement result;

[0038] A determination module is used to determine a target solution of the target SAT problem based on the initial solution and the target measurement result.

[0039] 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.

[0040] 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.

[0041] Compared with the prior art, the present application first obtains the linear equations corresponding to the XOR SAT problem corresponding to the target SAT problem and the initial solution of the linear equations; then, based on the initial solution, prepares an initial quantum state consisting of all solutions to the XOR SAT problem; then, using a quantum search circuit, performs evolution and measurement operations on the initial quantum state to obtain a target measurement result; finally, based on the initial solution and the target measurement result, determines the target solution to the target SAT problem. In the present application, the XOR SAT problem corresponding to the target SAT problem is first solved to obtain all solutions to the XOR SAT problem, thereby narrowing the scope of obtaining solutions to the SAT problem, and then using the advantages of quantum computing to search among all solutions, it is possible to accelerate the acquisition of solutions to the target SAT problem, thereby improving the efficiency of solving the SAT problem. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 is a network block diagram of a SAT problem processing system provided by an embodiment of the present application;

[0043] Figure 2 A schematic diagram of a SAT problem method provided in an embodiment of the present application;

[0044] Figure 3 A schematic diagram of a quantum circuit for preparing an initial quantum state provided in an embodiment of the present application;

[0045] Figure 4 A schematic diagram of a quantum circuit of a first counter provided in an embodiment of the present application;

[0046] Figure 5 A schematic diagram of a quantum circuit for marking quantum states provided in an embodiment of the present application;

[0047] Figure 6 A schematic diagram of the structure of a SAT problem processing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] 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.

[0049] Figure 1 1 is a network block diagram of a SAT problem processing system provided by an embodiment of the present application. The SAT problem processing 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.

[0050] Network 110 is a medium for providing communication links between various devices and computers connected together in the SAT problem processing 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.

[0051] 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.

[0052] 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 SAT problem processing method provided in an embodiment of the present application.

[0053] 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.

[0054] It should be noted that a true quantum computer is a hybrid structure, which includes at least Figure 1There 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.

[0055] 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.

[0056] 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 the silicon chip, the number of such computing units is also sufficient. At present, 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.

[0057] 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.

[0058] 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 processing of SAT problems in quantum computing, this application proposes a SAT problem processing method and device, which aims to improve the efficiency of processing SAT problems.

[0059] The following is an introduction to the relevant concepts involved in SAT problems:

[0060] Variable: specifically refers to a Boolean variable that can be True or False.

[0061] Text: It is the way a variable is presented in a question, usually the variable itself or its negation, such as x0, ~x1, etc. i It can be called the correct text, ~x i Call it negative text.

[0062] Clause: refers to an expression formed by connecting several literals through disjunction (OR), which represents a constraint on a variable. The same variable may have different values ​​for the corresponding literals in different clauses. When at least one of all the literals is True, the clause is True, and when all the literals are False, the clause is False. For example: x∨y∨~z, when x=True, y=True, z=True, since x=True, y=True, ~z=False, there are two True, which is True. When x=False, y=True, z=True, since x=False, y=True, ~z=False, there is one True, which is True. When x=False, y=False, z=True, since x=False, y=True, ~z=False, all three literals are False, so the clause is False.

[0063] Formula (conjunction) paradigm: It is an expression composed of several clauses connected by conjunction (AND), which represents a set of constraints on variables. The formula is True if and only if all clauses are True. For example, the formula (x∨y∨~z)∧(~x∨y∨w)∧(~x∨z∨w): When x=True, y=True, z=True, w=True, clause 1 is True, clause 2 is True, clause 3 is True, all are True, so the result of the conjunction paradigm is True. When x=False, y=False, z=True, w=True, clause 1 is False, clause 2 is True, clause 3 is True, there is one False, so the result of the conjunction paradigm is False.

[0064] Assignment: Give each variable a Boolean value (such as True or False).

[0065] SAT problem: Given a conjunctive normal form, determine whether there is a set of assignments such that the conjunctive normal form can be True.

[0066] q-in-p SAT problem: A special SAT problem. On the basis of the original SAT problem, each clause will have p literals, and the judgment of the clause is changed from the original "as long as there is 1 True" to "exactly q literals are True". q-in-p SAT problems are usually more difficult to solve than general SAT problems because they have higher constraints and less redundancy. For example: 2-in-3 SAT problem, conjunction normal form (x∨y∨~z)∧(~x∨y∨w)∧(~x∨z∨w). When x=True, y=True, z=True, w=True, clause 1 is True and has two literals that are True; clause 2 is True and has two literals that are True; clause 3 is True and has two literals that are True; all are True, so the result of the conjunction normal form is True. When x=True, y=False, z=True, w=True, clause 1 is True, there is 1 literal that is True, so the whole pattern is False; clause 2 is True, there is 1 literal that is True, so the whole pattern is False; clause 3 is True, there are two literals that are True; there is at least one clause that is False, so the whole conjunction pattern is False.

[0067] See also Figure 2 , Figure 2 A flowchart of a method for processing a SAT problem provided in an embodiment of the present application may include the following steps:

[0068] S201: Obtain a linear equation system corresponding to the XOR SAT problem corresponding to the target SAT problem and an initial solution of the linear equation system.

[0069] The XOR SAT problem is a modified SAT problem, which changes the "OR" in the SAT problem clause to "XOR". The XOR SAT problem is treated as a linear equation system, and the initial solution can be obtained by solving the linear equation system. Specifically, the Gaussian elimination method can be used to solve it.

[0070] In this application, the target SAT problem can be a q-in-p SAT problem. Assuming a q-in-p SAT problem, there are n variables and m restrictions (clauses). For each clause, it can be expressed as:

[0071]

[0072] in, Represents the i-th literal of the a-th clause. The wavy line indicates that the literal may be negated or not. Let True be 1 and False be 0. R is True if and only if is True, and

[0073] The problem to be solved can be expressed as:

[0074]

[0075] Is there a set x i The assignment method (expressed as a vector) makes I=1.

[0076] The corresponding XORSAT problem can be expressed as:

[0077]

[0078] in,

[0079] According to the theorem of classical computing, the solution to any q-in-p SAT problem must be the solution to the XORSAT problem. In other words, the solution space of XORSAT contains the solution space of q-in-p SAT. And the solution of XORSAT can be obtained by a simple method. Therefore, we can search for the solution of q-in-p SAT only in the solution space of XORSAT, thereby reducing the space size and accelerating the quantum search algorithm.

[0080] The linear equations corresponding to the XORSAT problem include coefficient matrices and vectors. The coefficient matrix A is determined by the text in the first clause, which is the clause of the XOR SAT problem. Specifically, the coefficient matrix A is an m×n binary matrix if and only if the i-th XOR clause R XOR,i There exists a j-th variable x in j (regardless of whether it is negated)A ij =1, otherwise, A ij = 0. The vector is determined by the number of negative characters in the first clause and the number of characters whose values ​​are the target values ​​in the first clause. Specifically, the element b in the vector i =(v i +q) mod2 , v i is the i-th XOR clause R XOR,i The number of literals to be negated in the XOR clause, and q is the number of literals whose values ​​are the target values ​​in the XOR clause.

[0081] All solutions of XORSAT are equations on a two-variable field If you want to solve this equation, you can use Gaussian elimination. When the coefficient matrix A and the augmented matrix [A|b] are transformed into the simplest row echelon form matrix, the operation used should be modulo-2 addition. The initial solution obtained by solving the linear equation system can include basic solutions and special solutions. Specifically, first solve the homogeneous linear equation system:

[0082]

[0083] In general, this equation has many solutions, forming a linear space, and a set of basic solutions is selected as {ξ1,ξ2,…,ξ k}, k≤min{n,m} is the dimension of the null space. In addition, a special solution of the equation is found Then all solutions can be written as:

[0084]

[0085] Specifically, it can be done through To obtain the solutions of all XORSAT problems, the solutions of all q-in-p SAT problems are in this space.

[0086] S202: According to the initial solution, prepare an initial quantum state consisting of all solutions to the XOR SAT problem.

[0087] After obtaining the initial solution of the XOR SAT problem, because the solution of the target SAT problem is in the solution space of the XOR SAT problem, it is necessary to obtain all solutions of the XOR SAT problem based on the initial solution, and then prepare these solutions into the initial quantum state. Specifically, the initial quantum state can be expressed as:

[0088]

[0089] Where |ψ> is the initial quantum state, k is the number of basic solutions, and v i is the coefficient of the ith basic solution, satisfying v i ={0,1},ξ i is the i-th basic solution, and ξ is the special solution.

[0090] The following is a specific example to illustrate the preparation process of the initial quantum state:

[0091] Assume that the target SAT problem is 1-in-3SAT, and the conjunction normal form is: (x1∨x2∨x4)∧(x1∨x2∨~x3)∧(x0∨~x3∨~x4). After processing, the linear equations to be solved are:

[0092]

[0093] The basic solution is:

[0094] ξ0=[0 1 0 1 1] T

[0095] ξ1=[0 1 1 0 0] T

[0096] The special solution is:

[0097] ξ=[0 1 0 1 0] T

[0098] The quantum circuit for preparing the initial quantum state can be Figure 3 As shown, the first two bits encode the coefficients of the basic solution The last 5 bits encode five variables. The q0 bit controls ξ0. When q0=1, the control gate is used to realize |1>|01011>. When q0=0, the variable bit is 0, that is, v0ξ0. Similarly, q1 controls ξ1. The special solution is directly constructed using the X gate. The X operation on the quantum bit directly conforms to the modulo-2 addition. Therefore, we can get:

[0099]

[0100] The initial quantum state obtained is a superposition state composed of all XORSAT solution spaces.

[0101] S203: Utilizing a quantum search circuit, executing evolution and measurement operations on the initial quantum state to obtain a target measurement result.

[0102] The quantum search circuit is a quantum circuit constructed based on a quantum search algorithm, specifically, it can be constructed based on the Grover algorithm. The quantum search circuit is used to operate the initial quantum state, and a search is performed in the solution space of all XORSAT. After the search is completed, a measurement is performed. At this time, the quantum state on the specific quantum bit evolves from the initial quantum state to the target quantum state. The target quantum state on the specific quantum bit is measured to obtain the target measurement result, which includes data characterizing the quantum state and its corresponding probability. In the present application, the specific quantum bit can be a quantum bit used to encode the coefficients of the basic solution.

[0103] In some embodiments of the present application, the use of a quantum search circuit to perform evolution and measurement operations on the initial quantum state to obtain a target measurement result includes:

[0104] Using the Oracle subcircuit, a target eigenstate is determined from the initial quantum state, and the target eigenstate is marked so that the initial quantum state evolves into a new quantum state;

[0105] Using the Graver amplification operator circuit, the probability of the marked eigenstate in the new quantum state is amplified;

[0106] The target quantum state obtained after the Graver amplifier circuit acts is measured to obtain a target measurement result.

[0107] The Oracle subcircuit is a circuit O related to the function to be searched f. When the quantum state |x> is input (some auxiliary bits may be required), the function value f(x) corresponding to the quantum state will be calculated. If the conditions are met, a negative phase will be added to the state, becoming -|x>. If the conditions are not met, it will not work. Then, for the probability superposition of the state to be searched (possibly unequal probabilities), after the action, it will become:

[0108]

[0109] V satisfies f(x i )=1,x i ∈V. Through this operation, the state to be solved can be separated, so that the probability can be amplified through subsequent operations.

[0110] Grover Amplification Operator Its functions are:

[0111]

[0112]

[0113]

[0114] Where N is the size of the solution space and M is the number of desired quantum states.

[0115] Action λ times, that is Therefore, after a certain number of actions, the probability of measuring a certain state in |β> will increase significantly.

[0116] Based on the above principle, the Oracle subcircuit will find the eigenstate that meets the requirements in the initial quantum state and mark it. The specific marking is phase marking, so as to obtain a new quantum state, and then use the Grover amplifier circuit to process the new quantum state, so that the probability of measuring the marked eigenstate becomes larger. The number of times the Grover amplifier circuit works is preset, which is determined by M and N.

[0117] In some possible implementations of the present application, the use of an Oracle subcircuit to determine a target eigenstate from an initial quantum state may include:

[0118] The Oracle subcircuit is used to obtain the judgment result of each second clause in the target SAT problem; based on the judgment result of each second clause, the target eigenstate is determined from the initial quantum state.

[0119] The judgment result of each second clause in the target SAT problem is related to the judgment result of the entire conjunction normal form, and the judgment result of the conjunction normal form directly affects the state separated from the initial quantum state. The Oracle sub-circuit can identify the value of the text in each clause, and determine the judgment result of the second sub-clause based on this, and then determine the target eigenstate by using the judgment results of all second clauses. It should be noted that when the text is a positive text, the value of the text is the assignment of the variable, and when the text is a negative text, the value of the file is the inverse of the variable assignment. Exemplarily, the variable x is assigned True, in one clause, the text x has the value of True, and in another clause, the text ~x has the value of False.

[0120] In some possible implementations of the present application, the Oracle sub-line includes a first line unit, a first counter corresponding to each second clause, a second counter, and a second line unit;

[0121] The first line unit is used to determine whether the value of the text in the second clause is a target value;

[0122] The first counter is used to update the count when the first line unit determines that the value of a character is the target value;

[0123] The second counter is used to update the count when the count of a first counter reaches a specified value, wherein the specified value is the number of characters assigned to the target value in a preset second clause;

[0124] The second circuit unit is used to determine the target eigenstate from the initial quantum state according to the count of the second counter that meets the preset condition, and mark it, so that the initial quantum state evolves into a new quantum state.

[0125] The first circuit unit has different corresponding structures due to different values ​​of the text. The first circuit unit can be implemented using a CNOT gate. When the text is True, it is controlled to 1, otherwise it is controlled to 0. Using the CNOT gate, the quantum bit of the encoding variable is the control bit, and the corresponding auxiliary bit in the first counter is operated as the target bit. When the judgment result of the text is counted using the first counter, if the value of the text is the target value, the count is increased by 1. The first counter includes [log2(p+1)] quantum bits for counting and an auxiliary quantum bit. When the first counter completes a count, the corresponding auxiliary bit can be reset using the CNOT gate.

[0126] In the present application, the first counter may be implemented by means of an accumulator. For example, taking the case where there are 4 quantum bits for counting as an example, the first counter may be implemented as follows: Figure 4 As shown, q0 is an auxiliary bit, q1-q4 are quantum bits used for counting, starting from the highest bit, all bits lower than this bit are used as control bits, and this bit is used as the controlled bit, and multi-control gates are implemented until the lowest bit of the counted quantum bit is controlled by the auxiliary bit.

[0127] The specified value refers to the number of words in the clause whose value is True when the result of the second clause is True. When a first counter completes counting and the count is the specified value, the count of the second counter is increased by 1. The second counter includes [log2(m+1)] quantum bits for counting and an auxiliary quantum bit. After the count of m second clauses is completed, the quantum state to be marked is determined and marked using the second line unit. In some possible implementations, determining the target eigenstate from the initial quantum state based on the count of the second counter that meets the preset conditions may include:

[0128] obtaining a binary representation of the count of the second counter;

[0129] According to the quantum state corresponding to the obtained value, the target eigenstate is determined from the initial quantum state.

[0130] The binary representation of the counted value, each bit of which corresponds to the quantum bit used for counting in the second counter. Based on this correspondence, the quantum state corresponding to the value can be used as the eigenstate to be marked in the quantum bit used for counting, because the quantum state obtained by the evolution of the initial quantum state is a superposition state, which is the superposition state of the quantum bit required to process the target SAT problem. Based on the eigenstate to be marked in the quantum bit used for counting, the target eigenstate of the initial quantum state can be determined. Exemplarily, the quantum state before counting is |p>|0>+|q|0>, and after counting, |p>|countp>+|q|countq>. The count is judged. If countp meets the conditions, the quantum state is marked and becomes -|p>|countp>+|q|countq>, and then the inverse transformation is restored to -|p>|0>+|q|0>.

[0131] The specific marking can be realized by using an X gate and a Z gate. For example, the count of the second counter that meets the preset condition is 4, and the corresponding binary representation is 100. There are 3 quantum bits used for counting in the second counter. If a binary bit is 0, then an X gate is applied to the quantum bit corresponding to the second counter, and then a controlled Z gate is applied to the quantum bit corresponding to 1. The specific diagram can be as follows: Figure 5 As shown, the X gate is then used to add a -1 phase for marking.

[0132] In this application, the first line unit, the first counter and the second counter are treated as a whole, and the dagger is constructed and reset. The final result will be exactly satisfying the conjunction normal form The corresponding quantum state is marked with a -1 phase.

[0133] In the present application, the number of quantum bits required to process the target SAT problem is: k+n+1+[log2(p+1)]+1+[log2(m+1)], where k is the number of basic solutions, the first k quantum bits can be called coefficient bits, which are also the final measurement values, used to encode the coefficients of the basic solutions; n is the number of variables in the target SAT problem, and the corresponding quantum bits can be called assignment bits, with one bit representing one variable; 1 bit is used to determine whether the corresponding text is True under a certain assignment; log2(p+1) is the first counter, used to count the number of correct texts in each clause; 1 bit is used to store whether the value of the first counter is a specified value, which is specified as q for the q-in-p problem, i.e., whether the clause satisfies the q-in-p condition; log2(m+1) is the second counter, used to count the number of clauses that meet the condition.

[0134] S204: Determine a target solution of the target SAT problem based on the initial solution and the target measurement result.

[0135] The data with the highest probability obtained from the measurement is taken as the coefficient v, and ∑ i v i ξ i +ξ, thereby obtaining the solution of the target SAT problem. Exemplarily, the target SAT problem is a q in p SAT problem, where q=1, p=3, m=5, n=8, and the conjunction normal form is: (~x0\ / ~x5\ / ~x6) / \(~x0\ / ~x4\ / x5) / \(x1\ / ~x6\ / x7) / \(~x0\ / x4\ / ~x5) / \(x4\ / x5\ / x7), and the corresponding XORSAT basic solution system (k=4, by row vector) is: [[1.1.0.0.0.1.0.1.] [0.1.0.0.1.1.1.0.] [0.0.0.1.0.0.0.0.] [0.0.1.0.0.0.0.0.]]

[0140] Special solution of XORSAT: [[0.0.0.0.1.0.0.0.]]

[0142] The target measurements are:

[0143] ('0011',0.24999999999999995)

[0144] ('0111',0.24999999999999995)

[0145] ('1011',0.24999999999999995)

[0146] ('1111',0.24999999999999995)

[0147] The solution to the target SAT problem is:

[0148] (array([1.,0.,0.,0.,0.,0.,1.,1.]),0.24999999999999995)

[0149] (array([1.,0.,0.,1.,0.,0.,1.,1.]),0.24999999999999995)

[0150] (array([1.,0.,1.,0.,0.,0.,1.,1.]),0.24999999999999995)

[0151] (array([1.,0.,1.,1.,0.,0.,1.,1.]),0.24999999999999995)

[0152] The target SAT problem may be obtained by processing some specific problems. In some possible implementations of the present application, the target SAT problem may be a Hamiltonian circuit problem.

[0153] The characteristic of a Hamiltonian circuit is that for each point, there are only two edges connected. Therefore, each edge is used as an encoding. For a q-regular (the degree of each point is q) graph with v vertices, there are a total of vq / 2 edges. The corresponding number of Boolean variables are constructed and named after the two vertices connecting this edge. According to the characteristics of the Hamiltonian circuit, the point has a total of q edges connected to it, but there must be only 2 of them as a circuit. Therefore, the Hamiltonian circuit is a 2-in-q SAT. For each point, if and only if 2 of the variables represented by the q edges connected to it are True, its constraint is true, and the corresponding paradigm can be obtained:

[0154]

[0155] in, means the neighborhood of i, True=1, False=0.

[0156] The rank corresponding to this problem is r = v-1, then the size of the null space is nr, and the solution space of XORSAT is 2 n-r . And n=vq / 2, then the solution space of XORSAT is Grover's algorithm can provide quadratic speedup, that is, the complexity is

[0157] In some possible implementations of the present application, the target SAT problem may be a task allocation problem.

[0158] When dealing with the task allocation problem, we can first process the task allocation problem into a bipartite graph, and then process the bipartite graph into a conjunction normal form, in which there are n = MR variables and m = M + N clauses, where M is the number of resources, N is the number of tasks, and R is the number of tasks that a resource can handle. Then, we obtain the corresponding coefficient matrix A and vector b, and solve them to obtain a set of basic solutions and a special solution. Determine the list of restrictions and assign a tuple to each clause, where the first M are (S, R) and the last N are (T, | T j|). When using the Gover algorithm for searching, the number of qubits required is k+n+1+[log2(p+1)]+1+[log2(m+1)]. The first k are coefficient bits, which are used to encode the coefficients of the basic solution and are also the qubits for the final measurement; n is the assignment bit, that is, one variable is represented by one qubit; 1 bit is used to determine whether the corresponding text is True under a certain assignment; log2(p+1) is the first counter, which is used to count the number of correct texts in each clause, p=max j {|T ij |,R} is the maximum value; 1 bit is used to store whether the clause meets the condition of the corresponding tuple; log2(m+1) is the second counter, which is used to count the number of clauses that meet the condition.

[0159] It can be seen that the present application first obtains the linear equations corresponding to the XOR SAT problem corresponding to the target SAT problem and the initial solution of the linear equations; then, based on the initial solution, prepares an initial quantum state consisting of all solutions to the XOR SAT problem; then, using the quantum search circuit, performs evolution and measurement operations on the initial quantum state to obtain the target measurement result; finally, based on the initial solution and the target measurement result, determines the target solution to the target SAT problem. In the present application, the XOR SAT problem corresponding to the target SAT problem is first solved to obtain all solutions to the XOR SAT problem, narrowing the scope of obtaining the solution to the SAT problem, and then using the advantages of quantum computing to search among all solutions, it is possible to accelerate the acquisition of the solution to the target SAT problem, thereby improving the efficiency of solving the SAT problem.

[0160] See also Figure 6 , Figure 6 A schematic diagram of a SAT problem processing device provided in an embodiment of the present application, and Figure 2 Corresponding to the process shown, the device includes:

[0161] A first obtaining module 601 is used to obtain a linear equation system corresponding to an XOR SAT problem corresponding to a target SAT problem and an initial solution of the linear equation system;

[0162] A preparation module 602 is used to prepare an initial quantum state consisting of all solutions of the XOR SAT problem according to the initial solution;

[0163] A second obtaining module 603 is used to use a quantum search circuit to perform evolution and measurement operations on the initial quantum state to obtain a target measurement result;

[0164] The determination module 604 is used to determine a target solution of the target SAT problem based on the initial solution and the target measurement result.

[0165] A target solution to the target SAT problem is determined based on the initial solution and the target measurement result.

[0166] In some possible implementations of the present application, the initial solution may include a basic solution and a special solution;

[0167] The initial quantum state may include:

[0168]

[0169] Where |ψ> is the initial quantum state, k is the number of basic solutions, and v i is the coefficient of the ith basic solution, satisfying v i ={0,1},ξ i is the i-th basic solution, and ξ is the special solution.

[0170] In some possible implementations of the present application, the system of linear equations includes a coefficient matrix and a vector, the coefficient matrix is ​​determined by the characters in the first clause, the vector is determined by the number of negative characters in the first clause and the number of characters whose values ​​are target values ​​in the first clause, and the first clause is a clause of the XOR SAT problem.

[0171] In some possible implementations of the present application, the quantum search circuit includes a quantum circuit constructed based on the Grover algorithm.

[0172] In some possible implementations of the present application, the second obtaining module 603 includes:

[0173] A marking submodule, used to determine a target eigenstate from an initial quantum state using an Oracle subcircuit, and mark the target eigenstate so that the initial quantum state evolves into a new quantum state;

[0174] An amplifier module, used for probabilistically amplifying the eigenstates marked in the new quantum state by using a Graver amplifier operator circuit;

[0175] The acquisition submodule is used to measure the target quantum state obtained after the Graver amplifier circuit acts on it to obtain the target measurement result.

[0176] In some possible implementations of the present application, the marking submodule may be specifically used for:

[0177] The Oracle subcircuit is used to obtain the judgment result of each second clause in the target SAT problem; based on the judgment result of each second clause, the target eigenstate is determined from the initial quantum state.

[0178] In some possible implementations of the present application, the Oracle sub-line may include a first line unit, a first counter corresponding to each second clause, a second counter, and a second line unit;

[0179] The first line unit is used to determine whether the value of the text in the second clause is a target value;

[0180] The first counter is used to update the count when the first line unit determines that the value of a character is the target value;

[0181] The second counter is used to update the count when the count of a first counter reaches a specified value, wherein the specified value is the number of characters assigned to the target value in a preset second clause;

[0182] The second circuit unit is used to determine the target eigenstate from the initial quantum state according to the count of the second counter that meets the preset condition, and mark it, so that the initial quantum state evolves into a new quantum state.

[0183] In some possible implementations of the present application, the first counter includes [log2(p+1)] qubits for counting, where p is the number of literals in a second clause;

[0184] The second counter includes [log2(m+1)] quantum bits for counting, where m is the number of clauses in the target SAT problem.

[0185] In some possible implementations of the present application, the second line unit may be specifically used for:

[0186] obtaining a binary representation of the count of the second counter;

[0187] According to the quantum state corresponding to the obtained value, the target eigenstate is determined from the initial quantum state.

[0188] In some possible implementations of the present application, the target SAT problem may be a Hamiltonian circuit problem.

[0189] In some possible implementations of the present application, the target SAT problem may be a task allocation problem.

[0190] It can be seen that the present application first obtains the linear equations corresponding to the XOR SAT problem corresponding to the target SAT problem and the initial solution of the linear equations; then, based on the initial solution, prepares an initial quantum state consisting of all solutions to the XOR SAT problem; then, using the quantum search circuit, performs evolution and measurement operations on the initial quantum state to obtain the target measurement result; finally, based on the initial solution and the target measurement result, determines the target solution to the target SAT problem. In the present application, the XOR SAT problem corresponding to the target SAT problem is first solved to obtain all solutions to the XOR SAT problem, narrowing the scope of obtaining the solution to the SAT problem, and then using the advantages of quantum computing to search among all solutions, it is possible to accelerate the acquisition of the solution to the target SAT problem, thereby improving the efficiency of solving the SAT problem.

[0191] 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.

[0192] Specifically, in this embodiment, the above storage medium may be configured to store a computer program for implementing the following steps:

[0193] S201: Obtain a linear equation system corresponding to the XOR SAT problem corresponding to the target SAT problem and an initial solution of the linear equation system;

[0194] S202: According to the initial solution, prepare an initial quantum state consisting of all solutions to the XOR SAT problem;

[0195] S203: using a quantum search circuit to perform evolution and measurement operations on the initial quantum state to obtain a target measurement result;

[0196] S204: Determine a target solution of the target SAT problem based on the initial solution and the target measurement result.

[0197] 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.

[0198] 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.

[0199] Specifically, in this embodiment, the processor may be configured to implement the following steps through a computer program:

[0200] S201: Obtain a linear equation system corresponding to the XOR SAT problem corresponding to the target SAT problem and an initial solution of the linear equation system;

[0201] S202: According to the initial solution, prepare an initial quantum state consisting of all solutions to the XOR SAT problem;

[0202] S203: using a quantum search circuit to perform evolution and measurement operations on the initial quantum state to obtain a target measurement result;

[0203] S204: Determine a target solution of the target SAT problem based on the initial solution and the target measurement result.

[0204] The above describes in detail the structure, features and effects of the present application based on the embodiments shown in the drawings. The above is only a preferred embodiment of the present application, but the present application does not limit the scope of implementation to what is shown in the drawings. Any changes made in accordance with the concept of the present application, or modifications to equivalent embodiments with equivalent changes, which still do not exceed the spirit covered by the description and drawings, should be within the protection scope of the present application.

Claims

1. A method for processing SAT problems, characterized in that: The method comprises: Obtain a linear equation system corresponding to the XOR SAT problem corresponding to the target SAT problem and an initial solution of the linear equation system; According to the initial solution, preparing an initial quantum state consisting of all solutions to the XOR SAT problem; Using a quantum search circuit, executing evolution and measurement operations on the initial quantum state to obtain a target measurement result; A target solution to the target SAT problem is determined based on the initial solution and the target measurement result.

2. The method according to claim 1, characterized in that The initial solution includes a basic solution and a special solution; The initial quantum state comprises: Where |ψ> is the initial quantum state, k is the number of basic solutions, and v i is the coefficient of the ith basic solution, satisfying v i ={0,1},ξ i is the i-th basic solution, and ξ is the special solution.

3. The method according to claim 1, characterized in that: The linear equation system includes a coefficient matrix and a vector, wherein the coefficient matrix is ​​determined by the characters in the first clause, and the vector is determined by the number of negative characters in the first clause and the number of characters whose values ​​are target values ​​in the first clause, and the first clause is a clause of the XOR SAT problem.

4. The method according to claim 1, characterized in that: The quantum search circuit includes a quantum circuit constructed based on the Grover algorithm.

5. The method according to claim 4, characterized in that The use of the quantum search circuit to perform the evolution and measurement operations on the initial quantum state to obtain the target measurement result includes: Using the Oracle subcircuit, a target eigenstate is determined from the initial quantum state, and the target eigenstate is marked so that the initial quantum state evolves into a new quantum state; Using the Graver amplification operator circuit, the probability of the marked eigenstate in the new quantum state is amplified; The target quantum state obtained after the Graver amplifier circuit acts is measured to obtain a target measurement result.

6. The method according to claim 5, characterized in that The method of using the Oracle subcircuit to determine the target eigenstate from the initial quantum state includes: The Oracle subcircuit is used to obtain the judgment result of each second clause in the target SAT problem; based on the judgment result of each second clause, the target eigenstate is determined from the initial quantum state.

7. The method according to claim 6, characterized in that The Oracle sub-circuit includes a first circuit unit, a first counter corresponding to each second clause, a second counter, and a second circuit unit; The first line unit is used to determine whether the value of the text in the second clause is a target value; The first counter is used to update the count when the first line unit determines that the value of a character is the target value; The second counter is used to update the count when the count of a first counter reaches a specified value, wherein the specified value is the number of characters assigned to the target value in a preset second clause; The second circuit unit is used to determine the target eigenstate from the initial quantum state according to the count of the second counter, and mark it, so that the initial quantum state evolves into a new quantum state.

8. The method according to claim 7, characterized in that The first counter includes [log2(p+1)] qubits for counting, where p is the number of literals in a second clause; The second counter includes [log2(m+1)] quantum bits for counting, where m is the number of clauses in the target SAT problem.

9. The method according to claim 7, characterized in that: Determining the target eigenstate from the initial quantum state according to the count of the second counter includes: obtaining a binary representation of the count of the second counter; According to the quantum state corresponding to the obtained value, the target eigenstate is determined from the initial quantum state.

10. The method according to any one of claims 1 to 9, characterized in that: The target SAT problem is a Hamiltonian circuit problem.

11. The method according to any one of claims 1 to 9, characterized in that: The target SAT problem is a task assignment problem.

12. A device for processing SAT problems, characterized in that: The device comprises: A first obtaining module is used to obtain a linear equation system corresponding to an XOR SAT problem corresponding to a target SAT problem and an initial solution of the linear equation system; A preparation module, used for preparing an initial quantum state consisting of all solutions of the XOR SAT problem according to the initial solution; A second acquisition module is used to use a quantum search circuit to perform evolution and measurement operations on the initial quantum state to obtain a target measurement result; A determination module is used to determine a target solution of the target SAT problem based on the initial solution and the target measurement result.

13. 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 11 when executed.

14. An electronic device comprising a memory and a processor, characterized in that: The memory stores a computer program, and the processor is configured to execute the computer program to implement the method according to any one of claims 1 to 11.