Online Learning of Temporal Dependencies for Sustainable Foraging Problem