# Optimization of Ship Permanent Magnet Synchronous Motor ADRC Based on Improved QPSO
## 4 Parameter Tuning of ADRC Using the QPSO Algorithm
### Parameter Tuning  
In the practical application of the Quantum-behaved Particle Swarm Optimization (QPSO) algorithm, the search space and solution space of the problem are two distinct spaces with different properties. The state of a particle in the quantum search space is described by its position wave function, but the wave function does not provide definitive information about the particle's exact location. However, precise information about the particle's position is crucial for evaluating its fitness. Therefore, a transformation between these two spaces becomes a necessary requirement. In quantum mechanics, the transition from quantum states to classical states is known as wave function collapse, a process that essentially involves the measurement of the particle's position. Due to the Heisenberg uncertainty principle, in quantum space, the particle's velocity and position cannot be simultaneously measured with high precision, which makes the particle's exact position uncertain. Therefore, in order to observe and evaluate the particle, it must be collapsed to a classical state. This transition is not only a fundamental concept in quantum mechanics but also an important mechanism for the effective operation of the QPSO algorithm. Through this classicalization process, the algorithm can more accurately evaluate the fitness of particles, thus advancing the optimization process of the problem's solution. This paper employs the Monte Carlo method to describe the position of the particle. The Monte Carlo method is a stochastic simulation technique that can implement the measurement process on a computer, allowing the position of quantum particles to be measured. The evolution equation governing the position of a particle moving in a one-dimensional potential well, with a point as the center, is as follows:  
\[x=p\pm\frac{L}{2}ln(1/u), \tag{21}\]  
In this context, \(L\) represents the characteristic length of the potential well, which corresponds to the particle's search radius, and \(u\) is a random number between (0, 1). The characteristic length is a critical parameter in the position evolution equation, and selecting its value appropriately is one of the key challenges in defining the potential well. Since the characteristic length determines the particle's search radius, its size directly influences the coverage of the search space. A larger characteristic length increases the particle's search range, but an excessively large value can reduce the algorithm's convergence rate. On the other hand, if the characteristic length is too small, the search range decreases, potentially preventing the algorithm from exploring the solution space thoroughly, thereby affecting the accuracy of convergence and limiting the particle's ability to adequately search within the feasible solution set. Therefore, choosing an appropriate characteristic length is critical, requiring a balance between the search range and convergence rate. To address this issue, this paper introduces the average of the best positions of all individual particles, i.e., the average best position, as follows:  
\[mbest^{k}=\frac{1}{N}\sum_{i=1}^{N}p_{i}^{k}, \tag{22}\]  
Therefore, the formula for the characteristic length is given by:  
\[L=2\beta\cdot\left|mbest^{k}-x_{i}^{k}\right|, \tag{23}\]  
Therefore, the particle update equation is given by:  
\[x_{i}^{k+1}=p_{i}^{k}\pm\beta\cdot\left|mbest^{k}-x_{i}^{k}\right|\cdot ln(1/u), \tag{24}\]  
where \(\beta\) represents the contraction-expansion factor, which controls the particle's convergence speed. QPSO directly updates the particle's position based on the quantum behavior model, without the need for explicit velocity. The logarithmic term \(ln(1/u)\) introduces a nonlinear stochastic distribution. Specifically, when the value of \(u\) is close to 1, the logarithmic value is small, resulting in a smaller update to the particle's position. Conversely, when \(u\) approaches 0, the logarithmic value increases, leading to a larger update.