## 4 Algorithms for Core System Functionality
### BOM Precedence Constraint Satisfaction Metaheuristics  
The first- and second-level dispatching methodologies outlined in Section 3.1 ignore, in favor of speed, precedence constraints that may exist among components scheduled to be produced within the same PPP. Except for scheduling speed, the main reason for this decomposition strategy was the make-to-stock policies the SME employs for raw materials, components, and end items. If there is sufficient stock of a child (the preceding component) to initiate production of the father (the succeeding component), then this type of precedence relationship can be regarded as a soft constraint with the penalty being the child's stock reduction. Due to the nature of the PPC system, it is an extreme rarity to come across more than a single-level child-father occurrence in a PPP, e.g., \(i-1\to i\to j\) where \(i-1\) and \(i\) denote the child and father/child, respectively, and \(j\) represents the father. Therefore, in the remainder of the paper, the focus will be solely on \(p(i,j)\) pairings. The authors, in order to explore the feasibility of a schedule with precedence constraint violations, formulated a hybrid TS/VNS algorithm coupled with the ATM module already mentioned in the paper. For more information regarding TS and VNS, the reader is referred to [PERSON] et al. (2018)[PERSON] et al. (2018) and [PERSON] et al. (2019)[PERSON] et al. (2019), respectively. In this unique implementation, random weights are assigned to SPT, LPT, and PSF, and a typical TS algorithm with backtracking is executed. The neighborhood consists of \(\pm 0.02\) of the previous iteration's \(w1,w2,w3\) values. Two tabu lists are kept to store the values of \(w1,w2\), with \(w3=1-w1-w2\). If a neighbor is found in which either \(w1\) or \(w2\) belong in the respective tabu lists, then that neighbor is rejected. Solution quality is determined by the number of properly oriented \(p(i,j)\) pairings, i.e., \(Ci\leq rj\). Two additional counters are initiated: \(vns\_counter=0\) and \(cycle\_counter=0\). These counters count the number of iterations for which the current solution quality has not improved. Once the \(vns\_counter\) reaches a certain number of iterations, the VNS concept of shaking is applied to launch \(w1\) and \(w2\) into other neighborhoods and diversify the search. If shaking fails to improve the quality and the \(cycle\_counter\) fill-up search up to that point stops, an elite solution is chosen from the elite set, the tabu lists are wiped, and the search is reinitiated from this solution. The elite set holds a number of promising solutions found during search and ranks them in last in first out (LIFO) fashion, thus serving a number of good points for re-intensification when the search stagnates. The search terminates when all possible pairings have been properly oriented, all possible elite solutions have been used, or the maximum number of iterations has been exhausted. The pseudocode of the algorithm is the following:  
1. Initialize parameters of the TS/VNS algorithm. 2. Assign random weights \(w1,w2,w3\) to SPT, LPT, PSF and set \(iters=0\), \(tabu\_list1=0\), \(tabu\_list2=0\). 3. If late orders are prioritized then \(\delta=1\), Else\(\delta=0\). 4. Create elite set \(E=\{u(w1,w2,n(n^{+}))\}\) with \(n(E)=8\) and set \(vns\_counter=0\), \(cycle\_counter=0\). 1. Create a sequence for which the following holds true: \(S=w1\times SPT+w2\times LPT+w3\times PSF+\delta\times WEDD\wedge w1+w2+w3=1\). 2. Calculate \(n^{+}=\{p(i,j)\in n^{\max}:S^{-1}(i)<S^{-1}(j)\}\). 3. Add current \(\{u(w1,w2,n(n^{+}))\}\) to \(E\). 4. Locate non-tabu neighbor of \(S\), \(S^{*}\) by randomly perturbing \(w1,w2\) within a \(\pm 0.02\) interval (neighborhood), set \(w3=1-w1-w2\). * Calculate \(n^{+}=\big{\{}p(i,j)\in n^{\max}:S^{-1}(i)<S^{-1}(j)\big{\}}\). * If \(n\big{(}n^{+}_{S^{*}}\big{)}>n(n^{+})\) set \(S=S^{*}\) and add \(w1,w2\) to \(tabu\_list\)\(1\) and \(tabu_{list2}\) and set \(iters=iters+1\).