The metal sheets play an important role in the mechanical design, particularly in the aerospace structures. The rivet connections are frequently used to connect these sheets. The riveting quality greatly influences the rupture of the rivet and the sheet. The various parameters affect the quality of this operation. In this paper, the optimization of the parameters contributing to the riveting quality in order to minimize the value of the maximum tangential stress in the sheets is addressed. To this end, the tolerance of the hole diameter in the top and the bottom sheets, the friction coefficient, and the tolerance of the rivet diameter and the rivet length were considered as the parameters influencing the riveting quality. A total of 64 models were obtained by the permutations of the parameters two at a time. The outputs were determined using the finite element method. The objective function for the optimization is the maximum tangential stress for which there is no analytical relation. Thus, three methods including the multivariable linear regression (MLR), the artificial neural network model of the radial basis function (RBF) type, and the hybrid model of the artificial neural network and the genetic algorithm (ANN-GA) were employed to model this function. Further, the performance of the three models was compared and the most suitable one was selected to model the objective function. The regression model was used to model the values of the height and the diameter after riveting. The imperialist competitive algorithm is utilized to solve this optimization problem. The obtained value for the maximum tangential stress using the imperialist competitive algorithm is 16368 pounds per square inches. After modification, this value increased to 23440 pounds per square inches using the finite element method. . The 0.07689 inches and 0.18524 inches were obtained for the height and diameter of the rivet after riveting, respectively.