In recent years, indoor positioning has drawn intensive attention for both pedestrian and mobile robot applications. Among various indoor positioning technologies, visible light positioning has many advantages due to its high localization accuracy, high bandwidth, energy efficiency, long lifetime, and cost efficiency. For postprocessing or semi-real-time applications, researchers often use smoothers to improve location accuracy. However, smoothers are always local estimators and lack integrity when calculating locations. To globally optimize the positioning results and further improve the accuracy, we propose a nonlinear optimization model based on the idea of graph optimization. Innovatively, the model adds the acceleration as a constraint to become one part of the residuals and regularize the trajectory. We design a signal-to-noise ratio-based weighting strategy to suppress the outliers and better assess the errors. Moreover, we design a loop constraint to further improve the positioning accuracy. The experimental results show that our proposed model significantly improves the accuracy by 71%, which is suitable for indoor positioning.