Optimal mesh discretization of the dynamic programming for hybrid electric vehicles