Optimal Foraging by Bacteriophages through Host Avoidance