# Hybrid Optimization and Explainable Deep Learning for Breast Cancer Detection
## 2 Proposed Methodology
### Optimization Algorithms
#### 2.4.2 Firefly Algorithm  
The FLA is a recently developed metaheuristic optimization algorithm, with its precursor developed by [62] along with mechanism elaborated by [63]. This algorithm is based upon the social and photosensory nature of fireflies, namely the bioluminescent flickering code in which they detect their mates or predators. The fireflies in the optimization context are considered as the candidate solutions whose attractiveness is defined with the quality of the objective value, usually metaphorically described as the brightness or intensity of the firefly lighting. This behavior is exploited by the algorithm, which guides less optimal fireflies toward the direction of brighter and more optimal fireflies. This leads to the build-up of a dynamic search pattern that searches for promising areas of the solution space and thus, FLA is effective to solve complex, nonconvex, and multi-mode optimization problems. The strength of the FLA is that it compensates between the search of new areas with the use of known high quality solutions by three main operations: action based on attractiveness, adaptation of the light intensity changes, and random movements to diversify the method [61,64]. During the initialization stage, the FLA randomly populates a multidimensional search space with a population of fireflies. This is vital to have the diversity of starting points that is essential to preventing premature convergence. The position of each of the fireflies in the space is normally generated by drawing uniformly in the specified ranges of each dimension, which is governed by the following formula:  
\[X_{i,n}=L_{n}+\text{rand}\times(U_{n}-L_{n}) \tag{7}\]  
where \(L_{n}\) and \(U_{n}\) are the lower and upper bounds for the nth dimension, and \(X_{i,n}\) is the position of the \(i\)th firefly in that dimension. The term 'rand' represents a uniformly distributed random variable in the range [0, 1]. The light intensity, representing the fitness value, influences the attractiveness of a firefly. A key component of FLA is the attractiveness function, which decays with distance, as follows:  
\[\beta(r)=\beta_{0}\cdot e^{-\gamma r^{2}} \tag{8}\]  
Here, \(\beta_{0}\) is the maximum attractiveness at distance \(r=0\), \(\gamma\) is the light absorption coefficient controlling the decay, and \(r\) is the Euclidean distance between fireflies, as follows:  
\[r_{ij}=|X_{i}-X_{j}|=\sqrt{\sum_{k=1}^{d}\Bigl{(}X_{i,k}-X_{j,k}\Bigr{)}^{2}} \tag{9}\]  
A firefly \(i\) moves toward a brighter (more attractive) firefly j according to  
\[X_{i}^{t+1}=X_{i}^{t}+\beta\bigl{(}r_{ij}\bigr{)}\cdot\Bigl{(}X_{j}^{t}-X_{i} ^{t}\Bigr{)}+\alpha\cdot(\text{rand}-0.5) \tag{10}\]  
where \(\alpha\) is a randomization parameter controlling the stochastic behavior of the algorithm. This movement integrates both exploitation (movement toward better solutions) and exploration (random perturbation). The light intensity I of each firefly is related to the objective function \(f(X)\), as follows:  
\[I_{i}\propto f(X_{i}) \tag{11}\]  
Better solutions emit stronger \"light\", making them more attractive to others. Over iterations, fireflies converge toward brighter peers, allowing the population to intensively search promising regions of the space. To avoid premature convergence and local optima, the algorithm introduces random walks and can be enhanced using dynamic parameters such as adaptive \(\propto\), chaotic maps, or Levy flights to increase diversity. The FLA's simplicity and parallelism make it suitable for high-dimensional, nonlinear, and multi-modal optimization problems. Despite its strengths, the standard FLA may suffer in convergence speed or stagnation in complex landscapes. Enhanced variants like the Adaptive Firefly Algorithm (AFA) or Hybrid FLA with Sine-Cosine or Genetic Operators have been developed to improve robustness and balance exploration-exploitation. Nonetheless, the foundational FLA remains widely applicable in engineering design, feature selection, scheduling, and medical image segmentation tasks.