Automatic radiation therapy treatment planning for generating a plan to be delivered from at least one beam angle, using a collimator having a variable collimator angle. Delivery times are determined for a number of possible collimator angles, and the optimization problem is defined to take the delivery times into account when selecting the collimator angles to be used when delivering the radiation.