Application of Genetic Algorithm for More Efﬁcient Multi-Layer Thickness Optimization in Solar Cells

: Thin-ﬁlm solar cells are predominately designed similar to a stacked structure. Optimizing the layer thicknesses in this stack structure is crucial to extract the best efﬁciency of the solar cell. The commonplace method used in optimization simulations, such as for optimizing the optical spacer layers’ thicknesses, is the parameter sweep. Our simulation study shows that the implementation of a meta-heuristic method like the genetic algorithm results in a signiﬁcantly faster and accurate search method when compared to the brute-force parameter sweep method in both single and multi-layer optimization. While other sweep methods can also outperform the brute-force method, they do not consistently exhibit 100% accuracy in the optimized results like our genetic algorithm. We have used a well-studied P3HT-based structure to test our algorithm. Our best-case scenario was observed to use 60.84% fewer simulations than the brute-force method.


Introduction
Simulations of optoelectronic devices have helped to understand and design better optimized structures with efficiencies nearing the theoretical maximum. Lucio et al. analyzed the possibility of achieving the limits of c-Si solar cells through such simulations [1]. Simulations have reduced the time it takes for researchers to find optimized device structure. However, the most common way to obtain results over a large range of a parameter's values is through parameter sweep method. This brute-force method is ineffective in most cases where the user only requires the end optimized device structure. Genetic algorithm (GA) is an optimization algorithm in artificial intelligence based on Darwin's evolution and natural selection theory, in which the fittest outcome survives [2,3]. This algorithm sets an environment with a random population and a function, which is called the fitness function, that scores each individual of that population. The environment then selects individuals to become the parents of the next generation through a selection process. The next generation of individuals (children of the previous generation's parents) is obtained via a crossover method. Similar to natural mutation in genes of the offspring, the new generation's individuals can also suffer mutation in their genes. After several generations, the population converges to the individuals representing the optimal solution. Through the application of genetic algorithm, Jafar-Zanjani et al. designed a binary-pattern reflect-array for highly efficient beam steering [4] and Tsai et al. was able to beam-shape the laser to obtain up to 90% uniformity in intensity distribution [5]. Genetic algorithm has been used by Donald et al. to improve the focusing of light propagating through a scattering medium [6] and by Wen et al. for designing highly coherent optical fiber in the mid-infrared spectral range [7]. It has also been used for designing nanostructures to improve light absorption in solar cells. Chen et al. were able to surpass the Yablonovitch Limit using genetic algorithms to design light trapping nanostructures [8]. Rogério et al. used a genetic algorithm to design surface structures on a Si solar cell to increase the short-circuit current density obtained from it [9].
In this article, we have demonstrated the optimization of an organic solar cell through the optimization of the optical spacer layers. Traditionally, finite difference time domain (FDTD) method was used to simulate the ideal short-circuit current density (J sc ) of the solar cell through the Lumerical, FDTD solutions software similar to our previous reported study [10]. Parameter sweep or brute-force method was used to vary the thickness of the optical spacer layers of the solar cell. At the optimized layer thicknesses, the solar cell will be observed to have the highest J sc output. Although not computationally intensive for a single-layer optimization, the number of simulations expands as in Equation (1) for multi-layer optimization problems. N = n 1 · n 2 · n 3 ...NN (1) where N is the total number of simulations and n 1 , n 2 , and n 3 are the number of simulations performed for layers 1, 2, and 3, and NN is the total number of layers (NN > 3), respectively. To alleviate the brute-force method's limitations, we propose the use of GA. This article then aims to heuristically assert the hypothesis that GA is a more efficient approach than brute-force algorithms in tasks such as optimizing optoelectronic device structures. Figure 1 shows the device structure that was constructed in Lumerical, FDTD solutions. It consists of a 150 nm indium tin oxide (ITO) similar to our previous study [11]. The Al thickness was set to 100 nm as light gets completely reflected from the Al electrode at this thickness. Any further increase in its thickness would not affect the outcome of our optical simulation. The active layer, poly (3-hexylthiophene) (P3HT): indene-C 60 bisadduct (ICBA), was designed to be 200 nm as it exhibited good efficiency in our previous study [12]. The charge transport layers, zinc oxide (ZnO) and Molybdenum oxide (MoOx), also act as optical spacer layers and are variable quantities in our simulation. In order to qualify as an optical spacer, the layer material should have the refractive index properties to shift the light induced electric field inside the solar cell structure by varying its thickness. ZnO was already shown to be a good optical spacer in our previous research [11]. While a ITO/PEDOT:PSS/P3HT:PCBM/ZnO/Al is a more commonly used solar cell structure [13], PEDOT:PSS does not have the suitable refractive index to control the distribution of electric field for the wavelengths under consideration. MoOx was found to be a suitable hole transport layer substitute to the PEDOT:PSS by a previously reported study by Bohao et al. [14]. MoOx was also found to have good optical spacer properties in our simulations and so it was used as the other optical spacer layer.

Methodology
The simulation was done in perpendicular illumination onto the solar cell as done for device simulations. This method does not simulate the real outdoor operation of the solar cell, and thus, the optimized thickness values calculated in this article would not be applicable in the view of energy yield optimization. However, our study was a comparison of the algorithms, and our conclusion should be consistent.The solar cell layers were stacked along the y-axis in the FDTD software. The incident light was set up as a plane wave with the spectral intensity of AM1.5G. The plane wave's propagation direction was the same axis along which the solar cell's layers were stacked. It was incident through the ITO electrode. Periodic boundaries were set along the x-axis and perfectly matched layers were used along the y-axis to set the FDTD boundary conditions. The device was meshed good enough for the results to converge. Further simulation setup details are published elsewhere [11,12]. To simulate the ideal J sc , 100% internal quantum efficiency was assumed.  Figure 1. Solar cell device structure. The electron transport layer is ZnO, while the hole transport layer is MoOx. Both also act as optical spacer layers as they affect the distribution of light inside the device. We optimized these optical spacer layers for maximizing photon absorption inside the active layer of the solar cell.

Brute Force
Using the software's parameter sweep option, we simulated our device structure according to three sections. The first section optimized only the ZnO layer, while keeping the MoOx layer at 10 nm thickness. The second simulation section consists of optimizing only the MoOx layer, while the ZnO layer was fixed at 30 nm. Our final section optimized both optical spacer layers together. The results of the brute-force method are provided in Figure 2. Using parameter sweep to simulate every possible combination is time-consuming. Figure 2 contains multiple local maxima and minima points. This makes it tedious to extrapolate the optimal thickness from fewer simulation points. Due to this, every possible simulation point is required to find the optical result. This way of obtaining the optimal result is termed as brute-force method henceforth. In order to make a 2-layer optimization problem similar to that of the single-layer optimization, we replaced the optical spacers' thickness combinations with a label in Figure 2d, effectively converting 3D data to a 2D data. The label number is given by label number = max(ZnO thickness) × MoOx thickness + MoOx thickness + 1.

Genetic Algorithm
To alleviate the computational and time inefficiencies of the brute-force method, we found inspiration in Darwin's natural selection theory and proposed the use of a genetic algorithm [3] for our optimization problem. Consider that there is a random population and their adaptability to the environment is given by a fitness function. In our optimization problem, the fitness function was to maximize J sc output from the FDTD simulation. Each population contains several individual chromosomes, which in turn consists of an array of bits called genes. Different selection methods are used to choose certain chromosomes in each generation (see Section 2.2.1) in order to reproduce off-springs using a crossover method (see Section 2.2.2). To further mimic biology, there is also a probability that a chromosome might suffer mutation, which is provided by the mutation rate, which allows the algorithm to escape local minima in the data. In the end, the fittest members of the population prevail, meaning that the algorithm converges to the optimal solution.
A step-by-step of the works of the genetic algorithm is shown in Algorithm 1. The initial population pop of size p is randomly selected from the search space, which in our case is the maximum and minimum thickness of the optical spacer layers. The first iteration of the algorithm then starts. For each population value, the GA calls the FDTD software to simulate and extract the J sc result. The fitness function (J sc ) is applied to all individuals in the population and ranked from the highest J sc to the lowest. A selection method is then applied taking into consideration each chromosome and their respective fitness score. After selecting the parents responsible for the next generation, they reproduce to obtain the next generation, a step detailed in Algorithm 2. Please note that in our algorithm, the fittest individual in the current generation is cloned to be part of the next generation. The current generation is then updated with the next generation, with the algorithm continuing until the maximum number of generations has been reached.

Algorithm 1: Genetic Algorithm
Data: max_generation, population_size (p), mutation_prob, search_space (range of population) Result: Best individual and fitness value (optimal solution) pop ← random initial population of size p from search_space; Save pop_sorted and f itness_score_sorted in .mat; As for the reproduction algorithm, detailed in Algorithm 2, the first step is to allocate an empty array for the new population. The second step is to select two parents to produce C children. Due to the crossover method used and mutation ratio, the same parents can reproduce different children. The new population is then updated with the new children obtained through crossover and mutation. Four selection methods were examined in this work: random, tournament, roulette wheel, and breeder. For better clarity of the following explanations, the fittest individual means the individual with highest fitness score, since our problem is a maximization problem.

Random
This is the simplest selection method since it does not incorporate selection criteria. This method consists of randomly selecting individuals to be the next generation's parents, with no regards to the fitness function. Because of this Monte-Carlo-like approach, it can take very long for the algorithm to converge.

Tournament
Tournament Selection [15] samples k individuals with replacement from a population of p and applies the fitness function to those individuals in order to select the one with best fitness score, also known as the fittest individual. One can think of this method as a battle of the fittest, where k individuals face each other in tournament fashion to decide the fittest. The fittest individuals from each tournament round will then constitute the parents responsible for forming the next generation.

Roulette Wheel
Roulette-Wheel Selection (RWS) [16] is a popular way of parent selection in which individuals have a fitness-proportionate probability of being selected. In that way, if an individual is very fit, it has a higher chance of being chosen, otherwise their chance is lower.

Breeder
Breeder Selection [17] follows the same strategy used for breeding animals and plants, where the goal is to preserve certain desired properties from the parents in their children. This is achieved by conserving the genetic material from the fittest individuals while still giving some mutation leeway by adding a few random individuals (lucky few) to the mix of parents for the next generation.

Crossover
Crossover is the reproduction method in genetic algorithms, and it consists of choosing the parts of each parent that will be present in their child.

Uniform
A uniform crossover is shown in Figure 3. In this type of crossover, each bit is chosen from one of the parents with probability of 0.5. The advantage of this method is that the same parents can form many children with a more diverse set of genes.

k-Point
In a k-point crossover, each parent is divided into k segments. These segments are then chosen with equal probability to compose the new chromosomes for their children. This crossover, shown in Figure 4, can be a one-point crossover (k = 1), or a multi-point crossover (1 < k < N C , where N C is the length of a chromosome). The disadvantage of the one-point crossover is that it is only able to generate two distinct children.

Mutation
This genetic operator is used to ensure genetic diversity within a group of individuals and to ensure the algorithm does not converge to a local minimum. The mutation operator works by flipping bits in a chromosome according to a mutation probability, as shown in Figure 5.

Complexity Analysis
In this section, we aim to further explain our algorithm's suitability with respect to its complexity. In brute force, the total simulation count increases with respect to the solar cell's layers which are thickness-optimized, as shown previously in Equation (1). In Big-O notation, which represents the upper bound for time complexity in an algorithm, the brute-force method has algorithmic complexity as in Equation (2): where l is the number of layers and n is the number of fitness function evaluations for a layer. In other words, the complexity increases exponentially with the number of layers, and that can be very expensive as that number grows.
Our goal is to efficiently optimize layer thickness in devices composed of a single layer and multiple layers alike. Hence, we used genetic algorithm for our global optimization requirement. GA can converge to an optimal solution by evaluating less individuals than the brute-force method. However, in the classical approach, the same individual might be evaluated multiple times. To prevent this redundancy from happening, we implement GA with dynamic programming. In this approach, there is a dynamic dictionary, also called lookup table, which serves as memory to store the already evaluated individuals and their respective fitness scores. The dictionary is said to be dynamic because it may change size if the algorithm receives an individual whose fitness score has not been calculated yet. This approach is illustrated with an example in Figure 6, where in every generation, or iteration, the algorithm searches the memory for a desired individual. If this individual has already been computed, its fitness score can simply be used by the algorithm. Otherwise, the fitness function is evaluated, and the lookup table is updated.

Results and Discussion
Since GA is a stochastic algorithm, we calculated the average number of simulations required by the GA and its standard deviation from 5000 repeated runs per section. The accuracy of the data discussed below are all 100%, which means that all the 5000 runs converged to the optimal solution. We have discussed three sections below: single layer-ZnO thickness optimization; single layer-MoOx thickness optimization; and multiple layers-concurrent ZnO and MoOx thickness optimization.

ZnO Optical Spacer Layer
For the single ZnO optical spacer layer optimization, we fixed the MoOx layer thickness as 10 nm. We applied the brute force and the genetic algorithm to our task and solved it within the same thickness limits of 0 to 80 nm. The best J sc , which is also the fitness value, was obtained when the ZnO thickness was optimized to 30 nm (as shown in Figure 2a). We have compared the total number of simulations and their respective accuracies for different selection methods. The initial population size, generations count, and mutation probability were the factors that were iterated in order to find the conditions that would use the least number of simulations to optimize the device structure. The population size was varied from 10 to 80 in increments of 10, the generation count from 10 to 100 in increments of 10, and the mutation probability from 5 to 100 in increments of 5. While the brute-force method required 81 simulations in total, the number of simulations required by the genetic algorithm was dependent on the selection method and initialization parameters used. The initialization parameters which provided the least average number of simulations from the 5000 simulations, while keeping the accuracy at 100%, is provided in Table 1.   Figure 7 presents the accuracy distribution over different initialization parameters. It was observed that the best result was obtained while using tournament selection model with the population size of 70, generation count of 30, and mutation probability of 60%. It required 78.16 ± 1.65 simulations to reach the optimal solution. Although the GA algorithm was observed to produce only a reduction of 2.26 ± 2.04% in the number of simulations required, this was mainly due to two optimal result points in the data. Since the device with a 24 nm ZnO layer thickness exhibited a J sc of 116.62 A/m 2 and the one with the optimal 30 nm ZnO layer thickness exhibited a near same J sc of 116.67 A/m 2 , the algorithm took longer to converge at the optimal structure. In a practical scenario, however, if both the above-mentioned structures were regarded as optimal, the algorithm would converge with high accuracy with much lesser number of simulations.

MoOx Optical Spacer Layer
For the MoOx optical spacer single-layer optimization, the ZnO thickness was fixed at 30 nm. The brute-force method required 31 simulations to determine the optimized layer thickness of 8 nm (Figure 2b). For finding the best initialization parameter combination, we varied the population size from 5 to 20 in increments of 5, the generation count from 10 to 100 in increments of 10, and the mutation probability from 5 to 100 in increments of 5. The best case results for each selection model is provided in Table 2. It was observed that while the roulette method was able to use 57.9 ± 10.45% fewer simulations to determine the optimal MoOx thickness, the other methods required nearly the same number of simulations as the brute-force method. We hypothesize that the roulette method's preferential weighing of the fittest model aided in the convergence to the optimal solution faster. Figure 8 presents the accuracy distribution for the optimum initializing parameter values.

Multi-Layer: ZnO + MoOx
As mentioned earlier, multi-layer optimization can take a large number of simulations. The computational and time cost required to run these simulations are expensive. GA can be used to refine the optimization process to take as less simulations as required. The ZnO layer thickness was incremented by 1 nm from 0 to 80 nm, while the same thickness increment was done from 0 to 30 nm for the MoOx layer. The brute-force method used 2511 simulations to find the optimized optical spacer layer thicknesses of 24 nm ZnO and 8 nm MoOx. We converted the 3D Figure 2c to a 2D Figure 2d by applying labels for each ZnO and MoOx thickness combination. Thus, we have 2511 labels and the GA algorithm was applied to determine the label pointing to the optimal result. The population size that was varied from 500 to 1500 in increments of 500, the generation count from 10 to 100 in increments of 10, and the mutation probability from 10 to 100 in increments of 10. Table 3 presents the result from multi-layer optimization.  Figure 9 presents a 29.96 ± 1.58% reduction in the number of simulations required by the roulette selection method to obtain the optimal solution. As the complexity became higher, having more randomness in the population through a high mutation probability rate aided constructively to reduce the number of simulations required. Due to this, the roulette selection method was able to show a best average number of simulation count of 1758.77 ± 39.75 from 5000 repetitive runs.

Performance Comparison: Uniform vs K-Point Crossover Methods
The roulette method demonstrates satisfactory performance in the ZnO layer thickness optimization problem and the best performances for both MoOx and multi-layer thickness optimization problems. These results are obtained using the uniform crossover genetic operator, whereas performances with the k-point crossover method remain uncharted. This section aims to fill that gap and provide a performance comparison between uniform and k-point crossover methods. We use k values of 1, 2, and 4 for our k-point crossover method. Table 4 shows the average number of simulations required to solve the optimization problem when using uniform versus when using k-point crossover. It also compares the result obtained through the various crossover methods to the chromosome's binary bit size. In the MoOx case with k = 1 and bits = 12, the chromosome is divided into segments of 6 bits. Since the maximum number of bits required to define the MoOx layer thicknesses is 5 bits, one of the parents does not pass on its chromosome to the child. Due to this, there is no genetic variation between the parents and children, essentially meaning that the children are copies of one parent, hence the solution did not converge. We also observed that in most cases using k-point crossover, the best results were obtained when the chromosome was segmented into segments of 4 bits in length. The exception to this were the MoOx case with 5-bit chromosomes and the ZnO case with 12-bit chromosomes. Uniform crossover and 4-point crossover proved better in these cases, respectively. We hypothesize that the poorer performance at other k-point values was linked to the amount of variation in the chromosome. Lower k-point values meant fewer segmentations in the parent chromosome, which in turn meant fewer genetic variations occurred, leading to a slower convergence of the result. However, at the same time, higher k-point value meant high genetic variation which also lead to slower convergence. The best initialization parameters for the optimization problems discussed in this article are tabulated in Table 5.

Conclusions
We have demonstrated that the genetic algorithm can perform better than the conventional parameter sweep used in simulations. In our best-case scenario, it exhibited no loss in accuracy, while outperforming the brute-force method by up to 57.9% with the correct initialization parameters. In the worst-case scenario, the GA utilized the same number of simulations as the brute-force method, demonstrating that it cannot be outperformed by brute force. We found that the best selection method was the roulette-wheel selection. For uniform crossover method, it exhibited a satisfactory performance for ZnO layer optimization and an outstanding performance for the MoOx and 2-layer optimization problems. When using k-point crossover, the roulette method was able to further decrease the number of simulations required to converge to the optimal result. In conclusion, we were able to reduce the average number of simulations required for MoOx layer optimization to 12.14 (brute force = 31), ZnO layer optimization to 70.76 (brute force = 81), and ZnO-MoOx layers optimization to 1140.06 (brute force = 2511). The GA is dependent on its initialization parameters and the selection method chosen. This article does not discuss an automated way to assign these parameters as it is not in its research scope. However, the results suggest that there is possibility for greatly refining the parameter sweep method using genetic algorithms as shown with both single and multi-layer optimization of the solar cell structure. Code and additional results are at https://github.com/gcunhase/GeneticAlgorithm-SolarCells.