Improved regenerative braking in electric vehicles through switch selection optimization