Perovskite/crystalline-silicon (c-Si) tandem solar cells offer a viable roadmap for reaching power conversion efficiencies beyond 30%. In this configuration, however, the silicon cell now mainly receives an infrared rich illumination spectrum where the absorption coefficient of silicon is poor. To boost the light absorption in this wavelength interval, transmitted through the top cell, a solution is to introduce a dedicated nanoscale texture on the front side of the silicon bottom cell and tweaking the optical elements in its design. These optical elements are manifold, with tunable geometrical dimensions, layer thicknesses, and refractive indices. For optically optimizing nanostructured silicon solar cells, electromagnetic wave solving methods, such as the rigorous coupled-wave analysis (RCWA), are normally used but they become computationally infeasible when several design variables are involved in an optimization problem. In this work, a natural selection algorithm, known as the genetic algorithm, is coupled with RCWA for extracting the optimal values of various design parameters in four-terminal perovskite/c-Si tandem devices in parallel. Both two-side-contacted and interdigitated back-contacted silicon heterojunction cell structures, featuring an inverse nanopyramid grating texture on the front, are optimized for five interdependent variables using a genetic algorithm for the bottom cell application and benchmarked against their random pyramid textured analogs. Our study shows that an optimized inverse nanopyramid grating texture can outperform the standard random pyramid texture when considering incidence angle variations. More importantly, the study illustrates how a genetic algorithm can support modeling complex solar cell structures with numerous degrees of freedom.