Distributed optimization of multi-agent systems: Framework, local optimizer, and applications