Lecture 6: Integer programming

advertisement
Lecture 6
1
Linear and Combinatorial
Optimization
Jörg Schmeling
Matematikcentrum
Lecture 6: Integer
programming
• Integer programming.
The transportation problem.
The assignment problem.
The traveling salesman problem.
The knapsack problem.
• Cutting plane methods.
Pure integer problems.
Mixed integer problems.
Lecture 6
2
Integer optimization
Linear optimization where some or all variables
should be integers.
max z = cT x
Ax ≤ b
x ∈ Zm
x≥0
Examples:
• The transportation problem.
• The assignment problem.
• The traveling salesman problem.
• The knapsack problem.
Lecture 6
3
The transportation problem
m - factories (with supply s1 , . . . , sm )
n - warehouses (with demand d1 , . . . , dn )
m
X
i=1
si ≥
n
X
dj
j=1
cij - cost for shipping one unit from factory i to
warehouse j .
xij - number of unit shipped from factory i to
warehouse j .
Lecture 6
4
min z =
m X
n
X
cij xij
i=1 j=1
m
X
i=1
n
X
xij ≥ dj ,
∀i
xij ≤ si ,
∀j
j=1
xij ∈ Z
xij ≥ 0
Theorem: (Homan och Kruskal) If all coecients
are integers in the transportation problem, then
the optimum is automatically at an integer point.
For the transportation problem, there are more
ecient methods than Simplex, see Chap 5.1 in
the book (or lecture 8) and lab 2.
Lecture 6
5
The assignment problem
The transportation problem when s and d are
only ones.
Suppose ve n persons are being considered for n
dierent jobs. Suppose each person does dierent
jobs not equally well. Represent this in a table cij
- the prot of person i performs job j . How should
the jobs be assigned to the dierent persons?
This becomes an integer problem:
max z =
n X
n
X
i=1 j=1
n
X
i=1
n
X
xij = 1,
∀i
xij = 1,
∀j
j=1
xij ∈ Z
xij ≥ 0
cij xij
Lecture 6
The traveling salesman
problem
A salesman has to visit each of n cities C1 , . . . , Cn
and he starts from his home city C1 , then visits
the other n − 1 cities and then returns to C1
again. The order which he visits the cities does
not matter.
cij - distance from city i to city j .
Which order should he visit the cities to minimize
distance?
This can be written as an integer problem.
xij - 1 if the distance between city i to j is
included in the route, otherwise 0.
6
Lecture 6
7
min z =
m X
n
X
cij xij
i=1 j=1
m
X
i=1
n
X
xij = 1,
∀i
xij = 1,
∀j
j=1
ui − uj + nxij ≤ n − 1,
xij ∈ Z
xij ≤ 1
xij ≥ 0
ui ∈ Z
ui ≥ 0
i, j = 2, . . . , n and i 6= j
Lecture 6
The knapsack problem
Pure integer problem with a single constraint.
n types of objects are available.
ith type has weight wi kg and value ci kronor.
Knapsack has weight capacity of w kg.
Objects cannot be broken. Only a nonnegative
integer no. of them can be loaded into knapsack.
Determine which subset of objects (and how
many of each) to load into knapsack to maximize
total value loaded subject to its weight capacity.
Two versions; nonnegative integer knapsack
problem, 0-1 knapsack problem.
Simplest pure IP problem with many applications.
8
Lecture 6
9
The knapsack problem
max z =
n
X
i=1
n
X
wi xi ≤ w,
i=1
xi ∈ Z
xi ≥ 0
(xi ≤ 1)
ci xi
Lecture 6
10
The cutting plane method
Pure integer problems
Ralph Gomory 1958.
1. Solve rst
max z = cT x
Ax ≤ b
x ≥ 0 x ∈ Rm
2. If the solution x∗ consists of only integers, we
are done. Otherwise introduce additional
constraints: cutting plane constraints
n
X
(−gij )xj + u = (−fi )
j=1
which removes x∗ , without removing integer
solutions.
3. Add the cutting plane constraint and go to 1.
NB: The cutting plane constraint removes x∗ , but
not any integer solution.
Lecture 6
11
The cutting plane method
Suppose a constraint in the tableau is
n
X
tij xj = XBi
(1)
j=1
where XBi is the value of basic variable i.
Let [a] denote the largest integer which is smaller
than a.
Since [tij ] ≤ tij and xj ≥ 0 it follows,
n
X
[tij ]xj ≤ XBi
j=1
For each integer solution, the left handside sums
up to an integer. Thus it follows
n
X
j=1
[tij ]xj ≤ [XBi ]
Lecture 6
12
Add a slack variable u:
n
X
(2)
[tij ]xj + u = [XBi ]
j=1
Subtract now (1) from (2), and we obtain
n
X
([tij ] − tij )xj + u = ([XBi ] − XBi )
j=1
Example:
1
1
17
x3 − x4 =
8
8
4
|{z}
|{z}
|{z}
t13
t14
XB1
gives rise to
7
1
x3 −
x4 + u =
−
8
8
|{z}
|{z}
[t13 ]−t13
[t14 ]−t14
1
−
4
|{z}
[XB1 ]−XB1
Since a new constraint is added, the dual simplex
can be used.
Lecture 6
13
Algorithm
1. Solve the problem without integer constraints.
2. If optimum x̂ is an integer solution, we are
done.
3. Otherwise form a cutting plane constraint and
add it to the problem. Go to 1.
NB:
* The new constraint does not remove any integer
solutions.
*The new constraint does remove x̂.
Examples.
Drawbacks:
• A lot of constraints may be required before
the integer optimum is obtained.
• It may be hard numerically to decide whether
a number is actually an integer or not.
• The integer solution does not appear until the
very last step.
Lecture 6
14
The cutting plane method
Mixed integer problems
If certain variables should be integers and others
not, then one can derive a similar constraint.
Let the equation where the basic variable that
should be an integer but is not be
n
X
tij xj = XBi
j=1
where XBi is the value of basic variable i.
Write XBi = [XBi ] + fi and tij = [tij ] + gij .
New constraint
X
nonbasicvariables
−dj xj + ui = −fi
(3)
Lecture 6
15
where dj är
• tij if tij ≥ 0 and xj need not be integer.
•
fi
fi −1 tij
if tij < 0 and xj need not be integer.
• gij if gij ≤ fi and xj must be integer.
•
fi
fi −1 (gij
integer.
− 1) if gij > fi and xj must be
with fi = XBi − [XBi ] and gij = tij − [tij ].
The reasoning is similar for pure integer
problems, though a little more complicated. See
pages 269-274 in the book.
Download