chapter 9 integer programming ( 整數規劃 ). 2 9.1 introduction to integer programming an integer...

130
Chapter 9 Integer Programming ( 整整整整 )

Upload: janel-parrish

Post on 02-Jan-2016

345 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

Chapter 9

Integer Programming (整數規劃 )

Page 2: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

2

9.1 Introduction to Integer Programming

An integer programming problem (IP) in which all variables are required to be integers is call a pure integer programming problem (PIP, 純整數規劃 ).

An integer programming problem in which only some of the variables are required to be integers is called a mixed integer programming problem (MIP, 混整數規劃 ).

An integer programming problem in which all the variables must be 0 or 1 is called a 0-1 IP.

The LP obtained by omitting all integer or 0-1 constraints on variables is called LP relaxation( 寬鬆式 ) of the integer programming.

p.475

Page 3: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

3

9.2 Formulating PIP

Practical solutions can be formulated as IPs. The basics of formulating an IP model.

Page 4: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

4

整數規劃應用範例貨物裝載問題 (Cargo-loading Problem)亦稱背包問題 (Knapsack Problem)

資本預算問題 (Capital budgeting Problem)固定費用問題 (Fixed-charge Problem)集合涵蓋問題 (Set Covering Problem)

Page 5: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

5

貨物裝載問題 (Cargo-loading Problem)一個總重量限制為 W 的貨車。要裝載 N 類貨物,每類貨物有相當多的數量供裝載,其中貨物 i 的重量為 wi 、價值為 vi 。每類貨物應裝載多少 ( 為整數 ) ,能獲得最高總價值?

設 xi為貨物 i 裝載數量

...2,1,0x

Wxw .t.s

xvz Max

i

N

1iii

N

1iii

Page 6: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

6

貨物裝載問題範例一個總重量限制為 200 公噸的貨櫃。要裝載 4 類貨物,如右表。每類貨物最少裝載 2 個,最多 10 個,貨櫃如何裝載,才能獲得最大總利潤?

...2,1,0x

4,3,2,1i 10x

4,3,2,1i 2x

200x11x8x7x5 .t.s

x20x16x14x12z Max

i

i

i

4321

4321

貨物種類單位重量( 公噸 )

單位利潤( 萬元 )

1 5 12

2 7 14

3 8 16

4 11 20設 xi 為貨物 i 裝載之數量

Page 7: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

7

背包問題 (Knapsack Problem)貨物裝載問題亦為背包問題。一位登山者必須決定要放哪些物品在背包裡, 才能使得背包的總價值 ( 對登山而言的價值 ) 最高。

Page 8: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

8

資本預算問題 (Capital budgeting Problem)

有 m 期資金要投資 N 個計畫,第 j 期可用資金為 Fj 。計畫 i 於第 j 期需用 fij的資金,其預期收益為 ri 。因為資本有限,所以無法投資所有的計畫。應選擇投資哪些計畫,才能獲致最大總額收益?設

0

i 1xi 否則

若投資計畫

N,...,2,1i 1,0x

m,...,2,1j Ffx .t.s

xrMaxz

i

N

1ijiji

N

1iii

Page 9: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

9

資本預算問題範例考慮右表之資本預算問題

4,3,2,1i 1,0x

30x12x6x11x8

16x6x4x5x3

20x8x5x7x6 .t.s

x38x25x35x30z Max

i

4321

4321

4321

4321

計畫 第 1年

第 2年

第 3年 預期收益

1 6 3 8 30

2 7 5 11 35

3 5 4 6 25

4 8 6 12 38

可用資金 20 16 30

0

i 1xi 否則

若投資計畫

Page 10: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

10

固定費用問題 (Fixed-charge Problem)

大部分製造業的生產過程中,生產成本 (C) 除了包括和數量 (x) 成比例的變動成本 (v) 外,還有固定成本 (f) 。若不生產,則不會有固定成本,亦即:

0x 0

0x vxfC

1,0y

Myx .t.s

vxfyz Min

Page 11: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

11

固定費用問題範例工廠訂單須於一週內生產 200 個產品。有三部機器可供生產,但每週只能提供120 個產能。三部機器之設置成本與單位生產成本如右表。如何安排各機器之生產數量,才能獲得最小總生產成本 ?

1 0y

3 2 1 iMyx

3 2 1i 120x

200xxx ts

x6.2x0.3x4.3y200y150y100Min z

i

ii

i

321

321321

,

,,

,,

..

機器 設置成本 單位生產成本1 100 3.4

2 150 3.0

3 200 2.6

設 xi 為機器 i 之生產數量

Page 12: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

12

Example 1: Capital Budgeting Problems

Stockco is considering four investments Each investment

Yields a determined net present value (NPV)Requires at certain cash flow at the present time

Stockco has $14,000 available for investment. Formulate an IP whose solution will tell Stockco how

to maximize the NPV obtained from the four investments.

p.478

Table 1

item weight benefit

1 5 16

2 7 22

3 4 12

4 3 8

Page 13: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

13

Solution:

Let xj(j=1,2,3,4)=1 if investment j is made 0 otherwise Total NPV obtained by Stocko =16x1+22x2+12x3+8x4

Stockco’s objective function ismax z = 16x1 + 22x2 + 12x3 +8x4

Stockco at most $14,000 can be invested.Stockco’s 0-1 IP is

max z = 16x1 + 22x2 + 12x3 +8x4

s.t. 5x1 + 7x2 + 4x3 +3x4 ≤ 14

xj = 0 or 1 (j = 1,2,3,4)

Page 14: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

14

Example 2: Capital Budgeting (cont.)

1. Stock can invest in at most 2 investments.2. If Stockco invests in investment 2, they must

also invest in investment 1.3. If Stockco invests in investment 2, they cannot

invest in investment 4.

Page 15: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

15

Solution :

1. Stock can invest in at most 2 investments.

Add the constraint x1+x2+x3+x4 ≤2

2. If Stockco invests in investment 2, they must also invest in investment 1.

Add the constraint x2-x1 ≤ 0 or x2 ≤x1

case 1: if x2=1 then x1 ≥ 1. ∵x1= 0 or 1 ∴ x1=1

case 2: if x2=0 then x1 ≥ 0 (x1= 0 or 1)

3. If Stockco invests in investment 2, they cannot invest in investment 4.Add the constraint x2+x4 ≤ 1case 1: if x2=1 then x4 ≤ 0. ∵x4= 0 or 1 ∴ x4=0case 2: if x2=0 then x4 ≤ 1 (x4= 0 or 1)

Page 16: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

16

Fixed-Charge Problems ( 固定費用問題 )

Suppose activity i incurs a fixed charge if undertaken at any positive level. Let level of activity i

= 1 if activity i is undertaken at positive level= 0 if activity i is not undertaken at positive level

Then a constraint of the form < must be added to the formulation. It must be large enough to ensure that will be less than or equal to .

p.480

Page 17: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

17

Example 3: Fixed-Charge IP

Table 2resource requirements

Table 3Revenue and cost

Rentingmachinery

Clothingtype

Labor(hour)

Cloth(square yards)

salesprice

Variable cost

Rentingcost

Shirt 3 4 12 6 200

Shorts 2 3 8 4 150

pants 6 4 15 8 100

p.486

Each week 150 hours of labor and 160 sq yd of cloth are available.

Formulate an LP to max Gandhi’s weekly profits.

Page 18: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

18

x1= number of shirts product each week

x2= number of shorts product each week

x3= number of pants product each week

y1=1 if any shirts are manufactured 0 otherwise

y2=1 if any shirts are manufactured 0 otherwise

y3=1 if any shirts are manufactured 0 otherwise

Solution :p.486

Page 19: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

19

Profits=revenue –(variable costs) –(costs of renting machinery)=(12x1+8x2+15x3)-(6x1+4x2+8x3)-(200y1+150y2+100y3)

=6x1+4x2+7x3-200y1-150y2-100y3

p.486

Table 2resource requirements

Table 3Revenue and cost

Rentingmachinery

Clothingtype

Labor(hour)

Cloth(square yards)

salesprice

Variable cost

Rentingcost

Shirt 3 4 12 6 200

Shorts 2 3 8 4 150

pants 6 4 15 8 100

Constrains: 150 hours of labor and 160 sq yd of cloth 3x1+2x2+6x3 ≤ 150

4x1+3x2+4x3 ≤ 160

Page 20: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

20

1 or 0=y

)3,2,1=i( integer; 0x

160x4+x3+x4

150x6+x2+x3 .t.s

y100-y150-y200-x7+x4+x6=z max

i

i

321

321

321321

333

222

111

yMx

yMx

yM≤x

The optimal solution is z=2, x1=30, x3=10, x2=y1=y2=y3=0 , but It is not reasonable.

That will ensure that if xi > 0, then yi =1

Adding

Page 21: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

21

The optimal solution is z=75, x3=25, y3=1

It should product 25 pants each week.

)3,2,1=i( 1 or 0=y

integer ;)3,2,1=i( 0x

number positive large M ;)3,2,1=i( yMx

160x4+x3+x4

150x6+x2+x3 .t.s

y100-y150-y200-x7+x4+x6=z max

i

i

iiii

321

321

321321

Page 22: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

22

Set-Covering Problem ( 集合涵蓋問題 )

決定一個子集合 , 使得集合 ( 包含 N 個元素 ) 內的每一項元素 , 都被涵蓋在內。

p.486

Page 23: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

23

Example 5: Facility-location

There are 6 cities (cities 1-6) in Kilroy county. The county must determine where to build fire stations. The county wants to build the minimum number of the fire station needed to ensure that at least one fire station is within 15 minutes of each city. The time required to drive between the cities in Kilroy County are shown in Table 6. Formulate an IP that will tell Kilroy how many fire stations should be built and where the should be located.

p.486

Page 24: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

24

Example 5: Facility-location

Table 7Cities within 15mins

city ≤ 15 mins

1 1,2

2 1,2,6

3 3,4

4 3,4,5

5 4,5,6

6 2,5,6

p.486

Table 6Time required between cities

c1 c2 c3 c4 c5 c6

c1 0 10 20 30 30 20

c2 10 0 25 35 20 10

c3 20 25 0 15 30 20

c4 30 35 15 0 15 25

c5 30 20 30 15 0 14

c6 20 10 20 25 14 0

Page 25: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

25

Solution :

)6,5,4,3,2,1=i( 1 or 0=x

1x+x+x

1x+x+x

1x+x+x

1x+x

1x+x+x

1x+x .t.s

x+x+x+x+x+x=z min

i

652

654

543

43

621

21

654321

p.486

Table 7City

( 考慮地點 )≤ 15 mins( 涵蓋區域 )

1 1,22 1,2,63 3,44 3,4,55 4,5,66 2,5,6

The optimal solution is z=2, x2=x4=1, x1=x3=x5=x6=0Building two fire stations in city 2 and city 4.

xi=1 if a fire station is built in city i

0 otherwise

Page 26: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

26

Set-Covering Problem ( 集合涵蓋問題 )

In a set-covering problem, each member of a given set (call it set 1) must be “covered” by an acceptable member of some set (call it set 2).

The objective of a set-covering problem is to minimize the number of elements in set 2 that are required to cover all the elements in set 1.

Page 27: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

27

Set-Covering Problem

For example, set 1 is the cities. set 2 is the fire stations.

The station in city 2 covers cities 1,2 and 6. The station in city 4 covers cities 3,4 and 5. Applications :

airline crew scheduling, political districting, airline scheduling and truck routing.

p.486

Page 28: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

28

Exercise:

北商大學實施垃圾分類‚ 打算在校園內設置 5 個分類垃圾箱。

現有 6 個位置列入考慮‚ 各位置和校園 8 個辦公室 (A,B,…,H)相隔距離如下表‚ 距離太長而不可能放置垃圾箱者以「 - 」表示校方希望垃圾箱所放位置和辦公室之間的總距離最短。寫出此問題之整數規劃模式。

A B C D E F G H1 3 - - - 6 4 2 -2 2 2 3 - - 3 - 43 - 2 3 5 - - - 64 - - 2 3 3 3 - 15 - 4 2 3 - - - -6 6 - - - 3 4 3 5

Page 29: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

29)6,5,4,3,2,1=i( 1 or 0=x

5=x+x+x+x+x+x

1x+x+x+x

1x+x

1x+x+x+x

1x+x+x

1x+x+x

1x+x+x+x

1x+x+x

1x+x+x .t.s

x21+x9+x12+x16+x14+x15=z min

i

654321

6432

61

6421

641

643

5432

532

621

654321

Solution :

xi=1 選擇位置 i

0 否則

A B C D E F G H

1 3 - - - 6 4 2 -

2 2 2 3 - - 3 - 4

3 - 2 3 5 - - - 6

4 - - 2 3 3 3 - 1

5 - 4 2 3 - - - -

6 6 - - - 3 4 3 5

Page 30: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

Either-Or-Constraints(兩者擇ㄧ限制式 )

Given two constraints

ensure that at least one is satisfied by adding an either-or-constraint

M is a number chosen large enough to ensure that both constraints are satisfied for all values of x1,x2,…xn that satisfy the other constraints in the problem.

( ) ( ) 0,...,,f ,0,...,,g xxxxxx n21n21 ≤≤

( ) ( ) ( ) My,...,,f ,y-1M,...,,g xxxxxx n21n21 ≤≤

Page 31: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

31

Example 6: Either-Or constraint

Table 8resource and profits for three types of cars

Resource Compact Midsize Large

Steel required (ton) 1.5 3 5

Labor required (hour) 30 25 40

Profit yielded ($) 2,000 3,000 4,000

p.488

6000 tons of steel and 60000 hours of labor are available.

If any cars of a given type are produced then at least1,000 cars of that type must be product.

Formulate an LP to max Dorian’s profits.

Page 32: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

32

x1= number of compact cars produced

x2= number of midsize cars produced

x3= number of large cars produced

Constraints: 1.x1 ≤ 0 or x1 ≥ 1000

2.x2 ≤ 0 or x2 ≥ 1000

3.x3 ≤ 0 or x3 ≥ 1000

4.The cars produced can use at least 6000 tons of steel.

5.The cars produced can use at least 60000 hours of labor.

Solution :

Page 33: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

33

)y-(1M x-1000

yMx

)y-(1M x-1000

yMx

)y-(1M x-1000

yMx

33

33

22

22

11

11

3

3

2

2

1

1

60000/30=2000, we may choose M1=2000 (at most).

Similarly M2=2000, M3=1200.

M1=min{60000/30,6000/1.5}=min{2000,4000}=2000

M2=min{60000/25,6000/3}=min{2400,2000}=2000

M3=min{60000/40,6000/5}=min{1500,1200}=1200

Page 34: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

34

)3,2,1=i( 1 or 0= y

integer 0;,x,xx

60000x40+x25+x30

6000x5+x3+x1.5

)-y1(1200 ≤ -x1000

y1200≤x

)-y1(2000 ≤-x1000

y2000≤x

)-y1(2000 ≤-x1000

y2000≤x .t.s

x4+x3+x2=z max

i

321

321

321

33

33

22

22

11

11

321

p.489

The optimal solution is z=6000, x2=2000, y2=1 y1=y3=x1=x3=0

Dorian should produce 2000 midsize cars.

Page 35: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

Example : (N 者擇 K 限制式 )

7x4+x

12x2+x4

10x+x5

6x3+x2

21

21

21

21

4,3,2,1=i )1,0(=y

1=y+y+y+y

My+7≤x4+x

My+12≤x2+x4

My+10≤x+x5

My+6≤x3+x2

i

4321

421

321

221

121

若四個限制式中,要求三個成立,則模式如下:

若 yi=0 ,則其在所限制式成立;若 yi=1 ,則一定滿足 ( 無此限制式 )所以須有 3 個 yi=0 , 1 個 yi=1 , i.e. y1+y2+y3+y4=1  

Page 36: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

36

N 者擇 K 限制式

若要求 N 個限制式中 K 個成立,則y1+y2+ 、、、 +yn = N-K

若要求 N 個限制式中至少 K 個成立,則y1+y2+ 、、、 +yn ≤ N-K

若要求 N 個限制式中至多 K 個成立,則y1+y2+ 、、、 +yn ≥ N-K

Page 37: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

37

If-Then Constraints

Suppose we want to ensure that f(x1,x2…xn) > 0

implies g(x1,x2…xn) ≥ 0 .

Then the following constraint in the formulation:

-g(x1,x2…xn) ≤My

f(x1,x2…xn) ≤M(1-y)

y = 0 or 1

M is a large positive number, chosen large enough so that f < M and – g < M hold for all values of that satisfy the other constraints in the problem.

p.490

Page 38: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

38

Exercise : p.502

1.2.3.4.5.6.Chapter 09-exercise.doc

Page 39: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

39

Solution :

1. Let xi = 1 if player i starts , xi = 0 otherwise

max z = 3x1 + 2x2 + 2x3 + x4 + 3x5 + 3x6 + x7

s.t. x1 + x3 + x5 + x7 4 (guards)

x3 + x4 + x5 + x6 + x7 2 (forwards)

x2 + x4 + x6 1 (center)

x1 + x2 + x3 + x 4 + x5 + x6 + x7 = 5

3x1 + 2x2 + 2x3 + x4 + 3x5 + 3x6 + 3x7 10 (BH)

3x1 + x2 + 3x3 + 3x4 + 3x5 + x6 + 2x7 10 (SH)

x1 + 3x2 + 2x3 + 3x4 +3x5 + 2x6 + 2x7 10 (REB)

x6 + x3 1

-x4-x5+2 2y (If x1>0 then x4 + x5 2)

x1 2(1‑y)

x2 + x3 1

x1,x2,...x7,y are all 0,1 variables

Page 40: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

40

2. Let xi = Tons of water processed at site i

yi = 1 if Pollution Control Station is built at Site i. , yi = 0 otherwise

min z =100,000y1+60,000y2+40,000y3+20x1+30x2+40x3

s.t. 0.40x1 + 0.25x2 + 0.20x380,000 (Pollutant 1)

0.30x1 + 0.20x2 + 0.25x350,000 (Pollutant 2)

x1 My1,

x2 My2,

x3 My3

All xi 0 and all yi = 0 or 1.

M = (1/0.20)(80,000) = 400,000 will do. This follows since at most 400,000 tons of water must be processed to remove the required pollutants.

Page 41: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

41

3. Let x1 = Units of Product 1 produced x2 = Units of Product 2 produced

yi = 1 if any Product i is produced 0 otherwise

max z = 2x1 + 5x2 ‑ 10y1 ‑ 20y2

s.t. 3x1 + 6x2 120

x1 40y1 ,

x2 20y2,

x1 0, x2 0, y1, y2 = 0 or 1

Page 42: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

42

4.The statement(x2+x3=2 implies x4=1)isequivalent to x2+x3-1>0 implies x4-1 0.

By (28) and (29) we should add the constraints (M = 1 will do the job)

1-x4 y ,

x2 + x3-1 (1-y)

y = 0 or 1

Page 43: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

43

5a. It is equivalent to x2 >0 implies x1 1.

Then(28)and(29) yield (M =1 is ok): 1-x1 y

x2 (1-y)

y=0 or 1 Instead the constraint y1y2.

5b. We want x1 1 (1-x1 0) or x2 1 (1-x2 0).

From (26)' and (27)' we add the constraints 1-x1 y

1-x2 (1‑y)

y = 0 or 1. Instead we could have added the constraint y1+y31.

Page 44: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

44

6.y1=1 if calculus is taken , y1=0 otherwise

y2=1 if OR is taken , y2= 0 otherwise

y3=1 if DS is taken,y3=0 otherwise

y4=1 if Bus Stat is taken,y4=0 otherwise

y5=1 if Comp. Sim. is taken , y5=0 else

y6=1 if Intro. Comp. is taken , y6=0

y7 = 1 if Forecasting is taken , y7 = 0 otherwise

min z = y1 + y2 + y3 + y4 + y5 + y6 + y7

s.t. y1 + y2 + y3 + y4 + y7 2 (math)

y2 + y4 + y5 + y7 2 (operations research)

y3 + y5 + y6 2 (computers)

y4 y1 ; y5 y6 ; y3 y6 ; y7 y4

y1,y2,...y7 = 0 or 1

Page 45: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

45

9.3 The Branch-and-Bound Method for Solving PIP Problems

In practice, most IPs are solved by some versions of the branch-and-bound procedure. Branch-and-bound methods implicitly enumerate all possible solutions to an IP.

p.512

Page 46: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

46

以單體法解得最佳解後,將非整數值之變數分為最接近的兩個整數,分列條件,加入原問題中,形成兩個子問題分別求解,可求得目標函數值的上限或下限,從其中尋得最佳解。假設原整數規則問題為求極大值,所有決策變數必須為整數時,則其求解步驟如下:考慮下列整數規劃問題

Max z = CXs.t. AX = b

所有 xj 為正整數

分枝界限法 (Branch and Bound Method)

Page 47: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

47

步驟一:求解時,先不考慮整數之限制條件,以單體法求解。若所有的變數均為整數,則獲得最佳解。若至少有一個決策變數為非整數時,令原問題為LP - 1 ,設最佳目標函數值 z = z1 ,z1 為原問題之最佳函數值之上限,並進入步驟二。

Page 48: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

48

步驟二:LP - 1 之最佳解中,選一非整數解之 xi ,將變數分割成最接近其解的兩個整數,分列條件,加入原問題 LP - 1 中,形成兩個子問題。記做 LP - 2 和 LP - 3 ,分別求解。假設 xi 為被選取作為分枝的變數,

xi = [ xi ] + fi [ xi ] :表示整數部分,且 0 < fi < 1 。

因此將 xi 分割成為最接近的兩個整數為: xi ≦[ xi ] 和 xi ≧ [ xi ] + 1 ( 即 xi 比小的小,比大的大 )

分別加入原問題 LP - 1 中,而得LP - 2 : Max z = CX

s.t. AX = b xi ≦ [ xi ] X ≧ 0

LP - 3 : Max z = CX s.t. AX = b

xi ≧ [ xi ] + 1 X ≧ 0

Page 49: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

49

步驟三: 於步驟二中,其可能的結果有 1. 若有一子問題之最佳解均為整數,則目標函數 z 成為原問題 最佳目標函數值之下限,如 LP - 2 之最佳解均為整數,其 目標函數值 z2 為原問題之目標函數值之下限。 (1) 若 LP - 3 無可行解或有可行解,但目標函數 z3< z2 ,

則 LP - 2 之最佳解即為原問題之最佳整數值; (2) 若 LP - 3 之最佳目標函數值 z3 大於 z2且變數均為整數, 則 LP - 3 為原問題之最佳解; (3) 若 LP - 3 有非整數解,且 z3> z2 , 則對 LP - 3 再分枝,並進入步驟四。2. 若兩個子問題之最佳解均為非整數,則選取一個子問題 (通常取目標函數值較大者 ) 做如步驟二之分枝情形, 進入步驟四。

Page 50: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

50

步驟四: 求出再分枝的兩個子問題之最佳解,當其中某一子問題

之最佳解均為整數時,其目標函數不小於原問題之目標函數的下限,且其與對應的另一子問題無可行解或有可行解,但目標函數值較前者為小時,則已獲得原問題之最佳解,否則回到步驟三。

有下列各種情況時,子問題便可不必再分枝求解1.某一子問題之最佳解均為整數時,即是原問題的可行解。2.某一子問題無可行解。3.某一子問題之最佳目標函數值較原問題之下限為小時。

Max z = 7x1 + x2

s.t. 5x1 + x2 ≤ 27/2 5x1 - x2 ≤ 13/2 x1, x2 為正整數

Page 51: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

51

Page 52: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

52

LP - 1 : Max z = 7x1 + x2

s.t. 5x1 + x2 ≤ 27/2

5x1 - x2 ≤ 13/2

x1, x2 為正整數

x1 = 2x2 = 7/2 z1 = 35/2

LP - 2 : Max z = 7x1 + x2

s.t. 5x1 + x2 ≤ 27/2

5x1 - x2 ≤ 13/2

x2 ≤ 3

x1, x2 為正整數

x1 = 19/10

x2 = 3

z2 = 163/10

LP - 3 : Max z = 7x1 + x2

s.t. 5x1 + x2 ≤ 27/2

5x1 - x2 ≤ 13/2

   x2 ≥ 4

x1, x2 為正整數

x1 = 19/10

x2 = 4

z3 = 173/10

Page 53: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

53

LP - 4 : Max z = 7x1 + x2

s.t. 5x1 + x2 ≤ 27/2 5x1 - x2 ≤ 13/2 x2 ≤ 3 x1 ≤ 1 x1, x2 為正整數

x1 = 1x2 = 3 z4 = 10( 整數解,停止運算 )

LP - 5 : Max z = 7x1 + x2

s.t. 5x1 + x2 ≤ 27/2 5x1 - x2 ≤ 13/2 x2 ≤ 3 x1 ≥ 2 x1, x2 為正整數

不可行解

Page 54: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

54

LP - 6 : Max z = 7x1 + x2

s.t. 5x1 + x2 ≤ 27/2

5x1 - x2 ≤ 13/2

x2 ≥ 4

x1 ≤ 1

x1, x2 為正整數

x1 = 1x2 = 17/2

z6 = 31/2

LP - 7 : Max z = 7x1 + x2

s.t. 5x1 + x2 ≤ 27/2

5x1 - x2 ≤ 13/2

x2 ≥ 4

x1 ≥ 2

x1, x2 為正整數

不可行解

Page 55: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

55

LP - 8 : Max z = 7x1 + x2

s.t. 5x1 + x2 ≤ 27/2

5x1 - x2 ≤ 13/2

x2 ≥ 4

x1 ≤ 1

x2 ≤ 8

x1, x2 為正整數

x1 = 1

x2 = 8

z8 = 15

( 整數解,停止運算,且為最佳解 )

LP - 9 : Max z = 7x1 + x2

s.t. 5x1 + x2 ≤ 27/2

5x1 - x2 ≤ 13/2

x2 ≥ 4

x1 ≤ 1

x2 ≥ 9

x1, x2 為正整數

x1 = 9/10x2 = 9

z9 = 153/10

(∵z9 > z8 ,繼續演算 )

Page 56: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

56

LP - 10 : Max z = 7x1 + x2

s.t. 5x1 + x2 ≤ 27/2 5x1 - x2 ≤ 13/2 x2 ≥ 4 x1 ≤ 1 x2 ≥ 9

x1 ≤ 0 x1, x2 為正整數

x1 = 9/10

x2 = 9

z10 = 27/10

∵ z10 < z8

∴ 停止演算

LP - 11 : Max z = 7x1 + x2

s.t. 5x1 + x2 ≤ 27/2

5x1 - x2 ≤ 13/2

x2 ≥ 4

x1 ≤ 1

x2 ≥ 9

x1 ≥ 1

x1, x2 為正整數

不可行解

Page 57: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

57

由樹枝圖和上表得知,此問題之最佳解為 LP - 8 之 x1 = 1 , x2 = 8 ,目標函數值 z = 15 。

Page 58: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

58

Example 9: Branch–and-Bound Method

Labor(hour)

wood(square feet)

profit

Table 1 9 8

Chair 1 5 5

Constraint ≤ 6 ≤ 45

p.513

Formulate an LP to max Telfa’s profits.

Let x1=number of tables manufactured

x2=number of chairs manufactured

Max z=8x1+5x2

s.t. x1+x2 ≤ 6 9x1+5x2 ≤ 45 x1,x2 ≥ 0 ; x1,x2 integer

Page 59: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

59

Solution:

The optimal solution to the LP relaxation is Z=165/4, x1=15/4,x2=9/4 (Figure 11)

Optimal z-value for IP ≤ Optimal z-value for IP relaxation

So, the optimal z-value for IP relaxation an upper bound for the Telfa’s profit.

Page 60: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

60

By solving a single subproblem, many possible solutions may be eliminated from consideration.  

Subproblems are generated by branching on an appropriately chosen fractional-valued variable.

Suppose that in a given subproblem (call it old subproblem), assumes a fractional value between the integers i and i+1. Then the two newly generated subproblems areNew Subproblem 1 Old subproblem + Constraint New Subproblem 2 Old subproblem + Constraint

ixi 1ixi

Page 61: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

61

Key aspects of the B&B method to solve pure IPs

If branch on a subproblem, it is fathomed( 洞悉 ).These three situations (for a max problem) result

in a subproblem being fathomed The subproblem is infeasible, thus it cannot

yield the optimal solution to the IP. The subproblem yield an optimal solution in

which all variables have integer values. If this optimal solution has a better z-value than any previously obtained solution that is feasible in the IP, then it becomes a candidate solution, and its z-value becomes the current lower bound (LB) on the optimal z-value.

The optimal z-value for the subproblem does not exceed (max problem) the current LB, so it may be eliminated from consideration.

Page 62: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

62

A subproblem may be eliminated from consideration in these situations

The subproblem is infeasible.The LB is at least as large as the z-value for

the subproblem

Page 63: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

63

Subproblem2 subproblem1 + Constraint x1 ≥ 4. 

Subproblem3 subproblem1 + Constraint x1 ≤ 3. 

Subproblem4 subproblem1 + Constraint x1 ≥ 4 and x2 ≥ 4

= subproblem2 + Constraint x2 ≥ 2. 

Subproblem5 subproblem1 + Constraint x1 ≥ 4 and x2 ≤ 1

= subproblem2 + Constraint x2 ≤ 1 . 

Subproblem6 subproblem5 + Constraint x1 ≥ 5. 

Subproblem7 subproblem5 + Constraint x1 ≤ 4. 

Page 64: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

64

Two general approaches are used to determine which subproblem should be solved next.The most widely used is LIFO.

LIFO leads us down one side of the branch-and-bound tree and quickly find a candidate solution and then we backtrack our way up to the top of the other side

The LIFO approach is often called backtracking.The second used approach is jumptracking.

When branching on a node, the jumptracking method solves all the problems created by branching.

Page 65: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

65

Subproblem 1Z=165/4,

x1=15/4,x2=9/4

Subproblem 3Z=39,

x1=3,x2=3,LB=40

Subproblem 2Z=41,

x1=4, x2=9/5

Subproblem 5Z=365/9,

x1=40/9, x2=1

Subproblem 4infeasible

Subproblem 6Z=40,x1=5,x2=0

Candidate solution

Subproblem 7Z=37,x1=4,x2=1

Candidate solution

x1≤3x1≥4

t=1

t=2

t=3 t=4

t=5t=6

t=7

x2≥2 x2≤1

x1≥5 x1≤4

x

x

x

Page 66: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

66

Exercise : p.522 B&B

1. max z = 5x1+2x2

s.t. 3x1+x2 ≤ 12 x1+x2 ≤ 5 x1,x2 ≥ 0; x1,x2 integer

3. max z = 2x1+3x2

s.t. x1+2x2 ≤ 10 3x1+4x2 ≤ 25 x1,x2 ≥ 0; x1,x2 integer

6. max z = 4x1+3x2

s.t. 4x1+9x2 ≤ 26 8x1+5x2 ≤ 17 x1,x2 ≥ 0; x1,x2 integer

Page 67: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

67

Solution :

1.

Page 68: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

68

3.

Page 69: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

69

6.

Page 70: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

70

9.4 The Branch-and-Bound Method for Solving Mixed Integer Programming Problems

In mixed IP (MIP), some variables are required to be integers and others are allowed to be either integer or nonintegers.

To solve a mixed IP by the branch-and-bound method, modify the method by branching only on variables that are required to be integers.

For a solution to a subproblem to be a candidate solution, it need only assign integer values to those variables that are required to be integers

When solving IP problems using Solver you can adjust a Solver tolerance setting.

The setting is found under the Options.

p.523

Page 71: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

71

Exercise : p.524 B&B

1. Max z=3x1+x2

s.t. 5x1+2x2 ≤ 10

4x1+x2 ≤ 7

x1,x2 ≥ 0; x2 integer

2. Max z=3x1+x2

s.t. x1+5x2 ≥ 8

x1+2x2 ≥ 4

x1,x2 ≥ 0; x1 integer

Page 72: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

72

Solution :

1.

Page 73: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

73

2. Solving the LP relaxation yields z = 2, x1 = 0, x2 = 2.

This solution has x1 integer, so it is an optimal solution.

Page 74: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

74

9.5 Knapsack Problems(背包問題 )

A knapsack problem is an IP with a single constraint.A knapsack problem in which each variable must be

equal to 0 or 1 may be written as

When knapsack problems are solved by the B&B method, two aspects of the method greatly simplify.Due to each variable equaling 0 or 1, branching

on xi will yield in xi =0 and an xi =1 branch.The LP relaxation may be solved by inspection.

max z = c1x1 + c2x2 + ∙∙∙ + cnxn

s.t. a1x1 + a2x2 + ∙∙∙ + anxn ≤ b x1 = 0 or 1 (i = 1, 2, …, n)

p.524

Page 75: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

75

Example :P.525

Table 59The optimal solution to the LP relaxation is z=80+60+10+(1/4)40=160

x2=x7,x4=1,x1=1/4,x3=x5=x6=0

max z = 40x1+80x2+10x3+10x4+80x5+10x6+10x7

s.t. 40x1+50x2+30x3+10x4+10x5+40x6+30x7 ≤ 100

xj = 0 or 1 (j = 1,2,3,4,5,6,7)

Page 76: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

76

Example 1: Capital Budgeting Problems

The B&B tree is shown in figure 22. (P.526)The optimal solution to the LP relaxation is z=42, x1=0,x2=x3=x4=1

p.525

max z = 16x1 + 22x2 + 12x3 +8x4

s.t. 5x1 + 7x2 + 4x3 +3x4 ≤ 14

xj = 0 or 1 (j = 1,2,3,4)

Page 77: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

77

Exercise : p.526

123Chapter 09-exercise.doc

Page 78: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

78

1. We choose up to eight "Item 1's" so define items

1', 2', ... 8' all identical to Item 1. We choose up to six Item 2's, so define items 9', 10',... 14' all identical to Item 2. we choose up to five Item 3's, so define items 15', 16',... 19' all identical to Item 3. Let xi = 1 if item i' is chosen and xi = 0 otherwise yields a 0‑1 knapsack problem.

Solution :

Page 79: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

79

2. Let item 1 = bedroom set,. item 5 = TV set Let xi = 1 if item i is chosen and xi = 0 otherwise.

max z = 60x1 + 48x2 + 14x3 + 31x4 + 10x5

s.t. 800x1 +600x2 +300x3 +400x4 +200x5 1100

xi = 0 or 1

From the following tree we find the optimal solution to be z = 79, x2 = x4 =1, x1 = x3 = x5 = 0.

Page 80: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

80

Page 81: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

81

3. Letting xi = 1 if item i is chosen , xi = 0 otherwise

yields the following knapsack problem:

max z = 5x1 + 8x2 + 3x3 + 7x4

s.t. 3x1 + 5x2 + 2x3 + 4x4 6

xi = 0 or 1

We obtain the following tree (for each subproblem any omitted variable equals 0):

Note that since optimal objective function value for any candidate solution associated with a branch must be an integer, SP 3 can at best yield a z‑value of 10, so we need not branch on SP 3.

The optimal solution is z =10, x1=x2=0, x3 =x4=1.

Page 82: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

82

Page 83: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

83

9.6 Solving Combinatorial Optimization Problems

A combinatorial optimization problem is any optimization problem that has a finite number of feasible solutions.

A B&B is often the most efficient way to solve them.Examples of combinatorial optimization problems

10 jobs must be processed on a single machine. It is known how long it takes to complete each job and the time at which each job must be completed. What ordering of the jobs minimizes the total delay of the 10 jobs?

A salesperson must visit each of the 10 cities before returning to his home. What ordering of the cities minimizes the total distance the salesperson must travel before returning home? This problem is called the traveling salesperson problem (TSP).

p.527

Page 84: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

84

Example 10: B&B Machine Scheduling

Four jobs must be processed on a single machine. The time required to process each job and the date the job is due are shown in Table 63. The delay of a job is the number of days after the due date that a job is completed (if a job is completed on time or early, the job’s delay is zero). In what order should the jobs be processed to minimize the total delay of the four jobs?

Table 63

Job Days Required to Completed job Due Date

1 6 End of day 8

2 4 End of day 4

3 5 End of day 12

4 8 End of day 16

Page 85: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

85

Solution:

Table 64Delay Incurred If Job Are Processed in the order 1-2-3-4

Job Completion time of job Delay of job

1 6 0

2 6+4=10 10-4=6

3 6+4+5=15 15-12=3

4 6+4+5+8=23 23-16=7

Page 86: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

86

Let x14=x24=x34=x44=1 will yield four branches with node 1-4 in Figure 23.

The jobs should be processed in the order2-1-3-4, with a total delay of 12 says results.

Node 1D≥15

Node 2D≥19

Node3D≥11

Node 4D≥7

Node 10D≥21

Node 11D≥25

Node 12D≥13

Node 5D≥14

Node 6D≥18

Node 7D≥10

Node 8D≥12

Node 9D≥16

x x

x

x

xxxx

x14=1x24=1 x34=1

x44=1

x13=1x43=1x23=1

x33=1x23=1x13=1

x12=1 x22=1

Page 87: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

87

Example 11: Traveling Salesperson Problem (TSP旅行銷售員問題 )

Joe State lives in Gary, Indiana and owns insurance agencies in Gary, Fort Wayne, Evansville, Terre Haute and South Bend.

Each December he visits each of his insurance agencies.

The distance between each agency is shown in Table 65.

What order of visiting his agencies will minimize the total distance traveled?

Page 88: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

88

Table 65 Distance between Cities in raveling Salesman Problem

Day GaryFort

WayneEvansville

Terre Haute

South Bend

City 1 Gary

0 132 217 164 58

City 2 Fort Wayne

132 0 290 201 79

City 3 Evansville

217 290 0 113 303

City 4 Terre Haute

164 201 113 0 196

City 5 South Bend

58 79 303 196 0

Page 89: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

89

Solution :

To begin define

Several branch-and-bound approaches have been developed for solving TSPs

The approach we will use is the one in which the subproblems reduce to assignments problems.

number positive large a is M where,Mc

j and i cities between distance c

,jifor Also,

otherwise0

j city to next travels and i city leaves Joe if1x

ii

ij

ij

Page 90: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

90

Table 66 Cost matrix for subprogram 1

Day GaryFort

WayneEvansville

Terre Haute

South Bend

City 1 Gary

M 132 217 164 58

City 2 Fort Wayne

132 M 290 201 79

City 3 Evansville

217 290 M 113 303

City 4 Terre Haute

164 201 113 M 196

City 5 South Bend

58 79 303 196 M

Page 91: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

91

Table 67 Cost matrix for subprogram 2

Day GaryFort

WayneEvansville

Terre Haute

South Bend

City 1 Gary

M 132 217 164 58

City 2 Fort Wayne

132 M 290 201 79

City 3 Evansville

217 290 M M 303

City 4 Terre Haute

164 201 113 M 196

City 5 South Bend

58 79 303 196 M

Page 92: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

92

Table 68 Cost matrix for subprogram 4

Day GaryFort

WayneEvansville

Terre Haute

South Bend

City 1 Gary

M 132 217 164 58

City 2 Fort Wayne

132 M 290 201 M

City 3 Evansville

217 290 M M 303

City 4 Terre Haute

164 201 113 M 196

City 5 South Bend

58 79 303 196 M

Page 93: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

93

Table 69 Cost matrix for subprogram 5

Day GaryFort

WayneEvansville

Terre Haute

South Bend

City 1 Gary

M 132 217 164 58

City 2 Fort Wayne

132 M 290 201 79

City 3 Evansville

217 290 M M 303

City 4 Terre Haute

164 201 113 M 196

City 5 South Bend

58 M 303 196 M

Page 94: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

94

Table 70 Cost matrix for subprogram 3

Day GaryFort

WayneEvansville

Terre Haute

South Bend

City 1 Gary

M 132 217 164 58

City 2 Fort Wayne

132 M 290 201 79

City 3 Evansville

217 290 M 113 303

City 4 Terre Haute

164 201 M M 196

City 5 South Bend

58 79 303 196 M

Page 95: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

95

Subprogram 1 Table 66 cost matrix for subprogram 1Subprogram 2 Subprogram 1+(x34=0 or c34=M)

Subprogram 3 Subprogram 1+(x43=0 or c43=M) Table 67 cost matrix for subprogram 2Subprogram 4 Subprogram 2+(x25=0 or c25=M)

Subprogram 5 Subprogram 2+(x52=0 or c52=M) Table 68 cost matrix for subprogram 4 Table 69 cost matrix for subprogram 5Subprogram 6 Subprogram 3+(x25=0 or c25=M)

Subprogram 7 Subprogram 3+(x52=0 or c52=M) Table 70 cost matrix for subprogram 3

Page 96: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

96

First solve the assignment problem in subproblem 1. This solution contains two subtours and cannot be the optimal solution.

Now branch on subproblem 1 in a way that will prevent one of subproblem 1’s subtours from recurring in solutions to subsequent subproblems.

Arbitrarily choose subproblem 2 to solve, applying the Hungarian method to the cost matrix shown.

This solution can not be the optimal solution. Now branch subproblem 2 in an effort to exclude the

subtour 2-5-2. Thus we add two additional subproblems.

Following the LIFO approach, next solve subproblem 4 or subproblem 5. By using the Hungarian method on subproblem 4, the optimal solution z=668 , x15 = x24 = x31 = x43 = x52 =1.

Page 97: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

97

This is a candidate solution and any node that cannot yield a z-value < 668 may be eliminated from consideration.

Following the LIFO rule, next solve subproblem 5. z=704 thus this subproblem is eliminated.

Only subproblem 3 remains. The optimal solution is z =652. It is possible for this subproblem to yield a solution with no subtours that beats z=668.

Next branch on subproblem 3 creating subproblem 6 and 7.

Both of these subproblems have a z-value that is larger than 668.

Subproblem 4 thus yields the optimal solution.

Page 98: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

98

Subproblem 1 z=495

x14=x21=x34=x43=x52=1

Subproblem 2 z=652

x14=x25=x31

=x43=x52=1

Subproblem 3 z=652

x13=x25=x34

=x41=x52=1UB=668

Subproblem 4 z=668

x15=x24=x31

=x43=x52=1Candidate solution

Subproblem 5 z=704

x14=x25=x32

=x43=x51=1UB=668

Subproblem 6 z=704

x15=x23=x34

=x41=x52=1UB=668

Subproblem7 z=910

x13=x25=x31

=x42=x54=1UB=668

t=1

t=2

t=3 t=4

t=5

t=6 t=7

X

X

XX

x34=0 x43=0

x25=0 x52=0x25=0 x52=0

Figure 25

B&B tree for TSP

Page 99: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

99

When using branch-and-bound methods to solve TSPs with many cities, large amounts of computer time is needed.

Heuristic methods, or heuristics, can be used to quickly lead to a good solution.

Heuristics is a method used to solve a problem by trial and error when an algorithm approach is impractical.

Two types of heuristic methods can be used to solve TSP; nearest neighbor method and cheapest-insertion method.

Page 100: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

100

Nearest Neighbor Method

1.Begin at any city and then “visit” the nearest city. 2.go to the unvisited city closest to the city we have most recently visited.

3.Continue in this fashion until a tour is obtained. After applying this procedure beginning at each city, take the best tour found.

Cheapest Insertion Method (CIM)1.Begin at any city and find its closest neighbor. 2.create a subtour joining those two cities. 3.replace an arc in the subtour (say, arc (i, j) by the combinations of two arcs---(i, k) and (k, j), where k is not in the current subtour---that will increase the length of the subtour by the smallest (or cheapest) amount.

4.Continue with this procedure until a tour is obtained. After applying this procedure beginning with each city, we take the best tour found.

Page 101: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

101

Three methods to evaluate heuristics Performance guarantees

Gives a worse-case bound on how far away from optimality a tour constructed by the heuristic can be

Probabilistic analysis A heuristic is evaluated by assuming that

the location of cities follows some known probability distribution

Empirical analysis Heuristics are compared to the optimal

solution for a number of problems for which the optimal tour is known

Page 102: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

102

An IP formulation can be used to solve a TSP but can become unwieldy and inefficient for large TSPs.

LINGO can be used to solve the IP of a TSP.

cij = distance from city i to city j

xij = 1 if tour visits i then j ; 0 otherwise (binary)

ti = arbitrary real numbers we need to solve for

n

i

n

jijijxc

1 1

nj,innxtt

njx

nix

ijji

n

iij

n

jij

21

11

11

0

0

Min z=

s.t.

Page 103: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

103

Exercise : p.538 #1

1.Four jobs must be processed on a single machine . The time required to perform each job and the due date for each job are shown in Table 74. Use the B&B method to determine the order of performing the jobs that minimizes the total time the jobs are delayed.

Table 74

JobTime to Perform Job

(minutes)Due date of Job

1 7 End of minute 14

2 5 End of minute 13

3 7 End of minute 18

4 11 End of minute 15

Page 104: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

104

Solution :

1.

Page 105: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

105

Solution :

In tree we jumptrack by branching on best bound. Thus x34 = 1

branch is "followed" first. This yields us to a feasible solution having (D = total delay) D = 22 minutes. Branching on the x44 = 1

branch yields a feasible solution having D = 20. All other branches must have D20, so we have found an optimal sequence. Job 1, then job 2, then job 3 and then job 4 is optimal (it has a total delay of 20 minutes. Job 2 then job 1, then job 3, and then job 4 is also optimal.

Page 106: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

106

Binary Integer Programming( 二元整數規劃 )理論上,若能有效率解決 BIP ,則能解決 IP任何整數均能以 0-1 整數形式表達例如 : 整數限制 xk=0.1.2…20 可轉換為 xk=20y0+21y1+22y2+23y3+24y4

=y0+2y1+4y2+8y3+16y4

xk ≤ 20

yi= (0,1) i=0,1,…4

當 xk很大時,此方法不是很有效率,所以在實際解決 IP 問題時,除非整數很少且不是很大,否則不會刻意將 MIP轉換成 BIP處理

Page 107: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

107

9.7 Implicit Enumeration(隱含式列舉 )

The method of implicit enumeration is often used to solve 0-1 IPs (零壹整數規劃 ).

Implicit enumeration uses the fact that each variable must be equal to 0 or 1 to simplify both the B&B components of the B&B process and to determine efficiently when a node is infeasible.

The tree used in the implicit enumeration method is similar to those solving 0-1 knapsack problems.

Some nodes have variable that are specified called fixed variables.

All variables whose values are unspecified at a node are called free variables.

For any node, a specification of the values of all the free variables is called a completion of the node.

Page 108: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

108

Three main ideas used in implicit enumerationSuppose we are at any node with fixed variables,

is there an easy way to find a good completion of the node that is feasible in the original 0-1 TSP?

Even is the best completion of a node is not feasible, the best completion gives us a bound on the best objective function value that can be obtained via feasible completion of the node. This bound can be used to eliminate a node from consideration.

At any node, is there an easy way to determine if all completions of the node are infeasible?

In general, check whether a node has a feasible completion by looking at each constraint and assigning each free variable the best value for satisfying the constraint.

Page 109: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

109

Example 12: Implicit Enumeration

)5 ,4 ,3 ,2 ,1i( 1 or 0x

7x2xx4x2x4

3xx2xx2x4.t.s

x2xx2x3x7z Max

i

54321

54321

54321

Page 110: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

110

1

32

t=1

x1=1 x1=0

1

32

t=1

x1=1 x1=0

4 5

x2=1 x2=0

t=2

76

1

32

t=1

x1=1 x1=0

4 5

x2=1 x2=0

t=2

t=3

x3=1 x3=0

Page 111: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

111

76

1

32

t=1

x1=1 x1=0

4 5

x2=1 x2=0

t=2

t=3

x3=1 x3=0

t=5t=4

CandidateWith z=-9

XNo feasiblecompletion

Page 112: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

112

76

1

32

t=1

x1=1 x1=0

4 5

x2=1 x2=0

t=2

t=3

x3=1 x3=0

t=5t=4

CandidateWith z=-9

XBest we can do isz=-10, which does not beat z=-9

t=6

XNo feasiblecompletion

Page 113: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

113

76

1

32

t=1

x1=1 x1=0

4 5

x2=1 x2=0

t=2

t=3

x3=1 x3=0

t=5t=4

CandidateWith z=-9

XNo feasiblecompletion

t=6

t=7

XNo feasiblecompletion

XBest we can do isz=-10, which does not beat z=-9

Page 114: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

114

9.8 Cutting-Plane Algorithm(切割平面法 )An alternative method to the B&B method is the

cutting plane algorithm.Summary of the cutting plane algorithm

Step 1Find the optional tableau for the IP’s programming relaxation. If all variables in the optimal solution assume integer values, we have found an optimal solution to the IP; otherwise, proceed to step2.

Page 115: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

115

Step 2Pick a constraint in the LP relaxation optimal tableau whose right-hand side has the fractional part closest to 1/2. This constraint will be used to generate a cut.Step 2a For the constraint identified in step 2, write its right-hand side and each variable’s coefficient in the form [x]+ f, where 0 ≤ f < 1.

Step 2b Rewrite the constraint used to generate the cut as All terms with integer coefficients = all terms with fractional coefficients. Then the cut is All terms with fractional coefficients ≤ 0.

Page 116: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

116

Step 3Use the simplex to find the optimal solution to the LP relaxation, with the cut as an additional constraint. If all variables assume integer values in the

optimal solution, we have found an optimal solution to the IP.

Otherwise, pick the constraint with the most fractional right-hand side and use it to generate another cut, which is added to the tableau.

We continue this process until we obtain a solution in which all variables are integers. This will be an optimal solution to the IP.

Page 117: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

117

假設所有變數皆為整數 ,

最佳表格如右 :xi為整數。

x1 至 xn 為 BV, 若 xi不為整數 ,

則第 i 個 BV 可得

xi x1 x2 x3…… xn s1 s2……sm bi

x1 1 0 0………0 d11 d12 …d1m b1

x2 0 1 0………0 d21 d22 …d2m b2

x3 0 0 0………0 d31 d32 …d3m b3

: : : 0………0 : : :

xn 0 0 0………1 dn1 dn2 …dnm bn

n1,2,...,i bsdxm

1jijiji

)1(x n1,2,...,i sd-bx i

m

1jjij ii

不全為整數且即

1 f0 1,f0 ,:] [

m1,2,...,j n,1,2,...,i f][dd

n1,2,...,i f]b [b

iji

ijijij

iii

高斯符號

Page 118: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

118

此限制式使非整數之變數成為整數

將限制式

加入最佳解之表中 ,再以 dual-simplex 或 simplex 解之

-(2)-n1,2,...,i , sffs ]d[-][b

s )f]d([f][b sd-bx

j

m

1jijij

m

1jij i

j

m

1jijiji i

m

1jjij ii

或負整數又

或整數為整數欲使

0sff 1f0 ,1f0

0sff x

j

m

1jijijii

j

m

1jijii

varslack:s , fssffsf0sff 'ii

'ij

m

1jijij

m

1jijj

m

1jiji

fssf...sfsfsf i'imim33i22i11i

Page 119: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

119

Exercise : p.549 #1

1.

The optimal tableau for this IP’s LP is given as below.Use the cutting plane algorithm to solve this IP.

egerintx,x ;0x,x

35xx7

6x3x .t.s

x18x14z Max

2121

21

21

21

z x1 x2 s1 s2 rhs

1 0 0 56/11 30/11 126

0 0 1 7/22 1/22 7/2

0 1 0 -1/2 3/22 9/2

Page 120: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

120

Solution :

1.Since both constraints have a fractional part of

1/2 in the optimal tableau, we arbitrarily choose

to use the first constraint to yield the cut:

x2 + (7/22)s1 +(1/22)s2 = 3 + 1/2

x2 ‑ 3 = 1/2 ‑ (7/22)s1 ‑ (1/22)s2

1/2 ‑ (7/22)s1 ‑ (1/22)s2 0.

‑ (7/22)s1 ‑ (1/22)s2 ‑ 1/2

‑ (7/22)s1 ‑ (1/22)s2 + s3 = ‑ 1/2

Page 121: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

121

z x1 x2 s1 s2 s3 RHS

z 1 0 0 56/11 30/11 0 126

x2 0 0 1 7/22 1/22 0 7/2

x1 0 1 0 ‑1/22 3/22 0 9/2

s3 0 0 0 ‑7/22 -1/22 1 -1/2

對偶單體法z x1 x2 s1 s2 s3 RHS

z 1 0 0 0 2 16 118

x2 0 0 1 0 0 1 3

x1 0 1 0 0 1/7 -1/7 32/7

s1 0 0 0 1 1/7 -22/7 11/7

Page 122: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

122

x1+(1/7)s2 +(-1/7)s3 = 4/7+4

arbitrarily choose row 2 to generate the next cut:

x1+(1/7)s2 +(6/7-1)s3 = 4/7+4

x1+(1/7)s2 ‑s3+(6/7)s3 = 4/7+4

x1‑s3‑4= 4/7‑ (1/7)s2 ‑(6/7)s3 yielding the cut

4/7‑ (1/7)s2 ‑(6/7)s3 0

‑ (1/7)s2 ‑(6/7)s3 ‑4/7

‑ (1/7)s2 ‑(6/7)s3 +s4= ‑4/7

Page 123: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

123

z x1 x2 s1 s2 s3 s4 RHS

z 1 0 0 0 2 16 0 118

x2 0 0 1 0 0 1 0 3

x1 0 1 0 01/7

-1/7 0 32/7

s1 0 0 0 11/7

-22/7 0 11/7

s4 0 0 0 0 -1/7 -6/7 1 ‑4/7z x1 x2 s1 s2 s3 s4 RHS

z 1 0 0 0 0 4 14 110

x2 0 0 1 0 0 1 0 3

x1 0 1 0 0 0 -1 1 4

s1 0 0 0 1 0 -4 1 1

s2 0 0 0 0 1 6 -7 4

z =110 x1=4 x2=3.

Page 124: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

124

Exercise : p.549 #2

2.

The optimal tableau for this IP’s LP is given as below.Use the cutting plane algorithm to solve this IP.

z x1 x2 s1 s2 rhs

1 0 0 -4/5 -18/5 88/5

0 1 0 -2/5 1/5 4/5

0 0 1 1/5 -3/5 8/5

egerintx,x ;0x,x

4x2x

4xx3 .t.s

x8x6z Max

2121

21

21

21

Page 125: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

125

z x1 x2 e1 e2 s3 RHS

z 1 0 0 ‑4/5 ‑18/5 0 88/5

x1 0 1 0 ‑2/5 1/5 0 4/5

x2 0 0 1 1/5 ‑3/5 0 8/5

s3 0 0 0 ‑1/5 ‑2/5 1 ‑3/5

z x1 x2 e1 e2 s3 RHS

z 1 0 0 0 -2 -4 20

x1 0 1 0 0 1 -2 2

x2 0 0 1 0 ‑1 1 1

e1 0 0 0 1 2 -5 3

z = 20, x1 = 2, x2 = 1.

Page 126: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

126

3.

The optimal tableau for this IP’s LP is given as below.Use the cutting plane algorithm to solve this IP.

Exercise : p.549 #3

egerint x,x ;0x,x

5x4x4

5xx2 .t.s

x4x2z Max

2121

21

21

21

z x1 x2 s1 s2 rhs

1 0 0 -2/3 -5/6 -15/2

0 1 0 1/3 -1/12 5/4

0 0 1 1/3 1/6 5/2

Page 127: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

127

3. From row 2 we obtain the following cut:

x2 + (1/3)s1 + (1/6) s2 = 2 + 1/2

x2 ‑ 2 = 1/2 ‑ (1/3)s1 ‑ (1/6) s2

1/2 ‑ (1/3)s1 ‑ (1/6)s2 0.

‑ (1/3)s1 ‑ (1/6)s2 ‑(1/2)

‑ (1/3)s1 ‑ (1/6)s2 + s3 = ‑ (1/2) .

Solution :

Page 128: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

128

z x1 x2 s1 s2 s3 RHS

z 1 0 0 ‑2/3 ‑5/6 0 ‑15/2

x1 0 1 0 1/3 ‑1/12 0 5/4

x2 0 0 1 1/3 1/6 0 5/2

s3 0 0 0 ‑1/3 -1/6 1 -1/2

z x1 x2 s1 s2 s3 RHS

z 1 0 0 0 ‑1/2 -2 ‑13/2

x1 0 1 0 0 ‑1/4 1 3/4

x2 0 0 1 0 0 1 2

s1 0 0 0 1 1/2 -3 3/2

Page 129: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

129

From the last constraint we obtain a cut as follows:

s1 + (1/2)s2 ‑ 3s3 = 1 + 1/2

s1 ‑ 3s3 ‑ 1 = 1/2 ‑(1/2)s2

1/2 ‑ s2/2 0

1/2 ‑ s2/2 + s4 = 0.

Page 130: Chapter 9 Integer Programming ( 整數規劃 ). 2 9.1 Introduction to Integer Programming An integer programming problem (IP) in which all variables are required

130

z x1 x2 s1 s2 s3 s4 RHS

z 1 0 0 0 ‑1/2 -2 0 ‑13/2

x1 0 1 0 0 ‑1/4 1 0 3/4

x2 0 0 1 0 0 1 0 2

s1 0 0 0 1 1/2 -3 0 3/2

s4 0 0 0 0 ‑1/2 0 1 ‑1/2z x1 x2 s1 s2 s3 s4 RHS

z 1 0 0 0 0 -2 -1 ‑6

x1 0 1 0 0 0 1 ‑1/2 1

x2 0 0 1 0 6 1 0 2

s1 0 0 0 1 0 -3 1 1

s2 0 0 0 0 1 0 ‑2 1z = ‑6, x1 = 1, x2 = 2.