In this paper, a physics-based method to inversely determine wheel—rail contact area in their lifecycle is proposed by introducing a continuous optimization pipeline including filtering and projection procedures. First, the element connectivity parameterization method is introduced to construct continuous objections with discrete contact pairs and formulate the physics-based optimization model. Second, the radius-based filter equation is employed for smoothing the design variables to improve the numerical stability and the differentiable step function is introduced to project smoothed design variables into 0–1 discrete integer space to ensure the solution of the optimization model yields discrete contact pairs. Finally, the method of moving asymptotes is constructed for iteratively updating wheel—rail contact area by analyzing the sensitivity of relaxed optimization formulation with respect to design variables until the algorithm converged. The experimental result shows the effectiveness of the proposed method to inversely determine the wheel—rail contact points in their lifecycle compared to the line tracing method; to the best of our knowledge, it is the first attempt to consider wheel—rail contact area in lifecycle service with both the measured profile and the predicted profile data by gradient-based optimization method.