06: Flow Shop Scheduling Phan Nguyen Ky Phuc April 20, 2019 Contents 1 Flow Shop 1 1.1 Assumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 When number of machines in each work station is 1 . . . . . . . . . . . . . . . . . . . . . . . 1 1.3 When number of machines in each work station is more than 1 and process sequence on each 1.4 1 work station is not fixed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Sample Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Flow Shop 1.1 Assumption • There are several work stations {1, 2, ...M } in the system • Each job must be processed in work stations following the sequence of 1 → 2 → 3... → M • Work station m has Nm identical machine, Nm ≥ 1 1.2 When number of machines in each work station is 1 It is assumed that in the flow shop the work station sequence on each job is 1 → 2 → 3... → M Sets M : set of work stations J: set of jobs Parameters pij be processing time on workstation i of job j Variables Sij : starting time on work station i of job j xjk : binary variable xjk = 1 if job j is processed before job k in the sequence; otherwise xjk = 0 Cmax : the make span min Cmax 1 Ho Chi Minh City International University Industrial Systems Engineering Department Scheduling Lecturer: Phan Nguyen Ky Phuc subject to Shj ≥ Sij + pij , ∀j, h > i Cmax ≥ Sij + pij , ∀i, j Sij ≥ Sik + pik − BigM × (1 − xkj ), ∀i, j, k xjk + xkj = 1 1.3 When number of machines in each work station is more than 1 and process sequence on each work station is not fixed Sets M : set of work stations J: set of jobs Parameters pij be processing time on work stationi of job j Ni number of machines on work station i Variables Smj : starting time on work station m of job j Dmj : departure time on work station m of job j Cmax : the make span t t Umj = 1 if t ≥ Smj otherwise Vmj =0 t t Vmj = 1 if t ≤ Dmj otherwise Umj =0 t t Rmj = 1 if Smj ≥ t ≥ Dmj otherwise Rmj =0 min Cmax subject to Shj ≥ Smj + pmj , Cmax ≥ Dmj , ∀j, h > m ∀m, j Dmj ≥ Smj + pmj − 1, ∀m, j Constraints for Ujt and Vjt t t ≥ Smj − 1 − BigM × (1 − Umj ), ∀j, t t t ≤ Smj − 1 + BigM × Umj , ∀j, t t t ≤ Dmj + 1 + BigM × (1 − Vmj ), ∀j, t t t ≥ Dmj + 1 − BigM × Vmj , ∀j, t Constraints for Yjt t t Rmj ≤ Umj j, ∀j, t t t Rmj ≤ Vmj , ∀j, t t t t Rmj ≥ Vmj + Umj − 1, ∀j, t Workforce constraints J X t Rmj ≤ Nm ∀t, j j=1 06: Flow Shop Scheduling Page 2 Ho Chi Minh City International University Industrial Systems Engineering Department 1.4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 Scheduling Lecturer: Phan Nguyen Ky Phuc Sample Code i n t numStation = . . . ; i n t numJob = . . . ; i n t numTime=30; r a n g e r a n g e S t a t i o n = 1 . . numStation ; r a n g e ra ngeJ ob = 1 . . numJob ; r a n g e rangeTime = 0 . . numTime ; i n t N[ r a n g e S t a t i o n ] = . . . ; i n t p [ r a n g e S t a t i o n ] [ ra nge Job ] = . . . ; i n t BigM=10000; dvar i n t+ S [ r a n g e S t a t i o n ] [ ran geJ ob ] ; dvar i n t+ D[ r a n g e S t a t i o n ] [ ra nge Job ] ; dvar b o o l e a n U[ rangeTime ] [ r a n g e S t a t i o n ] [ ran geJ ob ] ; dvar b o o l e a n V[ rangeTime ] [ r a n g e S t a t i o n ] [ ran geJ ob ] ; dvar b o o l e a n R[ rangeTime ] [ r a n g e S t a t i o n ] [ ra nge Job ] ; dvar f l o a t+ Cmax ; e x e c u t e PRE{ c p l e x . t i l i m =60∗3; } m i n i m i z e Cmax ; s u b j e c t to { f o r a l l ( h i n r a n g e S t a t i o n , m i n r a n g e S t a t i o n , j i n ra nge Job : h>m) { S [ h ] [ j ]>=S [m ] [ j ]+p [m ] [ j ] ; 23 24 } 25 26 27 28 29 f o r a l l ( m i n r a n g e S t a t i o n , j i n r ang eJob ) { Cmax>=D[m ] [ j ] ; D[m ] [ j ]>=S [m ] [ j ]+p [m ] [ j ] − 1 ; } 30 31 32 33 34 35 36 forall ( j t>=S [m ] [ t<=S [m ] [ t<=D[m ] [ t>=D[m ] [ } i n rangeJob , t i n rangeTime , m i n r a n g e S t a t i o n ) { j ]−1−BigM∗(1−U[ t ] [ m ] [ j ] ) ; j ]−1+BigM∗U[ t ] [ m ] [ j ] ; j ]+1+BigM∗(1−V[ t ] [ m ] [ j ] ) ; j ]+1−BigM∗V[ t ] [ m ] [ j ] ; forall ( j R[ t ] [ m ] [ R[ t ] [ m ] [ R[ t ] [ m ] [ } i n rangeJob j ]<=U[ t ] [ m ] [ j ]<=V[ t ] [ m ] [ j ]>=V[ t ] [ m ] [ 37 38 39 40 41 42 , t i n rangeTime , m i n r a n g e S t a t i o n ) { j ]; j ]; j ]+U[ t ] [ m ] [ j ] − 1 ; 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 f o r a l l ( t i n rangeTime ,m i n r a n g e S t a t i o n ) { sum ( j i n ran geJ ob )R[ t ] [ m ] [ j ]<=N[m ] ; } } e x e c u t e WRITE{ v a r o f i l e =new I l o O p l O u t p u t F i l e ( " R e s u l t . t x t " ) ; o f i l e . w r i t e l n ( "The o b j e c t i v e f u n c t i o n v a l u e : " , c p l e x . getObjValue ( ) ) ; f o r ( var m in r a n g e S t a t i o n ) { f o r ( v a r j i n ra nge Job ) { o f i l e . w r i t e l n ( "S time on S t a t i o n [ " ,m, " ] o f j o b [ " , j , " ] i s : " , S [m ] [ j ] ) ; o f i l e . w r i t e l n ( "D time on S t a t i o n [ " ,m, " ] o f j o b [ " , j , " ] i s : " , D[m ] [ j ] ) ; } } o f i l e . w r i t e l n ( "−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−" ) ; o f i l e . close () ; 06: Flow Shop Scheduling Page 3 Ho Chi Minh City International University Industrial Systems Engineering Department 59 Scheduling Lecturer: Phan Nguyen Ky Phuc } Example 1 The Nm is given as Nm = [1, 2, 1] \J 1 2 3 1 2 5 3 2 5 5 1 3 3 5 2 4 2 4 4 Example 2 Consider following job shop problem with revisit workstation is allowed The Nm is given as Nm = [2, 1, 2, 2] J 1 2 3 4 06: Flow Shop Scheduling Sequence 1,2,3,1 2,3,1 4,1,3,2 1,4,2,4 Processing Time p11 = 1, p21 = 2, p31 = 3, p11 = 2 p22 = 1, p32 = 2, p12 = 2 p43 = 4, p13 = 1, p33 = 2, p23 = 3 p14 = 2, p44 = 3, p24 = 2, p44 = 3 Page 4