An optimization approach to weak approximation of stochastic differential equations with jumps