A Nonconvex Variational Problem With Constraints