Flexibility of foraging behavior in hummingbirds: the role of energy constraints and cognitive abilities