Existence theorems for discontinuous solutions in optimization problems