In the present paper, we propose an iterative algorithm for solving the generalized $(P,Q)$-reflexive solution of the quaternion matrix equation $overset{u}{underset{l=1}{sum}}A_{l}XB_{l}+overset{v} {underset{s=1}{sum}}C_{s}widetilde{X}D_{s}=F$. By this iterative algorithm, the solvability of the problem can be determined automatically. When the matrix equation is consistent over a generalized $(P,Q)$-reflexive matrix $X$, a generalized $(P,Q)$-reflexive solution can be obtained within finite iteration steps in the absence of roundoff errors, and the least Frobenius norm generalized $(P,Q)$-reflexive solution can be obtained by choosing an appropriate initial iterative matrix. Furthermore, the optimal approximate generalized $(P,Q)$-reflexive solution to a given matrix $X_{0}$ can be derived by finding the least Frobenius norm generalized $(P,Q)$-reflexive solution of a new corresponding quaternion matrix equation. Finally, two numerical examples are given to illustrate the efficiency of the proposed methods.