Optimization methodologies are being utilized in various structural designing practices to solve size, shape and topology optimization problems. A heuristic Particle swarm optimization (HPSO) algorithm was anticipated in this article in order to address the size optimization problem of truss with stress and displacement constraints. This article contributes in improvisation in the truss structure design rationality while reducing the engineering cost by proposing the HPSO approach. Primarily, the basic principle of the original PSO algorithm is presented, then the compression factor is established to improve the PSO algorithm, and a reasonable parameter setting value is presented. To validate the performance of the proposed optimization approach, various experimental illustrations were performed. The results show that the convergence history of experimental illustration 2 and experimental illustration 3 is optimal. The experimental illustration 2 converges after about 150 iterations, however, the experimental illustration 3 is close to the optimal solution after about 500 iterations. Therefore, the PSO algorithm can successfully optimize the size design of truss structures, and the algorithm is also time e cient. The improved PSO algorithm has good convergence and stability, and can effectively optimize the size design of truss structures.