Device-Algorithm Co-Optimization of TiOₓ-based Resistive Switching Devices