# Binary Spring Search Algorithm for Solving Various Optimization Problems
## 2 Spring Search Algorithm
### BSSA Formulation  
In this section, the mathematical formulation of the \(BSSA\) is modeled according to [PERSON]'s law. Similar to population-based algorithms, the \(BSSA\) has a population matrix in which each row represents a member of the population as a weight. Thus, every member of the population is a vector, where each vector element determines the value of a variable of the optimization problem. In the \(BSSA\), each member of the population is introduced using Equation (2). \[X_{i}=\left(x_{i}^{1},\ldots,x_{i}^{d},\ldots,x_{i}^{m}\right)\quad\text{ for }i=1,\ 2,\ \ldots,\ N, \tag{2}\]  
Here, \(X_{i}\) is the \(i\)'th member of population matrix, \(x_{i}^{d}\) is the status of the \(d\)'th dimension of the \(i\)'th member of the population matrix, \(m\) is the number of the problem's variables, and \(N\) is the number of members of the population. The initial position of each member of the population is randomly considered in the search space of the problem. Then, based on the forces that the spring exerts on the weights, the members of the population move in the search space. The force of the springs is proportional to the spring constant, which is updated in each iteration using Equation (3). \[K_{i,j}=K_{max}\left|F_{n}^{i}-F_{n}^{j}\right|max\left(F_{n}^{i},F_{n}^{j}\right) \tag{3}\]  
Here, \(K_{i,j}\) is the spring constant of a specified spring that connects weight \(i\) to weight \(j\), \(K_{max}\) is the maximum value of the spring constant for all springs, and its value is 1, and \(F_{n}\) is the normalized objective function, in which \(F_{n}^{i}\) means a normalized objective function for the \(i\)'th member. In the \(BSSA\), objective functions are normalized using Equations (4) and (5). \[F^{\prime i}_{n}=\frac{f_{obj}^{i}}{\min\left(f_{obj}\right)}, \tag{4}\]  
\[F_{n}^{i}=\frac{\min\left(F^{\prime i}_{n}\right)}{F^{\prime i}_{n}} \tag{5}\]  
where \(f_{obj}\) is the vector of the objective function, in which \(f_{obj}^{i}\) means an objective function for the \(i\)'th member. An \(m\)-variable problem has an \(m\)-dimensional search space. Therefore, the search space has m coordinate axes corresponding to each variable. Each member of the population has a value on each axis. For each member of the population in each axis, the fixed points on the right and left are defined. Fixed points for a member are members who have a better objective function than that member. This causes two separate forces to be applied to each member on each axis from the left and right, which can be determined using Equations (6) and (7). \[F^{j,d}_{total_{R}}=\sum_{i=1}^{m_{R}^{d}}K_{i,j}\ x_{i,j}^{d} \tag{6}\]  
\[F^{j,d}_{total_{L}}=\sum_{l=1}^{m_{L}^{d}}K_{i,j}\ x_{l,j}^{d} \tag{7}\]where \(F^{jd}_{total_{R}}\) and \(F^{jd}_{total_{L}}\) are respectively the total of the forces exerted on the \(d\)'th dimension of the \(i\)'th member of the population matrix from the right and left, \(n^{d}_{R}\) is the number of fixed points on the right in the \(d\)'th axis or dimension, and \(n^{d}_{L}\) is the number of fixed points on the left in the \(d\)'th axis or dimension. Now, according to [PERSON]'s law, the amount of displacement to the right and left side for each member in each axis can be calculated using Equations (8) and (9). \[dX^{jd}_{R}=\frac{F^{jd}_{total_{R}}}{K^{j}_{equal_{L}}} \tag{8}\]  
\[dX^{jd}_{L}=\frac{F^{jd}_{total_{L}}}{K^{j}_{equal_{L}}} \tag{9}\]  
where \(dX^{jd}_{R}\) is the amount of displacement to the right side for the \(j\)'th member in the \(d\)'th axis or dimension, and \(dX^{j,d}_{L}\) is the amount of displacement to the left side for the \(j\)'th member in the \(d\)'th axis or dimension. In this case, the final displacement value can be calculated by merging Equations (8) and (9) according to Equation (10). \[dX^{jd}=dX^{jd}_{R}+dX^{j,d}_{L} \tag{10}\]  
where \(dX^{j,d}\) is the final displacement for the \(j\)'th member in the \(d\)'th axis or dimension. After determining the amount of displacement, the new position of each member in the search space is updated using Equation (11).