Optimal control inspired q-learning for switched linear systems