## 4 Algorithms for Core System Functionality
### BOM Precedence Constraint Satisfaction Metaheuristics
* If \(n\big{(}n^{+}_{S^{*}}\big{)}>n\big{(}n^{+}_{\min}\big{)},n\big{(}n^{+}_{\min} \big{)}=\min n(n^{+}),\forall u\in E\) then replace \(u_{\min}\) with \(u_{S^{*}}\) and set \(vns\_counter=0\), \(cycle\_counter=0\). * If \(n\big{(}n^{+}_{S^{*}}\big{)}\leq n\big{(}n^{+}_{\min}\big{)},n\big{(}n^{+}_{ \min}\big{)}=\min n(n^{+}),\forall u\in E\) then set \(vns\_counter=vns\_counter+1\), \(cycle\_counter=cycle\_counter+1\). * If \(vns\_counter=60\) perform shaking by randomly setting \(w1^{*}=w1\pm 0.1\wedge w2^{*}=w2\pm 0.1\). * If \(cycle\_counter=75\) then recover \(u_{lifo}(w1,w2,n(n^{+}))\) and set \(w1=w1_{lifo}\), \(w2=w2_{lifo}\) and go to a. * Terminate if \(n(n^{\max})=n(n^{+})\lor n(E)=\varnothing\loriters=\maxiters\). Empirical analysis showed that in the vast majority of the cases, the TS/VNS algorithm did not properly orientate all the \(p(i,j)\). This outcome was of no surprise since no problem-specific knowledge is incorporated into the algorithm. Furthermore, such a result does not necessarily create an infeasible schedule, as was previously mentioned. To test schedule feasibility, the ATM algorithm is employed. Once its parameters are initialized, ATM identifies a set of \(p(i,j)\) pairings that maintain improper orientations and then proceeds to create three discreet subsets: Subset \(C\) contains pairings in which children have \(1\) to \(1\) relationships with the fathers, subset \(F\) contains pairings of \(n\) to \(1\) type relationships, and finally, subset \(K\), in which those same relationships are \(1\) to \(n\). The next step is the calculation per subset of the earliest possible starting times \(\min rjm_{j}\) of the fathers while taking into account current stock levels, desired child quantities, and children's completion times. Comparisons of these starting times with the ones provided by the TS/VNS algorithm reveal if feasibility has been broken. The steps of ATM are given below:  
1. Initialize ATM parameters. 2. Identify set \(n^{-}=\{p(i,j)\in n^{\max}\backslash n^{+}\}\). 3. Dim \(C=\{p(i,j)\in n^{-}:i\
eq k,j\
eq l,\forall p(i,j),p(k,l)\in C\subseteq n^{-}\}\). 4. If \(mj=mi\) then \(\delta mjmi=0\), else \(\delta mjmi=1\). 5. \(\forall p(i,j)\in C\) calculate \(\min rjm_{j}=rim_{i}+\delta m_{i}m_{j}\times\tau im_{i}\times\left(1-\frac{ STI}{NI}\right)+\left(1-\delta m_{i}m_{j}\right)\times\tau im_{i}\). 6. If \(rjm_{j}<\min rjm_{j}\) then the orientation of \(p(i,j)\in C\) is wrong. 7. Dim \(F=\{p(i,j)\in n^{-}\backslash C:j\
eq l,\forall p(i,j),p(k,l)\in F\subseteq n^ {-}\}\). 8. \(\forall i\in F\) calculate \(\min rjm_{j}=rim_{i}+\delta m_{i}m_{j}\times\tau im_{i}\times\left(1-\frac{ STI}{NI}\right)+\left(1-\delta m_{i}m_{j}\right)\times\tau im_{i}\). 9. Find \(\max(\min rjm_{j})\). 10. If \(rjm_{j}<\max(\min rjm_{j})\) then the orientation of \(p(i,j)\in F\) is wrong. 11. \(\forall i\in K\). 12. \(\forall j\in K\) calculate \(\Delta=rjm_{j}-(rim_{i}+\tau im_{i})\). 13. For \(mi=mj\) if \(\Delta<0\) then the orientation of \(p(i,j)\in K\) is wrong. 14. For \(mi\
eq mj\) then 1. \(\forall p(i,j)\in K\wedge\Delta<0\) if \(STi\leq\sum_{j=1}^{J}Ni_{j}\) then at least one of \(p(i,j)\in K\) the orientations are wrong. 15. \(\forall p(i,j)\in K\wedge\Delta>0\) then \(p(i,j)\in K\) is correctly oriented. 16. Collect all wrongly oriented \(p(i,j)\in n^{-}\) and terminate. ATM's termination is accompanied by the feasibility status of the schedule. Empirical data showed that infeasibility is highly probable, especially for functional groups with a very large number of \(p(i,j)\) pairings (as many as 60 spanning two PPPs), such as door lock assembly. If that is the case, the next step is supporting the planner in his decision to properly orientate the wrong pairs through the repair method outlined below:  
1. \(\forall\ p(i,j)\in C^{-}\) do: 1. Prompt user to transfer either \(i\) or \(j\) earlier or later until \(rjm_{j}=\min rjm_{j}\). 2. \(\forall\ p(i,j)\in F^{-}\) do: 1. Prompt user to transfer either \(i\) or \(j\) earlier or later until \(rjm_{j}=\max\bigl{(}\min rjm_{j}\bigr{)}\). 3.