In this work, a new method to solve the Reynolds equation including mass-conserving cavitation by using the physics informed neural networks (PINNs) is proposed. The complementarity relationship between the pressure and the void fraction is used. There are several difficulties in problem solving, and the solutions are provided. Firstly, the difficulty for considering the pressure inequality constraint by PINNs is solved by transferring it into one equality constraint without introducing error. While the void fraction inequality constraint is considered by using the hard constraint with the max-min function. Secondly, to avoid the fluctuation of the boundary value problems, the hard constraint method is also utilized to apply the boundary pressure values and the corresponding functions are provided. Lastly, for avoiding the trivial solution the limitation for the mean value of the void fraction is applied. The results are validated against existing data, and both the incompressible and compressible lubricant are considered. Good agreement can be found for both the domain and domain boundaries.