From Sorting To Optimization: Coping With Error-Prone Comparisons