Discrete and Continuous Optimization for Collaborative and Multi-task Learning