Abstract:Genetic Algorithm (Genetic Algorithm) is a random investigation method simulating Darwin's biological evolution, and it is applied to the fields like combinatorial optimization, machine learning, signal processing, adaptive control and artificial life. However, the implementation process of genetic algorithm is very complicated and easily introduce error artificially, and influence the accuracy of research. for this problem, the key technology of implementing genetic algorithm based on GAlib(Genetic Algorithm Library)class library is discussed. Finally, genetic algorithm is implemented using GAlib and evaluate the algorithm by solving the traveling salesman problem(TSP), the results shows that the genetic algorithm implemented based on GAlib is easily programming, highly readable,and results are accurate.