Dynamic optimization with side information