# Research on Application of Improved Quantum Optimization Algorithm in Path Planning
## 2 Bloch Sphere Quantum Genetic Algorithm
### Solution Space Transformation and Coordinate Fitting  
Then, apply solution space transformation and coordinate fitting to the chromosomes encoded with Bloch coordinates. Each chromosome within the population comprises 3n Bloch coordinates, representing n quantum bits [32]. Through linear transformation, these 3n coordinates can be mapped onto the solution space of the optimization problem, with each coordinate corresponding to an optimization variable within the solution space [33,34]. Let the corresponding solution space transformation formula of the \(j\) quantum bit on the \(i\) chromosome \(p_{i}\) be  
\[ \begin{cases}X_{ix}^{j}=\frac{1}{2}\left[b_{j}\big{(}1+x_{ij}\big{)}+a_{j} \big{(}1-x_{ij}\big{)}\right]\\ X_{iy}^{j}=\frac{1}{2}\left[b_{j}\big{(}1+y_{ij}\big{)}+a_{j}\big{(}1-y_{ij} \big{)}\right],\\ X_{iz}^{j}=\frac{1}{2}\left[b_{j}\big{(}1+z_{ij}\big{)}+a_{j}\big{(}1-z_{ij} \big{)}\right]\end{cases} , \tag{5}\]  
where \(i=1,2,\cdots,m\) and \(j=1,2,\cdots n\). \(m\) is the population size and \(n\) is the number of qubits. Least squares space fitting is introduced to seek the best function, which is matched for the data. The least squares criterion is a tool that has been widely used in disciplines such as uncertainty prediction [35]. Least-squares fitting is used in fitting linear equations to points in three-dimensional space, and can provide insight into the trend of variation between points, predict future changes in points, and ultimately enable the optimal solution to be determined. Assuming that there are \(n\) data points that need to be fitted, \((x_{1},y_{1},z_{1}),\cdots,(x_{i},y_{i},z_{i})\). It can be obtained from the two plane equations as shown in (6). \[Ax+By+Cz+D=0(C\
eq 0), \tag{6}\]  
Then it can be deduced that  
\[z=-\frac{A}{C}x-\frac{B}{C}y-\frac{D}{C}, \tag{7}\]  
marked as \(a=-\frac{A}{C}\), \(b=-\frac{B}{C}\), \(c=-\frac{D}{C}\), and \(z=ax+by+c\). The standard equation is  
\[\frac{x-x_{0}}{X}=\frac{y-y_{0}}{Y}=\frac{z-z_{0}}{Z}, \tag{8}\]  
So the spatial straight line can be obtained from the intersection of the two planes above, and it van be fitted to fit the equations of these two planes. The least-squares principle is as follows. \[M=\sum_{i=1}^{n}(ax_{i}+by_{i}+c-z)^{2}, \tag{9}\]The partial derivative of (9) can be obtained, that is, the model parameters obtained by the least squares fitting. \[ \begin{cases}\sum 2(ax_{i}+by_{i}+c-z)x_{i}=0\\ \sum 2(ax_{i}+by_{i}+c-z)y_{i}=0\,,\\ \sum 2(ax_{i}+by_{i}+c-z)=0\end{cases}  \tag{10}\]  
Formula (10) can be derived. \[ \begin{cases}a\sum x_{i}{}^{2}+b\sum x_{i}y_{i}+c\sum x_{i}=\sum x_{i}z_{i}\\ a\sum x_{i}y_{i}+b\sum y_{i}{}^{2}+c\sum y_{i}=\sum y_{i}z_{i}\,,\\ a\sum x_{i}+b\sum y_{i}+n=\sum z_{i}\end{cases}  \tag{11}\]  
\[ \begin{bmatrix}\sum x_{i}{}^{2}&\sum x_{i}y_{i}&\sum x_{i}\\ \sum x_{i}y_{i}&\sum y_{i}{}^{2}&\sum y_{i}\\ \sum x_{i}&\sum y_{i}{}^{2}&n\end{bmatrix}\begin{bmatrix}a\\ b\\ c\end{bmatrix} = \begin{bmatrix}\sum x_{i}z_{i}\\ \sum y_{i}z_{i}\\ \sum z_{i}\end{bmatrix} , \tag{12}\]  
Solutions include  
\[ \begin{cases}a=\frac{n\sum x_{i}z_{i}-\sum x_{i}\sum z_{i}}{n\sum x_{i}^{2}- \sum x_{i}\sum x_{i}}-b\frac{n\sum x_{i}y_{i}-\sum y_{i}\sum x_{i}}{n\sum x_{i} ^{2}-\sum x_{i}\sum x_{i}}\\ b=\frac{(n\sum y_{i}z_{i}-\sum y_{i}\sum z_{i})(n\sum x_{i}^{2}-\sum x_{i}\sum x _{i})-(n\sum x_{i}^{2}-\sum x_{i}\sum x_{i})(n\sum x_{i}y_{i}-\sum x_{i}\sum y _{i})}{(n\sum y_{i}^{2}-\sum y_{i}\sum y_{i})(n\sum x_{i}^{2}-\sum x_{i}\sum x _{i})-(n\sum x_{i}y_{i}-\sum x_{i}\sum y_{i})(n\sum x_{i}y_{i}-\sum x_{i}\sum y _{i})}{(n\sum y_{i}^{2}-\sum y_{i}\sum y_{i})(n\sum x_{i}^{2}-\sum x_{i}\sum x _{i})-(n\sum x_{i}y_{i}-\sum x_{i}\sum y_{i})(n\sum x_{i}y_{i}-\sum x_{i} \sum y_{i})}\,,\\ c=\frac{\sum z_{i}-a\sum x_{i}-b\sum y_{i}}{n}\end{cases}  \tag{13}\]  
We can substitute the obtained result into (7) to get:  
\[