# An Algorithm for Part Input Sequencing of Flexible Manufacturing Systems with Machine Disruption
## 3 Proposed Algorithm
For the above sets, the segment set functions can be obtained. A detailed description of these segment set functions is provided in [5]. An algorithm is proposed by applying the segment set functions to part input sequencing of FMSs for handling machine breakage. The proposed algorithm is segment set-based. It also applies the earliest due date scheduling rule for machine scheduling. Its aim is to achieve part input sequencing of FMSs to handle a machine breakage. It is simply called the machine disruption handling algorithm (MDH Algorithm, Algorithm 1). The proposed algorithm is depicted as follows. Additional symbols utilized in the algorithm are listed in Table 1.  
```
Step 1. Initialize \(t=t_{0}\), \(\rho(t)=0\), \(\delta(t)=0\), \(m_{r}(t)=0\), \(m_{j}(t)=1\), \(j\in J\). Step 2. Check the current \(t\), If \(t\geq T\), Stop. Step 3. Check the current status of part \(b_{hi}\). If part \(b_{hi}\) finishes processing, \(\delta(t)=1\), then \(t=c_{hi}\). If \(\delta(t)=0\), go to Step 10. Step 4. Obtain machine status. \(m_{j}(t),j\in J\). If \(\forall j\in J\), \(m_{j}(t)\lor m_{r}(t)=0\), then identify and remove broken machine. Remove parts from broken machine. \(BM(t)=\big{\{}\,j|j\in J\lor m_{j}(t)=0\big{\}}\), \(t=t_{p}\), \(m_{r}(t)=1\). Step 5. Place parts in preprocess area in \(A_{x}(t)\), \(A_{x}(t)=\{\,b_{hi}|g_{b_{hi}x}(t)=1\}\). Update parts at \(BM(t)\) in set \(A_{e}(t)\), \(A_{e}(t)=\{\,b_{hi}|g_{b_{hi}e}(t)=1\}\). Update parts in \(A_{x}(t)\) for not processing at \(BM(t)\) in set \(A_{o}(t)\), \(A_{o}(t)=\{\,b_{hi}|b_{hi}\in A_{x}(t)\wedge g_{b_{hi}0}(t)=1\}\). Update parts in set \(A_{x}(t)\) for processing at \(BM(t)\) in set \(A_{e}(t)\), \(A_{e}(t)=\{\,b_{hi}|b_{hi}\in A_{x}(t)\wedge g_{b_{hi}e}(t)=1\}\). Step 6. If \((m_{r}(t)\
eq 0)\) (\(A_{o}(t)\
eq\phi\)), then \(A_{y}(t)=\big{\{}\,b_{hi}|b_{hi}\in A_{o}(t)\,\big{\}}\), go to Step 7, else if \((m_{r}(t)=0)\wedge(A_{e}(t)\
eq\phi)\), then \(A_{y}(t)=\big{\{}\,b_{hi}|b_{hi}\in A_{o}(t)\,\big{\}}\), go to Step 7, else if \((m_{r}(t)=0)\wedge(A_{e}(t)\
eq\phi)\vee(m_{r}(t)=0)\wedge(A_{o}(t)\
eq\phi)\), then \(A_{y}(t)=\big{\{}\,b_{hi}|\big{\{}b_{hi}\in A_{e}(t)\,\big{\}}\cup\{b_{hi}\in A _{o}(t)\,\big{\}}\big{\}}\). ```  
**Algorithm 1**Machine Disruption Handling Algorithm  
```
Step 2. Check the current \(t\), If \(t\geq T\), Stop. Step 3. Check the current status of part \(b_{hi}\). If part \(b_{hi}\) finishes processing, \(\delta(t)=1\), then \(t=c_{hi}\). If \(\delta(t)=0\), go to Step 10. Step 4. Obtain machine status. \(m_{j}(t),j\in J\). If \(\forall j\in J\), \(m_{j}(t)\lor m_{r}(t)=0\), then identify and remove broken machine. Remove parts from broken machine. Remove parts from broken machine. \(BM(t)=\big{\{}\,j|j\in J\lor m_{j}(t)=0\big{\}}\), \(t=t_{p}\), \(m_{r}(t)=1\). Step 5. Place parts in preprocess area in \(A_{x}(t)\), \(A_{x}(t)=\{\,b_{hi}|g_{b_{hi}x}(t)=1\}\). Update parts at \(BM(t)\) in set \(A_{e}(t)\), \(A_{e}(t)=\{\,b_{hi}|g_{b_{hi}e}(t)=1\}\). Update parts in \(A_{x}(t)\) for not processing at \(BM(t)\) in set \(A_{o}(t)\), \(A_{o}(t)=\{\,b_{hi}|b_{hi}\in A_{x}(t)\wedge g_{b_{hi}0}(t)=1\}\). Update parts in set \(A_{x}(t)\) for
```
Step 7. Obtain workload in the FMS at time \(t\). Obtain the least workload machine, \(\widetilde{j}=\left\{j|j\in J\wedge\eta_{j}(t)=\min_{j\in I}\eta_{j}(t)\right\}\). Also, obtain the 2 nd least workload machine \(\widetilde{j}=\left\{j|j\in J\wedge\eta_{j}(t)=\min_{j\in I,j\
eq j}\eta_{j}(t)\right\}\). \(A_{x}(t)=A_{y}(t)\). Apply Equation (1) to (6) to obtain subsets \(A_{q}(t)\) for \(q=a,b\), also for \(q=u,v,m,n\). \(g_{h,q}(t)=1\), for \(q=x,a,b\), also for \(q=u,v,m,n\). Step 8. Obtain segment set functions by equations in [5]. Obtain the simple set functions \(\lambda_{q}\) of set set \(A_{q}(t)\) by Equation (13) for \(q=x,a,b\), also for \(q=u,v,m,n\). Obtain the transform function \(\overline{\lambda}\) by Equations (14) and (19). Assign weights \(\xi_{q}\) for \(q=u,v,m,n\).