An optimization technique for designing the steel space frame with T-stub semi-rigid connections and interaction between soil and structure is presented in this article. A three-parameter-based elastic foundation model is utilized to investigate soil-structure interactions (SSI). To enable two-way data transfer for all optimization methods, computer software was developed using C# version 17.8.6, which connects to SAP2000-OAPI version 22. Particle swarm optimization (PSO) and teaching-learning-based optimization (TLBO) are employed for optimal designs. These optimization techniques choose profile sections from a list, including 64W discrete sections from the American Institute of Steel Construction (AISC). The Load and Resistance Factor Design-American Institute of Steel Construction (LRFD-AISC) strength constraints, geometric constraints, inter-storey drift constraints, and displacement constraints are considered during optimization. The first phase entails creating optimal designs for two unique steel space frames that consider SSI but do not include T-stub semi-rigid connections. Following that, the same optimization procedures are carried out with T-stub semi-rigid connections. The parameters needed for the foundation model are obtained through soil surface displacements. Utilizing T-stub semi-rigid connections while considering the interaction between the structure and the soil produces increased structural weight.