Variational methods in some shape optimization problems