The Banach-Mazur game and generic existence of solutions to optimization problems