Functional response of optimally foraging herbivores