# An ANN-Based Approach for Real-Time Scheduling in Cloud Manufacturing
## 3 Artificial Neural Network based Resource Allocation Methodology  
The main purpose of the real-time scheduling problem is to allocate MSs for every MT, and the allocation of \(\mathbb{T}_{j}^{(c)}\) can be depicted as Figure 6. The candidate MRs are determined by their capability type and the upper bound of available capacity as formulated in Equation (23). \[\mathcal{I}_{k}(v)\triangleq\left\{i\in\mathcal{I}_{k}\middle|k=\kappa_{j}^{(c )},\overline{V}_{i}^{(k)}\geq v\right\}\quad\forall k\in\mathcal{K} \tag{23}\]  
However, since the number of candidate MRs is large and the processing statuses of these MRs are changing over time, the conventional search algorithms are no longer applicable because they will spend a long time checking all of the possible time intervals in every candidate MR. Therefore, we adopt an ANN that is based on the multi-layer perceptron architecture to speed up the searching procedure by estimating the objective values of each candidate MR. Specifically, take \(\mathbb{T}_{j}^{(c)}\) as an example, after filtering out candidate MRs according to (23), the objective values projected on MT can be estimated by the completion status prediction model as shown in Figure 7.  
Figure 5: Precedence constraint of \(\mathbb{T}_{6}^{(c)}\) with logistics duration considered. Since both \(C_{i}^{(k)}\) and \(P_{i}^{(k)}\) are intrinsic values of \(\mathbb{R}_{i}^{(k)}\), the key of this prediction model is to predict the completion time \(d_{j}^{(k)}\) of \(\mathbb{T}_{j}^{(k)}\). It can be known from the activity-on-vertex structure of one MP (Figure 3), that is, one MT will affect the make-span of its MP only if it is on the critical path, otherwise it has a flexible interval for completion time. Using the level-order traversal algorithm, the upper and lower bounds of the ideal completion time of \(\mathbb{T}_{j}^{(c)}\) that may not affect the make-span of its MP can be obtained. Then, the upper and lower bounds can divide the time axis into three adjacent sections, and their probabilities are Equations (24)-(26). \[\varphi_{i,2}^{(c,j)} =Pr\left\{d_{j}^{(c)}\leq\underline{d}_{j}^{(c)}\Big{|}x_{i,j}^{ (c)}=1\right\} \tag{24}\] \[\varphi_{i,1}^{(c,j)} =Pr\left\{\underline{d}_{j}^{(c)}<d_{j}^{(c)}\leq\overline{d}_{j }^{(c)}\Big{|}x_{i,j}^{(c)}=1\right\}\] (25) \[\varphi_{i,0}^{(c,j)} =Pr\left\{\overline{d}_{j}^{(c)}<d_{j}^{(c)}\Big{|}x_{i,j}^{(c)}=1\right\} \tag{26}\]  
where \(\varphi_{i,n}^{(c,j)}\) means the probability of completion time \(d_{j}^{(c)}\) lies in time interval \"Completion status \(n\)\". Since the completion status of \(\mathbb{T}_{j}^{(c)}\) can only belong to one of these three statuses, we have \(\varphi_{i,0}^{(c,j)}+\varphi_{i,1}^{(c,j)}+\varphi_{i,2}^{(c,j)}=1\). Then the allocation preference for MR candidates of \(\mathbb{T}_{j}^{(c)}\) can be defined as Equation (27), which motivates the allocation of MR to process \(\mathbb{T}_{j}^{(c)}\) as early as possible. \[D_{i}^{(k)}(\mathbb{T}_{j}^{(c)})=\sum_{n=0}^{2}10^{n}\cdot\varphi_{i,n}^{(c,j )} \tag{27}\]  
As shown in Figure 8, the ANN predicts the completion status of MT. Figure 7: Procedure of Manufacturing Task (MT) completion status prediction on candidate Manufacturing Resources (MRs.)  
Where \(O_{0}\), \(O_{1}\), \(O_{2}\) represent \(\varphi_{i,0}^{(c,j)}\), \(\varphi_{i,1}^{(c,j)}\), \(\varphi_{i,2}^{(c,j)}\), respectively. The expression of actual completion status of \(\mathbb{T}_{j}^{(c)}\) processed on \(\mathbb{R}_{i}^{(k)}\) is defined as Equation (28). \[\mathbf{y}(j,c,i,k)= \begin{bmatrix}y_{0}&y_{1}&y_{2}\end{bmatrix} ^{T}(j,c,i,k) \tag{28}\]  
The inputs of this ANN are written in Input (29), which means all the possible features from the decision condition. \[\mathbf{I}(j,c,i,k)\triangleq \begin{bmatrix}I_{0}&I_{1}&\cdots&I_{N}\end{bmatrix}