The paper focuses on an algorithm for controlling a group of unmanned gliding aircraft which are notable for the absence of a propulsion system. The flight is accomplished by using the full mechanical energy reserve received by the unmanned gliding aircraft at the time of the air launch. The task of a group flight with each gliding device being autonomous is currently relevant. Developing a group control algorithm and forming the trajectory of each unmanned gliding aircraft make it possible to solve a wide range of practical problems. This paper states the problem implying the maximization of the flight range with boundary conditions set at the ends of the trajectory. The trajectory of each of the group unmanned gliding aircraft is formed by specifying a reference function for each phase coordinate (xg, yg, zg). The flight range of the group is maximized as a result of solving a boundary value problem by the Ritz --- Galerkin method based on optimization of a function of several variables. In contrast to classical optimization methods, it allows solving the considered optimization problem with sufficient accuracy in a practical sense, without requiring large computational resources for its implementation. This method was used to optimize flight trajectories; however, in this work, it is applied with a number of significant differences both in terms of the problem statement and in terms of requirements for the dynamic capabilities of the aircraft