Alternating Optimization: Constrained Problems, Adversarial Networks, and Robust Models