This study presents application of genetic algorithm and particle swarm optimization techniques to estimate optimal weight of two truss structures, two-dimensional and three-dimensional truss, satisfying a constrained displacement and allowable stress. Constraints are mostly handled by using the concept of penalty functions. Two strategies of penalty functions, exterior penalty function strategy (EPFS) and self-organizing adaptive penalty strategy (SOAPS), are used in turn to combine with mass function to become objective function of optimization problems. This study proposes the comparison of efficiency and convenience between two penalty function strategies, EPFS and SOAPS, as well as the result of optimal weight for truss structure between genetic algorithm and particle swarm optimization.