## 3 Online Clustering-Based Intelligent Batching Method
### AP Offline Formula Learning  
Historical data hide the valuable operational wisdom of engineers. By using the AP clustering algorithm, we can extract empirical knowledge of human formulas from these historical data. At present, the main clustering methods include K-means, DBSCAN, hierarchical clustering, etc. However, the dynamic characteristics of real-time data put forward higher requirements for the traditional clustering algorithm. The algorithm needs to quickly process and summarize a large number of continuously arriving data while at the same time adapting to the changes of data distribution, detecting new clusters, and merging old clusters. In order to meet the needs of rapid processing, many dynamic data clustering methods are incremental algorithms, such as incremental K-means, incremental DBSCAN, and incremental AP clustering algorithms. Incremental K-means needs to preset the number of clusters K. If the appropriate number cannot be determined, it may need to try many times. The incremental DBSCAN algorithm is computationally complex and needs to deal with a large number of center points and boundary points each time [25; 26; 27]. In contrast, incremental the AP clustering algorithm does not need to preset a K value and has fewer parameter settings. Therefore, the AP clustering algorithm is used for the machine learning of formulas. The basic idea of the AP clustering algorithm is to treat the element content corresponding to \(N\) historical ratio data as nodes in the network and then calculate the clustering centers of each sample through the messages passing from each edge in the network. During the clustering process, there are two types of messages passing between nodes, namely, attractiveness \(r(i,k)\) and belonging \(a(i,k)\). \(R=[r(i,k)]_{N\times N}\) is the attractiveness matrix, and \(A=[a(i,k)]_{N\times N}\) is the belonging matrix. The AP clustering algorithm continuously  
Figure 3: Schematic diagram of \(C\) element filtering in secondary ash from blast furnace. updates the attractiveness and membership values of each point through an iterative process until \(n\) high-quality cluster centers (Exemplar) are generated, where \(n\in N\). At the same time, the remaining ratios are assigned to the corresponding clusters, and \(R\) and \(A\) can be obtained. The iterative equations for attractiveness and belonging are as follows:  
\[r_{t+1}(i,k)= \begin{cases}s(i,k)-\max\limits_{j\
eq k}\{a_{t}(i,j)+r_{t}(i,j) \},\quad i\
eq k\\ s(i,k)-\max\limits_{j\
eq k}\{S(i,j)\},\quad i=k\end{cases}  \tag{4}\]  
\[a_{t+1}(i,k)= \begin{cases}\min\{0,r_{t+1}(k,k)+\sum\limits_{j\
eq i,k}\max\{r _{t+1}(j,k),0\}\}\qquad i\
eq k\\ \sum\limits_{j\
eq k}\max\{r_{t+1}(j,k),0\},\quad j=k\end{cases}  \tag{5}\]  
where \(r(i,j)\) is the degree of attraction, which is used to describe the suitability of the element content of ratio \(j\) as the clustering center of the element content of ratio \(i\); \(a(i,j)\) is is the attribution degree, which is used to describe the appropriate degree of selecting the element content of ratio \(j\) as its clustering center of the element content of ratio \(i\); and \(s(i,k)\) is the similarity, which represents the ability of the element content of ratio \(k\) to serve as the clustering center for the element content of ratio \(i\). Generally, negative Euclidean distance is used, so the larger the \(s(i,k)\), the closer the two points are. In order to avoid oscillations during the iteration process, a soft update strategy is adopted, and the update equations are as follows:  
\[ \begin{cases}r_{t+1}(i,k)=\lambda*r_{t}(i,k)+(1-\lambda)*r_{t+1}(i,k)\\ a_{t+1}(i,k)=\lambda*a_{t}(i,k)+(1-\lambda)*a_{t+1}(i,k)\end{cases}  \tag{6}\]  
where \(\lambda\) is the parameter damping factor, \(\lambda\in(0,1)\). The damping factor is introduced to prevent data oscillations during the information propagation process. A higher \(\lambda\) limits the magnitude of updates during iterations, thus enhancing algorithm stability but slowing convergence.