Quantum classical hybrid calculation method and device
Through linearization of the quadratic constrained binary optimization model and the solution of quantum computers, the 0-1 binary optimization problem under nonlinear constraints is solved, which simplifies hyperparameter adjustment and complexity and improves the solution efficiency.
Patent Information
- Application Number
- CN202410811377.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-12-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When the prior art deals with the 0-1 binary optimization problem with nonlinear constraints, there are problems such as complex hyperparameter adjustment, high constraint complexity and limited nonlinear constraint processing capabilities.
By performing linear operations on the binary optimization model of quadratic constraints, the objective function and constraint conditions become linear forms, the variable matrix and linear mapping operator are set, the residual vector is calculated and the parameters are updated, and the quadratic unconstrained are solved using quantum computers to solve the quadratic unconstrained Binary optimization problem until the final solution is obtained.
There is no need to adjust the penalty coefficient, which simplifies the solution process and effectively deals with nonlinear constraints, reduces the complexity of the problem and the difficulty of solving it, and improves the solution efficiency.
Smart Images

Figure CN119180346A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of quantum computing technology, and in particular to a quantum-classical hybrid computing method and device. Background Art
[0002] At present, quantum computing has gradually become an important tool for solving complex optimization problems. In particular, for 0-1 binary optimization problems, quantum computing devices such as quantum annealing and Ising machine have demonstrated their excellent performance in solving quadratic unconstrained binary optimization (QUBO) problems. However, many optimization problems in the prior art are not completely unconstrained, but usually contain complex constraints. In the prior art, when using quantum computing devices to process the above-mentioned optimization problems with constraints, it is usually necessary to first convert the optimization problems with constraints into optimization problems without constraints, that is, to add the constraints to the objective function through the penalty method.
[0003] However, the above conversion method has the following significant disadvantages:
[0004] 1) Hyperparameter adjustment problem: The penalty function method requires the introduction of penalty coefficients to weigh the relationship between the objective function and the constraints. The choice of these penalty coefficients directly affects the quality of the final solution. However, finding the right penalty coefficient usually requires a lot of trial and error and experience, which makes this process time-consuming and complicated.
[0005] 2) Constraint complexity: When a problem contains multiple constraints, the number of penalty coefficients will increase accordingly. Since each penalty coefficient needs to be adjusted independently, when the number of constraints increases, the adjustment space of the penalty coefficient will increase exponentially, greatly increasing the complexity of the problem and the difficulty of solving it.
[0006] 3) Processing of nonlinear constraints: Existing methods that do not rely on penalty functions mainly focus on processing linear constraints. For nonlinear constraints, such as nonlinear constraints in polynomial form, the processing capabilities are limited and it is difficult to effectively solve these problems. Summary of the invention
[0007] In view of this, the present invention provides a quantum classical hybrid computing method and device, which can effectively solve the 0-1 binary optimization problem with nonlinear constraints.
[0008] The technical solution of the present invention is specifically achieved as follows:
[0009] A method for quantum classical hybrid computing, the method comprising:
[0010] Performing linearization operation on the objective function and constraint conditions in the quadratic constraint binary optimization model, so that the expression of the objective function after the linearization operation is an expression of degree not exceeding quadratic, and the constraint conditions after the linearization operation are linear constraint conditions;
[0011] According to the objective function, constraints and corresponding co-optimization problem after linearization operation, the corresponding variable matrix and linear mapping operator are set;
[0012] The residual vector is calculated based on the current variable matrix and the linear mapping operator;
[0013] According to the current linear mapping operator, the first step length, the second step length, the first Lagrange multiplier, the second Lagrange multiplier, the residual vector and the objective function, the corresponding quadratic unconstrained binary optimization coefficient matrix is calculated;
[0014] Solve the quadratic unconstrained binary optimization problem corresponding to the current quadratic unconstrained binary optimization coefficient matrix to obtain the current solution vector;
[0015] Determine the iteration direction of the current solution vector according to the current solution vector, and use the first step length to update the variable matrix, and use the updated variable matrix as the current variable matrix;
[0016] When the current number of iterations is less than or equal to the preset iteration threshold, the first step length, the second step length, the first Lagrange multiplier and the second Lagrange multiplier are updated, and the step of calculating the residual vector according to the current variable matrix and the linear mapping operator is returned;
[0017] When the current number of iterations is greater than a preset iteration threshold, a rounding operation is performed on the current variable matrix, and a vector is extracted from the variable matrix after the rounding operation as the final solution.
[0018] Preferably, the linearization operation of the objective function and the constraint conditions in the quadratic constraint binary optimization model includes:
[0019] When there is a product of any two decision variables in the objective function and the constraints, an auxiliary qubit is added, and the product of the two decision variables is replaced by an auxiliary qubit variable corresponding to the auxiliary qubit, and additional corresponding linear constraints are added so that the value of the auxiliary qubit variable is correct.
[0020] Preferably, before linearizing the objective function and the constraint conditions in the quadratic constraint binary optimization model, the method further comprises:
[0021] A corresponding quadratic constraint binary optimization model is established according to the problem to be solved, and the objective function and constraint conditions of the quadratic constraint binary optimization model are determined.
[0022] Preferably, the objective function and constraint conditions in the quadratic constraint binary optimization model are expressed as:
[0023] min x T Qx
[0024] stp i (x)≤0,1≤i≤m
[0025] Where x is a vector of decision variables, Q is the coefficient matrix of the quadratic objective function, m is the number of constraints, pi(x)≤0 is the expression of the i-th constraint, and pi(x) is a polynomial function.
[0026] Preferably, the objective function and constraints after linearization are expressed as:
[0027] min x T Qx
[0028] sA eq x=b eq
[0029] A ineq x≤b ineq
[0030] Among them, x is a vector composed of decision variables, Q is the coefficient matrix of the quadratic objective function, and A eq is the coefficient matrix in the equality constraint, b eq is the equation constant term in the equality constraint, A ineg is the coefficient matrix in the inequality constraint, b ineg is the inequality constant term in the inequality constraint.
[0031] Preferably, the setting of the corresponding variable matrix and linear mapping operator includes:
[0032] Set a variable matrix whose dimension is the length of vector x plus 1;
[0033] A first linear mapping operator and a second linear mapping operator are set; wherein the first linear mapping operator and the second linear mapping operator are respectively used to map the variable matrix into a corresponding vector.
[0034] Preferably, the calculation of the residual vector according to the current variable matrix and the linear mapping operator may include:
[0035] The residual vector includes: an equality residual vector and an inequality residual vector;
[0036] Using a first linear mapping operator to map the current variable matrix into a first mapping vector, and obtaining an equation residual vector according to a difference between the first mapping vector and its corresponding constant vector;
[0037] Using the second linear mapping operator The current variable matrix V is mapped to a second mapping vector, and the inequality residual vector r is obtained according to the difference between the projection area of the second mapping vector and its corresponding constant vector ineq .
[0038] Preferably, before calculating the residual vector according to the current variable matrix and the linear mapping operator, the method further comprises:
[0039] Initialize the first step size, second step size, variable matrix, first Lagrange multiplier, and second Lagrange multiplier.
[0040] Preferably, the corresponding quadratic unconstrained binary optimization coefficient matrix is calculated by the following formula:
[0041]
[0042] Among them, Q is the coefficient matrix of the quadratic objective function, They are the first linear mapping operators and the second linear mapping operator The adjoint operator, y eq is the first Lagrange multiplier, y ineq is the second Lagrange multiplier, β is the second step length, r eq is the residual vector of the equation, r ineq is the inequality residual vector.
[0043] Preferably, a quantum computer is used to solve the quadratic unconstrained binary optimization problem corresponding to the current quadratic unconstrained binary optimization coefficient matrix to obtain a current solution vector.
[0044] Preferably, the variable matrix is updated according to the following formula:
[0045] (1-α)V+αxx T
[0046] Among them, α is the first step length, V is the variable matrix, and x is the current solution vector.
[0047] Preferably, the rounding operation on the current variable matrix includes:
[0048] The values of the elements in the current variable matrix V whose values are not less than 0.5 are set to 1, and the values of the elements whose values are less than 0.5 are set to 0.
[0049] Preferably, the values of the first step length and the second step length are updated by the following formula:
[0050]
[0051] Among them, α is the first step length, β is the second step length, and k is the current number of iterations.
[0052] Preferably, the updating of the values of the first Lagrangian multiplier and the second Lagrangian multiplier includes:
[0053] Calculate the sum of the current first Lagrange multiplier and the current equation residual vector, and use the sum as the current first Lagrange multiplier;
[0054] The sum of the current second Lagrange multiplier and the current inequality residual vector is taken as the current second Lagrange multiplier.
[0055] The present application also proposes a quantum classical hybrid computing device, which includes: a linearization module, a linear mapping module, a first computing module and a second computing module;
[0056] The linearization module is used to perform a linearization operation on the objective function and the constraint conditions in the quadratic constraint binary optimization model, so that the expression of the objective function after the linearization operation is an expression of degree not exceeding quadratic, and the constraint conditions after the linearization operation are linear constraint conditions;
[0057] The linear mapping module is used to set the corresponding variable matrix and linear mapping operator according to the objective function, constraint conditions and corresponding co-normal optimization problem after the linearization operation; and calculate the residual vector according to the current variable matrix and linear mapping operator;
[0058] The first calculation module is used to calculate the corresponding quadratic unconstrained binary optimization coefficient matrix according to the current linear mapping operator, the first step length, the second step length, the first Lagrange multiplier, the second Lagrange multiplier, the residual vector and the objective function; determine the iteration direction of the current solution vector according to the current solution vector, and use the first step length to update the variable matrix, and use the updated variable matrix as the current variable matrix; when the current number of iterations is greater than a preset iteration threshold, round the current variable matrix, and extract a vector from the variable matrix after the rounding operation as the final solution; when the current number of iterations is less than or equal to the preset iteration threshold, update the first step length, the second step length, the first Lagrange multiplier and the second Lagrange multiplier; return to execute the step of calculating the residual vector according to the current variable matrix and the linear mapping operator;
[0059] The second calculation module is used to solve the quadratic unconstrained binary optimization problem corresponding to the current quadratic unconstrained binary optimization coefficient matrix to obtain a current solution vector.
[0060] Preferably, the second computing module is a quantum computer.
[0061] Preferably, the quantum computer is a quantum annealing machine or a coherent Ising machine.
[0062] As can be seen from the above, in the quantum classical hybrid computing method and device of the present invention, since the objective function and the constraint conditions in the QCBO model are first linearized, the expression of the objective function after the linearization operation is an expression of no more than two times, and the constraint conditions after the linearization operation are linear constraints, and then the corresponding variable matrix and linear mapping operator are set, and then the residual vector is calculated according to the current variable matrix and the linear mapping operator, and then the current linear mapping operator, the first step length, the second step length, the first Lagrange multiplier, the second Lagrange multiplier, the residual vector and the objective function are calculated to obtain The corresponding QUBO coefficient matrix is obtained, and then the QUBO problem corresponding to the current QUBO coefficient matrix is solved to obtain the current solution vector. The iteration direction of the current solution vector is determined according to the current solution vector, and the variable matrix is updated with the first step size. Then the first step size, the second step size, the first Lagrange multiplier and the second Lagrange multiplier are updated to perform the next iteration. After completing the preset number of iterations, the current variable matrix V can be rounded to obtain the final optimal solution, so that the above-mentioned quantum classical hybrid calculation can be used to effectively solve the 0-1 binary optimization problem with nonlinear constraints. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 It is a schematic flow chart of a quantum classical hybrid computing method in a specific embodiment of the present invention.
[0064] Figure 2 It is a schematic diagram of a quantum classical hybrid computing device in a specific embodiment of the present invention. DETAILED DESCRIPTION
[0065] In order to make the technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0066] Figure 1 Schematic diagram of the flow of the quantum classical hybrid computing method in an embodiment of the present invention.
[0067] like Figure 1 As shown, the quantum classical hybrid computing method in the embodiment of the present invention includes the following steps:
[0068] Step 101, linearize the objective function and constraint conditions in the quadratic constrained binary optimization (QCBO) model, so that the expression of the objective function after the linearization operation is an expression of degree not exceeding quadratic, and the constraint conditions after the linearization operation are linear constraint conditions.
[0069] The technical solution of the present application can be used to solve constrained 0-1 binary optimization problems, for example, quadratic constrained binary optimization (QCBO, Quadratic Constrained Binary Optimization) problems.
[0070] When solving the above constrained 0-1 binary optimization problem, the penalty method can be used to multiply the corresponding constraint term by a penalty function and then add it to the objective function, thereby converting the above constrained 0-1 binary optimization problem into an unconstrained 0-1 binary optimization problem, such as the quadratic unconstrained binary optimization (QUBO) problem. However, when using the above method, it is usually necessary to adjust the penalty coefficient of the penalty function multiple times to find a parameter value with a better effect. When there are more constraints, the value space of the penalty coefficient will grow exponentially.
[0071] In the technical solution of the present application, the objective function and constraints in the QCBO model can be first linearized, so that the expression of the objective function after the linearization operation is an expression of degree not exceeding quadratic, and all the constraints after the linearization operation are linear constraints, so as to facilitate subsequent calculations.
[0072] In the technical solution of the present application, the above linearization operation can be performed through a variety of specific implementations. The following will take one or more of the specific implementations as examples to introduce the technical solution of the present application.
[0073] For example, as an example, in a preferred specific embodiment of the present application, the linearization operation of the objective function and the constraint conditions in the quadratic constraint binary optimization model may include:
[0074] When there is a product of any two decision variables in the objective function and the constraints, an auxiliary qubit is added, and the product of the two decision variables is replaced by an auxiliary qubit variable corresponding to the auxiliary qubit, and additional linear constraints are added so that the value of the auxiliary qubit variable is correct.
[0075] For example, assume that the objective function and constraints in the QCBO model are expressed as:
[0076] min x T Qx
[0077] stp i (x)≤0,1≤i≤m
[0078] Wherein, x represents a vector composed of decision variables, each decision variable is a binary variable (i.e., a variable that can only take two preset values, which can be 0 or 1, or two other values); Q is the quadratic objective function coefficient matrix, each element in the matrix represents the interaction intensity between decision variables; m is the number of constraints; pi(x)≤0 represents the i-th constraint expression, where p is a polynomial function.
[0079] If there is a product x of two decision variables in the objective function or constraint conditions in the above QCBO model i x j , we can add an auxiliary qubit and multiply the two decision variables x i x j Replaced with the auxiliary qubit variable x corresponding to the added auxiliary qubit ij , and at the same time add the corresponding linear constraints to make the value of the auxiliary quantum bit variable correct:
[0080] x ij ≤x i
[0081] x ij ≤x j
[0082] x ij ≥x i +x j -1
[0083] Among them, x i represents the i-th decision variable, x j represents the jth decision variable, x ij Represents an auxiliary qubit variable.
[0084] By means of the above-mentioned added linear constraints, the objective function and / or constraints before the linearization operation can be made equivalent to the objective function and / or constraints after the linearization operation.
[0085] Through the above linearization operation, the objective function and constraints after the linearization operation can be expressed as:
[0086] minx T Qx
[0087] sA eq x=b eq
[0088] Aineq x≤b ineq
[0089] Among them, x is the vector of decision variables, Q is the coefficient matrix of the quadratic objective function, and A eq is the coefficient matrix in the equality constraint, b eq is the equation constant term in the equality constraint, A ineq is the coefficient matrix in the inequality constraint, b ineq is the inequality constant term in the inequality constraint.
[0090] Through the above linearization operation, the purpose of reducing the degree of expression of the objective function and the constraint conditions can be achieved.
[0091] By analogy, the above operations can be repeated multiple times to reduce the degree of the expressions of the objective function and the constraints, until the expression of the objective function is an expression of degree not exceeding quadratic, and the constraints are linear constraints.
[0092] In addition, as an example, in a preferred specific embodiment of the present application, before the above step 101, the following may be further included:
[0093] A corresponding quadratic constrained binary optimization (QCBO) model is established according to the problem to be solved, and the objective function and constraint conditions of the quadratic constrained binary optimization model are determined.
[0094] In actual application scenarios, a QCBO model corresponding to the optimization problem to be solved can be first established, and the objective function and constraints corresponding to the model can be determined; then, the above-mentioned step 101 is performed to linearize the objective function and constraints in the QCBO model, so that the expression of the objective function after the linearization operation is an expression of no more than two degrees, and the constraints after the linearization operation are linear constraints.
[0095] Step 102, according to the objective function after the linearization operation, the constraint conditions and the corresponding co-optimization problem, set the corresponding variable matrix and linear mapping operator.
[0096] In the technical solution of the present application, the 0-1 binary optimization problem can be equivalently converted into a copositive optimization (copositive programming) problem based on copositive cone. The equivalence of the above conversion can be proved by corresponding theories. Due to limited space, the specific proof process will not be introduced in detail here.
[0097] Therefore, in order to convert the QCBO problem into the corresponding co-positive optimization problem, the corresponding variable matrix V and linear mapping operator can be set, wherein the specific form of the linear mapping operator is related to the form of the corresponding co-positive optimization problem.
[0098] For example, as an example, in a preferred specific embodiment of the present application, the setting of the corresponding variable matrix may include:
[0099] Set up a variable matrix V whose dimension is the length of vector x plus 1.
[0100] For example, when the length of the vector x is 3 (ie, the vector x contains 3 decision variables), the dimension of the variable matrix V is 4, and the variable matrix V is a 4×4 square matrix.
[0101] For another example, as an example, in a preferred specific embodiment of the present application, the setting of the corresponding linear mapping operator may include:
[0102] Set the first linear mapping operator and the second linear mapping operator Among them, the first linear mapping operator and the second linear mapping operator can be used to map the variable matrix V into corresponding vectors respectively.
[0103] For example:
[0104]
[0105] in, Indicates A eq The i-th row of Indicates A ineq The i-th row of They are and The adjoint operator of .
[0106] Step 103, calculating a residual vector according to the current variable matrix and the linear mapping operator.
[0107] In the technical solution of the present application, the corresponding residual vector can be calculated based on the current variable matrix V and the linear mapping operator.
[0108] For example, as an example, in a preferred specific embodiment of the present application, the calculation of the residual vector according to the current variable matrix V and the linear mapping operator may include:
[0109] The linear mapping operator comprises: a first linear mapping operator and the second linear mapping operator
[0110] The residual vector includes: eq and inequality residual vector r ineq ;
[0111] Using the first linear mapping operator Map the current variable matrix V to the first mapping vector, and obtain the residual vector r of the equation according to the difference between the first mapping vector and its corresponding constant vector eq ;
[0112] Using the second linear mapping operator The current variable matrix V is mapped to a second mapping vector, and the inequality residual vector r is obtained according to the difference between the projection area of the second mapping vector and its corresponding constant vector ineq .
[0113] For example, in a preferred specific embodiment of the present application, the above step 103 can be expressed as:
[0114]
[0115] in,
[0116]
[0117]
[0118] Among them, V is the current variable matrix, r eq is the residual vector of the equation, c eq is the first linear mapping operator The corresponding constant vector, r ineq is the inequality residual vector, proj is the projection operation, is the second linear mapping operator The corresponding constant vector, y eq is the first Lagrange multiplier, y ineq is the second Lagrange multiplier, α is the first step length, and β is the second step length.
[0119] In addition, in the technical solution of the present application, various parameters required for use may be initialized in advance so that the various parameters have corresponding initial values to facilitate subsequent calculations or processes.
[0120] For example, as an example, in a preferred specific embodiment of the present application, before the above step 103, the following may be further included:
[0121] Initialize the first step size, the second step size, the variable matrix V, the first Lagrange multiplier, and the second Lagrange multiplier.
[0122] The above initialization operation can pre-set the specific values of the first step length, the second step length, the variable matrix V, the first Lagrange multiplier and the second Lagrange multiplier. The specific values can be pre-set according to the needs of the actual application scenario, and can be any suitable values, so the specific values are not listed here one by one.
[0123] Step 104, calculate and obtain the corresponding QUBO coefficient matrix according to the current linear mapping operator, the first step size, the second step size, the first Lagrange multiplier, the second Lagrange multiplier, the residual vector and the objective function.
[0124] In the technical solution of the present application, a conditional gradient algorithm can be used to minimize the co-normal optimization problem. The conditional gradient algorithm is an iterative algorithm for solving convex optimization problems. Its main idea is to find the direction of iteration by solving the linear optimization problem in the current feasible domain in each iteration. Therefore, in the present application, each step of minimization in the conditional gradient algorithm is equivalent to the first-order approximation at the current solution matrix, and the optimization problem about the solution matrix V can be equivalent to a QUBO problem, and the QUBO coefficient matrix in the QUBO problem can be calculated by the above-mentioned linear mapping operator.
[0125] Therefore, in this step, the corresponding QUBO coefficient matrix can be calculated according to the current parameters or elements, namely, the current linear mapping operator, the current first step size, the current second step size, the current first Lagrange multiplier, the current second Lagrange multiplier, the current residual vector and the current objective function.
[0126] For example, as an example, in a preferred specific embodiment of the present application, the following formula can be used for calculation to obtain the corresponding QUBO coefficient matrix:
[0127]
[0128] Among them, Q is the coefficient matrix of the quadratic objective function, They are the first linear mapping operators and the second linear mapping operator The adjoint operator, y eq is the first Lagrange multiplier, y ineq is the second Lagrange multiplier, β is the second step length, r eq is the residual vector of the equation, r ineq is the inequality residual vector.
[0129] Through this step, the current first Lagrange multiplier and second Lagrange multiplier can be fixed, which is equivalent to performing one-step iteration of the conditional gradient algorithm on the variable matrix V.
[0130] Step 105, solving the QUBO problem corresponding to the current QUBO coefficient matrix to obtain the current solution vector.
[0131] In the technical solution of the present application, after obtaining the above-mentioned QUBO coefficient matrix, the QUBO problem corresponding to the current QUBO coefficient matrix can be solved to obtain the current solution vector x, thereby obtaining the next iteration direction x of the current variable matrix V. T .
[0132] In addition, as an example, in a preferred specific embodiment of the present application, a suitable data processing device can be used to solve the QUBO problem corresponding to the current QUBO coefficient matrix to obtain the current solution vector.
[0133] Although the co-normal optimization problem is a convex optimization problem, simply converting the 0-1 binary optimization problem into a co-normal optimization problem does not change the difficulty of the problem, because the simplest verification of whether a matrix belongs to a co-normal cone is an NP-complete problem. Therefore, when iterating according to the conditional gradient algorithm, the linear optimization problem on the co-normal cone that needs to be solved in each iteration is actually also an NP-hard problem.
[0134] Quantum computers use quantum bits (qubits) to represent binary variables and use superposition and entangled states in quantum mechanics to perform calculations. Therefore, through the excellent parallel computing capabilities of quantum computers, the QUBO problem corresponding to the current QUBO coefficient matrix can be solved to obtain the current solution vector.
[0135] For example, as an example, in a preferred specific embodiment of the present application, a quantum computer can be used to solve the QUBO problem corresponding to the current QUBO coefficient matrix to obtain the current solution vector.
[0136] For another example, as an example, in a preferred specific embodiment of the present application, the quantum computer may be a quantum computer such as a quantum annealing machine or a coherent Ising machine (CIM).
[0137] For example, CIM is a quantum computer based on a degenerate optical parametric oscillator (DOPO), a hybrid quantum computing system that can include an optical part and an electrical part. The optical part can include a laser, an amplifier, a periodically poled lithium niobate crystal (PPLN), and an optical fiber loop. The laser can be a femtosecond pulse fiber laser with an amplifier system. The amplified laser is first frequency-doubled using a PPLN crystal; the frequency-doubled laser is used as a pump source to synchronously pump a PPLN crystal in an optical fiber loop to form a degenerate optical parametric oscillation; hundreds of oscillation pulses can exist simultaneously in the optical fiber loop. The electrical part can include a field programmable gate array (FPGA), a digital analog / analog digital conversion (AD / DA), and a phase detection part. The laser output from the optical fiber loop and the baseband laser are measured by a phase detector, and the phase of the output light can be tested. FPGA is used with high-speed AD / DA to measure and feedback control optical pulses.
[0138] Unlike classical computers that run on semiconductor integrated circuits, CIM uses laser pulses in optical fibers as quantum bits for calculations. In DOPO, pump light is incident on a nonlinear optical crystal and split into two beams of light. The two beams have the same polarization direction and half the frequency of the pump light. They are in a compressed state and can be used as a quantum bit. By gradually increasing the power of the pump light and exceeding the oscillation threshold, the generated light becomes a coherent state, and the phase of the light is divided into two states (phase 0 state and π state). At this time, the phase can be set to ±1 of the spin to solve the optimization problem.
[0139] Therefore, in the technical solution of the present application, a quantum computer can be used to solve the QUBO problem corresponding to the current QUBO coefficient matrix, thereby greatly improving the solution efficiency and obtaining the current solution vector more quickly.
[0140] Step 106, determining the iteration direction of the current solution vector according to the current solution vector, and using the first step length to update the variable matrix, and using the updated variable matrix as the current variable matrix.
[0141] In the technical solution of the present application, after obtaining the current solution vector, the iteration direction of the current solution vector can be determined according to the current solution vector, and the variable matrix is updated using the first step length, and then the updated variable matrix is used as the current variable matrix V.
[0142] For example, as an example, in a preferred specific embodiment of the present application, the variable matrix can be updated according to the following formula:
[0143] (1-α)V+αxx T
[0144] Among them, α is the first step length, V is the variable matrix, and x is the current solution vector.
[0145] The above operation of updating the variable matrix can actually be the value of the variable matrix before the update and the next iteration direction x T The weighted sum of can ensure that the variable matrix V is always in the feasible domain of the co-positive optimization problem.
[0146] Step 107, when the current number of iterations is greater than a preset iteration threshold, rounding operation is performed on the current variable matrix V, and the variable matrix V after the rounding operation is used as the optimal solution; otherwise, execute step 108.
[0147] In this step, it can be determined whether the current number of iterations is greater than the preset iteration value. If the current number of iterations is greater than the preset iteration threshold, it means that the preset number of iterations has been completed, so the current variable matrix V can be rounded, and the variable matrix V after the rounding operation is used as the optimal solution.
[0148] If the current number of iterations is less than or equal to the preset iteration threshold, it means that the preset number of iterations has not been completed, so step 108 will be executed to continue to the next iteration.
[0149] In the technical solution of the present application, the value of the above iteration threshold can be preset according to the needs of the actual application scenario, so as to achieve satisfactory results. The specific value of the iteration threshold can be any suitable value, so the specific values are not listed here one by one.
[0150] In addition, as an example, in a preferred specific embodiment of the present application, the rounding operation on the current variable matrix V may include:
[0151] The values of the elements in the current variable matrix V whose values are not less than 0.5 are set to 1, and the values of the elements whose values are less than 0.5 are set to 0.
[0152] In addition, in the technical solution of the present application, the above-mentioned rounding operation can also be performed in other ways (for example, setting the values of elements in the current variable matrix V whose values are not less than 0.6 to 1, setting the values of elements whose values are less than 0.6 to 0, etc.), which are not listed one by one here.
[0153] Through the above rounding operation, the values of each element of the variable matrix V after the rounding operation can be made to be integers 0 or 1, and the solution matrix is obtained. Therefore, the variable matrix V after the above rounding operation can be used as the final optimal solution, and the whole process ends.
[0154] Step 108 , updating the first step length, the second step length, the first Lagrange multiplier and the second Lagrange multiplier, and returning to execute step 103 .
[0155] In the technical solution of the present application, if the current number of iterations is less than or equal to a preset iteration threshold, it means that the preset number of iterations has not been completed, so the first step length, the second step length, the first Lagrangian multiplier and the second Lagrangian multiplier are updated, and then the process returns to step 103 to continue with the next iteration.
[0156] In the technical solution of the present application, the first step length, the second step length, the first Lagrange multiplier and the second Lagrange multiplier can be updated through a variety of specific implementations. The technical solution of the present application will be introduced below by taking one or more of the specific implementations as examples.
[0157] For example, as an example, in a preferred specific embodiment of the present application, the values of the first step length and the second step length can be updated by the following formula:
[0158]
[0159] Among them, α is the first step length, β is the second step length, and k is the current number of iterations.
[0160] For another example, as an example, in a preferred specific embodiment of the present application, the updating of the values of the first Lagrangian multiplier and the second Lagrangian multiplier may include:
[0161] Calculate the sum of the current first Lagrange multiplier and the current equation residual vector, and use the sum as the current first Lagrange multiplier;
[0162] The sum of the current second Lagrange multiplier and the current inequality residual vector is taken as the current second Lagrange multiplier.
[0163] Therefore, the values of the first step length, the second step length, the first Lagrange multiplier and the second Lagrange multiplier can be updated through the above specific implementation method.
[0164] Therefore, through the above steps 101 to 108, the above quantum classical hybrid calculation can be used to effectively solve the 0-1 binary optimization problem with nonlinear constraints, for example, the QCBO problem with nonlinear constraints.
[0165] In addition, in the technical solution of the present application, a quantum-classical hybrid computing device is also proposed.
[0166] Figure 2 FIG. 1 is a schematic diagram of the structure of a quantum classical hybrid computing device in a specific embodiment of the present invention. Figure 2 As shown, the quantum classical hybrid computing device in the embodiment of the present invention includes: a linearization module 201, a linear mapping module 202, a first computing module 203 and a second computing module 204;
[0167] The linearization module is used to perform a linearization operation on the objective function and the constraint conditions in the quadratic constrained binary optimization (QCBO) model, so that the expression of the objective function after the linearization operation is an expression of degree not exceeding quadratic, and the constraint conditions after the linearization operation are linear constraint conditions;
[0168] The linear mapping module is used to set the corresponding variable matrix and linear mapping operator according to the objective function, constraint conditions and corresponding co-normal optimization problem after the linearization operation; and calculate the residual vector according to the current variable matrix and linear mapping operator;
[0169] The first calculation module is used to calculate the corresponding QUBO coefficient matrix according to the current linear mapping operator, the first step length, the second step length, the first Lagrange multiplier, the second Lagrange multiplier, the residual vector and the objective function; determine the iteration direction of the current solution vector according to the current solution vector, and use the first step length to update the variable matrix, and use the updated variable matrix as the current variable matrix; when the current number of iterations is greater than the preset iteration threshold, round the current variable matrix V, and use the variable matrix V after the rounding operation as the optimal solution; when the current number of iterations is less than or equal to the preset iteration threshold, update the first step length, the second step length, the first Lagrange multiplier and the second Lagrange multiplier; return to execute the step of calculating the residual vector according to the current variable matrix and the linear mapping operator;
[0170] The second calculation module is used to solve the QUBO problem corresponding to the current QUBO coefficient matrix to obtain a current solution vector.
[0171] In addition, as an example, in a preferred specific embodiment of the present application, the second computing module may be a quantum computer.
[0172] In addition, as an example, in a preferred specific embodiment of the present application, the quantum computer may be a quantum computer such as a quantum annealing machine or a coherent Ising machine (CIM), or may be other suitable quantum computers.
[0173] In summary, in the technical solution of the present application, the objective function and the constraints in the QCBO model are first linearized, so that the expression of the objective function after the linearization operation is an expression of no more than two degrees, and the constraints after the linearization operation are linear constraints, and then the corresponding variable matrix and linear mapping operator are set, and then the residual vector is calculated according to the current variable matrix and the linear mapping operator, and then the corresponding QUBO coefficient matrix is calculated according to the current linear mapping operator, the first step size, the second step size, the first Lagrange multiplier, the second Lagrange multiplier, the residual vector and the objective function, and then The QUBO problem corresponding to the current QUBO coefficient matrix is solved to obtain the current solution vector, the iteration direction of the current solution vector is determined according to the current solution vector, and the variable matrix is updated with the first step size, and then the first step size, the second step size, the first Lagrange multiplier and the second Lagrange multiplier are updated to perform the next iteration; after completing the preset number of iterations, the current variable matrix V can be rounded to obtain the final optimal solution, so that the above-mentioned quantum classical hybrid calculation can be used to effectively solve the 0-1 binary optimization problem with nonlinear constraints, for example, the QCBO problem with nonlinear constraints.
[0174] Therefore, the technical solution of the present application has the following advantages:
[0175] 1) No need to adjust hyperparameters:
[0176] The technical solution of the present application does not rely on the penalty function method, so there is no need to adjust the penalty coefficient hyperparameter. By adopting the above processing method, the constrained optimization problem can be solved directly, which can greatly simplify the solution process and reduce the complexity and uncertainty of manual adjustment.
[0177] 2) Effectively handle nonlinear constraints:
[0178] The prior art can usually only handle optimization problems with linear constraints, but it is difficult to handle optimization problems with nonlinear constraints. The technical solution of the present application can easily handle optimization problems with nonlinear constraints in the form of polynomials. This feature makes the technical solution of the present application have wider applicability and stronger solving ability when solving complex optimization problems in practical applications.
[0179] 3) Simplify the complexity of the problem:
[0180] Since there is no need to adjust the penalty coefficient, the technical solution of the present application can effectively avoid the exponential growth of the penalty coefficient adjustment space when dealing with multiple constraints, thereby greatly simplifying the complexity and difficulty of solving the optimization problem and greatly improving the efficiency of the solution.
[0181] Therefore, the technical solution of the present application provides a quantum-classical hybrid computing method and device that is efficient, flexible, and does not require manual adjustment of hyperparameters. It can solve the QCBO problem with nonlinear constraints, thereby overcoming many deficiencies in the prior art and providing new ideas, methods, and equipment for quantum computing solutions to optimization problems.
[0182] In addition, the technical solution of the present application also has important application prospects in the field of artificial intelligence. Artificial intelligence systems often need to solve various complex optimization problems, especially in machine learning and deep learning, involving a large number of parameter adjustments and hyperparameter optimization. The technical solution of the present application provides a quantum classical hybrid computing method and device that does not require adjustment of the penalty coefficient, which can directly process the binary optimization problem of nonlinear constraints in polynomial form, thereby simplifying the model training and optimization process, reducing the computational overhead and the difficulty of parameter adjustment. In addition, the technical solution of the present application can handle more diversified constraints and is suitable for a wider range of AI application scenarios, such as image recognition, natural language processing, and reinforcement learning. By improving the solution efficiency and reducing the complexity of parameter adjustment, the technical solution of the present application provides an efficient and reliable optimization tool for the research and application of artificial intelligence, which helps to promote the development of AI technology and the implementation of practical applications.
[0183] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for quantum classical hybrid computing, characterized in that: The method includes: Performing linearization operation on the objective function and constraint conditions in the quadratic constraint binary optimization model, so that the expression of the objective function after the linearization operation is an expression of degree not exceeding quadratic, and the constraint conditions after the linearization operation are linear constraint conditions; According to the objective function, constraints and corresponding co-optimization problem after linearization operation, the corresponding variable matrix and linear mapping operator are set; The residual vector is calculated based on the current variable matrix and the linear mapping operator; According to the current linear mapping operator, the first step length, the second step length, the first Lagrange multiplier, the second Lagrange multiplier, the residual vector and the objective function, the corresponding quadratic unconstrained binary optimization coefficient matrix is calculated; Solve the quadratic unconstrained binary optimization problem corresponding to the current quadratic unconstrained binary optimization coefficient matrix to obtain the current solution vector; Determine the iteration direction of the current solution vector according to the current solution vector, and use the first step length to update the variable matrix, and use the updated variable matrix as the current variable matrix; When the current number of iterations is less than or equal to the preset iteration threshold, the first step length, the second step length, the first Lagrange multiplier and the second Lagrange multiplier are updated, and the step of calculating the residual vector according to the current variable matrix and the linear mapping operator is returned; When the current number of iterations is greater than a preset iteration threshold, a rounding operation is performed on the current variable matrix, and a vector is extracted from the variable matrix after the rounding operation as the final solution.
2. The method according to claim 1, characterized in that The linearization operation of the objective function and the constraint conditions in the quadratic constraint binary optimization model includes: When there is a product of any two decision variables in the objective function and the constraints, an auxiliary qubit is added, and the product of the two decision variables is replaced by an auxiliary qubit variable corresponding to the auxiliary qubit, and additional linear constraints are added so that the value of the auxiliary qubit variable is correct.
3. The method according to claim 1, characterized in that Before linearizing the objective function and the constraint conditions in the quadratic constrained binary optimization model, the method further includes: A corresponding quadratic constraint binary optimization model is established according to the problem to be solved, and the objective function and constraint conditions of the quadratic constraint binary optimization model are determined.
4. The method according to claim 3, characterized in that The objective function and constraints in the quadratic constrained binary optimization model are expressed as: my xT T Qx stpi(x)≤0,1≤≤m Where x is a vector of decision variables, Q is the coefficient matrix of the quadratic objective function, m is the number of constraints, and p is i (x)≤0 is the i-th constraint expression, p i (x) is a polynomial function.
5. The method according to claim 2 or 4, characterized in that: The objective function and constraints after linearization are expressed as: my xT T Qx stAeqx=beq Aineqx≤bbine q Among them, x is a vector composed of decision variables, Q is the coefficient matrix of the quadratic objective function, Aeq is the coefficient matrix in the equality constraint, beq is the equality constant term in the equality constraint, Aineq is the coefficient matrix in the inequality constraint, and bineq is the inequality constant term in the inequality constraint.
6. The method according to claim 5, characterized in that The setting of the corresponding variable matrix and linear mapping operator includes: Set a variable matrix whose dimension is the length of vector x plus 1; A first linear mapping operator and a second linear mapping operator are set; wherein the first linear mapping operator and the second linear mapping operator are respectively used to map the variable matrix into a corresponding vector.
7. The method according to claim 6, characterized in that The step of calculating the residual vector according to the current variable matrix and the linear mapping operator may include: The residual vector includes: an equality residual vector and an inequality residual vector; Using a first linear mapping operator to map the current variable matrix into a first mapping vector, and obtaining an equation residual vector according to a difference between the first mapping vector and its corresponding constant vector; The current variable matrix is mapped into a second mapping vector using a second linear mapping operator, and an inequality residual vector is obtained according to a difference between the second mapping vector and a projection area corresponding to the constant vector.
8. The method according to claim 7, characterized in that Before calculating the residual vector according to the current variable matrix and the linear mapping operator, the method further includes: Initialize the first step size, second step size, variable matrix, first Lagrange multiplier, and second Lagrange multiplier.
9. The method according to claim 7, characterized in that: The corresponding quadratic unconstrained binary optimization coefficient matrix is calculated by the following formula: Among them, Q is the coefficient matrix of the quadratic objective function, They are the first linear mapping operators and the second linear mapping operator The adjoint operator, y eq is the first Lagrange multiplier, y ineq is the second Lagrange multiplier, β is the second step length, r eq is the residual vector of the equation, r ineq is the inequality residual vector.
10. The method according to claim 1, characterized in that: A quantum computer is used to solve the quadratic unconstrained binary optimization problem corresponding to the current quadratic unconstrained binary optimization coefficient matrix to obtain a current solution vector.
11. The method according to claim 1, characterized in that Update the variable matrix according to the following formula: (1-α)V+αxx T Among them, α is the first step length, V is the variable matrix, and x is the current solution vector.
12. The method according to claim 1, characterized in that The rounding operation on the current variable matrix includes: Set the values of the elements in the current variable matrix whose values are not less than 0.5 to 1, and set the values of the elements whose values are less than 0.5 to 0.
13. The method according to claim 1, characterized in that Update the first and second step lengths using the following formula: Among them, α is the first step length, β is the second step length, and k is the current number of iterations.
14. The method according to claim 1, characterized in that The updating of the values of the first Lagrangian multiplier and the second Lagrangian multiplier includes: Calculate the sum of the current first Lagrange multiplier and the current equation residual vector, and use the sum as the current first Lagrange multiplier; The sum of the current second Lagrange multiplier and the current inequality residual vector is taken as the current second Lagrange multiplier.
15. A quantum classical hybrid computing device, characterized in that: The quantum classical hybrid computing device comprises: a linearization module, a linear mapping module, a first computing module and a second computing module; The linearization module is used to perform a linearization operation on the objective function and the constraint conditions in the quadratic constraint binary optimization model, so that the expression of the objective function after the linearization operation is an expression of degree not exceeding quadratic, and the constraint conditions after the linearization operation are linear constraint conditions; The linear mapping module is used to set the corresponding variable matrix and linear mapping operator according to the objective function, constraint conditions and corresponding co-normal optimization problem after the linearization operation; and calculate the residual vector according to the current variable matrix and linear mapping operator; The first calculation module is used to calculate the corresponding quadratic unconstrained binary optimization coefficient matrix according to the current linear mapping operator, the first step length, the second step length, the first Lagrange multiplier, the second Lagrange multiplier, the residual vector and the objective function; determine the iteration direction of the current solution vector according to the current solution vector, and use the first step length to update the variable matrix, and use the updated variable matrix as the current variable matrix; when the current number of iterations is greater than a preset iteration threshold, round the current variable matrix, and extract a vector from the variable matrix after the rounding operation as the final solution; when the current number of iterations is less than or equal to the preset iteration threshold, update the first step length, the second step length, the first Lagrange multiplier and the second Lagrange multiplier; return to execute the step of calculating the residual vector according to the current variable matrix and the linear mapping operator; The second calculation module is used to solve the quadratic unconstrained binary optimization problem corresponding to the current quadratic unconstrained binary optimization coefficient matrix to obtain a current solution vector.
16. The quantum classical hybrid computing device according to claim 15, characterized in that: The second computing module is a quantum computer.
17. The quantum classical hybrid computing device according to claim 16, characterized in that: The quantum computer is a quantum annealing machine or a coherent Ising machine.
Citation Information
Cited By
Renewable energy data clustering method and system based on optical quantum computer
CN120123790A
