Symplectic geometry of constrained optimization