Online Optimization of Smoothed Piecewise Constant Functions