Preferences in Constraint Satisfaction and Optimization