Learning and decision-making in spatiotemporally varying domains