Our report presents an optimization algorithm for energy-efficient driving of electric vehicles. The algorithm is based on Pontryagin?s Minimum Principle by considering the driving mission as an optimal control problem. On a planned route, diverse application cases may occur due to various physical traits such as powertrain (e.g., switching between motor and generator operation), environmental variations (e.g., terrain grade change), traffic laws (e.g., speed limits), and safety concerns (e.g., headway to the leading vehicle). The proposed algorithm handles these real-world challenges by considering the perturbation to the system dynamics and the constraints to the control and state variables.