Multi-agent hybrid social cognitive optimization (MAHSCO) based on the Internet of Things (IoT) is suggested to solve the problem of the generation of formations of unmanned vehicles. Through the analysis of the unmanned vehicle formation problem, formation principles, formation scale, unmanned vehicle formation safety distance, and formation evaluation indicators are taken into consideration. The application of the IoT enables the optimization of distributed computing. To ensure the reliability of the formation algorithm, the convergence of MAHSCO has been proved. Finally, computer simulation and actual unmanned aerial vehicle (UAV) formation generation flight generating four typical formations are carried out. The result of the actual UAV formation generation flight is consistent with the simulation experiment, and the algorithm performs well. The MAHSCO algorithm based on the IoT is proved to be able to generate formations that meet the mission requirements quickly and accurately.