Encoding methods, devices, programs, and storage media for quantum optimization solutions
By using machine learning to select modules and encoding models, a subset of the variable space is automatically selected and an equivalent Hamiltonian is generated, which solves the problem of low resource utilization efficiency in quantum optimization algorithms and achieves efficient quantum optimization solutions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-05
- Publication Date
- 2026-04-03
AI Technical Summary
In existing quantum optimization algorithms, fixed encoding methods have poor adaptability, cannot effectively utilize quantum resources, are difficult to capture the correlation between variables in high-dimensional or continuous variable spaces, and lack end-to-end trainable encoding schemes.
We employ a machine learning-based encoding model and selection module to automatically select a finite subset from the variable space. We then generate Hamiltonians equivalent to the optimization problem through training and encode them using a neural network model with an attention mechanism to construct a sparse, low-depth Hamiltonian structure.
It significantly reduces the resource requirements of qubits, improves coding efficiency and scalability, and the generated Hamiltonian is energy equivalent to the original problem, thereby improving the performance and solution accuracy of quantum optimization algorithms and making it suitable for various optimization scenarios.
Smart Images

Figure CN121457653B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of quantum computing technology, and in particular to an encoding method, apparatus, program, and storage medium for quantum optimization solutions. Background Technology
[0002] Quantum computing has shown potential for speeding up combinatorial optimization problems, lattice optimization problems, and machine learning model training. Typical quantum optimization algorithms include quantum annealing and variable quantum eigenstate solvers. These methods typically rely on transforming the problem to be optimized into Hamiltonian form so that the optimal solution can be obtained by solving eigenstates in quantum state space.
[0003] In the aforementioned quantum optimization framework, variable space encoding is a crucial step. A common approach in existing technologies is to map classical variables to quantum states based on fixed mapping rules (such as binary encoding or amplitude encoding). However, this static encoding method has several shortcomings. Firstly, fixed mappings lack adaptability. Fixed encoding rules are often irrelevant to the specific optimization problem, leading to high Hamiltonian complexity and low quantum resource utilization efficiency. Secondly, it cannot optimize the encoding structure based on problem characteristics. In complex optimization problems (such as the shortest vector problem in lattice cryptography), the variable space structure is highly complex, and traditional encoding struggles to capture the correlations between variables. Furthermore, the variable space is typically a high-dimensional continuous space, which cannot be fully represented with a finite number of qubits; a subset must be selected for quantum encoding. Existing methods often rely on manual or heuristic rules, lacking systematicity and optimizability.
[0004] On the other hand, machine learning has demonstrated powerful capabilities in low-dimensional embedding, feature selection, data compression, and adaptive encoding. In recent years, research has attempted to combine neural networks with quantum circuits to generate parameterized quantum states or learn the structure of Hamiltonians. However, existing work largely focuses on optimizing quantum circuit parameters or quantum feature mapping, with less attention paid to how to automatically select a finite subset from the classical variable space and encode it as a quantum state. Especially in scenarios where it is necessary to ensure that the constructed quantum Hamiltonian is equivalent to the original optimization problem, an end-to-end trainable and optimizable encoding scheme is still lacking. Summary of the Invention
[0005] To address the aforementioned shortcomings of existing technologies, this invention proposes an encoding method, apparatus, program, and storage medium for solving quantum optimization problems. For a given optimization problem, it can automatically select a finite subset from the variable space and learn the optimal quantum state mapping method, enabling the generated Hamiltonian to be efficiently solved on a quantum processor while maintaining equivalence with the original problem. This significantly improves the feasibility and performance of quantum optimization algorithms in complex optimization problems.
[0006] The technical solution of this invention is implemented as follows:
[0007] This invention proposes an encoding method for solving quantum optimization problems, the method comprising:
[0008] Receive classical input data for defining the optimization problem, which simultaneously determines the variable space of the optimization problem;
[0009] Using a machine learning-based encoding model, the elements of a finite subset in the variable space are mapped to quantum states;
[0010] Based on the quantum state representation, a Hamiltonian is constructed that is equivalent or approximately equivalent to the optimization problem in solving its eigenstates, for the quantum processor to perform optimization calculations.
[0011] Preferably, the subset of the variable space is selected through a selection module, which is a machine learning model; the parameters of the encoding model and the selection module are jointly trained based on several optimization metrics.
[0012] Preferably, the training of the selection module and the encoding model is based on multiple optimization problem instances, each instance including the classic input data of the optimization problem and the corresponding optimal or near-optimal solution.
[0013] Preferably, the optimization indicators include, but are not limited to, the following:
[0014] The number of elements in the variable space subset;
[0015] The subset of the variable space contains the probability of a correct or approximate solution to the optimization problem;
[0016] The fidelity of the solution given by the Hamiltonian relative to the correct solution of the optimization problem.
[0017] Preferably, during joint training, a loss function is constructed using a weighted combination of the optimization metrics.
[0018] Preferably, the encoding model is an autoencoder, and the selection module is a neural network model based on an attention mechanism.
[0019] Preferably, the mapping constructed by the encoding model from a finite subset of the variable space to the quantum state space maps each element in the variable space to a corresponding computational basis.
[0020] Preferably, the optimization problem is the shortest vector problem in lattice cryptography, the input data is a lattice basis matrix, and the variable space is the set of integer coefficient vectors of lattice vectors under the lattice basis.
[0021] Preferably, the mapping constructed by the encoding model will be an integer coefficient vector. Mapping to computational basis ,in Represents a binary sequence consisting of individual bits in the computational basis, with subscripts. and combination It is a two-dimensional index used to identify each bit in the sequence. From the equation Uniquely determined, among which for The Components, coefficients The Hamiltonian is constructed as determined by the encoding model.
[0022] ,
[0023] in For lattice basis matrices, To act on the index Pauli Operator, It is the identity operator.
[0024] The present invention also proposes an adaptive encoding device for solving quantum optimization problems, the device comprising:
[0025] An input unit is configured to receive classical input data for defining the optimization problem, wherein the classical input data simultaneously determines the variable space of the optimization problem;
[0026] The encoding unit is used to map the elements of a finite subset in the variable space to quantum states using a machine learning-based encoding model;
[0027] A construction unit is used to construct a Hamiltonian that is equivalent or approximately equivalent to the optimization problem in solving the eigenstate problem based on the quantum state representation, so that the quantum processor can perform optimization calculations.
[0028] Preferably, the device further includes a selection unit, which is based on a machine learning model for selecting a finite subset from the variable space; the parameters of the encoding unit and the selection unit are jointly trained based on several optimization metrics.
[0029] Preferably, the apparatus includes a training unit for training the selection unit and the encoding unit based on multiple optimization problem instances, each instance including classical input data of the optimization problem and the corresponding optimal or near-optimal solution.
[0030] Preferably, the optimization metrics on which the training unit is trained include, but are not limited to, the following:
[0031] The number of elements in the variable space subset;
[0032] The subset of the variable space contains the probability of a correct or approximate solution to the optimization problem;
[0033] The fidelity of the solution given by the Hamiltonian relative to the correct solution of the optimization problem.
[0034] Preferably, the training unit constructs a loss function using a weighted combination of the optimization metrics.
[0035] Preferably, the encoding unit is based on an autoencoder model, and the machine learning model on which the selection unit is based is a neural network model based on an attention mechanism.
[0036] Preferably, the mapping constructed by the encoding unit from a finite subset of the variable space to the quantum state space maps each element in the variable space to a corresponding computational basis.
[0037] Preferably, the optimization problem is the shortest vector problem in lattice cryptography, the input data received by the input unit is a lattice basis matrix, and the variable space is a set of integer coefficient vectors of lattice vectors under the lattice basis.
[0038] Preferably, the mapping constructed by the encoding unit will be an integer coefficient vector. Mapping to computational basis The Hamiltonian is constructed based on the following formula:
[0039] ,
[0040] The present invention also proposes an adaptive encoding program for quantum optimization solutions, which, when executed by a processor, causes the computer to execute the encoding method for quantum optimization solutions as described above.
[0041] Furthermore, the present invention also proposes a computer-readable storage medium storing an adaptive encoding program for quantum optimization solutions as described above, which, when executed by a processor, implements the encoding method for quantum optimization solutions as described above.
[0042] Compared with the prior art, the present invention has the following beneficial effects:
[0043] This invention proposes an encoding method, apparatus, program, and storage medium for quantum optimization solutions. By introducing a machine learning-based selection module, a finite subset can be automatically selected from a high-dimensional or continuous variable space, thereby significantly reducing the demand for qubit resources while ensuring representativeness and diversity. Compared with manually set or fixed sampling methods, this module can dynamically adjust the selection strategy according to the optimization objective, improving encoding efficiency and scalability.
[0044] This invention enables the selection module and encoding model to work collaboratively by jointly training them under a unified optimization metric. The optimization metric can simultaneously consider factors such as the size of the variable subset and the fidelity of the quantum Hamiltonian solution, achieving a balance between encoding accuracy and quantum resource consumption, thereby improving the global performance of the entire quantum optimization process.
[0045] Because the encoding model directly participates in the mapping learning from the variable space to the quantum state, the generated quantum Hamiltonian can maintain energy equivalence with the original optimization problem in structure. Compared with the traditional method that relies on fixed mapping rules, this invention can generate more sparse, low-depth, and interpretable Hamiltonian structures, reducing quantum computation complexity and improving solution accuracy;
[0046] The method is not dependent on any specific problem type and can be applied to a variety of classic optimization scenarios;
[0047] By training the neural network model in a classical computing environment and performing Hamiltonian optimization at the quantum layer, a closed-loop optimization is formed between quantum encoding and quantum solution. Attached Figure Description
[0048] Figure 1 This document provides an overall flowchart of the encoding method for quantum optimization solutions and unit examples of the corresponding apparatus involved in the embodiments of the present invention. Detailed Implementation
[0049] The present invention will now be clearly and completely described with reference to the accompanying drawings in the embodiments of the present invention.
[0050] An encoding method for solving quantum optimization problems, the method comprising:
[0051] Receive classical input data for defining the optimization problem, which simultaneously determines the variable space of the optimization problem;
[0052] The subset of the variable space is selected through a machine learning-based selection module;
[0053] Using a machine learning-based encoding model, the elements of a finite subset in the variable space are mapped to quantum states;
[0054] The parameters of the encoding model and the selection module are jointly trained based on several optimization metrics;
[0055] Based on the quantum state representation, a Hamiltonian is constructed that is equivalent or approximately equivalent to the optimization problem in solving its eigenstates, for the quantum processor to perform optimization calculations.
[0056] The selection module is a neural network model based on the attention mechanism. The selection method for the finite subset of the variable space is to use a selection unit to select a finite and representative subset from the variable space. The selection unit contains a neural network model based on the attention mechanism. The representation of the subset is selected as the union of intervals, and an upper limit is set on the number of intervals. By setting several optimization objectives, the training unit is used to jointly train the parameters of the neural network model and the encoding model corresponding to the selection module.
[0057] The training of the selection module and the encoding model is based on multiple optimization problem instances, each instance including the classic input data of the optimization problem and the corresponding optimal or near-optimal solution.
[0058] The optimization metrics include, but are not limited to, the following:
[0059] The number of elements in the variable space subset;
[0060] The subset of the variable space contains the probability of a correct or approximate solution to the optimization problem;
[0061] The fidelity of the solution given by the Hamiltonian relative to the correct solution of the optimization problem.
[0062] The mapping constructed by the encoding model from a finite subset of the variable space to the quantum state space maps each element in the variable space to a corresponding computational basis.
[0063] The optimization problem is the shortest vector problem in lattice cryptography, the input data is a lattice basis matrix, and the variable space is the set of integer coefficient vectors of lattice vectors under the lattice basis.
[0064] The mapping constructed by the encoding model will be an integer coefficient vector. Mapping to computational basis ,in Represents a binary sequence consisting of individual bits in the computational basis, with subscripts. and combination It is a two-dimensional index used to identify each bit in the sequence. From the equation Uniquely determined, among which for The Components, coefficients The Hamiltonian is constructed as determined by the encoding model.
[0065] ,
[0066] in For lattice basis matrices, To act on the index Pauli Operator, It is the identity operator.
[0067] like Figure 1 The present invention also discloses an adaptive encoding device for solving quantum optimization problems, the device comprising:
[0068] An input unit is configured to receive classical input data for defining the optimization problem, wherein the classical input data simultaneously determines the variable space of the optimization problem;
[0069] The encoding unit is used to map the elements of a finite subset in the variable space to quantum states using a machine learning-based encoding model;
[0070] A construction unit is used to construct a Hamiltonian that is equivalent or approximately equivalent to the optimization problem in solving the eigenstate problem based on the quantum state representation, so that the quantum processor can perform optimization calculations.
[0071] The device includes a selection unit, which is a neural network model based on an attention mechanism, used to select a finite subset from the variable space; the parameters of the encoding unit and the selection unit are jointly trained based on several optimization metrics; the device includes a training unit, which constructs a loss function using a weighted combination of the optimization metrics, used to train the selection unit and the encoding unit based on multiple optimization problem instances, each instance including the classic input data of the optimization problem and the corresponding optimal or near-optimal solution.
[0072] The training unit constructs a loss function using a weighted combination of the optimization metrics. The encoding unit is based on an autoencoder model, and the selection unit is a neural network model based on an attention mechanism. The mapping constructed by the encoding unit from a finite subset of the variable space to the quantum state space maps each element in the variable space to a corresponding computational basis. The optimization problem is the shortest vector problem in lattice cryptography. The input data received by the input unit is a lattice basis matrix, and the variable space is a set of integer coefficient vectors of lattice vectors under this lattice basis.
[0073] The present invention also discloses an adaptive encoding program for solving quantum optimization problems, which, when executed by a processor, causes the computer to perform any of the methods described above.
[0074] The present invention also discloses a computer-readable storage medium having the above-described computer program stored thereon, which, when executed by a processor, implements the above-described method.
[0075] Embodiments of the present invention:
[0076] This example uses the Shortest Vector Problem (SVP) in lattice cryptography as an instance of the optimization problem. Given a lattice basis matrix... This matrix defines a Vig The goal of SVP is to find the shortest non-zero vector in the lattice. .
[0077] Figure 1 The relationship between the various units in the device involved in this embodiment and the overall method flow are described, mainly including the following steps:
[0078] Step 1: Receive the classic input data used to define the SVP problem, namely the lattice basis matrix, through the input unit. This matrix also defines the variable space of the optimization problem, namely, the vector of all possible integer coefficients. The space that it constitutes.
[0079] Step 2: The encoding unit uses a machine learning-based encoding model to encode the variable space. The elements of a finite subset are mapped to quantum states.
[0080] In this embodiment, the finite subset of the variable space is selected using a selection unit from... Select a finite, representative subset from the data. The selection unit includes a neural network model based on an attention mechanism. The subset representation can be chosen as the union of intervals, and an upper limit can be set on the number of intervals to improve the running efficiency of the selection module. By setting several optimization objectives, the training unit can be used to jointly train the parameters of the neural network model and the encoding model corresponding to the selection module. For example, the training data may include lattice basis matrices and corresponding shortest vector solutions for multiple SVP problems, and the optimization metrics may include the probability that the subset does not contain the shortest or approximately shortest vector, and the subset of the variable space. The number of elements in the algorithm and the deviation of the solution given by the Hamiltonian from the correct solution to the optimization problem are considered. Training can use gradient descent, and the loss function can be set as a weighted sum of optimization metrics. During training, the parameters of the encoding model and the selection module (a neural network model based on an attention mechanism) are updated synchronously to minimize the loss function.
[0081] For example, a manually calculated subset can be input as an initial subset to the selection unit, allowing the selection unit to perform optimization based on this subset. For instance, in this embodiment, an initial subset can be obtained through mathematical methods. Specifically, for vectors... (in For lattice basis matrices The Middle (the vector corresponding to the column), through calculation Dual lattice base The absolute value of the coefficient can be obtained. Further utilize the The estimation of the upper limit of the magnitude, for example, can be achieved by applying Gaussian heuristics to estimate the length of the shortest vector to be approximately [value missing]. (in Representing grid points (the volume), so we can choose an integer. ,Will As a response The estimated upper limit of the module length is then obtained. Therefore, the following set can be selected as the initial subset:
[0082]
[0083] The encoding model can be selected as an autoencoder, and the specific mapping method of the autoencoder is to map a subset... Each vector in Mapped to a certain computing base .in, This represents a binary sequence composed of individual qubits in a computing substrate. (Subscript) and combination This is a two-dimensional index used to identify each bit in the sequence. Each bit value in the sequence... From the equation Uniquely determined, among which It is a vector The Each component, coefficient It is determined by the parameters of the autoencoder model.
[0084] Step 3: Based on the quantum state representation established in Step 2, construct a Hamiltonian whose eigenstate solution problem is equivalent or approximately equivalent to the original SVP problem by constructing a unit. This allows the quantum processor to perform optimized calculations. In this embodiment, the Hamiltonian takes the following form:
[0085] ,
[0086] in It applies to indexes Pauli Operator, It is the unit operator. The ground state of this Hamiltonian corresponds to the zero vector, and the first excited state corresponds to the shortest vector in the SVP problem. The first excited state can be solved subsequently using methods such as a variational quantum eigenvalue solver or a quantum approximation optimization algorithm.
[0087] As can be seen from the embodiments of this invention, this invention proposes an encoding method, apparatus, program, and storage medium for solving quantum optimization problems. By introducing a machine learning-based selection module, a finite subset can be automatically selected from a high-dimensional or continuous variable space, thereby significantly reducing the demand for qubit resources while ensuring representativeness and diversity. Compared with manual setting or fixed sampling methods, this module can dynamically adjust the selection strategy according to the optimization objective, improving encoding efficiency and scalability. This invention enables the selection module and encoding model to work collaboratively by jointly training them under a unified optimization index. The optimization index can simultaneously consider factors such as the size of the variable subset and the fidelity of the quantum Hamiltonian solution, achieving a balance between encoding accuracy and quantum resource consumption, thereby improving the global performance of the entire quantum optimization process. Since the encoding model directly participates in the mapping learning from the variable space to the quantum state, the generated quantum Hamiltonian can maintain energy equivalence with the original optimization problem in structure. Compared to traditional methods that rely on fixed mapping rules, this invention can generate more sparse, low-depth, and interpretable Hamiltonian structures, reducing quantum computation complexity and improving solution accuracy. The method is not dependent on specific problem types and can be applied to a variety of classical optimization scenarios. By training the neural network model in a classical computing environment and performing Hamiltonian optimization at the quantum layer, a closed-loop optimization is formed between quantum encoding and quantum solution.
Claims
1. A coding method for solving quantum optimization problems, characterized in that, The method includes: Receive classical input data for defining the optimization problem, which simultaneously determines the variable space of the optimization problem; The subset of the variable space is selected through a machine learning-based selection module; Using a machine learning-based encoding model, the elements of a finite subset in the variable space are mapped to quantum states; The parameters of the encoding model and the selection module are jointly trained based on several optimization metrics; Based on the quantum state representation, a Hamiltonian equivalent or approximately equivalent to the optimization problem is constructed for the quantum processor to perform optimization calculations. The selection module is a neural network model based on the attention mechanism. The selection method for the finite subset of the variable space is to use a selection unit to select a finite and representative subset from the variable space. The selection unit contains a neural network model based on the attention mechanism. The representation of the subset is selected as the union of intervals, and an upper limit is set on the number of intervals. By setting several optimization objectives, the training unit is used to jointly train the parameters of the neural network model and the encoding model corresponding to the selection module.
2. The encoding method for quantum optimization solutions according to claim 1, characterized in that, The selection module is a neural network model based on the attention mechanism. The selection method for the finite subset of the variable space is to use a selection unit to select a finite and representative subset from the variable space. The selection unit contains a neural network model based on the attention mechanism. The representation of the subset is selected as the union of intervals, and an upper limit is set on the number of intervals. By setting several optimization objectives, the training unit is used to jointly train the parameters of the neural network model and the encoding model corresponding to the selection module.
3. The encoding method for quantum optimization solutions according to claim 1, characterized in that, The training of the selection module and the encoding model is based on multiple optimization problem instances, each instance including the classic input data of the optimization problem and the corresponding optimal or near-optimal solution.
4. The encoding method for quantum optimization solutions according to claim 1, 2, or 3, characterized in that, The optimization metrics include: The number of elements in the variable space subset; The subset of the variable space contains the probability of a correct or approximate solution to the optimization problem; The Hamiltonian represents the fidelity of the solution relative to the correct solution to the optimization problem.
5. The encoding method for quantum optimization solutions according to claim 1, characterized in that, The mapping constructed by the encoding model from a finite subset of the variable space to the quantum state space maps each element in the variable space to a corresponding computational basis.
6. The encoding method for quantum optimization solutions according to claim 1, characterized in that, The optimization problem is the shortest vector problem in lattice cryptography, the input data is a lattice basis matrix, and the variable space is the set of integer coefficient vectors of lattice vectors under the lattice basis.
7. The encoding method for quantum optimization solutions according to claim 5 or 6, characterized in that, The mapping constructed by the encoding model will be an integer coefficient vector. Mapping to computational basis ,in Represents a binary sequence consisting of individual bits in the computational basis, with subscripts. and combination It is a two-dimensional index used to identify each bit in the sequence. From the equation Uniquely determined, among which for The Components, coefficients The Hamiltonian is constructed as determined by the encoding model. , in For lattice basis matrices, To act on the index Pauli Operator, It is the identity operator.
8. An adaptive encoding device for solving quantum optimization problems, used to implement the encoding method according to any one of claims 1 to 7, characterized in that, The device includes: The input unit is used to receive classical input data for defining the optimization problem, which simultaneously determines the variable space of the optimization problem. The encoding unit is used to map the elements of a finite subset in the variable space to quantum states using a machine learning-based encoding model; A construction unit is used to construct a Hamiltonian that is equivalent or approximately equivalent to the optimization problem in solving the eigenstate based on the quantum state representation, so that the quantum processor can perform optimization calculations.
9. The adaptive encoding device for quantum optimization solving according to claim 8, characterized in that, The device includes a selection unit, which is a neural network model based on an attention mechanism, used to select a finite subset from the variable space; the parameters of the encoding unit and the selection unit are jointly trained based on several optimization metrics; the device includes a training unit, used to train the selection unit and the encoding unit based on multiple optimization problem instances, each instance including the classic input data of the optimization problem and the corresponding optimal or near-optimal solution.
10. The adaptive encoding device for quantum optimization solving according to claim 9, characterized in that, The training unit constructs a loss function using a weighted combination of the optimization metrics. The encoding unit is based on an autoencoder model. The mapping constructed by the encoding unit from a finite subset of the variable space to the quantum state space maps each element in the variable space to a corresponding computational basis. The optimization problem is the shortest vector problem in lattice cryptography. The input data received by the input unit is a lattice basis matrix. The variable space is a set of integer coefficient vectors of lattice vectors under this lattice basis.
Citation Information
Patent Citations
Optimization problem solving method and device
CN119514713A
Quantum calculation method for solving combinatorial optimization problem
CN120019395A