Experience-Based Robot Task Learning and Planning with Goal Inference