With the recent boom in unmanned aerial vehicle (UAV) technology, many UAV applications involving complex and risky tasks in military and civilian fields have emerged, such as military strikes and disaster monitoring. Task allocation for UAVs is the process of planning the division of work among UAVs, controlled from ground stations by human operators. This study formulates the UAV task-allocation problem as an extended traveling salesman problem and presents a novel UAV task-allocation model for complex air concentration monitoring tasks. Then, an optimized non-dominated sorting genetic algorithm III (NSGA-III) based on a twin-exclusion mechanism, hierarchical objective-domination operator, and segmented gene encoding (i.e., NSGA-III-TEHOD) is developed to solve complex task-allocation problems involving multiple UAVs, hierarchical objectives, obstacles, and ambient wind. The algorithm is tested in several simulations, and the results demonstrate that the new algorithm outperforms NSGA-III, non-dominated sorting genetic algorithm II (NSGA-II), and genetic algorithm (GA) in terms of efficiency of global convergence and early maturation prevention and is available for the hierarchical objective-optimization problems.