Short-term foraging behavior is typically influenced by the needs to obtain food at a high rate and to avoid predation. The need to balance these conflicting demands plays a role in ontogenetic habitat shifts, including the spectacular shifts characteristic of complex life cycles. Previous theory has led to rules that are independent of time to predict the size at which habitat shifts take place. The authors develop a model that incorporates time constraints, but assuming that reproduction or some other major event, such as diapause or metamorphosis, must occur by a specified time or date; and incorporate recent formulations of dynamic programming that allow strategies to balance conflicting behaviors by expressing them in the common currency of future reproductive output. The resulting theory predicts optimal strategies for pre-reproductive output. The resulting theory predicts optimal strategies for pre-reproductive habitat shifts that depend on both time and body weight. -from Authors