Episodic Task Planning And Learning In Pervasive Environments