Implemented the task selection algorithm (spams A* searches, is correct)