Coordination of Multiple Teams of Robots for an Optimal Global Plan