The quantum marginal problem for symmetric states: applications to variational optimization, nonlocality and self-testing. (15th March 2021)