A spectrum allocation method and system based on hybrid quantum and classical algorithms
By optimizing spectrum allocation through hybrid quantum and classical algorithms, constructing a parse tree and optimizing the search space, the computational complexity and resource consumption problems in large-scale spectrum allocation problems are solved, and efficient spectrum allocation is achieved.
Patent Information
- Application Number
- CN202510010065.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2045-01-03
AI Technical Summary
When faced with large-scale spectrum allocation problems, existing technologies have high computational time complexity and high computational resource consumption, making it difficult to effectively solve the problems of frequency interference between devices and spectrum resource utilization efficiency.
A hybrid quantum and classical algorithm is used to optimize the search space by constructing Boolean expressions and parse trees, combined with the Grover quantum search algorithm. The high-quality search space is selected by using the ratio of positive and negative variables, and the spectrum allocation scheme is iteratively adjusted through non-uniform superposition and average inversion operators to reduce redundant calculations.
It significantly reduces the computational time complexity and resource consumption of spectrum allocation, and improves the efficiency and accuracy of spectrum allocation, especially in large-scale problems.
Smart Images

Figure CN119865903B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of spectrum allocation, and in particular relates to a spectrum allocation method and system based on hybrid quantum and classical algorithms. Background Art
[0002] Spectrum allocation is a core issue in wireless communications. Its core task is to allocate frequency resources to communication devices, ensuring that frequencies between adjacent devices do not interfere with each other and utilizing limited spectrum resources as efficiently as possible. As a typical NP-complete problem, spectrum allocation's complexity increases rapidly with the number of devices and the interference relationships between them.
[0003] In related technologies, spectrum allocation is mainly solved using backtracking algorithms, greedy algorithms, and genetic algorithms. However, when faced with large-scale spectrum allocation problems, their time complexity and computational overhead are far from satisfactory. Once the number of devices increases and the interference relationship increases, solving the appropriate spectrum allocation requires a lot of time and computing resources, which increases costs. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a spectrum allocation method and system based on hybrid quantum and classical algorithms, which can reduce computing time and save computing resources.
[0005] A spectrum allocation method based on a hybrid quantum and classical algorithm, comprising:
[0006] Obtain the number of devices and frequencies to be allocated spectrum;
[0007] Obtaining a connection relationship between adjacent devices and setting a constraint condition between the adjacent devices, wherein the adjacent devices are devices that have frequency interference with each other, and the constraint condition is that the adjacent devices have different allocated frequencies;
[0008] Establishing a Boolean expression according to the number of devices to be allocated and the constraint conditions;
[0009] Expanding the Boolean expression constructs a parse tree, the parse tree including a root node and a plurality of child nodes, the child nodes further including leaf nodes and non-leaf nodes, the leaf nodes being nodes without child nodes, the root nodes and non-leaf nodes storing logical relationships, including logical AND, logical OR, and logical NOT, the leaf nodes storing device variables, the device variables modified by logical NOT being negative variables, and the device variables not modified by logical NOT being positive variables;
[0010] Calculate, based on the number of devices, a total number of allocation scheme combinations for spectrum allocation to each device, and use the total number of allocation scheme combinations as a search space, where the search space includes a front search space, a middle search space, and a rear search space;
[0011] Traversing each node of the parse tree to obtain a ratio of the number of positive and negative variables, and selecting a high-quality search space from the search space according to the ratio of the number of positive and negative variables;
[0012] performing non-uniform superposition on the allocation schemes according to the high-quality search space to obtain an initial scheme after non-uniform superposition, wherein the amplitude of each allocation scheme in the initial scheme is the same;
[0013] Marking all the non-uniform superposition initial solutions according to the constraint conditions to obtain a target solution set, and performing phase flipping on the target solution set to obtain a flipped solution set;
[0014] Continuously iteratively adjusting the flipping solution set through an average inversion operator to increase the amplitude of the target solution and obtain an amplitude increase solution set;
[0015] The amplitude increase scheme set is measured to obtain an allocation result.
[0016] Optionally, constructing a parse tree according to the expansion of the Boolean expression includes:
[0017] The Boolean expression is:
[0018] (A⊕B)∧(B⊕C)……
[0019] Expand the Boolean expression to get the expanded form of the Boolean expression:
[0020] (A⊕B)∧(B⊕C)……=[(¬A∧B)∨(A∧¬B)]∧[(¬B∧C)∨(B∧¬C)]……=1;
[0021] Among them, A, B, and C represent the frequencies of different devices, ⊕ represents different frequencies, ∧ represents the logical AND operation, ∨ represents the logical OR operation, and ¬ represents the logical NOT operation;
[0022] According to the expansion of the Boolean expression, sub-nodes including different logical operations and connection relationships of the sub-nodes are obtained;
[0023] A parse tree is constructed based on the connection relationship of the sub-nodes and the logical operations of the sub-nodes.
[0024] Optionally, traversing each node of the parse tree to obtain a ratio of the number of positive and negative variables, and selecting a high-quality search space from the search space according to the positive and negative variables includes:
[0025] Get the number of device variables modified by non-nodes, the number of device variables modified by and nodes, and the number of device variables modified by or nodes in the parse tree;
[0026] Calculate the sum of the number of device variables modified by the AND node and the number of device variables modified by the OR node as the number of positive variables;
[0027] The number of the device variables modified by the non-node is regarded as the negative variable number;
[0028] Calculating the ratio of the number of positive variables to the number of negative variables as the ratio of the number of positive and negative variables;
[0029] A high-quality search space is selected from the search space according to the positive and negative variables.
[0030] Optionally, selecting a high-quality search space from the search space according to the ratio of the number of positive and negative variables includes:
[0031] Set the threshold value of the positive and negative variable ratio;
[0032] When the ratio of the number of positive and negative variables is less than the minimum value of the positive and negative variable ratio threshold, the front search space is selected as the high-quality search space;
[0033] When the ratio of the number of positive and negative variables is greater than the maximum value of the positive and negative variable ratio threshold, selecting the latter search space as the high-quality search space;
[0034] When the ratio of the number of positive and negative variables is within the positive and negative variable threshold, the middle search space is selected as the high-quality search space.
[0035] Optionally, marking all the non-uniform superposition initial solutions according to the constraint condition to obtain a target solution set, and performing phase flipping on the target solution set to obtain a flipped solution set includes:
[0036] Get the preset allocation plan;
[0037] All initial solutions that meet a preset allocation solution in the non-uniform superposition initial solution are marked to obtain a target solution set, and the target solution set is phase-reversed to obtain a reversed solution set.
[0038] Optionally, the step of continuously iteratively adjusting the flip solution set by using the average inversion operator to increase the amplitude of the target solution to obtain the amplitude increase solution set includes:
[0039] The average inversion operator is expressed as:
[0040] ;
[0041] where | > is a uniform superposition state of all potential solutions, I is the identity operator,<s|为|s> The conjugate transpose of
[0042] The average inversion operator is used to iteratively adjust the set of flip schemes, reduce the amplitude of non-target schemes, and increase the amplitude of target schemes, wherein the target schemes are schemes that satisfy the constraint conditions of spectrum allocation.
[0043] Optionally, the measuring the amplitude-increased scheme set to obtain an allocation result comprises:
[0044] The amplitude-increased scheme set is measured to obtain an allocation scheme corresponding to a maximum amplitude value.
[0045] The allocation scheme corresponding to the maximum amplitude value is taken as the allocation result.
[0046] A spectrum allocation system based on a hybrid quantum and classical algorithm comprises:
[0047] A first obtaining module is configured to obtain a number of devices to be allocated and a number of frequencies.
[0048] A second obtaining module is configured to obtain a connection relationship between adjacent devices and a constraint condition between adjacent devices, wherein the adjacent devices are devices that interfere with each other in frequency, and the constraint condition is that the allocated frequencies of adjacent devices are different.
[0049] A first establishing module is configured to establish a Boolean expression according to the number of devices to be allocated and the constraint condition.
[0050] A second establishing module is configured to expand the Boolean expression to construct a parse tree, wherein the parse tree comprises a root node and a plurality of child nodes, the child nodes comprise leaf nodes and non-leaf nodes, the leaf nodes are nodes without child nodes, the root node and the non-leaf nodes store logical relationships, including logical and, logical or, and logical not, the leaf nodes store device variables, the device variables modified by logical not are negative variables, and the device variables not modified by logical not are positive variables.
[0051] A calculating module is configured to calculate a total number of allocation scheme combinations for each device according to the number of devices, and take the total number of allocation scheme combinations as a search space, wherein the search space comprises a front search space, a middle search space, and a rear search space.
[0052] A traversing module is configured to traverse each node of the parse tree to obtain a ratio of the number of positive variables to the number of negative variables, and select a high-quality search space from the search space according to the ratio.
[0053] An initializing module is configured to perform non-uniform superposition on the allocation schemes according to the high-quality search space to obtain an initial scheme after non-uniform superposition, wherein the amplitudes of each allocation scheme in the initial scheme are the same.
[0054] a marking module, configured to mark all the non-uniform superposition initial schemes according to the constraint conditions to obtain a target scheme set, and perform phase flipping on the target scheme set to obtain a flipped scheme set;
[0055] An amplitude amplification module, configured to iteratively adjust the inversion solution set continuously through an average inversion operator to increase the amplitude of the target solution and obtain an amplitude amplification solution set;
[0056] The measuring module is used to measure the amplitude increase scheme set to obtain an allocation result.
[0057] A terminal device includes a memory and a processor. The memory stores a computer program that can be run on the processor. When the processor loads and executes the computer program, it adopts a spectrum allocation method based on a hybrid quantum and classical algorithm.
[0058] A computer-readable storage medium stores a computer program. When the computer program is loaded and executed by a processor, a spectrum allocation method based on a hybrid quantum and classical algorithm is adopted.
[0059] The beneficial effects of the present invention are:
[0060] According to the constructed Boolean expression, it is parsed into a parse tree, and then according to the ratio of positive variables and negative variables in the parse tree, a high-quality search space is selected from the search space, and the search range of the entire search space is reduced to a high-quality search space. Then, in the high-quality search space, non-uniform superposition is first performed to apply a larger amplitude to the potential solutions concentrated in the second half, so that its weight is significantly higher than that of other parts. Then, after the target allocation scheme is flipped, the flipped scheme set is continuously iterated through the constructed average inversion operator to increase the amplitude of the target scheme and obtain an amplitude increase scheme set; the amplitude increase scheme set is measured to obtain the allocation result. Compared with the traditional spectrum allocation method, the present application narrows the search space to a high-quality search space, reduces the search range, avoids redundant calculations and unnecessary resource consumption, and secondly, realizes the transition from the traditional uniform superposition state to the centralized search, significantly improving the practical application ability of quantum search in complex combinatorial optimization problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 A schematic diagram of modeling a communication network for spectrum allocation problem as a mathematically undirected graph frequency allocation problem according to the present invention;
[0062] Figure 2 It is intended to represent the XOR truth value of the present invention;
[0063] Figure 3 A schematic diagram of a parse tree after converting a Boolean expression into a parse tree according to the present invention;
[0064] Figure 4 Schematic diagram of uniform superposition of the initial state of the traditional Grover algorithm of the present invention;
[0065] Figure 5 A schematic diagram of the non-uniform superposition of the initial state used in the present invention;
[0066] Figure 6 A schematic diagram of the magnitude of potential allocation solutions eliminated in the remaining portion of the original search space according to the present invention;
[0067] Figure 7 A phase reversal diagram of the target allocation scheme of the present invention;
[0068] Figure 8 For the present invention to apply Schematic diagram of the relationship between all allocation schemes and amplitude after operation;
[0069] Figure 9 For the present invention to apply Schematic diagram of the relationship between all allocation schemes and amplitude after operation;
[0070] Figure 10 Schematic diagram of the comparison results between the present invention and the traditional calculation method. DETAILED DESCRIPTION
[0071] A spectrum allocation method based on a hybrid quantum and classical algorithm, the present invention comprises:
[0072] S1. Obtain the number of devices and frequencies to which spectrum is to be allocated.
[0073] Spectrum allocation for specific devices aims to use fewer frequencies to allocate spectrum to different devices. Generally speaking, the amount of spectrum is limited. If a different spectrum is allocated to each device, the cost will be greatly increased. Therefore, spectrum is allocated to each device under the premise of non-interference.
[0074] First, the communication network in the spectrum allocation problem needs to be modeled as an undirected graph frequency allocation problem in mathematics. Specifically, each wireless device in the communication network can correspond to a node in the undirected graph, and the interference relationship between the devices is mapped to the edge in the undirected graph. Through this mapping method, the interference information of the communication network is completely embedded in the undirected graph, thus laying the foundation for further mathematical modeling and solution. The core of this transformation process lies in establishing a strict correspondence between wireless devices and nodes, and interference relationships and edges. For example, in cellular network spectrum allocation, each base station or user equipment can be regarded as a node, and the possibility of interference between two devices can be represented by an undirected edge. This transformation simplifies the original wireless communication interference problem to an analysis of the graph structure. The transformation process is as follows: Figure 1 The goal of the frequency assignment problem in the transformed undirected graph is to determine the frequency of each node while satisfying certain constraints. The constraints usually require that adjacent nodes be assigned different frequencies to avoid interference.
[0075] S2. Obtaining a connection relationship between adjacent devices and setting a constraint condition between adjacent devices, where adjacent devices are devices that have frequency interference with each other, and the constraint condition is that the adjacent devices have different allocated frequencies;
[0076] Specifically, by introducing Boolean relations, the undirected graph frequency allocation problem can be further transformed into a Boolean satisfiability problem (SAT). In this process, the nodes of the undirected graph are mapped to Boolean variables in a Boolean formula, and the assignment combinations of these variables are used to describe possible frequency allocation schemes. By solving the Boolean formula, a solution that satisfies the interference constraints can be found, thus solving the original spectrum allocation problem.
[0077] The frequency allocation of each node in an undirected graph can be represented by a Boolean variable. For example, the true or false value of a Boolean variable can be used to indicate whether a node is assigned a specific frequency. To ensure that spectrum allocation meets constraints (for example, avoiding frequency conflicts between adjacent devices), the relationships between these variables can be modeled using Boolean logic formulas. For example, for two adjacent nodes (devices with an interference relationship), an incompatibility constraint formula can be introduced to ensure that they are not assigned the same frequency.
[0078] Take two devices as an example, assuming the frequency of one device is , and the frequency of the other device is Using Boolean operations, the exclusive OR (XOR) operation can be used to simply and efficiently ensure that the frequencies of the two devices are different. and When the XOR result is 1, it means that the two devices are assigned different frequencies, thus satisfying the constraints of the spectrum allocation problem.
[0079] More specifically, when two adjacent devices and When the XOR result of satisfies the following formula, the variable assignment combination can meet the solution requirements of the Boolean expression:
[0080] ⊕ = 1
[0081] After expanding it, it can be written as:
[0082] ⊕ =(¬ ∧ )∨(
[0083] This formula clearly reflects the logical relationship between the two variables when they take different values. For a more intuitive understanding, reference can be made to the truth table of the XOR gate (as shown in Table 1). According to the truth table, when Figure 2 and take different values (such as =0, =1 or =1, =0), the result of the XOR operation is 1, which meets the above assumption and satisfies the interference condition. Similarly, this method can be extended to more complex spectrum allocation problems. For example, in a multi-band allocation problem, more frequencies can be encoded using multiple Boolean variable combinations, and the corresponding Boolean expression can be extended to construct a logical formula that satisfies complex interference constraints. S3, according to the number of devices to be allocated and the constraint conditions, a Boolean expression is established;
[0084] Specifically, when there are multiple devices, binary codes "0" and "1" are set according to the different frequency values of each device, and a bit is used to represent the frequency allocation state of the device, and a Boolean expression for multiple devices is established.
[0085] S4, according to the expansion of the Boolean expression, an analysis tree is constructed, which includes a root node and a plurality of child nodes, the child nodes include leaf nodes and non-leaf nodes, the leaf nodes are nodes without child nodes, the root node and the non-leaf nodes store logical relationships including logical AND, logical OR and logical NOT, and the leaf nodes store device variables, the device variables modified by logical NOT are negative variables, and the device variables not modified by logical NOT are positive variables.
[0086] According to the expansion of the Boolean expression, the analysis tree is constructed, which includes:
[0087] The Boolean expression is:
[0088] (A⊕B)∧(B⊕C)……
[0089] The Boolean expression is expanded to obtain the expansion of the Boolean expression:
[0090] (A⊕B)∧(B⊕C)……=[(¬A∧B)∨(A∧¬B)]∧[(¬B∧C)∨(B∧¬C)]……=1
[0091] Wherein, A, B and C represent the frequencies of different devices, ⊕ represents different frequencies, ∧ represents logical AND operation, ∨ represents logical OR operation, and ¬ represents logical NOT operation.
[0092]
[0093] The result of the Boolean expression is 1, which is a constraint condition, indicating that the frequencies of adjacent devices are different.
[0094] According to the expansion of the Boolean expression, sub-nodes containing different logical operations and the connection relationship of the sub-nodes are obtained.
[0095] Specifically, the connection relationship indicates whether interference will exist between adjacent devices, and the sub-nodes of different logical operations are obtained according to the logical relationship between each device and other devices after the expansion of the Boolean expression.
[0096] According to the connection relationship of the sub-nodes and the logical operations of the sub-nodes, a parse tree is constructed.
[0097] Specifically, the recursive descent algorithm is used to parse the Boolean expression of the spectrum allocation, which is gradually decomposed into a syntax tree with a hierarchical structure, in which the internal nodes represent logical operators (such as AND, OR, NOT), and the leaf nodes correspond to the frequency variables allocated to user devices or communication links. The recursive descent algorithm can accurately capture the logical dependency relationship and mutual exclusion constraints between variables in the spectrum allocation by parsing the substructure of the expression layer by layer.
[0098] Taking three devices as an example, the Boolean expression expansion thereof is:
[0099] (A⊕B)∧(B⊕C)=[(¬A∧B)∨(A∧¬B)]∧[(¬B∧C)∨(B∧¬C)]=1
[0100] The parse tree established according to the expansion is shown in Figure 3 .
[0101] S5, according to the number of devices, the total number of allocation scheme combinations of the spectrum allocation of each device is calculated, and the total number of allocation scheme combinations is taken as a search space, which includes a front search space, a middle search space and a rear search space.
[0102] Specifically, when the number of devices is determined, all schemes for allocating the spectrum to each device can be obtained, which includes all spectrum allocation schemes satisfying the constraint condition and not satisfying the constraint condition. When the number of devices is n, the total number of allocation scheme combinations is . That is, there are several different spectrum allocation schemes in the search space.
[0103] When allocating the search space, first divide it into three equal parts. If it cannot be divided into three equal parts, first allocate the front search space and the back search space, and then use the values of the front search space or the back search space to fill the middle search space. For example, when the number of devices is 3, there are 3 allocation schemes in the front search space and 3 allocation schemes in the back search space. At this time, there are only 2 allocation schemes in the middle search space. In this case, one allocation scheme from the front search space or the back search space is copied to fill the middle search space.
[0104] S6. traverse each node of the parse tree to obtain the ratio of the number of positive and negative variables, and select a high-quality search space from the search space according to the ratio of the number of positive and negative variables;
[0105] Traverse each node of the parse tree to obtain the ratio of the number of positive and negative variables. Select the high-quality search space from the search space based on the positive and negative variables, including:
[0106] Get the number of device variables modified by non-nodes, the number of device variables modified by and nodes, and the number of device variables modified by or nodes in the parse tree;
[0107] Specifically, since the child nodes in the parse tree are established through the logical operation properties of the Boolean expression expansion, each node of the parse tree is directly traversed to obtain the node number of different nodes.
[0108] Calculate the sum of the number of device variables modified by the AND node and the number of device variables modified by the OR node as the number of positive variables;
[0109] The number of the device variables modified by the non-node is regarded as the negative variable number;
[0110] Calculate the ratio of the number of positive variables to the number of negative variables as the ratio of the number of positive and negative variables;
[0111] Specifically, the ratio of the number of positive and negative variables = the number of positive variables / the number of negative variables.
[0112] Select the best search space from the search space based on the positive and negative variables.
[0113] Selecting a high-quality search space from the search space based on the ratio of the number of positive and negative variables includes:
[0114] Set the threshold value of the positive and negative variable ratio;
[0115] When the ratio of the number of positive and negative variables is less than the minimum value of the positive and negative variable ratio threshold, the front search space is selected as the high-quality search space;
[0116] When the ratio of the number of positive and negative variables is greater than the maximum value of the positive and negative variable ratio threshold, the latter search space is selected as the high-quality search space;
[0117] Specifically, the positive-negative variable ratio threshold is a threshold for determining which search space the best solution is located in. In this embodiment, the minimum value of the positive-negative variable ratio threshold is set to 0.5, and the maximum value is set to 2.
[0118] If r>2, it means that the available frequencies are significantly greater than the unavailable frequencies, and the high-quality allocation schemes may be concentrated in the latter part of the search space (denoted as +∞);
[0119] If 0.5≤r≤2 r<2, it indicates that the available and unavailable frequencies are close to balance, and the high-quality allocation scheme is more likely to be distributed in the middle area of the search space (denoted as middle).
[0120] In other cases (r<0.5), unavailable frequencies are relatively dominant, and high-quality allocation schemes are usually concentrated in the first part of the search space (denoted as -∞).
[0121] Dynamically partitioning the search space based on the above inferences and prioritizing the solution in the inferred high-quality solution area can significantly reduce unnecessary search overhead and improve solution efficiency. This method combines the logical hierarchical analysis of the parse tree algorithm and the step-by-step construction characteristics of the recursive descent algorithm, making the processing of spectrum allocation Boolean expressions more intuitive and efficient.
[0122] S7, performing non-uniform superposition on the allocation schemes according to the high-quality search space to obtain an initial scheme after non-uniform superposition, wherein the amplitude of each allocation scheme in the initial scheme is the same;
[0123] Specifically, within the repartitioned search space, the Grover quantum search algorithm is used to solve the Boolean satisfiability model of the spectrum allocation problem. Based on the principles of the Grover quantum search algorithm, the entire solution process can be divided into three core modules: the initialization module, the Grover iteration module, and the measurement module.
[0124] When solving a spectrum allocation problem involving n devices, e interference relationships, and k frequencies, three types of quantum registers are required to support different quantum computing functions: input register, auxiliary register, and output register. The design of each register is precisely configured based on the scale and complexity of the problem. The details are as follows:
[0125] Input register: used to store the frequency allocation information of each device. The number of qubits required is related to the number of devices n and the frequency type k. The frequency of each device needs The total number of qubits required for the entire input register is: n× After initialization, this register can represent the color allocation status of all devices in the entire system.
[0126] Auxiliary registers: used to store intermediate results, help error correction and implement complex quantum logic operations, the number of qubits required is related to the interference relationship e of the system and the frequency category k, the number of qubits required for auxiliary records between each pair of adjacent devices is 2× +1, so the total number of qubits of the entire auxiliary register is:
[0127] e(2× +1). This register ensures that the frequency allocation of each pair of adjacent devices meets the constraint condition during the calculation process, such as avoiding interference.
[0128] Output register: used to store the final calculation result of the Boolean expression, the result of 1 indicates that the current frequency allocation meets the constraint condition, and the result of 0 indicates that it does not meet. Since the output only needs a binary state, the output register only needs one qubit.
[0129] According to the above rules, after determining the total number of qubits required to solve a spectrum allocation problem with n devices, e interference relationships and k frequencies, the next step is to initialize the quantum register. Assuming that the spectrum allocation problem has at least one allocation scheme that meets the conditions among all possible allocation schemes , denoted as . The traditional Grover algorithm will apply a Hadamard gate (H gate) to each qubit in the input register during the initialization phase, generating an equal-amplitude superposition state of all possible allocation schemes in the search space:
[0130]
[0131] As shown in Figure 4 , this operation assigns the same initial amplitude to all potential allocation schemes, ensuring the comprehensiveness of the search process. However, in order to find the result faster, the high-quality search space has already been found, so during initialization, a larger amplitude is applied to the potential solutions concentrated in the latter part, making their weights significantly higher than the other parts, and non-uniform initialization is performed.
[0132] The steps of non-uniform initialization are:
[0133] 1. Assign a larger initial amplitude to the potential allocation schemes in the latter part, usually twice or even higher than the amplitude of the potential allocation schemes in other parts, as shown in Figure 5 .
[0134] 2. Optionally, set the amplitude of the allocation schemes in the remaining part of the original search space to zero, thereby completely ignoring these solutions, as shown in Figure 6 .
[0135] The method of performing non-uniform superposition of initial states not only effectively narrows the search range, but also improves the efficiency of the Grover algorithm in finding the target allocation solution in the high-probability area, greatly reducing computational overhead and unnecessary searches.
[0136] S8. Mark all the initial non-uniform superposition solutions according to the constraint conditions to obtain a target solution set, and perform phase flipping on the target solution set to obtain a flipped solution set;
[0137] All the initial solutions of non-uniform superposition are marked according to the constraints to obtain the target solution set. The target solution set is phase-flipped to obtain the flip solution set including:
[0138] Get the preset allocation plan;
[0139] All initial solutions that meet a preset allocation solution in the non-uniform superposition initial solution are marked to obtain a target solution set, and the target solution set is phase-reversed to obtain a reversed solution set.
[0140] Specifically, after initializing the initial state by non-uniform superposition, we construct a mapping operation whose purpose is to flip the phase of the target allocation scheme without affecting the phases of other non-target allocation schemes. Assume that the target allocation scheme is , we apply a phase flip to it through a mapping operation, i.e. →- , while for other non-target allocation schemes , the phase remains unchanged, that is →- ,In this way, the phase of the target allocation scheme is flipped, while the phases of other allocation schemes are not affected, ,ensuring the distinguishability of the target allocation scheme from other allocation schemes.,Among all the initial schemes, not all schemes can meet the requirements.,The preset allocation schemes are the types of schemes that meet the spectrum allocation requirements.
[0141] During this process, the phase flip of the target allocation scheme will cause its amplitude sign to change, which in turn affects the final quantum measurement results. Figure 7 The effect of this operation is shown, where the target allocation scheme The sign of the amplitude of is reversed, indicating that the amplitude of the target allocation scheme has changed significantly compared to the initial state.
[0142] It can be seen from the XOR gate truth table that the spectrum allocation of adjacent devices that meet the constraint conditions is different.
[0143] Take the three-device linear two-frequency problem as an example. In this problem, we define the target allocation scheme as , and limit the search space to three possible allocation schemes , , Through the non-uniform superposition operation, we get the initial state as:
[0144]
[0145] in, This is the target allocation plan.
[0146] At this time, the initial state is a uniform state formed by the superposition of the target allocation scheme and other allocation schemes. Next, we apply a phase flip operation to this initial state so that the target allocation scheme The amplitude of the target allocation scheme changes from positive to negative, while the amplitudes of the other allocation schemes remain unchanged.
[0147] It is worth noting that although the amplitude of the target allocation scheme has been flipped, if we measure the input quantum bits at this stage, the probabilities of all allocation schemes are still equal. This is because the probability of the quantum state is determined by the square of the amplitude, not the sign of the amplitude. Therefore, the probability of the target allocation scheme is still equal to that of other allocation schemes. Although the sign of the amplitude of the target allocation scheme has changed, causing its phase to flip, the square value of the amplitude remains unchanged and is still the same as the probability of other allocation schemes. After this operation, the average amplitude of all allocation schemes will be reduced. Figure 8 The dashed line in represents the change in this average amplitude.
[0148] S9, constructing an average inversion operator;
[0149] S10, continuously iteratively adjusting the flipping solution set through the average inversion operator to increase the amplitude of the target solution, thereby obtaining an amplitude-increased solution set;
[0150] The average inversion operator is used to iteratively adjust the flipping scheme set to increase the amplitude of the target scheme. The amplitude increase scheme set includes:
[0151] The average inversion operator is expressed as:
[0152] ;
[0153] where | > is a uniform superposition state of all potential solutions, I is the identity operator,<s|为|s> The conjugate transpose of
[0154] The flip scheme set is iteratively adjusted continuously through the average inversion operator to reduce the amplitude of non-target schemes and increase the amplitude of target schemes. The target scheme is the scheme that meets the constraints of spectrum allocation.
[0155] Specifically, in the initial state Imposition After the operation (i.e. marking the target allocation scheme), the next thing to do in quantum search is to construct the average inversion operator by applying Operators, each solution in the quantum state undergoes a phase reversal relative to the uniform superposition state. In particular, the target state after phase reversal has a significantly different phase from other non-target states. This process gradually increases the probability amplitude of the target state over multiple iterations, ultimately causing the probability of the target state's measurement result to approach 1.
[0156] Taking the example of the three-device linear two-frequency problem, we first initialized all the allocation schemes, and then applied the Oracle operator and the average inversion operator. After one iteration, the target allocation scheme The amplitude of α begins to increase, while other non-target allocation schemes such as and The amplitude of the non-target allocation scheme gradually decreases. The reason for this phenomenon is that after the inversion operator operation, the amplitude change of the non-target allocation scheme is closer to the average value of the uniform distribution than the target allocation scheme. , so their amplitude will decrease during the adjustment process. Then the average The larger the deviation, the stronger the amplitude will be.
[0157] As this process continues to iterate, the amplitude of the target allocation scheme will become larger and larger, and eventually its probability amplitude will be significantly higher than all other non-target allocation schemes, and almost all measurement results will point to the target allocation scheme. The characteristics of this quantum search algorithm enable us to quickly find the target solution among many potential solutions, and its search efficiency far exceeds that of the classical brute force search method. This process can be intuitively expressed in a graphical way. Figure 9 It shows the changing trend that the amplitude of the target allocation scheme gradually increases after multiple iterations.
[0158] S11. Measure the amplitude increase scheme set to obtain an allocation result.
[0159] The amplitude increase scheme set is measured, and the distribution results include:
[0160] Measure the amplitude increase scheme set and obtain the allocation scheme corresponding to the maximum amplitude value;
[0161] The allocation scheme corresponding to the maximum amplitude value is taken as the allocation result.
[0162] Specifically, after G iterations, the quantum state will be close to the target state. At this point, the probability amplitude of the target allocation scenario is significantly amplified. Although the state of the entire quantum system is still a superposition of all allocation scenarios, the probability of the target allocation scenario is now the highest. This process is the key to quantum search. By repeatedly applying the inversion operator in the Grover algorithm, the amplitude of the target allocation scenario gradually increases, while the amplitudes of other non-target allocation scenarios decrease. This makes the target allocation scenario the most likely outcome in the final measurement stage.
[0163] In the final step of quantum search, measuring the quantum superposition state is crucial. This measurement causes the quantum state to collapse from the superposition to a specific classical state, namely, an entry in the database. In the traditional Grover algorithm, all solutions within the search space are equally likely. However, the method employed in this paper performs a non-uniform superposition during the initialization phase, significantly reducing the search space of the original SAT problem. This approach increases the probability of the target solution in the final result, thereby increasing the likelihood of finding the correct solution.
[0164] Specifically, in the example of the three-device linear two-frequency problem, after the initialization operation and one Grover iteration, we measure the qubits on the input register. At this time, the target allocation scheme The probability of the amplitude being the highest corresponds to an effective allocation scheme in the spectrum allocation problem. Compared with the results of the traditional Grover algorithm on the same spectrum allocation problem, the method of the present invention can find an effective allocation scheme with a higher probability after one iteration. Experimental results show that the probability of the target allocation scheme is more than twice that of the traditional method, and the results of the two methods are compared. Figure 10 shown.
[0165] This result means that the algorithm of the present invention can significantly reduce the time complexity when solving the spectrum allocation problem. Assume that the traditional Grover algorithm needs O( ) time complexity, then the method of the present invention only needs O( ), demonstrating the significant advantages of quantum algorithms for solving certain types of problems. In particular, when there is only one target allocation, the probability of finding the target allocation increases significantly after a single Grover iteration because the search space becomes smaller and the target allocation occupies a larger proportion.
[0166] This process not only demonstrates how quantum search algorithms accelerate the discovery of target solutions through clever amplitude amplification and phase inversion mechanisms, but also reveals the close relationship between the size of the search space and the probability of finding a good solution. When there is only one target solution, the probability of the target solution is higher, which enables quantum search to more efficiently find the best solution from a large number of potential solutions.
[0167] The spectrum allocation problem is a typical combinatorial optimization problem, which usually has an extremely large solution space, which makes the solution of the problem very complex and computationally intensive. In such problems, traditional search algorithms often face high computational costs, so effective strategies are needed to reduce the search space and thus accelerate the solution of the problem. To address this challenge, the present invention combines the classical parse tree algorithm with the traditional Grover quantum search algorithm, by determining the approximate position of the target spectrum allocation scheme in the search space in advance. This strategy effectively reduces or subdivides the search space of the original spectrum allocation problem, thereby reducing the amount of computation and significantly improving the solution efficiency.
[0168] Through this hybrid quantum-classical algorithm, the present invention can efficiently and accurately find a feasible solution to the spectrum allocation problem. Experimental results show that compared with traditional classical algorithms and quantum Grover algorithms, the method of the present invention can significantly reduce the time complexity of the solution process. Specifically, the traditional classical algorithm requires O(N) time complexity to solve similar spectrum allocation problems, while the Grover algorithm requires O( ) time complexity, and the hybrid algorithm of the present invention reduces the time complexity to O( ), where N represents the size of the search space and L is the degree of subdivision of the search space. In this way, the efficiency of the algorithm is greatly improved, especially when dealing with large-scale spectrum allocation problems. Figure 10 This is a comparison chart of the results when comparing this application with the traditional method.
[0169] A spectrum allocation system based on a hybrid quantum and classical algorithm, comprising:
[0170] A first acquisition module is used to obtain the number of devices and frequencies to which spectrum is to be allocated;
[0171] A second acquisition module is configured to acquire a connection relationship between adjacent devices and set a constraint condition between the adjacent devices, wherein the adjacent devices are devices that have frequency interference with each other, and the constraint condition is that the adjacent devices have different allocated frequencies;
[0172] A first establishing module, configured to establish a Boolean expression according to the number of devices to be allocated and the constraint conditions;
[0173] A second establishment module is used to expand the Boolean expression and construct a parse tree, wherein the parse tree includes a root node and a plurality of child nodes, and the child nodes further include leaf nodes and non-leaf nodes, wherein the leaf node is a node without child nodes, and the root node and the non-leaf nodes store logical relationships, including logical AND, logical OR, and logical NOT. The leaf nodes store device variables, wherein the device variables modified by logical NOT are negative variables, and the device variables not modified by logical NOT are positive variables;
[0174] a calculation module, configured to calculate a total number of allocation scheme combinations for spectrum allocation to each device based on the number of devices, and use the total number of allocation scheme combinations as a search space, where the search space includes a front search space, a middle search space, and a rear search space;
[0175] A traversal module is used to traverse each node of the parse tree to obtain a ratio of the number of positive and negative variables, and select a high-quality search space from the search space according to the ratio of the number of positive and negative variables;
[0176] an initialization module, configured to perform non-uniform superposition on the allocation schemes according to the high-quality search space to obtain an initial scheme after the non-uniform superposition, wherein the amplitude of each allocation scheme in the initial scheme is the same;
[0177] a marking module, configured to mark all the non-uniform superposition initial schemes according to the constraint conditions to obtain a target scheme set, and perform phase flipping on the target scheme set to obtain a flipped scheme set;
[0178] An amplitude amplification module, configured to iteratively adjust the inversion solution set continuously through an average inversion operator to increase the amplitude of the target solution and obtain an amplitude amplification solution set;
[0179] The measuring module is used to measure the amplitude increase scheme set to obtain an allocation result.
[0180] An embodiment of the present application also discloses a terminal device, including a memory and a processor. The memory stores a computer program that can be run on the processor. When the processor loads and executes the computer program, it adopts a spectrum allocation method based on a hybrid quantum and classical algorithm.
[0181] Among them, the terminal device can be a computer device such as a desktop computer, a laptop computer or a cloud server, and the terminal device includes but is not limited to a processor and a memory. For example, the terminal device can also include input and output devices, network access devices and buses, etc.
[0182] Among them, the processor can adopt a central processing unit (CPU). Of course, according to actual usage, other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. can also be adopted. The general-purpose processor can adopt a microprocessor or any conventional processor, etc., and this application does not impose any restrictions on this.
[0183] Among them, the memory can be an internal storage unit of the terminal device, such as the hard disk or memory of the terminal device, or it can be an external storage device of the terminal device, such as a plug-in hard disk, smart memory card (SMC), secure digital card (SD) or flash memory card (FC) equipped on the terminal device, etc., and the memory can also be a combination of the internal storage unit and the external storage device of the terminal device. The memory is used to store computer programs and other programs and data required by the terminal device. The memory can also be used to temporarily store data that has been output or is to be output. This application does not impose any restrictions on this.
[0184] Among them, through this terminal device, a spectrum allocation method based on a hybrid quantum and classical algorithm in the above embodiment is stored in the memory of the terminal device, and is loaded and executed on the processor of the terminal device for easy use.
[0185] An embodiment of the present application further discloses a computer-readable storage medium, and the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, a spectrum allocation method based on a hybrid quantum and classical algorithm in the above embodiment is adopted.
[0186] Among them, the computer program can be stored in a computer-readable medium, the computer program includes computer program code, the computer program code can be in the form of source code, object code, executable file or certain middleware, etc. The computer-readable medium includes any entity or device that can carry computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that computer-readable medium includes but is not limited to the above-mentioned components.
[0187] Among them, through this computer-readable storage medium, a spectrum allocation method based on a hybrid quantum and classical algorithm in the above embodiment is stored in a computer-readable storage medium, and is loaded and executed on a processor to facilitate the storage and application of the above method.
[0188] Those skilled in the art should understand that the above discussion of any embodiment is only intended to be illustrative and is not intended to be limiting to the scope of the present application; the above embodiments or technical features among different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes such as the different aspects of one or more embodiments of the present application as described above, which are not provided in details for the sake of brevity.
[0189] One or more embodiments of the present application are intended to cover all such alternatives, modifications, and variations as fall within the broad scope of the present application. Accordingly, any one of the above-cited examples, or any other unrecited example, can be prepared by any method and materials equivalent to those described above, without departing from the spirit and scope of one or more embodiments of the present application.
Claims
1. A spectrum allocation method based on hybrid quantum and classical algorithms, characterized by: include: Obtain the number of devices and frequencies to be allocated spectrum; Obtaining a connection relationship between adjacent devices and setting a constraint condition between the adjacent devices, wherein the adjacent devices are devices that have frequency interference with each other, and the constraint condition is that the adjacent devices have different allocated frequencies; Establishing a Boolean expression according to the number of devices to be allocated and the constraint conditions; Expanding the Boolean expression constructs a parse tree, the parse tree including a root node and a plurality of child nodes, the child nodes further including leaf nodes and non-leaf nodes, the leaf nodes being nodes without child nodes, the root nodes and non-leaf nodes storing logical relationships, including logical AND, logical OR, and logical NOT, the leaf nodes storing device variables, the device variables modified by logical NOT being negative variables, and the device variables not modified by logical NOT being positive variables; Calculate, based on the number of devices, a total number of allocation scheme combinations for spectrum allocation to each device, and use the total number of allocation scheme combinations as a search space, where the search space includes a front search space, a middle search space, and a rear search space; Traversing each node of the parse tree to obtain a ratio of the number of positive and negative variables, and selecting a high-quality search space from the search space according to the ratio of the number of positive and negative variables; Performing non-uniform superposition on the allocation schemes according to the high-quality search space to obtain an initial scheme after non-uniform superposition, wherein the amplitude of each allocation scheme in the initial scheme is the same; Marking all the non-uniform superposition initial solutions according to the constraint conditions to obtain a target solution set, and performing phase flipping on the target solution set to obtain a flipped solution set; Continuously iteratively adjusting the flipping solution set through an average inversion operator to increase the amplitude of the target solution and obtain an amplitude increase solution set; The amplitude increase scheme set is measured to obtain an allocation result.
2. The spectrum allocation method based on hybrid quantum and classical algorithms as claimed in claim 1, characterized in that: According to the expansion of the Boolean expression, constructing a parse tree includes: The Boolean expression is: (A⊕B)∧(B⊕C)…… Expand the Boolean expression to get the expanded form of the Boolean expression: (A⊕B)∧(B⊕C)……=[(¬A∧B)∨(A∧¬B)]∧[(¬B∧C)∨(B∧¬C)]……=1; Among them, A, B, and C represent the frequencies of different devices, ⊕ represents different frequencies, ∧ represents the logical AND operation, ∨ represents the logical OR operation, and ¬ represents the logical NOT operation; According to the expansion of the Boolean expression, sub-nodes including different logical operations and connection relationships of the sub-nodes are obtained; A parse tree is constructed based on the connection relationship of the sub-nodes and the logical operations of the sub-nodes.
3. The spectrum allocation method based on hybrid quantum and classical algorithms as claimed in claim 1, characterized in that: Traversing each node of the parse tree to obtain a ratio of the number of positive and negative variables, and selecting a high-quality search space from the search space according to the positive and negative variables includes: Get the number of device variables modified by non-nodes, the number of device variables modified by and nodes, and the number of device variables modified by or nodes in the parse tree; Calculate the sum of the number of device variables modified by the AND node and the number of device variables modified by the OR node as the number of positive variables; The number of the device variables modified by the non-node is regarded as the negative variable number; Calculating the ratio of the number of positive variables to the number of negative variables as the ratio of the number of positive and negative variables; A high-quality search space is selected from the search space according to the positive and negative variables.
4. The spectrum allocation method based on hybrid quantum and classical algorithms as claimed in claim 3, characterized in that: The selecting a high-quality search space from the search space according to the ratio of the number of positive and negative variables comprises: Set the threshold value of the positive and negative variable ratio; When the ratio of the number of positive and negative variables is less than the minimum value of the positive and negative variable ratio threshold, the front search space is selected as the high-quality search space; When the ratio of the number of positive and negative variables is greater than the maximum value of the positive and negative variable ratio threshold, selecting the latter search space as the high-quality search space; When the ratio of the number of positive and negative variables is within the positive and negative variable threshold, the middle search space is selected as the high-quality search space.
5. The spectrum allocation method based on hybrid quantum and classical algorithms as claimed in claim 1, characterized in that: The step of marking all the non-uniform superposition initial solutions according to the constraint conditions to obtain a target solution set, and performing phase flipping on the target solution set to obtain a flipped solution set includes: Get the preset allocation plan; All initial solutions that meet a preset allocation solution in the non-uniform superposition initial solution are marked to obtain a target solution set, and the target solution set is phase-reversed to obtain a reversed solution set.
6. The spectrum allocation method based on hybrid quantum and classical algorithms as claimed in claim 1, characterized in that: The average inversion operator is used to continuously iteratively adjust the flip solution set to increase the amplitude of the target solution, and the amplitude increase solution set obtained includes: The average inversion operator is expressed as: ; where, | > is the uniform superposition state of all potential solutions, I is the identity operator, and <s| is the conjugate transpose of |s>; The set of flip schemes is iteratively adjusted continuously by the average inversion operator to reduce the amplitude of non-target schemes and increase the amplitude of target schemes, wherein the target scheme is a scheme that satisfies the constraint conditions of spectrum allocation.
7. The spectrum allocation method based on hybrid quantum and classical algorithms as claimed in claim 1, characterized in that: The measuring the amplitude increase scheme set to obtain an allocation result includes: The amplitude increase scheme set is measured to obtain an allocation scheme corresponding to a maximum amplitude value; The allocation scheme corresponding to the maximum amplitude value is taken as the allocation result.
8. A spectrum allocation system based on a hybrid quantum and classical algorithm, characterized by: include: A first acquisition module is used to obtain the number of devices and frequencies to which spectrum is to be allocated; A second acquisition module is configured to acquire a connection relationship between adjacent devices and set a constraint condition between the adjacent devices, wherein the adjacent devices are devices that have frequency interference with each other, and the constraint condition is that the adjacent devices have different allocated frequencies; A first establishing module, configured to establish a Boolean expression according to the number of devices to be allocated and the constraint conditions; A second establishment module is used to expand the Boolean expression and construct a parse tree, wherein the parse tree includes a root node and a plurality of child nodes, and the child nodes further include leaf nodes and non-leaf nodes, wherein the leaf node is a node without child nodes, and the root node and the non-leaf nodes store logical relationships, including logical AND, logical OR, and logical NOT. The leaf nodes store device variables, wherein the device variables modified by logical NOT are negative variables, and the device variables not modified by logical NOT are positive variables; a calculation module, configured to calculate a total number of allocation scheme combinations for spectrum allocation to each device based on the number of devices, and use the total number of allocation scheme combinations as a search space, where the search space includes a front search space, a middle search space, and a rear search space; A traversal module is used to traverse each node of the parse tree to obtain a ratio of the number of positive and negative variables, and select a high-quality search space from the search space according to the ratio of the number of positive and negative variables; an initialization module, configured to perform non-uniform superposition on the allocation schemes according to the high-quality search space to obtain an initial scheme after the non-uniform superposition, wherein the amplitude of each allocation scheme in the initial scheme is the same; a marking module, configured to mark all the non-uniform superposition initial schemes according to the constraint conditions to obtain a target scheme set, and perform phase flipping on the target scheme set to obtain a flipped scheme set; An amplitude amplification module, configured to iteratively adjust the inversion solution set continuously through an average inversion operator to increase the amplitude of the target solution and obtain an amplitude amplification solution set; The measuring module is used to measure the amplitude increase scheme set to obtain an allocation result.
9. A terminal device comprising a memory and a processor, characterized in that: The memory stores a computer program that can be run on the processor. When the processor loads and executes the computer program, the method according to any one of claims 1 to 7 is adopted.
10. A computer-readable storage medium storing a computer program, wherein: When the computer program is loaded and executed by a processor, the method according to any one of claims 1 to 7 is adopted.
Citation Information
Patent Citations
Integer decomposition optimization method and system based on Grover quantum computing search algorithm
CN112182494A
Self-organizing quantum network protocol and route scheduling algorithm
CN113163433A