## 2 Materials and Methods
### Elimination of Invalid Configurations in the Solution Space
Global optimization problems require searching over the entire solution space, and since they usually have a very large and complex structure, traditional algorithms are inadequate in solving these problems. At this point, metaheuristic algorithms offer a suitable solution to scan large solution spaces, avoid getting stuck in local minima, and reach the global optimum. The problem in this study is a global optimization problem that can also be evaluated as discrete and combinatory optimization. The goal sought in the problem is to find the best bit sequence, that is, the best PV array configuration, within a large solution space. Each bit sequence is a representation of a specific solution and provides a result evaluated according to the optimization criteria. Metaheuristic algorithms aim to find optimal or approximate solutions by effectively scanning large solution spaces. They have two main functions: solution discovery and improvement of discovered solutions. In this respect, it is quite appropriate to use metaheuristic algorithms in large solution spaces based on bit sequences. The algorithms try to find solutions closer to the global optimum by avoiding local optima with randomness and discovery strategies. Algorithm 2 contains the pseudo code that optimizes the optimum PV panel configuration. ```
Inputs: fixed_panel_array, adaptive_panel_array, numChromosomes, crossoverRate, mutationRate Output: optimum_configuration, bestchromosome, bestfitness (max-min: CVI)
1:\(N\)\(\leftarrow\)length(adaptive_panel_array) // A
2:\(ROW\)\(\leftarrow\)length(fixed_panel_array) // F
3:chromosomelength\(\leftarrow\)N*\(ROW\)
4:population\(\leftarrow\)initial_population_generate()
5:Threshold\(\leftarrow\)value_between_0_and_1, bestfitness\(\leftarrow\)value_between_0_and_1
6:loop bestfitness\(>\)Threshold // Fitness values are calculated and stored in the fitnessValues array
7:fitnessValues\(\leftarrow\)empty_array
8:loop\(i\) = 1 to length(population)
9:chromosome\(\leftarrow\)population(\(i\))
10:fitnessValues\(\leftarrow\)fitnessValues\(+\)fitness_function(chromosome, \(N\), \(ROW\), \(A\), \(F\))
11:endloop
12:bestindex\(\leftarrow\)argminfitnessValues\([k]\) // Selection of the best chromosome
13:bestfitness\(\leftarrow\)fitnessValues[bestindex]
```

**Algorithm 2**_Genetic Algorithm-Based Controller_

### GA-Based Controller

Metaheuristic algorithms are general-purpose solution search techniques that aim to find optimum or approximate solutions in complex and large solution spaces. These algorithms are more flexible than traditional heuristic approaches and can be applied to different types of problems instead of adhering to rigid rules developed for a problem. Metaheuristic algorithms generally prevent local minima or maxima in global optimization problems and aim to reach the best solution by exploring large solution spaces. Inspired by natural events, biological processes, social dynamics and physical processes, these algorithms use evolutionary processes, swarm behaviors or random search methods. The problem discussed in this article is an optimization aimed at finding the most appropriate solution in a very large solution space that falls into the category of high-dimensional discrete optimization. The solution space consists of thousands or even millions of bit sequences, each of which has a fixed length such as 32 bits or 256 bits. This problem can be directly defined as a global optimization problem. Global optimization problems require searching over the entire solution space, and since they usually have a very large and complex structure, traditional algorithms are inadequate in solving these problems. At this point, metaheuristic algorithms offer a suitable solution to scan large solution spaces, avoid getting stuck in local minima, and reach the global optimum. The problem in this study is a global optimization problem that can also be evaluated as discrete and combinatory optimization.