Tamping is the most important maintenance task for ballasted tracks. As the scheduling process of tamping tasks is of great importance, in this work a methodology is developed to plan tamping tasks automatically and thereby optimise life cycle costs. Beside of the prediction of the next tamping measure, a model is developed to determine the track quality behaviour after a tamping task. This model allows for the specification of general tamping strategies as well as the calculation of an optimal intervention level in any specific situation. In a subsequent step, the algorithm 4tamping is generated that allows for the determination of reasonable section lengths for tamping. The basis for this is formed by the ideal point in time for an intervention in every single cross section. The application of 4tamping and the comparison with actually executed tasks show that it is possible to reduce life cycle costs by 20 % due to the optimised tamping schedule.