Optimality and flexibility in Iterative Learning Control for varying tasks. (May 2016)