# Retinal Vessel Segmentation Using Math-Inspired Metaheuristic Algorithms
## 2 Materials and Methods
### Sine Cosine Algorithm  
The SCA is a population-based metaheuristic algorithm inspired by the fluctuating behaviors and cyclic patterns of the sine and cosine trigonometric functions, which was proposed by [PERSON] in 2016 [PERSON] (2016). In the SCA, while the exploration of the search space is controlled by changing the range of the sine and cosine functions, the repositioning of a solution around another solution can also be realized according to its cyclic pattern property. The detailed pseudo-code for the SCA is given as follows:  
Randomly create an initial population consisting a set of search agents,  
\(x_{i,j}\ \in\ \{1,2,\ \ldots,\ N\}\)  
Cycle = 1  
**WHILE**: \(Cycle\leq Maximum\ Cycle\)  
Calculate the fitness value of each \(x_{i}\) search agent in the population  
Determine the best search agent so far and store it in a variable as  
destination agent  
Update the random parameters \(r1,\ r2,\ r3\) and \(r4\)  
Update the position of each search agent in the current population  
Store the current destination point as the best search agent obtained so far  
Cycle = Cycle + 1 In the SCA, the random parameter \(r1\) decides whether a solution updates its position towards the best solution (\(r1<1\)) or away from it (\(r1>1\)). It can be updated using the following equation:  
\[r1=a-t\ \frac{a}{Max\ Cycle\ Number} \tag{30}\]  
where \(a\) is a constant and \(t\) is the current cycle. Meanwhile, \(r2\) varies randomly in the interval of \([0,2\pi]\), which determines the required distance towards or away from the destination. Furthermore, \(r3\) varies randomly in the interval of \([0,2]\) and represents a random weight for the destination, either emphasizing (\(r3>1\)) or de-emphasizing (\(r3<1\)) the effect of the destination in defining the distance. Finally, \(r4\) varies randomly in the interval of \([0,1]\) and acts as a switch to choose between the sine and cosine functions. The position of each search agent in the current population can be updated using the following equation:  
\[X_{i\ j}^{t+1}\ =\ \ \left\{ \begin{array}{l}X_{i\ j}^{t}\ +\ r1\cdot\cos(r2) \cdot\left|\ r3\cdot P_{i\ j}^{t}\ -\ X_{i\ j}^{t}\ \right|,\ \ r4\geq 0.5\\ X_{i\ j}^{t}\ +\ r1\cdot\sin(r2)\cdot\left|\ r3\cdot P_{i\ j}^{t}\ -\ X_{i\ j}^{t}\ \right|,\ \ r4<0.5\end{array} \right. \tag{31}\]  
where \(X_{i\ j}^{t}\) represents the current search agent \(i\) in cycle \(t\) and \(P_{i\ j}^{t}\) denotes the position of the best search agent in cycle \(t\). The values of the _Population Size_ and _Maximum Cycle Number_ parameters were determined as \(10\) and \(100\), respectively, for each algorithm. Furthermore, the maximum and minimum pixel values were defined as \(X_{\text{max}}\) and \(X_{\text{min}}\), respectively. The remaining control parameter values used in the simulations for each algorithm are provided in Table 1. The optimal control parameter values for the CSA, TSA, AOA, GNDO, GOBC-PA, and SCA algorithms were taken from [1; 2; 3; 4; 5; 6], respectively. On the other hand, for the control parameters that can take values within a certain range, simulations were carried out for different values within the relevant range and the value at which the optimum segmentation results were obtained was defined as the optimal value. In particular, the parameter values that produced the highest segmentation performance (i.e., in terms of Se, Sp, and Acc) and also produced the lowest MSE values were determined as the optimal parameter values. In this work, the metaheuristic algorithms were used to obtain the optimal cluster centers corresponding to optimal pixel values. While investigating the optimal cluster center values, the quality of each possible clustering center was calculated depending on the mean squared error (MSE) function: