A method for controlling a motion of an electric vehicle, wherein the method uses a processor coupled to a memory storing an energy-loss function mapping values of acceleration and velocity of the EV to energy dissipation of the EV resulting from controlling one or multiple electric motors of the EV to move the EV at corresponding acceleration and velocity values, wherein the processor is configured to execute instructions stored in the memory for implementing the method, wherein the instructions, when executed by the processor carry out steps of the method, comprising: determining a velocity profile moving the EV from an initial velocity over a period of time by minimizing the energy dissipation according to the energy-loss function, wherein the velocity profile is a function of time including an initial velocity of the EV and a target velocity for the EV; and controlling the one or multiple electric motors of the EV to generate a torque for moving the EV according to the velocity profile, wherein the energy-loss function corresponds to a pseudo-convex function having a global minimum to minimize energy losses of the EV, that include driving losses and electric motor losses, and the energy-loss function is determined based on at least the model of the longitudinal motion, the predetermined torque-split function, and the predetermined motor efficiency function, wherein the energy-loss function is a cost function that is derived from a tabulated data of an efficiency map of the electric motor, wherein the efficiency map of the electric motor includes a contour plot that determines the maximum efficiency of the electric motor for any combination of torque and a rotational speed of the electric motor and the predetermined motor efficiency function is learned using a kernel-based regression that fits data of the efficiency map of one electric motor relating the efficiency of the electric motor to a motor speed and a motor torque and the longitudinal motion model is determined based on forces resulting from the aerodynamic drag of the EV and forces resulting from the rolling resistance of the EV and the predetermined torque split function is determined by using the predetermined motor efficiency function along with the longitudinal motion model and the predetermined torque split function comprises the wheel torques. determining a velocity profile moving the EV from an initial velocity over a period of time by minimizing the energy dissipation according to the energy-loss function, wherein the velocity profile is a function of time including an initial velocity of the EV and a target velocity for the EV; and controlling the one or multiple electric motors of the EV to generate a torque for moving the EV according to the velocity profile, wherein the energy-loss function corresponds to a pseudo-convex function having a global minimum to minimize energy losses of the EV, that include driving losses and electric motor losses, and the energy-loss function is determined based on at least the model of the longitudinal motion, the predetermined torque-split function, and the predetermined motor efficiency function, wherein the energy-loss function is a cost function that is derived from a tabulated data of an efficiency map of the electric motor, wherein the efficiency map of the electric motor includes a contour plot that determines the maximum efficiency of the electric motor for any combination of torque and a rotational speed of the electric motor and the predetermined motor efficiency function is learned using a kernel-based regression that fits data of the efficiency map of one electric motor relating the efficiency of the electric motor to a motor speed and a motor torque and the longitudinal motion model is determined based on forces resulting from the aerodynamic drag of the EV and forces resulting from the rolling resistance of the EV and the predetermined torque split function is determined by using the predetermined motor efficiency function along with the longitudinal motion model and the predetermined torque split function comprises the wheel torques.