Trajectory Optimization and Design for a Large Number of Unmanned Aerial Vehicles