# Surrogate-Based Robust Design for a Non-Smooth Radiation Source Detection Problem
## Appendix A Particle Swarm  
The initialization stage of Particle Swarm is described in Algorithm 11. The algorithm starts by selecting the population size of the swarm denoted by \(P\). Initially, the state positions \([\mathbf{\theta}^{old}]^{j}\) and velocities \([\mathbf{v}^{old}]^{j}\), \(j=1,2,...,P\) are randomly selected from uniform distributions; i.e., \([\theta_{i}^{old}]^{j}\), \([\
u_{i}^{old}]^{j}\sim U[l_{i},u_{i}],\ i=1,2,3\). Each state point has an associated neighborhood of size \(N=Ns\) influencing its future trajectory. Other parameters of the algorithm must be selected too, such as the inertia parameters \(W^{j}\in\mathbb{R}\) and stall counter \(c^{j}\) for \(j=1,2,...,P\). These parameters influence the space search. ```
1:Select swarm size \(P\in\mathbb{N}\) and generate initial state points \([\mathbf{\theta}^{old}]^{j}\) and velocities \([\mathbf{v}^{old}]^{j}\), \(j=1,2,...,P\) such that \([\theta_{i}^{old}]^{j}\), \([\
u_{i}^{old}]^{j}\in[l_{i},u_{i}],\ i=1,2,3\). 2:Select the minimum neighborhood size \(minNs\) and the inertia parameters \(W^{j}\in\mathbb{R}\), \(j=1,2,...,P\), \(W^{j}\in[0.1,1.1]\). 3:Set the stall counter \(c^{j}=0\) for all state points \(j=1,2,...,P\). 4:Set the self and social adjustment real variables \(y_{1}\) and \(y_{2}\). 5:Set \(N=Ns\). ```  
**Algorithm 11** Particle Swarm--Initialization  
The evolution of the space point \(jth\) from the current state to the next one is described in Algorithm 12. The index notation is dropped. The proposal function depends on a two steps formula. First, the velocity \(\mathbf{v}^{new}\) is adjusted via Equation (11) while in the second phase, the new state is obtained by adding the newly generated velocity to its previous position (12). The weights \(y_{1}\) and \(y_{2}\) denote the self and social adjustment coefficients steering the search towards either the state point \(\mathbf{p}\) or its neighbors \(\mathbf{g}\) best position. We denote the Hadamard product by \(\cdot*\). A successful replacement of the best state point position \(\mathbf{b}\) among the entire population ensures a change in the inertia parameter \(W\) while a failure leads to a larger neighborhood selection and maintains \(W\) constant. Finally, the new proposals are set to replace the current ones for the next iteration. The algorithm stops when the relative change in the lowest objective function value \(J_{b}^{*}\) over a range of predefined number of iterations is smaller than a specified tolerance, the maximum number of iterations is reached, or a preset objective function percentage decrease has been achieved. ```
1:Select \(N\) state points other than \(j\) to generate the associated neighborhood. 2:Set \(flag=false\). Define set \(S\) containing all the \(N\) state points. Find the lowest objective function \[\mathbf{g}=\min_{\mathbf{\theta}^{old}\in S}J(\mathbf{\theta}^{old})andsetJ^{n*}=J( \mathbf{g}).\]
3:Select random vectors \(\mathbf{u}_{1}\) and \(\mathbf{u}_{2}\) of size 3 from the uniform distribution \(U(0,1)\). Update the velocity: \[\mathbf{v}^{new}=W\cdot\mathbf{v}^{old}+y_{1}\cdot\mathbf{u}_{1}\cdot( \mathbf{p}-\mathbf{\theta}^{old})+y_{2}\cdot\mathbf{u}_{2}\cdot*(\mathbf{g}-\mathbf{ \theta}^{old}).\] (1)
4:Update the position \[\mathbf{\theta}^{new}=\mathbf{\theta}^{old}+\mathbf{v}^{new}.\] (2)
5:Enforce the bounds. If any component of \(\mathbf{\theta}^{new}\) is outside a bound, set it equal to that bound. 6:if\(J(\mathbf{\theta}^{new})<J^{*}\)then\(\mathbf{p}=\mathbf{\theta}^{new}\), \(J^{*}=J(\mathbf{\theta}^{new})\)
7:endif. 8:if\(J(\mathbf{\theta}^{new})<J_{b}^{*}\)then\(flag=true\), \(J_{b}^{*}=J(\mathbf{\theta}^{new})and\mathbf{b}=\mathbf{\theta}^{new}\), where \(J_{b}^{*}\) corresponds to the smallest objective function in the swarm. 9:else\(flag=false\)
10:endif. 11:if flag = true then set \(c=\max(0,c-1)\) and \(N=Ns\). 12:if\(c<2\)then\(W=2\cdot W\)
13:endif. 14:if\(c>5\)then\(W=W/2\) and ensure that \(W\) is inside the bounds. 15:endif. 16:else set \(c=c+1\), \(N=\min(N+Ns,P)\)
17:endif.