A computer-based method of optimization of at least one treatment plan involving at least a first and a second radiation set, where the first radiation set is to be delivered to a first patient and the second radiation set is to be delivered to the first patient or to a second patient, the first and second radiation set requiring a first and a second set of resources, respectively, wherein the optimization is performed using an optimization problem comprising an optimization function related to the first and second sets of resources, wherein the optimization problem is designed to optimize the allocation of resources between at least two patients.