In recent years, due to the great potential of genetic algorithms to solve complex optimization problems, it has attracted wide attention. But the traditional genetic algorithm still has some shortcomings. In this paper, a new adaptive genetic algorithm (NAGA) is proposed to overcome the disadvantages of the traditional genetic algorithm (GA). GA algorithm is easy to fall into the local optimal solution and converges slowly in the process of function optimization. NAGA algorithm takes into accounts the diversity of the population fitness, the crossover probability and mutation probability of the nonlinear adaptive genetic algorithm. In order to speed up the optimization efficiency, the introduced selection operator is combined with the optimal and worst preserving strategies in the selection operator. And in order to keep the population size constant during the genetic operation, the strategy of preserving the parents is proposed. Compared with the classical genetic algorithm GA and IAGA, the improved genetic algorithm is easier to get rid of the extremum and find a better solution in solving the multi-peak function problem, and the convergence rate is faster. Therefore, the improved genetic algorithm is beneficial for function optimization and other optimization problems.