I have been able to do some constrained functional optimizations in Mathematica by using time-dependent Lagrange multipliers, as described in Courant & Hilbert, Methods of Mathematical Physics, in Chapter, Section 7, Variational Problems With Subsidiary Conditions. Unfortunately, I cannot at this time locate one of those calculations to post here.