A Mixed Continuous-Discrete Approach to Fast Charging of Li-ion Batteries While Maximizing Lifetime