Variable Stiffness for Robust Locomotion through Reinforcement Learning