# Optimization of Parametric Equalizer Filters in In-Vehicle Audio Systems with a Genetic Algorithm
## 3 Materials and Methods
### Modeling and Optimization of System Output
\[r=\frac{n\sum{(xy)}-\sum{x}\sum{y}}{\sqrt{\left[{n{\sum{x^{2}}-\sum{(x)}^{2}}} \right]\left[{n{\sum{y^{2}}-\sum{(y)}^{2}}}\right]}} \tag{3}\]  
Here, x and y refer to the data sets, and n refers to the total number of data points. The RMSE is a method used to measure the magnitude of differences between two data sets. The RMSE evaluates the deviations among the obtained results and quantitatively indicates the amount of error. A low RMSE value indicates that the results are close to each other. RMSE is calculated using (4). \[\sqrt{\frac{1}{n}{\sum_{i=1}^{n}{(y_{i}-x_{i})}^{2}}} \tag{4}\]  
These statistical analyses played a critical role in evaluating the agreement between the ideal contour and the experimental and simulation results. While Pearson correlation analysis determined the linear relationship between the results, RMSE analysis quantitatively measured the accuracy of this relationship [18]. To align the signal output from the speaker with the ideal contour given by the equal-loudness principle, the optimization of filter parameters was performed. Metaheuristic algorithms were preferred for the optimization. Metaheuristic algorithms are methods capable of conducting effective and efficient searches over large solution spaces and are not specific to a particular problem. In this study, the genetic algorithm (GA), one of the metaheuristic algorithms, was chosen. The GA is an optimization technique based on the principles of biological evolution and operates on solution sets called chromosomes. Initially, an initial population consisting of random solutions is created. Then, the fitness of each solution is evaluated according to a specific objective. Solutions with higher fitness values are selected to have greater representation in subsequent generations. Crossover operations are performed among the selected solutions to create new solutions (offspring), and small random changes (mutations) are applied to the solutions obtained from the crossover. Finally, the population is updated with the new solutions, and the process is repeated until a certain fitness value is achieved, or a specified number of iterations is reached [19]. Genetic algorithms have the capability to operate effectively in large and complex solution spaces. In terms of flexibility and adaptability, genetic algorithms can be tailored to various optimization problems and provide flexibility for different objectives [20]. Given the numerous frequency and parameter combinations in vehicle audio systems, genetic algorithms are ideal for addressing such problems. In this study, a GA was implemented using the \"optimoptions\" and \"ga\" functions from Matlab's Global Optimization Toolbox. The GA was configured with a population size of 100 individuals. Thus, 100 different solutions were evaluated in each generation, and it allowed for a more comprehensive exploration of the solution space. The algorithm was allowed to run for a maximum of 50 generations, ensuring that the algorithm had sufficient time to search for an optimal solution, while keeping the computation time under control. The success of the GA depends on the careful selection of various parameters. In this study, the crossover rate was set to 0.8. This rate helps maintain genetic diversity while allowing successful traits to be passed on to the next generation. Additionally, uniform mutation was chosen as the mutation function, and the mutation rate was set to 0.2. This enables the algorithm to avoid local minima and explore a broader solution space. The selection function used was stochastic uniform selection. This method increases the probability of selecting individuals based on their fitness values, allowing better-performing solutions to be more represented in the next generation. Arithmetic crossover was used as the crossover function. This method combines the genetic information of the parents to create new individuals, facilitating the discovery of better solutions.