Discontinuous solutions in problems of optimization