Travelling safely and comfortably on high speed railway lines requires excellent conditions of the whole railway infrastructure in general and of the railway track geometry in particular. The maintenance process required to achieve such excellent conditions is largely complex and expensive, demanding an increased amount of both human and technical resources. In this framework, an optimal scheduling of maintenance interventions is an issue of increased relevance. In this work a method for optimization of the tamping scheduling is presented. It is based on a heuristic algorithm, which finds a very detailed tamping schedule where each planned intervention is fully specified. The algorithm tries to maximize an objective function, which is a quantitative expression of the maintenance process's objectives defined by the railway company. It first finds an upper bound for the objective function value, and then returns the best feasible solution found. The method is validated by means of a case study based on real data of the 240 km track of a French high speed TGV line. The results presented show that the value of the best solution found is very near to the upper bound (the difference is smaller than 1%), with a calculation time of under 1 second using a standard computer, so we think the heuristic has a great performance potential.