The study of road traffic flow theory utilizes physics and applied mathematics to analyze relevant parameters and their relationships quanlitatively and quantitatively, in order to explore their dynamic changes. The fluid dynamics model used for traffic flow analysis is highly favored by scholars due to its solid mathematical foundation and good simulation results. However, existing models have two main shortcomings: firstly, existing research is mostly limited to non-viscoelastic fluid equation or incompressible non-Newtonian fluid equation, making it difficult to accurately describe the viscosity state and micro cluster properties of the actual traffic flow; secondly, the existing non-Newtonian fluid partial differential equations (PDEs) rely heavily on the finite element method (FEM) for solving, requiring higher computational cost, larger storage space, and more constraint conditions. Thus, in this paper, a traffic flow equation based on compressible non-Newtonian fluid has been constructed, and it has been solved by using physical-informed rational neural network (PIRNN) and noise heavy-ball acceleration gradient descent (NHAGD) to ensure learning and training speed and accuracy. Numerical results indicate that the proposed method can truly reflect the gradual change process in the viscosity of traffic flow, and has better solving performance than traditional FEM and physical-informed neural network (PINN) with activation functions; under the same conditions, the prediction error of the proposed method is also smaller than that of traditional traffic flow models.