https://medium.com/@monocosmo77/how-optimal-control-problems-are-used-in-machine-learning-part1-7881c1542358