Reinforcement learning with offline data: foundations and algorithms