Modeling adaptive effects of drift. A. In a simplified model in which both phenotypes and environments have two states, the optimal fraction of the population that should change preference (fshift) over a period of time equals the probability the environment changes (pshift). See Supplementary text REFREF. B. Model for the number of individuals with a particular continuous preference as a function of time in a fluctuating environment and individual age. nϕ,α,t, is the number of individuals with preference ϕ, age α at day t in the simulation. Two different cases determine this value, one for flies surviving from the previous timestep (α > 0), and one for flies born in a particular timestep (α = 0). The number of flies of a particular behavioral phenotype surviving on each successive day is determined by a function of how that preference is from the ideal preference on that day (orange), the total number of flies that already have, or drift into having that phenotype on that day (red), and a bounding term that stops the distribution of preferences from diffusing away from general range of what is adaptive (purple). The key behavioral strategy parameter from these terms is σd, which determines the rate at which flies’ preferences drift over time. The number of new flies born each day is given by the total number of flies above the age of reproductive maturity amin (red) times the birth rate β. New flies are born with an initial preference from a normal distribution centered on the long term environmental mean with a standard deviation given by σbet-hedging (blue) C. Example environmental fluctuations and corresponding fitness landscape showing final populations for differing amounts of drift and bet-hedging. Green dot indicates ideal strategy (ii)D. Population over time for strategies marked with roman numerals in (C). E, F. As in (C) for two additional example environmental fluctuation patterns.