Size matters: Optimal management of dynamic systems with varying size