Ants live in dynamically changing environments, where food sources become depleted and alternative sources appear. Yet most mathematical models of ant foraging assume that the ants' foraging environment is static. Here we describe a mathematical model of ant foraging in a dynamic environment. Our model attempts to explain recent empirical data on dynamic foraging in the Argentine ant . Linepithema humile (Mayr). The ants are able to find the shortest path in a Towers of Hanoi maze, a complex network containing 32,768 alternative paths, even when the maze is altered dynamically. We modify existing models developed to explain ant foraging in static environments, to elucidate what possible mechanisms allow the ants to quickly adapt to changes in their foraging environment. Our results suggest that navigation of individual ants based on a combination of one pheromone deposited during foraging and directional information enables the ants to adapt their foraging trails and recreates the experimental results.