1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming...

39
1 Chapter 3 線線線線線線線線線線線線 Applications of Linear Applications of Linear and Integer Programming and Integer Programming Models Models
  • date post

    20-Dec-2015
  • Category

    Documents

  • view

    225
  • download

    5

Transcript of 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming...

Page 1: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

1

Chapter 3

線性與整數規劃模式之應用Applications of Linear and Integer Applications of Linear and Integer

Programming Models Programming Models

Page 2: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

2

3.1 LP 在企業與政府之逐漸發展 (p. 140)• 有許多應用 LP與 ILP 之成功案例• 四個目標 :

– 檢視 LP 可用之應用領域– 發展好的模型化技巧– 使用試算表產生結果– 說明與分析試算表報告結果

• 成功案例:見 (p.140)

Page 3: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

3

• 成功建立模型之三項因素 :– 熟悉度 ( Familiarity )– 簡單化 (Simplicity)– 明確性 (Clarity)

3.2 建立良好線性與整數規劃模式

Page 4: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

4

總和變數與限制式 (P.142) Summation Variables / Constraints

• 範例– 生產三種機型電視機型– 每種機型分別使用 2, 3, and 4 磅塑膠– 可利用塑膠 plastic為 7000磅 .– 任何機型不超過總產量之 40% – 單位利潤分別為 $23, $34, 和 $45.– 求生產計畫使得總利潤最大

Page 5: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

5

• 求解 Solution

Max 23X1 + 34X2 + 45X3

S.T. 2X1 + 3X2 + 4X3

不使用總和變數X1 .4(X1 + X2 + X3)

X2 .4(X1 + X2 + X3)X3 .4(X1 + X2 + X3)

X1, X2, X3

使用總和變數X1 + X2 + X3 = X4

X1 .4X4

X2 .4X4

X3 .4X4

X1, X2, X3 , X4

總和變數與限制式Summation Variables / Constraints

Page 6: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

6

TV production Solver 試算表

=SUM(B2:D2) 總生產量

決策變數

百分比限制式

塑膠限制式

Page 7: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

7

– 轉換成下列形式 : ( 數學式子 ) [ 關係式 ] ( 常數 )

建立線性模型清單 (p.145)

A + 2BA + 2B 2A + B +10

- A + B 10

– 在形成數學符號之前先以說話形式形成一種關係

( 某個式子 ) [ 有某種關係 ] ( 另一個式子或常數 )

Page 8: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

8

建立線性模型清單

– 關係式兩邊的單位必須要一致– 適當使用總和變數– 確認變數為

非負 Non-negative

整數 Integers

二元 Binary

Page 9: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

9

• 協助管理者做決策對於資源之使用能有效率

• 應用領域包含 :– 決定生產水準– 排程輪班– 加班– 額外資源之成本效益

3.4. 線性規劃模式之應用─ 生產排程模型 (Production Scheduling Models)

Page 10: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

10

Galaxy Industries 擴張計畫

• Galaxy Industries 計畫增加產能並試銷兩種新產品

• Data ( 見 p.149 , 表 3.1)– 可用塑膠數量 3000 pounds

– 正常工作時間 (Regular time) 40 hours.

– 加班時間 (Overtime) 32 hours .

– 加班時間 成本每小時比正常工作時間多 $180

Page 11: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

11

• Data - continued• 兩種新產品 :

• 大水槍 (Big Squirts)• 滲透者 (Soakers)

• 市場需求 :• Space Rays = 總產量之 50%.• 其他產品產量 <= 總產量之 40%.• 最小總產量 1000 打 / 每週 .

Galaxy Industries 擴張計畫

兩種舊產品 :•宇宙光 Space rays•射擊手 Zappers

Page 12: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

12

• Data - Continued Plastic ProductionProduct Profit (lbs) Time (min)

Space Rays $16 2 3Zappers $15 1 4Big Squirts $20 3 5Soakers $22 4 6

Plastic ProductionProduct Profit (lbs) Time (min)

Space Rays $16 2 3Zappers $15 1 4Big Squirts $20 3 5Soakers $22 4 6

• 管理者希望週淨利潤 (Net Weekly Profit) 最大 • 需決定一週生產排程與加班時數

Galaxy Industries 擴張計畫

Page 13: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

13

• 決策變數 (Decision Variables) (p.150)

X1 = 每週生產 Space Rays 打數X2 = 每週生產 Zapper 打數X3 = 每週生產 Big Squirts 打數X4 = 每週生產 Soakers 打數X5 = 每週排定加班 overtime 時數

Galaxy Industries 擴張計畫– 求解過程

Page 14: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

14

• 目標函數 (Objective Function)

週淨利潤 Net Weekly Profit = 銷售利潤 the sale of products – 加班成本 extra cost of overtime

Maximize 16X1 +15X2 +20X3+22X4 - 180X5

Galaxy Industries 擴張計畫– 求解過程

Page 15: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

15

• 限制式 (Constraints) (p.150)

200X2 :200produced] [Zappers

32X4 :32used] hours [Overtime

240060X5- 6X4+5X3+4X2+3x1or 60X5,+24006X4+5X3+4X2+3X1

:available] minutes overtime) +time regular ( of [Numberminutes] production of [Number

30004X4+3X3+X2+2X :3000usedplastic ofAmount

1

[

Galaxy Industries 擴張計畫– 求解過程

Page 16: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

16

加入總和限制式 X6 ( 產品組合限制式之用 )

X6 = 每週生產總數 (in dozens ),X6 = X1+X2+X3+X4, or X1+X2+X3+X4 -X6 =0

Galaxy Industries 擴張計畫– 求解過程

Page 17: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

171000X61000least at is production Total

0.4X6X4production total of 40%Soakers of productionWeekly

0.4X6X3production total of 40%Squirts Big of productionWeekly

0.4X6X2production total of 40%Zappers of productionWeekly

0.5X6X1production total of 50%Rays Space of productionWeekly

Galaxy Industries 擴張計畫– 求解過程

Page 18: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

18

完整數學模式

Max 16X1 + 15X2 + 20X3 + 22X4 – 180X5

S.T. 2X1 + 1X2 + 3X3 + 4X4 3X1+ 4X2 + 5X3 + 6X4 – 60X5 2400

X5 321X2 200

X1 + X2 + X3 + X4 - - X6 = 0X1 -.5X6 = 0

X2 -.4X6 = 0X3 -.4X6 = 0

X4 -.4X6 = 0X6 1000

Xj are non-negative

Galaxy Industries 擴張計畫– 求解過程

Page 19: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

19

=SUM(B4:E4)

PercentageConstraints

SUMPRODUCT($B$4:$F$4,B6,F6) Drag to G7:G10

Galaxy Industries 擴張計畫– 求解過程

Page 20: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

20

Microsoft Excel Sensitivity ReportWorksheet: [Galaxy Expansion.xls]Galaxy Expansion Input

Adjustable CellsFinal Reduced Objective Allowable Allowable

Cell Name Value Cost Coefficient Increase Decrease$B$4 Space Rays 565 0 16 4 12$C$4 Zappers 200 0 15 0.5 1E+30$D$4 Big Squirts 365 0 20 1E+30 0.571428571$E$4 Soakers 0 -2.5 22 2.5 1E+30$F$4 O/T Hours 32 0 -180 1E+30 90

ConstraintsFinal Shadow Constraint Allowable Allowable

Cell Name Value Price R.H. Side Increase Decrease$C$4 Zappers 200 0 0 1E+30 252$D$4 Big Squirts 365 0 0 1E+30 87$E$4 Soakers 0 0 0 1E+30 452$B$4 Space Rays 565 5 0 486.6666667 91.57894737$G$7 Platistic Total 2425 0 3000 1E+30 575$G$8 Prod. Min. Total 2400 4.5 2400 920 520$G$9 Overtime Hours Total 32 90 32 15.33333333 8.666666667$G$10 Contract Total 200 -0.5 200 280 89.23076923$G$4 Total Production 1130 0 1000 130 1E+30

Microsoft Excel Sensitivity ReportWorksheet: [Galaxy Expansion.xls]Galaxy Expansion Input

Adjustable CellsFinal Reduced Objective Allowable Allowable

Cell Name Value Cost Coefficient Increase Decrease$B$4 Space Rays 565 0 16 4 12$C$4 Zappers 200 0 15 0.5 1E+30$D$4 Big Squirts 365 0 20 1E+30 0.571428571$E$4 Soakers 0 -2.5 22 2.5 1E+30$F$4 O/T Hours 32 0 -180 1E+30 90

ConstraintsFinal Shadow Constraint Allowable Allowable

Cell Name Value Price R.H. Side Increase Decrease$C$4 Zappers 200 0 0 1E+30 252$D$4 Big Squirts 365 0 0 1E+30 87$E$4 Soakers 0 0 0 1E+30 452$B$4 Space Rays 565 5 0 486.6666667 91.57894737$G$7 Platistic Total 2425 0 3000 1E+30 575$G$8 Prod. Min. Total 2400 4.5 2400 920 520$G$9 Overtime Hours Total 32 90 32 15.33333333 8.666666667$G$10 Contract Total 200 -0.5 200 280 89.23076923$G$4 Total Production 1130 0 1000 130 1E+30

Galaxy Industries 擴張計畫– 求解過程 (p.153~p.154)

負值如何解釋 ?

Page 21: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

21

3.5 整數線性規劃模型之應用 (p.179)

• 許多現實模型中至少一個決策變數為整數值

• 整數模型之分類– 純整數線性模型 Pure integer (AILP) :所有決策變數皆為整數

– 二元整數線性模型 Binary (BILP) :所有決策變數皆為二元數 (0 或 1)

– 混合整數線性模型 Mixed integer (MILP) :有些變數非整數或二元值

Page 22: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

22

使用二元變數The use of binary variables in constraints

X 10 If a new health care plan is adopted If it is not

X 1 If a new police station is built downtown0 If it is not

X 1 If a particular constraint must hold0 If it is not

• 一個變數之決策結果分為 “ yes”/“no”, “good”/“bad” 等 . 皆為二元分類

• 說明

Page 23: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

23

• 範例– 以二元變數 Y1 ,Y2 ,Y3 表示三家工廠的每一家是否要建 (Yi =

1) 或不建 (Yi = 0) 需求 Requirement 二元 Binary 表示法

至少兩家工廠要被建立 Y1 + Y2 + Y3 2若工廠 1 要建,則工廠 2 不能建 Y1 + Y2 1若工廠 1 要建,則工廠 2 也要建 Y1 – Y2 一間工廠要建,但不可以兩間工廠同時建 Y1+ Y2 = 1兩者都要或都不要建 Y1 – Y2 =0工廠建設不可超過 $17 百萬

其中個別成本為 $5, $8, $10 百萬 5Y1+8Y2+10Y3 17

使用二元變數 (p.179)

Page 24: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

24

• 範例 ( 條件限制式 )• 工廠 1 生產鋼材可以製造兩種產品:

– 產品 1 需要 6 磅重鋼材,產品 2 需要 9 磅重鋼材 – 若工廠 1 被建後,將有 2000 磅重鋼材可以利用– 此產品是否生產取決於工廠 1 是否建立,表示式如下

6X1 + 9X2 2000Y1

使用二元變數 (p. 180)

若工廠 1 建立則 Y1 = 1.限制式變為6x1 + 9X2 2000

若工廠 1 不建則 Y1 = 0限制式變為6x1 + 9X2 0, 且X1 = 0 , X2 = 0

Page 25: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

25

3.5.1 人員排程模型 (p. 180) Personnel Scheduling Models

• 典型整數規劃問題,為分派人員或機器以達到最低的要求範圍

• 這些模型有多於一期或以上可以利用的資源限制式 (i.e. 第 t 期可獲得資源數將影響第 t + 1 期結果 )

Page 26: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

26

• Sunset 海灘市一週七天需要海灘救生員• 法律規定救生員每週工作 5 天且有兩天連假 . • 安全起見,每天平均每 8000 名遊客需提供一

名救生員• 成本考量起見,雇用救生員人數越少越好

Sunset 海灘救生員的派任 (p.181)Sunset Beach Lifeguard Assignments

Page 27: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

27

• 總結 Summary– 排定連續五天救生員排程– 雇用救生員人數總數越少越好– 符合每天最低救生員需求量

Sun. Mon. Tue. Wed. Thr. Fri. Sat. 8 6 5 4 6 7 9

Sunset 海灘救生員的派任 (p.181)

Page 28: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

28

• 決策變數 Decision VariablesXi = 第“ i ” 排定救生員人數 for i=1, 2, …,7 (i=1 is Sunday)

• 目標函數 Objective Function救生員總人數最少

• 限制式 Constraints確定每天有最低需求量的救生員 .

Sunset 海灘救生員的派任 (p.181~182)

Page 29: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

29

X 7X 7

Sunset 海灘救生員的派任

X6X6 X5X5

X4X4 X3X3

Tue. Wed. Thu. Fri. Sat Sun.

Who works on Saturday ?Who works on Friday?

X2

Mon

X3X4X5X6

找出每天工作的救生員,逐步建立限制式

Page 30: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

30

Sunset 海灘救生員的派任模式Min X1 + X2 + X3 + X4 + X5 + X6 + X7

S.T. X1 + X4 + X5 + X6 + X7 8 (Sun)

X1 + X2 + X5 + X6 + X7 6 (Mon)

X1 + X2 + X3 + X6 + X7 5 (Tue)X1 + X2 + X3 + X4 + X7 4 (Wed)

X1 + X2 + X3 + X4 + X5 6 (Tur)

X2 + X3 + X4 + X5 + X6 7 (Fri)

X3 + X4 + X5 + X6 + X7 9 (Sat)

Page 31: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

31

Sunset 海灘救生員的派任

Page 32: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

32

Sunset 海灘救生員的派任

Page 33: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

33TOTAL LIFEGUARDS

最佳解組合LIFEGUARDS

DAY PRESENT REQUIRED BEGIN SHIFT

SUNDAY 9 8 1MONDAY 8 6 0TUESDAY 6 5 1WEDNESDAY 5 4 1THURSDAY 6 6 3FRIDAY 7 7 2SATURDAY 9 9 2

10Note: An alternate optimal solution exists.

Sunset 海灘救生員的派任

Page 34: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

34

• 專案選擇模型由一群二元變數表示” “ go/no-go” 的決定

• 模型中包含元件有 :

– 預算 Budget– 空間 Space– 優先順序 Priority conditions

3.5.2 專案選擇模型Project selection Models

Page 35: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

35

• Salem 市議會的目標是最大化選民之支持度下合理分派預算

• 資料中包含成本 costs, 可利用資源 , 計畫優順序 .

Salem 市議會─專案選擇Salem City Council – Project Selection

Page 36: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

36

計畫 成本($1000) 工作 記點僱請七名新警官 400.00$ 7 4176警察總部現代化 350.00$ 0 1774購買新警車 50.00$ 1 2513巡邏警察恤金 100.00$ 0 1928購買新消防車與支援設備 500.00$ 2 3607雇用消防局助理 90.00$ 1 962恢復被刪體育計畫 220.00$ 8 2829恢復被刪音樂計畫 150.00$ 3 1708高中新購新電腦 140.00$ 2 3003

民調之結果

X1

X2

X3

X4

X5

X6

X7

X8

X9

Salem 市議會─專案選擇 (p. 185)

Page 37: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

37

• 決策變數 : Xj- 一組二元決策變數; if a project j is selected (Xj=1) or not (Xj=0) for j=1,2,..,9

• 目標函數 :使經費之計畫總點數最大化

• 限制式 :See the mathematical model.

Salem 市議會─專案選擇 (p. 185)

Page 38: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

38

互斥性:警車與消防車購其一

體育與音樂須在電腦設備購買前通過

共同必要性:體育與音樂同時恢復或不恢復

最大預算不能超過 $900,000

4 個警察計畫中至多 3 個限制式通過

工作創造限制式:至少十個工作數量

Salem 市議會─專案選擇 (p.185~186)

• The Mathematical Model

Max 4176X1+1774X2+ 2513X3+1928X4+3607X5+962X6+2829X7+1708X8+3003X9

S.T. 400X1+ 350X2+ 50X3+ 100X4+ 500X5+ 90X6+ 220X7+ 150X8+ 140X9

900

7X1+ X3+ 2X5+ X6+ 8X7+ 3X8+ 2x9 10

X1+ X2+ X3+ X4 3

X3+ X5 = 1

X7 - X8 = 0

X7 - X9 0

x8 - x9

(Xi = 0,1 for i=1, 2…, 9)

Page 39: 1 Chapter 3 線性與整數規劃模式之應用 Applications of Linear and Integer Programming Models.

39

Salem 市議會─專案選擇

=SUMPRODUCT(B4:B12,E4:E12)

=SUMPRODUCT(B4:B12,C4:C12)=SUMPRODUCT(B4:B12,D4:D12)=SUM(B4:B7)=B6+B8=B10-B11=B10-B12=B11-B12