There are guidelines on gradient changes both in terms of the minimum and maximum RATE of change, as well as the minimum distance between gradient changes.
For example it is undesirable for a gradient to change more than once under a vehicle, for obvious reasons.
On heavy haul freight lines, the restriction on multiple gradient changes is principally that only one gradient change is permitted underneath the train, and this may only consist of a positive or negative gradient leading to a 0 gradient (level).
In one case that comes to mind, there is a prohibition placed on gradient changes taking place with 4 Km of each other, as this is the length of the train plus a slight margin !
The reason for this is so that the train is not compressed at one end whilst being stretched at the other end. So far it has not become a problem in the UK because of the (relatively) short length of our trains in comparison to both Europe and the Americas.
For obvious reasons these prohibitions impose considerable difficulties when track renewal is taking place, more especially when on Heavy Haul freight lines, Renewal time is measured in the hours between trains with little or no opportunity to work within an extended Possession.