Numerical method for constrained optimization problems governed by nonlinear hyperbolic systems of PDEs