# Quantum-Based Analytical Techniques on the Tackling of Well Placement Optimization
## 3 Methodology
### Quantum Particle Swarm Optimization Algorithm  
In 1995, a novel search approach was developed and proposed by [PERSON] and [PERSON] [43], which is known as PSO and was stochastic. In a search space, the particles of PSO can fly and change their position with respect to time. At first, the initialization of individuals is done through a random process. To update the velocity of each particle, the following equation is utilized  
\[V_{i}^{k+1}=wV_{i}^{k}+c_{1}rand_{1}\Big{(}pbest_{i}^{k}-x_{i}^{k}\Big{)}+c_{2 }rand_{2}\Big{(}gbest^{k}-x_{i}^{k}\Big{)}, \tag{12}\]  
Figure 1: A general flow chart for searching the maximum net present value. where the individual \(i\) particles velocity is denoted by \(V_{i}\) for iteration \(k\). For defining a particle's acceleration, \(c_{1}\) and \(c_{2}\) are introduced as acceleration constant, \(w\) is used for weight vector, \(rand_{1}\) and \(rand_{2}\) are the random number ranging from 0 to 1, for individual \(i\) position is represented by \(x_{i}^{k}\) in iteration \(k\), \(pbest_{i}^{k}\) and \(gbest^{k}\) denotes the best position and global best of individual \(i\) in \(k\) iteration. In the search space, by using the following equation, each particle's next position will be updated:  
\[x_{i}^{k+1}=V_{i}^{k+1}+x_{i}^{k}. \tag{13}\]  
[PERSON] et al. [44] implemented the principle of quantum mechanics with basic PSO. The QPSO algorithm not only tackles the drawbacks but also preserves the good features of the PSO algorithm [45], and thus the incorporation of improved search capability in addition to fast convergence is possible [46]. Another feature of QPSO is that it has only one parameter that needs to be tuned. The flowchart of QPSO is depicted in Figure 2. Figure 2 shows that at first the positions are randomly generated. Then, the cost function is calculated for each particle. Based on the results, _mbest_ and _gbest_ are updated. The search process will continue unless the termination criteria are met. Unlike the behavior of the Newtonian particle that is described by both the position (\(\overrightarrow{x}\)) and velocity (\(\overrightarrow{v}\)) in traditional PSO, in case of QPSO to define the quantum state of a particle, the aid of wave function \(\Psi(\overrightarrow{x},s)\) will be taken. By expanding the wave function in the three-dimensional space, we can get,  
\[\big{|}\Psi\big{|}_{2}dxdydz=Rdxdydz. \tag{14}\]  
where \(Rdxdydz\) is a probabilistic measure indicating the appearance of that particle at specific time \(s\) at \((x,y,z)\) point. It should be noted that the square of the wave function (\(|\Psi|^{2}\)) is the probability density of the particle at that specific point satisfying the following expression:  
\[\int_{-\infty}^{\infty}|\Psi|^{2}dxdydz=\int_{-\infty}^{\infty}Rdxdydz=1. \tag{15}\]  
Figure 2: Flowchart of quantum particle swarm optimization (QPSO). Time variant 3D wave function \(\Psi(\overrightarrow{x},s)\), which can be interpreted by (14) or (15), satisfies the following time-dependent Schrodinger equation [47]:  
\[i\hbar\frac{\partial}{\partial t}\Psi\Big{(}\overrightarrow{x},s\Big{)}=\hat{ \hbar}\Psi\Big{(}\overrightarrow{x},s\Big{)}. \tag{16}\]  
In this case, \(\hbar\) and \(\hat{\hbar}\) represents constant of Planck and Hamiltonian operator, respectively. Considering the particle in a potential field \(\mathbf{V}\) with mass V(s) we can write:  
\[\hat{\hbar}=-\frac{\hbar^{2}}{2m}\
abla^{2}+V(x) \tag{17}\]  
Assuming each particle as QPSO, Sun and associates [47] treat the particle with no spin in \(D\) dimensional Hilbert space with a given energy. Hence, their states can be characterized by the wave function. Now for \(D\) dimensional quantum space having a population that consists of \(k\) particles, \(i\)th particle's location can be defined by \(X_{i}=(x_{i1},\,x_{i2},\,\ldots,\,x_{iD})\). For the \(i\)th particle, the best solution's position in previous step, i.e., _pbest_ could be denoted by \(Qi=(Q_{i1},\,Q_{i2},\,\ldots,\,Q_{iD})\).