## 3 Materials and Methods
### The Proposed Method: Artificial Afterimage Algorithm (AAIA)  
In this section of the study, the structure of the artificial afterimage algorithm is explained. The afterimage infrastructure was presented in Section 1.2. The developed method, artificial afterimage algorithm, is an original new method that has not been studied in the literature before. It is a method inspired by the light reflections that occur during a visual event in the eye. It has an infrastructure based on afterimage and visual angle mentioned in Section 1.2. The pseudo code of the method is presented in Algorithm 1.  
This study was carried out on data clustering. Here, the concept called object size represents the current value of the candidate solution, and object distance represents the distance from the best solution. These values are used in Equations (1) and (2) to calculate the visual angle and perceptual size of the object. Then, based on these two values, the new values of the candidate solutions of the population are updated around the best solution.  
After this process is applied for a certain number of steps, the best solution available gives us the best value for the clustering process.  
```
1. Begin
2. Produce initial population of candidate solution
3. Determine initial best solution
4. while (count \(\leq\) iteration)
5. Determine Object size (value of current solution)
6. Determine Object distance (distance of the current solution from the best solution)
7. Calculate Visual angle (\(V\))
8. Calculate Perceptual size of object (\(S\))
9. local best solution \(\leftarrow\) Determine the current best values
10. if fitness value of local best solution \(<\) fitness of best solution then
11. best \(\leftarrow\) local best values
12. end if
13. Calculate New solution for population
14. end while
15. Present best solution
16. end begin
```  
**Algorithm 1**Pseudo code of AAIA  
Equations (8)-(10) show the calculations of visual angle, perceptual size of object, and update solutions.  
\[V=2*\text{atan}(\frac{pop_{i,j}}{2*pop_{i,j}-best_{1,j}}) \tag{8}\]  
\[S_{i,j}=V*\left(pop_{i,j}-best_{1,j}\right) \tag{9}\]  
\[New\ pop_{i,j}=S_{i,j}+\left(\Big{|}\ S_{i,j-}(best_{1,j}-\Big{|}\Big{(}worst _{i,j}-pop_{i,j}\Big{)}\Big{|}\right)*rand \tag{10}\]  
\(pop_{i,j}\) specified in Equations (8)-(10), is used instead of object size. It is the size of the candidate solution as the current value. \(pop_{i,j}-best_{i,j}\) used instead of object distance is the distance of the cim from the best value, best. The worst value used in Equation (10) represents the worst result. Best and worst values represent positive and negative afterimage.  
Here, the worst means the worst solution; it expresses the opposite of the color of the real image in the event of vision. The distance of the candidate solution from the worst value actually represents the colors we see inverted when we close our eyes. In other words, it is like looking at a white object and seeing black when we close our eyes. Subtracting this value from the best value represents the difference from the original values. By adding this to the perceptual size value, we calculate the new solution value.  
The algorithm aims to produce the new pop values in Equation (10) by using the visual angle and perceptual size values calculated in Equations (8) and (9). New pop values are the new population values obtained in each generation. Obtaining them by using the best and worst values allows better values to be obtained each time. In this way, the values obtained in the end can give very close results to the expected ones.  
This situation is expressed in Figures 2 and 3 in Sections 1.2.1 and 1.2.2 In light of this information, the pseudo code of the method is as in Algorithm 2.