A Flexible Algorithm for Task Ordering