Evolution of mating preference and sexual dimorphism