Drosophila larval foraging depends on resource quality:

(A) Individual larvae were placed in the middle of a square arena (25 x 25 cm) containing 2% agar and 4 patches of the same resource (agar (gray), 0.1M fructose (blue), 1M fructose (yellow)). The behavior of a single larva was recorded for 3 hours under infrared illumination. (B) Sample trajectories of individual larvae for 3 hours when the patches contained agar, 0.1M fructose, or 1M fructose. The patch heatmap visualizes the spatial distribution of larvae both on the patch (marked by a white circle) and in the surrounding area across all patches (N = 11 larvae per patch condition). (C) Number of return trips to the patch as a function of the maximum displacement from the patch edge after the exit. (D) Average thresholded patch residence time for each larva. The dots represent individual larvae, and the line shows the mean ± 95% confidence interval. (Mann-Whitney U test, * p < 0.05) (E) Mean squared displacement (MSD) of larvae on-patch as a function of time lag. The dotted line indicates the linear fit to the MSD (Agar: 1.3636, 0.1M Fructose: 0.41401, 1M Fructose: 0.40739). (F) Average inter-patch travel time of the larvae.

Drosophila larval foraging depends on resource valence:

(A) Individual larvae were placed in the middle of a square arena (25 x 25 cm) containing 2% agar and 4 patches of the same resource (agar (gray), 0.1M salt (green), 1M salt (orange)). (B) Sample trajectories of individual larvae for 3 hours when the patches contained agar, 0.1M salt, or 1M salt. The patch heatmap visualizes the spatial distribution of larvae both on the patch (marked by a white circle) and in the surrounding area across all patches (N = 11 larvae per patch condition). (C) Number of return trips as a function of the maximum displacement from the patch edge. (D) Average thresholded patch residence time for each larva. Dots represent individuals, and the line shows the mean ± 95% confidence interval. (E) MSD of larvae on-patch; dotted line is the linear fit to the MSD (Agar: 1.3636, 0.1M Salt: 1.0026, 1M Salt: 1.4092). (F) Average inter-patch travel time of the larvae. (Mann-Whitney U test, * p < 0.05)

Drosophila larvae adapt their foraging behavior based on resource quality and valence:

(A) Square arena (25 × 25 cm) containing 2% agar, with two 0.1M fructose patches (blue) and two 1M fructose patches (yellow). (B) Sample trajectory of an individual larva over 3 hours. (C) Patch heatmap showing the spatial distribution of larvae both on the patches (outlined in white) and in the surrounding arena for 0.1M and 1M fructose patches (N = 21 larvae). (D) Average thresholded patch residence time for each larva on 0.1M and 1M fructose patches. Dots indicate individual larvae, and the line represents the mean ± 95% confidence interval. Number of return trips as a function of the maximum displacement from the patch edge (Mann-Whitney U test, * p < 0.05). MSD of larvae on-patch. The dotted line indicates the linear fit to the MSD (0.1M Fructose: 0.256, 1M Fructose: 0.079). (E) Square arena (25 × 25 cm) containing 2% agar, with two 0.1M salt patches (green) and two 1M salt patches (orange). (F) Sample trajectory of an individual larva over 3 hours. (G) Patch heatmap for 0.1M and 1M salt patches (N = 21 larvae). (H) Average thresholded patch residence time for each larva on 0.1M and 1M salt patches. Number of return trips made by the larvae. MSD of larvae on-patch. The dotted line indicates the linear fit to the MSD (0.1M Salt: 0.383, 1M Salt: 0.559).

Drosophila larvae adapt their behavior based on past foraging experience:

(A) Schematic illustration of subsequent patch visits by a larva when the patches contained fructose. (B) Average patch residence time of larvae on patches 1 and 2 in homogeneous (gray, Fig 1A) or heterogeneous environments (blue for same-type patches, pink for different-type patches; Fig 3A). Data is shown as mean ± SEM (Wilcoxon signed-rank test, * p < 0.05, indicated in the legend). (C) Average patch residence time on patch 2 based on the first patch experienced by the larvae in a heterogeneous environment. Dots indicate individuals, and the line represents the mean ± 95% confidence interval. (D) Time taken by larvae to travel from patch 1 to patch 2 in a heterogeneous environment. (E) Schematic illustration of subsequent patch visits when the patches contained salt. (F) Average patch residence time of larvae on patches 1 and 2 in homogeneous (gray, Fig 1A) or heterogeneous environments (blue for same-type patches, pink for different-type patches; Fig 3A). (G) Average patch residence time on patch 2 in a heterogeneous environment, based on the first patch experienced by the larvae. Dots indicate individuals; the line represents the mean ± 95% confidence interval (Mann-Whitney U test, * p < 0.05). (H) Travel time between patches 1 and 2 in a heterogeneous environment.

Integration model captures larval patch foraging behavior:

(A) Implementation of the drift-diffusion model (DDM) for patch leaving in homogeneous environments, with x as the decision variable and μ as the drift variable. (B) Model fits for the different substrates (black line: mean fit; shaded area: ± standard deviation; KS test indicates goodness-of-fit). (C) Mean ± std of the patch residence times from the empirical data and model prediction. (D) Drift rates obtained from the DDM fits (E) Implementation of the DDM model for patch leaving in the heterogeneous environment, with x as the decision variable, μ as the drift, and 𝞴 as the leak. (F) Model fits for the different substrates (black line: mean fit; shaded area: ± standard deviation; KS test indicates goodness-of-fit). (G) Mean ± std of the patch residence times from the empirical data and the model. (H) Drift (μ) and leak (λ) obtained from the model fits.

Analysis of larval behavior in homogeneous environments of different resource qualities:

(A) Number of unique patches visited by larvae when the patches contained agar (gray), 0.1M fructose (blue), and 1M fructose (yellow). (B) Average patch residence time of larvae. Dots indicate individual larvae; the line represents the mean ± 95% confidence interval (Mann-Whitney U test = * p < 0.05). (C) Correlation between maximum displacement from the patch edge and the return time to the patch. Each dot represents an individual trip, and the line indicates the linear regression fit. (D) Schematic illustrating the calculation of patch residence time after applying a distance threshold. (E) Number of patch entries by each larva before and after thresholding. (F) Thresholded average patch residence time in 30 min interval (Kruskal-Wallis test = * p < 0.05). (G) Speed of larvae on- and off-patch. (H) MSD of larvae when they were off-patch. The dotted line indicates the linear fit to the MSD. (I) Travel time in 30 min intervals (Kruskal-Wallis test = * p <0.05). (J) Time spent by larvae when they were off-patch at the border, in regions near the patches and in the center of the arena.

Analysis of larval behavior in homogeneous environments of different resource valences:

(A) Number of unique patches visited by larvae when the patches contained agar (gray), 0.1M salt (green) and 1M salt (orange). (B) Average patch residence time of larvae. Dots indicate individual larvae; the line represents the mean ± 95% confidence interval (Mann-Whitney U test = * p < 0.05). (C) Correlation between maximum displacement from the patch edge and the return time to the patch. Each dot represents an individual trip and the line indicates the linear regression fit. (D) Schematic illustrating the calculation of patch residence time after applying a distance threshold. (E) Number of patch entries by a larva before and after thresholding. (F) Thresholded average patch residence time over 30-min intervals (Kruskal-Wallis test = * p < 0.05). (G) Larval speed on- and off-patch (H) MSD of larvae when they are off-patch; the dotted line indicates the linear fit to the MSD. (I) Travel time between patches at 30-min intervals (Kruskal-Wallis test). (J) Time spent by larvae when they were off-patch at the border, in regions near the patches and in the center of the arena.

Analysis of larval behavior in a heterogeneous environment of different resource qualities and valences:

(A) Number of unique patches visited by larvae when two patches contained 0.1M fructose (light blue) and 1M fructose (blue). (B) Correlation between maximum displacement from the patch edge and the return time to the patch. Each dot represents an individual trip, and the line indicates the linear regression fit. (C) Number of patch entries by a larva after thresholding. Dots indicate individual larvae; the line represents the mean ± 95% confidence interval (Mann-Whitney U test = * p < 0.05). (D) Thresholded patch residence time over time in 30 min intervals (Kruskal-Wallis test = * p < 0.05). (E) Speed of larvae on- and off-patch. (F) Number of unique patches visited by larvae when two patches contained 0.1M salt (light red) and 1M salt (red). (G) Correlation between maximum displacement from the patch edge and the return time to the patch. (H) Number of patch entries by larvae after thresholding. (I) Thresholded patch residence time over time in 30 min intervals (Kruskal-Wallis test = * p < 0.05). (J) Larval speed on- and off-patch.

Analysis of DDM model parameters:

(A) Goodness-of-fit values for the drift-diffusion model for patch-leaving decisions, with and without inclusion of the first encountered patch, with x as the decision variable and μ as the drift, based on the empirical data from Fig. 5A. (B) Goodness-of-fit values for the drift-diffusion model for patch-leaving decisions excluding the first encountered patch, evaluated with and without λ as the leak, with x as the decision variable and μ as the drift, based on the empirical data from Fig. 5A.(C) Goodness-of-fit values for the drift-diffusion model for patch-leaving decisions excluding encounters prior to the exploration of both patch types, evaluated with and without λ as the leak, with x as the decision variable and μ as the drift, applied to the empirical data from Fig. 5E. (D) Goodness-of-fit values for the drift-diffusion model for patch-leaving decisions, with and without inclusion of the first encountered patch of both types, with x as the decision variable, μ as the drift and λ as the leak, applied to the empirical data from Fig. 5E.