The invention discloses a method for solving the traveling salesman problem based on an improved genetic algorithm. The steps include: aiming at the TSP problem, encoding the path using a decimal number string; calculating the total length, and then judging the total length; after encoding On the search space U of the decimal number string path, define the fitness function f(x), and define the population size n, the crossover probability Pc, the mutation probability Pm and the number of iterations T; in the search space U, randomly generate n individuals s1, s2, s3, ..., sn, constitute the initial population S0 = {s1, s2, s3, ..., sn}, set the current iteration number t = 0; according to the fitness function f(x), evaluate the individual fitness in the population , if t<T, then end the step, otherwise perform the genetic operation step; the individual with the highest fitness obtained through the genetic operation step is the optimal solution of the traveling salesman problem solving method. Based on the traditional genetic algorithm, the present invention optimizes the traveling salesman problem to achieve the purpose of improving the shortcoming that the algorithm is prone to premature convergence and optimizing the search efficiency.