Complete absorption of electromagnetic waves is paramount in today's applications, ranging from photovoltaics to cross-talk prevention into sensitive devices. In this context, we use a genetic algorithm (GA) strategy to optimize absorption properties of periodic arrays of truncated square-based pyramids made of alternating stacks of metal/dielectric layers. We target ultra-broadband quasi-perfect absorption of normally incident electromagnetic radiations in the visible and near-infrared ranges (wavelength comprised between 420 and 1600 nm). We compare the results one can obtain by considering one, two or three stacks of either Ni, Ti, Al, Cr, Ag, Cu, Au or W for the metal, and poly(methyl methacrylate) (PMMA) for the dielectric. More than 1017 configurations of geometrical parameters are explored and reduced to a few optimal ones. This extensive study shows that Ni/PMMA, Ti/PMMA, Cr/PMMA and W/PMMA provide high-quality solutions with an integrated absorptance higher than 99% over the considered wavelength range, when considering realistic implementation of these ultra-broadband perfect electromagnetic absorbers. Robustness of optimal solutions with respect to geometrical parameters is investigated and local absorption maps are provided. Moreover, we confirm that these optimal solutions maintain quasi-perfect broadband absorption properties over a broad angular range when changing the inclination of the incident radiation. The study also reveals that noble metals (Au, Ag, Cu) do not provide the highest performance for the present application.