Deep reinforcement learning combined with transformer to solve the traveling salesman problem
摘要
The Transformer model is widely employed to address the traveling salesman problem due to its robust global information acquisition, learning, and generalization capabilities. However, its high computational complexity and limited accuracy require further refinement. To overcome these shortcomings, a novel model is proposed, integrating a lightweight CNN embedding layer with a Transformer model enhanced by an efficient Pyramid Compressed Attention (PSA) mechanism. The introduction of the lightweight CNN embedding layer significantly reduces the number of parameters and computational complexity, allowing for the flexible extraction of local spatial features between neighboring nodes, while maintaining the ability to handle larger-scale datasets. The PSA mechanism, on one hand, improves solution accuracy by accounting for both local neighborhood relations and global dependencies. On the other hand, its multi-scale nature enables the model to adapt to problems of varying scales, ensuring strong performance for both small- and large-scale problems. Extensive experiments conducted on random datasets as well as the public TSPLIB dataset have demonstrated that the proposed model surpasses other deep reinforcement learning algorithms in terms of solution quality and generalization ability.