Anda di halaman 1dari 22

Inheritance problem (not in the book)

Problem: Divide objects with values 100, 61, 45, 37,


22, 21, 2 between two persons in a fair way
(without cutting objects!).
Variables: xi = 1/0: person 1 gets object i or not.
Person 1 gets objects valued:
100x1 + 61x2 + 45x3 + 37x4 + 22x5 + 21x6 + 2x7
Person 2 gets
100(1-x1)+61(1-x2)+45(1-x3)+37(x4-1)+22(1-x5)+21(1x6)+2(1-x7)
Make the difference as small as possible:

Min
|100x1 + 61x2 + 45x3 + 37x4 + 22x5 + 21x6 +
2x7-144|
s.t. xi {0,1}

This objective function is non-linear!

Different approach: Maximize the total value for the


person that gets least.
Max

100x1 + 61x2 + 45x3 + 37x4 + 22x5 + 21x6 + 2x7

s.t.

100x1+61x2+45x3+37x4+22x5+21x6 +2x7 144


xi {0,1}

A heuristic solution approach would be to


give the next object to the person that has least:
1: 100
2: 61

37
45

2
22

21

LP relaxation:
(1, 0.7213, 0, 0, 0, 0, 0)

Z = 144

Rounding?
(1, 1, 0, 0, 0, 0, 0)
(1, 0, 0, 0, 0, 0, 0)

Not feasible!
Z = 100

IP solution(s):
(1, 0, 0, 0, 1, 1, 0)

Z = 143

(0, 1, 1, 1, 0, 0, 0)

Z = 143

(0, 1, 0, 1, 1, 1, 1)

Z = 143

139
149

Branch-and-Bound method (Ch. 11.6)


Example:
Max
s.t.

Z = 9x1 + 5x2 + 6x3 + 4x4


6x1 + 3x2 + 5x3 + 2x4 10
x3 + x4 1
-x1 + x3 0
-x2 + x4 0
x1, x2, x3, x4 {0,1}

Relaxed LP problem:
Max
s.t.

Z = 9x1 + 5x2 + 6x3 + 4x4


6x1 + 3x2 + 5x3 + 2x4 10
x3 + x4 1
-x1 + x3 0
-x2 + x4 0
0 x1, x2, x3, x4 1

Solution: (0.8333, 1, 0, 1) Z = 16.5


This solution is not integer, but 16.5 (and therefore
16) is an upper bound for the optimal objective
value.

Now add either x1 = 0, r x1 = 1:


Max
s.t.

Z = 9x1 + 5x2 + 6x3 + 4x4


6x1 + 3x2 + 5x3 + 2x4 10
x3 + x4 1
-x1 + x3 0
-x2 + x4 0
0 x1, x2, x3, x4 1, x1 = 0

Solution: (0, 1, 0, 1) Z = 9.
This solution is integer. Z = 9 is therefore a lower
bound for the optimal objective value.
Max
s.t.

Z = 9x1 + 5x2 + 6x3 + 4x4


6x1 + 3x2 + 5x3 + 2x4 10
x3 + x4 1
-x1 + x3 0
-x2 + x4 0
0 x1, x2, x3, x4 1, x1 = 1

Solution: (1, 0.8, 0, 0.8) Z = 16.2


The solution is not integer. Upper bound is Z = 16.
This possibility must be explored further:

Choose x2 = 0 or x2 = 1:
Max
s.t.

Z = 9x1 + 5x2 + 6x3 + 4x4


6x1 + 3x2 + 5x3 + 2x4 10
x3 + x4 1
-x1 + x3 0
-x2 + x4 0
0 x1, x2, x3, x4 1, x1 = 1, x2 = 0

Solution: (1, 0, 0.8, 0) Z = 13.8


This branch has an upper bound of Z = 13.
Max
s.t.

Z = 9x1 + 5x2 + 6x3 + 4x4


6x1 + 3x2 + 5x3 + 2x4 10
x3 + x4 1
-x1 + x3 0
-x2 + x4 0
0 x1, x2, x3, x4 1, x1 = 1, x2 = 1

Solution: (1, 1, 0, 0.5) Z = 16


Investigate this branch:

Choose x3 = 0 of x3 = 1:
Max
s.t.

Z = 9x1 + 5x2 + 6x3 + 4x4


6x1 + 3x2 + 5x3 + 2x4 10
x3 + x4 1
-x1 + x3 0
-x2 + x4 0
0 x1, x2, x3, x4 1, x1 = 1, x2 = 1, x3 = 0

Solution: (1, 1, 0, 0.5) Z = 16


Max
s.t.

Z = 9x1 + 5x2 + 6x3 + 4x4


6x1 + 3x2 + 5x3 + 2x4 10
x3 + x4 1
-x1 + x3 0
-x2 + x4 0
0 x1, x2, x3, x4 1, x1 = 1, x2 = 1, x3 = 1

Problem is not feasible! (see first constraint)


This branch needs no further consideration.
Explore the previous branch further:

Choose x4 = 0 of x4 = 1:
Max
s.t.

Z = 9x1 + 5x2 + 6x3 + 4x4


6x1 + 3x2 + 5x3 + 2x4 10
x3 + x4 1
-x1 + x3 0
-x2 + x4 0
0 x1, x2, x3, x4 1,x1 = 1, x2 = 1, x3 = 0, x4 = 0

Solution: (1, 1, 0, 0) Z = 14
Max
s.t.

Z = 9x1 + 5x2 + 6x3 + 4x4


6x1 + 3x2 + 5x3 + 2x4 10
x3 + x4 1
-x1 + x3 0
-x2 + x4 0
0 x1, x2, x3, x4 1,x1 = 1, x2 = 1, x3 = 0, x4 = 1

Not feasible!
The branches under (1, 0, *, *) need no further
investigation, because there Z 13.
Optimal solution: (1, 1, 0, 0) Z = 14.

Binary search tree for branch-and-bound.

How to search the binary tree?


Breadth-first or depth-first?
Depth-first is better:
- Solutions often lie deeper in the tree (it is better
to find integer solutions fast)
- Easier to program
- LP relaxations can use old results
First explore the branches with large upper bounds:
Chances are better to find an integer solution there
with a large objective value which may exclude
many other branches with small upper bounds.

Branch-and-bound for MIP (Ch 11.7)


Max
s.t.

Z = 4x1 2x2 + 7x3 x4


x1 + 5x3 10
x1 + x2 x3 1
6x1 5x2 0
-x2 + 2x3 2x4 3
0 x1, x2, x3, x4
x1, x2, x3 Z

LP-relaxation: leave out the conditions xj Z:


Max
s.t.

Z = 4x1 2x2 + 7x3 x4


x1 + 5x3 10
x1 + x2 x3 1
6x1 5x2 0
-x2 + 2x3 2x4 3
0 x1, x2, x3, x4

Solution: (1.25, 1.5, 1.75, 0)

Z = 14.25

Branch into two cases: x1 1 and x1 2:


Max
s.t.

Z = 4x1 2x2 + 7x3 x4


x1 + 5x3 10
x1 + x2 x3 1
6x1 5x2 0
-x2 + 2x3 2x4 3
0 x1, x2, x3, x4, x1 1

Solution: (1, 1.2, 1.8, 0)


Max
s.t.

Z = 4x1 2x2 + 7x3 x4


x1 + 5x3 10
x1 + x2 x3 1
6x1 5x2 0
-x2 + 2x3 2x4 3
0 x1, x2, x3, x4, x1 2

Not feasible!

Z = 14.2

Branch x2 1, x2 2:
Max
s.t.

Z = 4x1 2x2 + 7x3 x4


x1 + 5x3 10
x1 + x2 x3 1
6x1 5x2 0
-x2 + 2x3 2x4 3
0 x1, x2, x3, x4, x1 1, x2 1

Solution: (0.8333, 1, 1.8333, 0)


Max
s.t.

Z = 14.1666

Z = 4x1 2x2 + 7x3 x4


x1 + 5x3 10
x1 + x2 x3 1
6x1 5x2 0
-x2 + 2x3 2x4 3
0 x1, x2, x3, x4, x1 1, x2 2

Solution: (0.8333, 2, 1.8333, 0)

Z = 12.1666

First explore x2 2: Branch x1 = 0 and x1 = 1:


Max
s.t.

Z = 4x1 2x2 + 7x3 x4


x1 + 5x3 10
x1 + x2 x3 1
6x1 5x2 0
-x2 + 2x3 2x4 3
0 x1, x2, x3, x4, x1 = 0, x2 1

Solution: (0, 0, 2, 0.5)


Z = 13.5
(The first three coordinates are integer, so this is a
solution)
Max
s.t.

Z = 4x1 2x2 + 7x3 x4


x1 + 5x3 10
x1 + x2 x3 1
6x1 5x2 0
-x2 + 2x3 2x4 3
0 x1, x2, x3, x4, x1 = 1, x2 1

Not feasible!

Now explore x2 2: Branch x1 = 0 and x1 = 1:


Max
s.t.

Z = 4x1 2x2 + 7x3 x4


x1 + 5x3 10
x1 + x2 x3 1
6x1 5x2 0
-x2 + 2x3 2x4 3
0 x1, x2, x3, x4, x1 = 0, x2 1

Solution: (0, 0, 2, 0.5)

Z = 1.5

(The first three coordinates are integer, so this is a


suboptimal solution)
Max
s.t.

Z = 4x1 2x2 + 7x3 x4


x1 + 5x3 10
x1 + x2 x3 1
6x1 5x2 0
-x2 + 2x3 2x4 3
0 x1, x2, x3, x4, x1 = 1, x2 1

Not feasible!

The overall optimal solution is therefore:


(0, 0, 2, 0.5)

Z = 13.5

Cyclic scheduling problem


A bus company each week needs the following numbers
of drivers:
Monday

25

Tuesday Wednesday Thursday

27

23

21

Friday

Saturday

Sunday

25

20

15

Each driver works for 5 consecutive days, followed by


two days off. Salary: 100 per working day, Saturday
115, Sunday 125.
Find a schedule that minimizes salary cost.
Model: Number the days (Monday = 1, etc.)
xi is the number of drivers that starts at day i.
Min 500x1 + 515x2 + 540x3 + 540x4 +540x5 + 540x6 + 525x7
s.t.
x1 + x7 + x6 + x5 + x4 25
x2 + x1 + x7 + x6 + x5 27
x3 + x2 + x1 + x7 + x6 23
x4 + x3 + x2 + x1 + x7 21
x5 + x4 + x3 + x2 + x1 25
x6 + x5 + x4 + x3 + x2 20
x7 + x6 + x5 + x4 + x3 15
x1, x2, , x7 0, xj Z.
IP optimal solution: (10, 7, 0, 4, 4, 5, 2)

Z = 16675

LP relaxation: (10.6, 5.6, 0.6, 3.6, 4.6, 5.6, 0.6) Z = 16275


LP solution rounded upwards:
(11, 6, 1, 4, 5, 6, 1)

Z = 17775

Trick (Bartholdi, 1980):


Solve the LP relaxation: x1 + x2 + + x7 = 31.2.
Round up and down, and add this as a constraint in LP:
With x1 + x2 + + x7 = 31:

Not feasible

With x1 + x2 + + x7 = 32:
16675

(12, 5, 2, 2, 4, 7, 0)

Z=

This special type of IP problem can always be solved by


solving 3 LP problems.
If the relaxed problem has an integer solution you are
ready.
Otherwise, one of the two other problems will give an
integer solution (solve with simplex method)

Improving linear constraints (Ch. 11.8)


for binary variables:

5x1 3

x1 = 0

(x1 = 1 is not possible)

5x1 +2x1 4

x1 = 0, no condition for x2

5x1 x2 3

x1 = 0, no condition for x2

5x1 + 3x2 x3 1
maximal)

x1 = 0, (choose x2 minimal, x3

remaining inequality:
3x2 x3 1 x2 = 0, no condition for x3.
Total: x1 = x2 = 0, no condition for x3.
From the two inequalities
8x1 4x2 5x3 + 3x4 2
3x2 + 2x3
4
it follows that x1 = 0 (because x2 and x3 cannot be equal
to 1 at the same time).
Tightening constraints as preprocessing can help the
branch-and-bound process, because the relaxed problem
will have better upper bounds and there is a better
chance of having integer solutions.

Algorithm (Ch. 11.8)


for tightening binary constraints:
a1 x1 + a2 x2 + + an xn b
Algorithm:
Compute S = max(a1x1 + a2x2 + + anxn) =
sum of all positive coefficients.
Find aj 0 such that |aj| > S b.
Compute new coefficient and right-hand side:
If aj > 0 let

aj = S b
b = S - aj

If aj < 0 let

aj = b S.

This algorithm decreases the coefficients in the


inequality.

Example:

2x1 + 3x2 4.

S=2+3=5
Is a1 possible? 2 > 1 = 5 4, so a1 can be adapted
a1 > 0 so

a1 = S b = 5 4 = 1
b = S a1 = 5 2 = 3

Consequence:

2x1 + 3x2 4

x1 + 3x2 3

Another time?
S=1+3=4
Is a1 possible? a1 = 1 = 4 3, so a1 cannot be adapted
Is a2 possible? 2 > 1 = 4 3, so a2 can be adapted:
a1 > 0 so

a1 = S b = 4 3 = 1
b = S a1 = 4 3 = 1

Consequence:
2x1 + 3x2 4
1

x1 + 3x2 3

x1 + x2

The idea of tightening constraints is that relaxed


problems will lead to an integer answer sooner, so
branch-and-bound will be successful earlier.

Cutting planes
Cutting plane = Extra constraint that decreases the
feasible region of the LP-relaxation, but not the
feasible region of the original BIP.
Example:
6x1 + 3x2 + 5x3 + 2x4 10,

xj [0,1]

It follows that: x1 + x2 + x4 2 (because 6 + 3 + 2 >


10 and 6 + 3, 6 + 2 and 3 + 2 10.
This inequality can be added, but does not replace
the original!
More general: Consider a -inequality with positive
coefficients. Find N variables such that:
If these N variables are 1 while the others are 0 this
solution does not satisfy the inequality.
If N-1 variables are 1 and the rest is 0 it satisfies the
inequality.
Take as a cutting plane:
the sum of these N variables N-1
Other possibility: x1 + x3 1.
Tightening and adding inequalities can increase the
performance of branch-and-bound drastically
(branch-and-cut).

Anda mungkin juga menyukai