知識點
第一類生產線平衡問題,第二類生產線平衡問題
整數線性規划模型,+Leapms模型,直接求解,CPLEX求解
裝配生產線平衡問題 (The Assembly Line Balancing Problem)
裝配生產線又叫做組裝生產線, 是把產品的工藝做串行生產安排的流水生產線。一個產品的組裝需要不同的工序來完成,且工序之間有先后次序要求。
下表是Jackson, J. R. . (1956)給出一個產品工序的裝配次序要求:
| 工序 | 執行時長 | 緊前工序 |
| 1 | 6 | -- |
| 2 | 2 | 1 |
| 3 | 5 | 1 |
| 4 | 7 | 1 |
| 5 | 1 | 1 |
| 6 | 2 | 2 |
| 7 | 3 | 3,4,5 |
| 8 | 6 | 6 |
| 9 | 5 | 7 |
| 10 | 5 | 8 |
| 11 | 4 | 10,9 |
上表也可以用有向圖表示:

生產線平衡問題的目的是:把工序划分成工作站,且滿足工序緊前要求。優化目標有兩種:(1)在生產節拍被指定時使得工作站數量最少;或(2)在工作站數量被限定情況下使得生產節拍最小。
前一種目標被稱為第一類生產線平衡問題,后一種目標被稱為第二類生產線平衡問題。
第二類問題生產線平衡問題的建模
(1)問題
已知工作站共有m=5個,工序共有n=11個,極小化生產節拍。
(2)有向圖的表達
有向圖可以表達為節點的點對集合,例如 e={ 1 2, 1 3, 1 4,...,10 11}
第k條邊的前后兩個頂點一般被寫成 a[k], 和 b[k]。第k條邊被記為 (a[k], b[k])
邊的數目 ne 是 e 中元素數除以2,即:ne=_$(e)/2
(3)決策變量
設 x[i][j] 為0-1變量,表示工序j是否被分配給工作站i。其中i=1,...,m; j=1,...,n。
(4)依賴變量
設變量c為生產線的節拍
(5)目標是極小化生產節拍,即:
minimize c
(6)約束1: 每個工序被分配給且僅被分配給一個工作站:
sum{i=1,...,m} x[i][j] =1 | j =1,...,n
(7)約束2:節拍大於等於任何一個工作站的執行時長:
c >= sum{j=1,...,n}x[i][j]t[j] | i=1,...,m
(8)約束3:對任何邊k,如果其后節點b[k]被分配到工作站i,則其前節點 a[k] 必須被分配到 j=1,...,i 中的某個節點,即:
x[i][b[k]] <= sum{j=1,...,i}x[j][a[k]] | i=1,...,m;k=1,...,ne
第二類問題生產線平衡問題的+leapms模型
//第二類生產線平衡問題
minimize c
subject to
sum{i=1,...,m} x[i][j] =1 | j =1,...,n
c >= sum{j=1,...,n}x[i][j]t[j] | i=1,...,m
x[i][b[k]]<=sum{j=1,...,i}x[j][a[k]]|i=1,...,m;k=1,...,ne
where
m,n,ne are integers
t[j] is a number | j=1,...,n
e is a set
a[k],b[k] is an integer|k=1,...,ne
c is a variable of number
x[i][j] is a variable of binary|i=1,...,m;j=1,...,n
data
m=5
n=11
t={6 2 5 7 1 2 3 6 5 5 4}
e={
1 2
1 3
1 3
1 5
2 6
3 7
4 7
5 7
6 8
7 9
8 10
9 11
10 11
}
data_relation
ne=_$(e)/2
a[k]=e[2k-1]|k=1,...,ne
b[k]=e[2k]|k=1,...,ne
第二類問題生產線平衡問題的模型求解
Welcome to +Leapms ver 1.1(162260) Teaching Version -- an LP/LMIP modeling and
solving tool.歡迎使用利珀 版本1.1(162260) Teaching Version -- LP/LMIP 建模和求
解工具.
+Leapms>load
Current directory is "ROOT".
.........
p2.leap
.........
please input the filename:p2
================================================================
1: //第二類生產線平衡問題
2: minimize c
3:
4: subject to
5: sum{i=1,...,m} x[i][j] =1 | j =1,...,n
6: c >= sum{j=1,...,n}x[i][j]t[j] | i=1,...,m
7: x[i][b[k]]<=sum{j=1,...,i}x[j][a[k]]|i=1,...,m;k=1,...,ne
8:
9: where
10: m,n,ne are integers
11: t[j] is a number | j=1,...,n
12: e is a set
13: a[k],b[k] is an integer|k=1,...,ne
14: c is a variable of number
15: x[i][j] is a variable of binary|i=1,...,m;j=1,...,n
16:
17: data
18: m=5
19: n=11
20: t={6 2 5 7 1 2 3 6 5 5 4}
21: e={
22: 1 2
23: 1 3
24: 1 3
25: 1 5
26: 2 6
27: 3 7
28: 4 7
29: 5 7
30: 6 8
31: 7 9
32: 8 10
33: 9 11
34: 10 11
35: }
36: data_relation
37: ne=_$(e)/2
38: a[k]=e[2k-1]|k=1,...,ne
39: b[k]=e[2k]|k=1,...,ne
40:
================================================================
>>end of the file.
Parsing model:
1D
2R
3V
4O
5C
6S
7End.
..................................
number of variables=56
number of constraints=81
..................................
+Leapms>mip
relexed_solution=9.2; number_of_nodes_branched=0; memindex=(2,2)
nbnode=230; memindex=(24,24) zstar=13; GB->zi=10
The Problem is solved to optimal as an MIP.
找到整數規划的最優解.非零變量值和最優目標值如下:
.........
c* =10
x1_1* =1
x1_5* =1
x2_2* =1
x2_6* =1
x2_8* =1
x3_3* =1
x3_10* =1
x4_4* =1
x4_7* =1
x5_9* =1
x5_11* =1
.........
Objective*=10
.........
+Leapms>
上面的結果顯示, 目標值即最小節拍為10, 分配方案是: 工序1,5分配在工作站1, 工序2,6,8 分配在工作站2, 工序3,10 分配在工作站3, 工序4,7分配在工作站4, 工序9,11分配在工作站5。
第二類生產線平衡問題求解結果圖示
第二類生產線平衡問題的+Leapms-Latex數學概念模型
在+Leapms環境下,使用 “latex"命令可以把上面的+Leapms模型直接轉換為如下Latex格式的數學概念模型。

第一類生產線平衡問題
由求解第2類生產線平衡問題知道,工作站數是5時,最小節拍是10。假設如果將節拍上限增加到10,問是否能夠減小工作站數目。
第一類生產線平衡問題的建模
第一類生產線平衡問題的數學模型見Ritt, M. , & Costa, A. M. . (2015)。
第一類生產線平衡問題的+Leapms模型
//第一類生產線平衡問題
minimize sum{i=1,...,m}y[i]
subject to
sum{i=1,...,m} x[i][j] =1 | j =1,...,n
y[i]c >= sum{j=1,...,n}x[i][j]t[j] | i=1,...,m
x[i][b[k]]<=sum{j=1,...,i}x[j][a[k]]|i=1,...,m;k=1,...,ne
y[i]<=y[i-1]|i=2,...,m
where
m,n,ne are integers
t[j] is a number | j=1,...,n
e is a set
a[k],b[k] is an integer|k=1,...,ne
c is a number
x[i][j] is a variable of binary|i=1,...,m;j=1,...,n
y[i] is a variable of binary|i=1,...,m
data
m=6
n=11
c=12
t={6 2 5 7 1 2 3 6 5 5 4}
e={
1 2
1 3
1 3
1 5
2 6
3 7
4 7
5 7
6 8
7 9
8 10
9 11
10 11
}
data_relation
ne=_$(e)/2
a[k]=e[2k-1]|k=1,...,ne
b[k]=e[2k]|k=1,...,ne
第一類生產線平衡問題的模型求解
Welcome to +Leapms ver 1.1(162260) Teaching Version -- an LP/LMIP modeling and
solving tool.歡迎使用利珀 版本1.1(162260) Teaching Version -- LP/LMIP 建模和求
解工具.
+Leapms>load
Current directory is "ROOT".
.........
p1.leap
p2.leap
.........
please input the filename:p1
1: //第一類生產線平衡問題
2: minimize sum{i=1,...,m}y[i]
3:
4: subject to
5: sum{i=1,...,m} x[i][j] =1 | j =1,...,n
6: y[i]c >= sum{j=1,...,n}x[i][j]t[j] | i=1,...,m
7: x[i][b[k]]<=sum{j=1,...,i}x[j][a[k]]|i=1,...,m;k=1,...,ne
8: y[i]<=y[i-1]|i=2,...,m
9:
10: where
11: m,n,ne are integers
12: t[j] is a number | j=1,...,n
13: e is a set
14: a[k],b[k] is an integer|k=1,...,ne
15: c is a number
16: x[i][j] is a variable of binary|i=1,...,m;j=1,...,n
17: y[i] is a variable of binary|i=1,...,m
18:
19: data
20: m=6
21: n=11
22: c=12
23: t={6 2 5 7 1 2 3 6 5 5 4}
24: e={
25: 1 2
26: 1 3
27: 1 3
28: 1 5
29: 2 6
30: 3 7
31: 4 7
32: 5 7
33: 6 8
34: 7 9
35: 8 10
36: 9 11
37: 10 11
38: }
39: data_relation
40: ne=_$(e)/2
41: a[k]=e[2k-1]|k=1,...,ne
42: b[k]=e[2k]|k=1,...,ne
43:
>>end of the file.
Parsing model:
1D
2R
3V
4O
5C
6S
7End.
===========================================
number of variables=72
number of constraints=100
int_obj=0
===========================================
+Leapms>mip
relexed_solution=3.83333; number_of_nodes_branched=0; memindex=(2,2)
nbnode=117; memindex=(12,12) zstar=5.22619; GB->zi=6
nbnode=314; memindex=(38,38) zstar=5.625; GB->zi=6
nbnode=587; memindex=(24,24) zstar=5.01852; GB->zi=5
nbnode=861; memindex=(26,26) zstar=4.25; GB->zi=5
nbnode=1128; memindex=(22,22) zstar=3.83333; GB->zi=5
nbnode=1395; memindex=(38,38) zstar=3.83333; GB->zi=5
nbnode=1680; memindex=(40,40) zstar=6; GB->zi=5
nbnode=1959; memindex=(46,46) zstar=6; GB->zi=5
nbnode=2230; memindex=(30,30) zstar=3.9246; GB->zi=5
nbnode=2487; memindex=(26,26) zstar=4.44444; GB->zi=5
nbnode=2774; memindex=(36,36) zstar=4.16667; GB->zi=4
nbnode=2971; memindex=(20,20) zstar=3.83333; GB->zi=4
nbnode=3149; memindex=(26,26) zstar=4.16667; GB->zi=4
nbnode=3343; memindex=(36,36) zstar=3.91667; GB->zi=4
nbnode=3546; memindex=(20,20) zstar=4.04167; GB->zi=4
The Problem is solved to optimal as an MIP.
找到整數規划的最優解.非零變量值和最優目標值如下:
.........
x1_1* =1
x1_2* =1
x1_6* =1
x2_5* =1
x2_8* =1
x2_10* =1
x3_3* =1
x3_4* =1
x4_7* =1
x4_9* =1
x4_11* =1
y1* =1
y2* =1
y3* =1
y4* =1
.........
Objective*=4
.........
+Leapms>
結果顯示工作站數可減少到4。分配方式如下面的圖示。
第一類生產線平衡問題求解結果圖示

第一類生產線平衡問題的CPLEX求解
在+Leapms環境中輸入cplex命令即可觸發在另外窗口內啟動CPLEX求解器對模型進行求解:
+Leapms>cplex You must have licience for Ilo Cplex, otherwise you will violate corresponding copyrights, continue(Y/N)? 你必須有Ilo Cplex軟件的授權才能使用此功能,否則會侵犯相應版權, 是否繼續(Y/N)?y +Leapms>
Tried aggregator 1 time.
MIP Presolve eliminated 24 rows and 3 columns.
MIP Presolve modified 71 coefficients.
Reduced MIP has 76 rows, 69 columns, and 362 nonzeros.
Reduced MIP has 69 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.11 sec. (0.33 ticks)
Found incumbent of value 6.000000 after 0.20 sec. (0.40 ticks)
Probing fixed 15 vars, tightened 0 bounds.
Probing changed sense of 1 constraints.
Probing time = 0.00 sec. (0.18 ticks)
Cover probing fixed 1 vars, tightened 0 bounds.
Tried aggregator 1 time.
MIP Presolve eliminated 20 rows and 16 columns.
MIP Presolve modified 45 coefficients.
Reduced MIP has 56 rows, 53 columns, and 247 nonzeros.
Reduced MIP has 53 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.01 sec. (0.21 ticks)
Probing fixed 1 vars, tightened 0 bounds.
Probing time = 0.02 sec. (0.11 ticks)
Tried aggregator 1 time.
MIP Presolve eliminated 3 rows and 1 columns.
MIP Presolve modified 12 coefficients.
Reduced MIP has 53 rows, 52 columns, and 230 nonzeros.
Reduced MIP has 52 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.02 sec. (0.15 ticks)
Probing time = 0.00 sec. (0.10 ticks)
Clique table members: 207.
MIP emphasis: balance optimality and feasibility.
MIP search method: dynamic search.
Parallel mode: deterministic, using up to 4 threads.
Root relaxation solution time = 0.05 sec. (0.33 ticks)
Nodes Cuts/
Node Left Objective IInf Best Integer Best Bound ItCnt Gap
* 0+ 0 6.0000 4.0000 33.33%
* 0+ 0 5.0000 4.0000 20.00%
0 0 4.0000 21 5.0000 4.0000 54 20.00%
* 0+ 0 4.0000 4.0000 0.00%
0 0 cutoff 4.0000 4.0000 54 0.00%
Elapsed time = 0.45 sec. (1.85 ticks, tree = 0.00 MB, solutions = 3)
Root node processing (before b&c):
Real time = 0.45 sec. (1.85 ticks)
Parallel b&c, 4 threads:
Real time = 0.00 sec. (0.00 ticks)
Sync time (average) = 0.00 sec.
Wait time (average) = 0.00 sec.
------------
Total (root+branch&cut) = 0.45 sec. (1.85 ticks)
Solution status = Optimal
Solution value = 4
x1_1=1
x1_2=1
x1_5=1
x1_6=1
x2_8=1
x2_10=1
x3_3=1
x3_4=1
x4_7=1
x4_9=1
x4_11=1
y1=1
y2=1
y3=1
y4=1
第一類生產線平衡問題的+Leapms-Latex數學概念模型
在+Leapms環境下,使用 “latex"命令可以把上面的+Leapms模型直接轉換為如下Latex格式的數學概念模型

參考文獻
[1] Jackson, J. R. . (1956). A computing procedure for a line balancing problem. Management Science, 2(3), 261-271.
[2] Ritt, M. , & Costa, A. M. . (2015). Improved integer programming models for simple assembly line balancing, and related problems. International Transactions in Operational Research, 19(8), 455-455.

