  This paper develops high-accuracy methods for numerically solving optimal
control problems subject to nonsmooth differential equations with set-valued
step functions. A notable subclass of these systems are Filippov systems. The
set-valued step functions are here written as the solution map of a linear
program. Using the optimality conditions of this problem we rewrite the initial
nonsmooth system into a equivalent dynamic complementarity systems (DCS). We
extend the Finite Elements with Switch Detection (FESD) method [Nurkanovi\'c et
al., 2024], initially developed for Filippov systems transformed via Stewart's
reformulation into DCS [Stewart, 1990], to the class of nonsmooth systems with
set-valued step functions. The key ideas are to start with a standard
Runge-Kutta method for the obtained DCS and to let the integration step sizes
to be degrees of freedom. Next, we introduce additional conditions to enable
implicit but exact switch detection and to remove possible spurious degrees of
freedom if no switches occur. The theoretical properties of the method are
studied. Its favorable properties are illustrated on numerical simulation and
optimal control examples. All methods introduced in this paper are implemented
in the open-source software package NOSNOC.
