Appointment scheduling with discrete random durations and applications