Basic framework for task selection and part of average time calculation