Control and collective intelligence of multi-agent system