A Gentle Introduction to Gradient-Based Optimization and Variational Inequalities for Machine Learning