0-1 integer programming and implicit enumeration-feeling the charm of pruning

Source: Internet
Author: User

0-1 integer Programming and implicit enumeration-feeling the charm of pruning

Integer Planning is a special case of linear programming, that is, when the constraint is a variable integer, the linear programming becomes the integer plan. If all variables are required to be integers, it is a pure integer plan ; If some of the variables are allowed to be integers, it is called mixed integer planning . the 0-1 integer plan to be discussed in this paper is a special case of pure integer programming, that is, all variables are equal to 0 or equal to 1, so this variable becomes a logical variable .

0-1 integer programming is still common in life and can often be summed up as "yes" or "no" issues. For example, there are N products sold to X1,..., xn to choose from, in order to make the most profit, then each of the land is faced with the choice of the problem, usually there are some restrictions, because the Land XI and the sales of the XJ distance closer, so that the choice of Xi can not choose XJ and so on. So how to solve the 0-1 planning problem? The simplest way to do this is to enumerate, to see if all of the pins are selected, then the enumeration of {0, ..., 0} to {1, ..., 1}, which requires 2 of the n-th-exponent. Obviously, when n is large, the efficiency of this approach is very low. The implicit enumeration method introduced in this paper can improve the efficiency of solving the optimal solution.

The so-called implicit enumeration method, in the literal sense, is to implicitly remove some cases that do not require enumeration, and from an example, the steps of the implicit enumeration method are given.

"Example" solves the following planning problems

Max z = 8*x1 + 2*x2-4*x3-7*x4-5*x5;

s.t.{

3*x1 + 3*x2 + x3 + 2*x4 + 3*x5 <= 4

5*x1 + 3*x2-2*x3-x4 + x5 <= 4

Xi = 0 or 1,i = 1, ..., 5

}

1. Preprocessing

First, you need to preprocess the original problem, as to why the text will be explained later. The steps for preprocessing are as follows:

1) Unify the objective function to find the minimum value, that is, "min", and the constraints are all ">=".

    • The Wakahara constraint condition is "<=", then the inequality is equal to 1;
    • The Wakahara constraint is ai * x = bi, which is "Ai * x >= bi" and "-ai * x >=-bi" where AI is the coefficient line vector and X is the variable column vector.

Min Z ' = -8*x1-2*x2 + 4*x3 + 7*x4 + 5*x5;

s.t.{

-3*X1-3*X2-X3-2*X4-3*X5 >= 4

-5*X1-3*X2 + 2*x3 + x4-x5 >= 4

Xi = 0 or 1,i = 1, ..., 5

}

2) A variable with a negative coefficient in the objective function XI is a variable with positive coefficient XI ', where Xi = 1-xi ' (If XI = 0 is xi ' = 1; If XI = 1 then XI ' = 0).

Therefore, in order to solve this problem, the coefficients of X1 and x2 before the objective function are negative, so that X1 = 1-x1 ', x2 = 1-x2 ', substituting 1) is simplified.

Min z ' = 8*x1 ' + 2*x2 ' + 4*x3 + 7*x4 + 5*x5-10;

s.t.{

3*x1 ' + 3*x2 '-x3-2*x4-3*x5 >= 2

5*x1 ' + 3*x2 ' + 2*x3 + x4-x5 >= 4

Xi or XI ' = 0 or 1,i = 1, ..., 5

}

3) Rearrange the order of the variables in the target function and the constraint condition, so that the coefficients in the target function increment.

Min z ' = 2*x2 ' + 4*x3 + 5*x5 + 7*x4 + 8*x1 '-10;

s.t.{

3*x2 '-x3-3*x5-2*x4 + 3*x1 ' >= 2 (a)

3*x2 ' + 2*x3-x5 + x4 + 5*x1 ' >= 4 (b)

Xi or XI ' = 0 or 1,i = 1, ..., 5

}

2. Implicit enumeration

The idea of implicit enumeration is to first enumerate to find a feasible solution, and to get the target function value Z0, after the enumeration if the target function value is not z0, then it must not be the optimal solution.

the role of preprocessing is now explained:

Preprocessing causes the objective function to be the minimum value, the coefficients of the variables are positive and are arranged from small to large, so there are the following rules:

    • Starting with the XI = 0 enumeration is the optimal function of the object, and the resulting function value is the lower bound of the optimal solution;
    • As long as the order of the variables in the target function enumeration is the binary digits from small to large (0 ... 0 to 1 ... 1) can be as early as possible to cite the objective function to take the minimum value (optimal value) of the feasible solution z0.
    • If the shape of the solution is 0. 0xj...x1 The objective function Z1 value is greater than the obtained feasible solution, so long as the end of the xj...x1 and only some bits in the xj...x1 from 0 to 1 of the solution of the objective function value must be greater than Z1, of course, is greater than z0, Therefore, it must not be the optimal solution, can be directly pruned , that is, regardless of the above two cases, directly in accordance with the binary digital enumeration of other forms.

The implicit enumeration steps are as follows:

(1) First ignore the constraints except "Xi or XI ' = 0 or 1", from XI = 0 that is 0 ... 0 Start Enumeration .

(2) The value of the target function is calculated.

    • If the value of the function is less than the available solution, or there is no feasible solution, then the execution (3);
    • If the value of the function is greater than the available solution, prune and then enumerate.

(3) Check whether the solution of the enumeration satisfies the constraint that is removed. (No need to check if a constraint is not met)

    • If not satisfied, the enumeration value at this time is not a feasible solution, continue to enumerate;
    • If satisfied, then update the feasible and objective function value z0. Feasible solution 0.. 0xj...x1 (the number of front ' 0 ' may be 0), so long as the end of the xj...x1 and only some bits from 0 to 1 of the solution of the target function value must be greater than z0, pruning, and then enumeration.

For this problem, start the enumeration from XI = 0 (i = 1 to 5) and get z ' =-10, so 10 is the lower bound of the optimal solution (so 10 is the upper bound of the original problem). The enumeration process list is as follows ('-' represents no judgment):

   x1 '    x4    x5     X3   &NBSP;X2 '  

whether (y/n) satisfies the constraints &NBSP;

  (a)                 (b)

(y/n) is a viable solution

0 0 0) 0 0

0 0 0) 0 1

0 0 0) 1 0

0 0 0) 1 1

-10

-8

-6

-4

N

Y N

N

Y y

N

N

N

Y pruning

   0     0     1     0     0   ;  

   0     0     1     0  1    

   0     0     1     1     0        

   0     1     0     0     0    

   0     1     1     0     0

-5

-3

-1

-3

2

N

Function value-3 is greater than the function value of the known feasible solution-4, must not be the optimal solution

-1 >-4

-3 >-4

2 >-4

N

There is no need to judge constraints, and the branch does not need to be enumerated, i.e. pruning

Ibid.

Ditto

Ditto

As can be seen from the table, we get a better feasible solution in the 4th time enumeration, the target function value Z0 =-4, after which the enumeration either does not satisfy the constraint, or the function value is greater than-4, pruning. In the end we only enumerate 9 times to complete the whole process (much faster than the direct enumeration of 2^5 = 32 times), get the optimal solution for {0,0,0,1,1},min Z ' =-4, revert it to the original problem, the optimal solution is {1, 0, 1, 0, 0},max z = 4.

Summary:

Enumeration (search) seems to be a straightforward way to solve many problems. However, when the solution space is large, the efficiency of the enumeration may be very low, unable to achieve the purpose. At this point, think about whether there are some solutions in the enumeration process before the enumeration can be judged that it must not meet the requirements, directly regardless of them ( pruning ), so you can reduce the solution space, improve efficiency.

0-1 integer programming and implicit enumeration-feeling the charm of pruning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.