Algorithms for Variable-Size Optimization