The Evolution of Resource Specialization through Frequency-Dependent and Frequency-Independent Mechanisms