3.1. 01CQP Algorithm Description
Consider the constrained
k-diagonal matrix zero-one quadratic programming problem:
where
Q has the same meaning as that of the 01UQP formula in
Section 2,
,
.
In this section, we utilize the dynamic programming method to solve the 01CQP problem. To apply the dynamic programming method, we introduce a state variable
and a stage variable
, which should satisfy the following iteration.
can be expressed as:
We only need to consider the integer point of the state space since and . Since satisfies , we define a set .
Algorithms 2 and 3 show the detailed calculation process.
Algorithm 2
Calculation Method of |
- Case 1:
When , there are two cases. (1a) , , (1b) , ,
We will get a series of functions after executing Case 1. - Case 2:
When , there are also two cases. (2a) must be 0 to satisfy . At this time, , by which we can obtain the function . (2b) In this case, can be both 0 or 1, which generates two more situations: 1) If and , we can get . 2) If and , we can get .
We can see that there is only one function corresponding to each state when , and there are several to each state when . To save storage and computational time, should be selected satisfactorily in the next step. We need to find the optimal and , that the optimizing process refers to for Algorithm 3. |
Algorithm 3 and |
Case 1: There is only one : Set , Case 2: There are more than one : 1) Compare , which are almost the same except for the constant term and pick up the smallest one. 2) Set and . Case 1: There is only one : Set , Case 2: There are more than one : 1) Find the using a similar approach to that in Case 2. 2) Set and .
|
According to the above algorithm, the maximum number of functions per
is shown in
Table 1. The primary time is spent generating the state table. The number of times that the core steps calculated is focused on the state number in
Table 1. In total, we need to update the state table
n times and the number of state is
b, so the time complexity is
.
3.2. Analysis on the Effectiveness and Rationality of 01CQP Algorithm
In this section, we analyze the properties of the polynomial time algorithm for 01CQP. To analyze the algorithm, we need to demonstrate the rationality of Algorithms 2 and 3. Suppose
has the form:
Step 1: Set
Clearly, when , each state has only one function . The coefficient of and the constants are the only different terms in the function.
Step 2: Set
(1) If , execute .
If
,
has the same form as function (
3):
( represents the constant term of the .)
If
,
has the same form as function (
4):
Then,
can be shown as:
At this point, the maximum number of corresponding to each is .
(2) If , execute and .
Here, the is the same as the one in Case 1, so we do not need to repeat it.
Consider , , .
If
,
has the form of function (
5). If
,
has the form of function (
6), then,
can be expressed as:
All are only different in the constant terms and the coefficient of .
Step 3:
Consider the most complex case, and the state variable corresponds to and respectively ( is the number of both). Therefore, we need to execute first, and then execute .
(1) :
Since
has the form as function (
8), the
is executed for the
respectively, and the following expression is obtained:
Clearly, these are only different in the constants and the coefficients of .
(2) :
It is possible to obtain
, which has the following form:
For both case (1) and (2), they are only different in the constants and the coefficients of .
Step 4:
Based on Algorithm 2 Case 2, we calculate the function , and the core is the implementation of and . When executing and , the difference between the two is the constant and the coefficients of . Therefore, when executing , we only need to compare the constant terms. When executing , we only need to compare the sum of the constants and the coefficients of . In this way, we can avoid solving the excess .
The form of the function and the maximum number of in each stage k are similar to the one in stage , which also ensures the repeatability of the algorithm. The algorithm is supplemented by concrete examples and numerical simulations.
3.3. Calculation Example of 01CQP
For example, the parameters
Q,
c,
a, and
b are:
In this example, we will omit some of the states.
(1) Set , ,
We can set
. According to Algorithm 2 Case 1, we can obtain
Table 2.
When , we can calculate and through Algorithm 2 Case (1a) for .
When , we can calculate and through Algorithm 2 Case (1b) for .
We omit , which is the same as .
(2) Set , ,
We can set
. According to Algorithm 2 Case 2, we obtain the
Table 3. The case of
is omitted.
(3) Set
According to Algorithm 2 Case 2 and Algorithm 3, we can gain
with
.
Table 4 and
Table 5 show part of the calculation process. From the table, we can see that only the coefficient of
and constant terms are different in the adjacent items.
(4) Set
Finally, we have
Table 6, which only has the constant terms. Through it, we can see that
,
, and by the backtracking method, we find the optimum solution
.