An optimal charging algorithm for lithium-ion batteries considering temperature rise minimization