A Tutorial on Optimization for Multi-Agent Systems