I have no idea what you mean. You say "Optimization" so I think you mean using Lagrange multipliers. But that is to maximize a function under given restraints. You say "max E(t)" but what is E(t)? Did you drop an equals sign? Is E(t)= Sum of [q(t) - q^2/st] dt ? Sum over what index? And what is that "dt" doing there. Did you mean integral rather than sum? If so, youdon'twant to integrate with respect to t. That would make E a function of s, not t.

But that right hand side looks like an energy formula. Are you finding the Lagrangian of a dynamics problem?