# Quality Prediction and Parameter Optimisation of Resistance Spot Welding Using Machine Learning
## 2 Proposed Approach
### Multi-Objective Particle Swarm Optimisation Algorithm  
The basic core of the particle swarm algorithm is to obtain the optimal solution to the problem to be optimised by using information sharing among individuals in the population [27,28]. A population of M particles in a D-dimensional search space is defined, with the position of the \(i\)th particle denoted by \(\mathbf{X}_{\mathrm{i}}=(X_{\mathrm{i1}},X_{\mathrm{i2}},\cdots,X_{\mathrm{id}})\), and the velocity denoted by \(\mathbf{V}_{\mathrm{i}}=(V_{\mathrm{i1}},V_{\mathrm{i2}},\cdots,V_{\mathrm{id}})\), where \(\mathrm{i}=1,2,\cdots,\mathrm{m}\). Particle i searches the current  
Figure 1: Flowchart of the CGO–MLSSVR algorithm.  
space based on the position \(\mathbf{X}_{\mathrm{i}}\) and the velocity \(\mathbf{V}_{\mathrm{i}}\), for each particle. The individual extreme value \(\mathbf{P}_{\mathrm{i}}=(\mathrm{p}_{\mathrm{i}1},\mathrm{p}_{\mathrm{i}2}, \cdots,\mathrm{p}_{\mathrm{i}d})\) and the historical best position \(\mathbf{P}_{\mathrm{g}}=(\mathrm{p}_{\mathrm{g}1},\mathrm{p}_{\mathrm{g}2}, \cdots,\mathrm{p}_{\mathrm{g}d})\) of the population are searched; the position and velocity of the iterated particles are updated according to Equations (4) and (5), and the optimal value after the tth iteration is derived from the fitness formula.  
\[\mathrm{V}_{\mathrm{i}d}^{\mathrm{t+1}}=\mathrm{w}\mathrm{V}_{\mathrm{i}d}^{ \mathrm{t}}+\mathrm{c}_{1}\mathrm{r}_{1}(\mathrm{p}_{\mathrm{i}d}^{\mathrm{t} }-\mathrm{X}_{\mathrm{i}d}^{\mathrm{t}})+\mathrm{c}_{2}\mathrm{r}_{2}(\mathrm{ p}_{\mathrm{g}d}^{\mathrm{t}}-\mathrm{X}_{\mathrm{i}d}^{\mathrm{t}}) \tag{4}\]  
\[\mathrm{X}_{\mathrm{i}d}^{\mathrm{t+1}}=\mathrm{X}_{\mathrm{i}d}^{\mathrm{t}}+ \mathrm{V}_{\mathrm{i}d}^{\mathrm{t}} \tag{5}\]  
where \(\mathrm{w}\) is the inertia weight, \(\mathrm{d}=1,2,3,\cdots,\mathrm{D}\) denotes the dimension corresponding to the particle, \(\mathrm{t}\) is the number of current iterations, \(\mathrm{c}_{1}\),\(\mathrm{c}_{2}\) are the learning factors, and \(\mathrm{r}_{1}\),\(\mathrm{r}_{2}\) are the random numbers within [0, 1].  
The first method for optimising the resistance spot welding process parameters is based on the principle that the larger the tensile shear load, the better the spot-welding quality within a reasonable range of nugget diameters. The objective function is shown in Equation (6). The second method gives a target value while constraining the nugget size; thus, the smaller the predicted value and the target value, the better the difference between the predicted tensile shear load \(\mathrm{y}_{\mathrm{p}}\) and the actual target tensile shear \(\mathrm{y}_{\mathrm{obj}}\). The objective function of the particle swarm is shown in Equation (7).  
\[\mathrm{fitness}=\mathrm{max}(\overline{\mathrm{y}}) \tag{6}\]  
\[\mathrm{fitness}=\left|\overline{\mathrm{y}}-\mathrm{y}_{\mathrm{obj}}\right| \tag{7}\]  
Based on the CGO-MLSSVR model for optimising process parameters, Figure 2 shows the flow chart of the proposed integrated approach.  
Figure 2: Flow chart of the PSO optimisation process parameters.