The speed profile of the train will be determined according to criteria such as safety, travel convenience, and the type of electric motor used for traction. Due to the passengers and cargo on the train, the electric train load is constantly changing. This will require reassigning the speed controller’s parameters of the electric train. For this purpose, the Gravitational Search optimization Algorithm (GSA) will be used to minimize the error between the setpoint speed profile and the speed profile obtained from the speed controller by using the appropriate assignment of control parameters. This algorithm has a low computational cost and high accuracy, but tuning the adjustable parameters of this algorithm according to the decision space will increase its accuracy. Therefore, by using fuzzy logic Type-I and Type-II, and considering the diversity of population in decision space and generation of population, adjustable parameters of GSA such as 𝐾𝑏𝑒𝑠𝑡 and 𝛼 will be tuned. Finally, a dynamic model of the electric train between two traction power supply substations (TPS) and a proportional-integral-derivative (PID) controller will be simulated in MATLAB software to control the train speed. Then, the controller parameters will be assigned using the GSA algorithm.