Learning to Optimize: From Theory to Practice