Optimal Iterative Learning Control