Finite-time consensus of multiagent systems with a switching protocol