# Quantum Selection for Genetic Algorithms Applied to Electromagnetic Design Problems
## 2 Genetic Algorithm with Quantum Selection
The selected individual is added to the parent pool, and the population is re-sorted. A new individual is then added to replace the removed one, maintaining diversity. Unlike tournament selection, this process avoids duplicating individuals, which helps prevent stagnation. The QC used in QSO is shown in Figure 1. It is an amplitude amplification circuit of \(n\) qubits consisting of 4 sections [13]. Amplitude amplification is a quantum computing mechanism for enhancing the probability of measuring a desired outcome. In this case, the desired outcome is the quantum states related to the individuals with the best fitness, effectively weighting the selection towards them. Each one of the sections in the amplitude amplification plays a crucial part in the final outcome and can be seen as a step-by-step process. The first section is the preparation stage; it works by creating a uniform superposition of all the states in the quantum circuit. When all states are in uniform superposition, all have the same probability of being measured. The second step is performed by the oracle; it is a small QC that has the most important role. It marks the states that are to be amplified using a rotation. It works by checking all present states in parallel and applying a controlled rotation only to the states that are desired. In the case of the QC previously presented, the oracle is a multicontrolled X-gate. This gate applies a rotation of _pi_ on the X axis of its target qubit (the qubit with the white circle with the plus inside) when all its inputs (the qubits with the small black dots) are in the state \(|1\rangle\). Since all the states in the quantum circuit are in uniform superposition, what the oracle does in this case is not modify any state except for the state \(|1\cdots 1\rangle\) to which it applies the rotation. The status of the states after the oracle is that all have a positive amplitude but the state \(|1\cdots 1\rangle\), which has a negative one. However, all of them have the same absolute value. The  
Figure 1: Quantum circuit used for the quantum selection operator (QSO), where the preparation, oracle, Grover diffusion, and measurement stages are presented. The circuit is constructed to implement amplitude amplification, increasing the probability of selecting high-fitness individuals. third step is performed by the Grover diffusion operator (GDO); this is a complex quantum circuit, but its working principle is simple. It takes the mean value of the amplitudes of all the states and rotates them around it. In the case of the QC presented in the figure, the mean value of the amplitudes is positive. When all the states are rotated around it, the final outcome is that all states with positive amplitude suffer a decrease in their amplitudes' absolute value, while the state \(|1\cdots 1\rangle\) (the only one with negative amplitude) has its absolute value increased, resulting in the state \(|1\cdots 1\rangle\) having the highest amplitude's absolute value. The final step is the measurement, the measurement of a quantum circuit is stochastic in nature. The probability of measuring a state is given by the square of the absolute value of the state's amplitude. Taking into account the way in which the amplitudes of the states are after the GDO, it is easy to understand that the state \(|1\cdots 1\rangle\) (which is related to the best individual) is more expected to be measured, applying in this way a strong selection pressure on selecting the fittest individuals.