Bellman equations for optimal feedback control of qubit states