  This paper concerns two algorithms for solving optimal control problems with
hybrid systems. The first algorithm aims at hybrid systems exhibiting sliding
modes. The first algorithm has several features which distinguishes it from the
other algorithms for problems described by hybrid systems. First of all, it can
cope with hybrid systems which exhibit sliding modes. Secondly, the systems
motion on the switching surface is described by index 2 differential--algebraic
equations and that guarantees accurate tracking of the sliding motion surface.
Thirdly, the gradients of the problems functionals are evaluated with the help
of adjoint equations. The adjoint equations presented in the paper take into
account sliding motion and exhibit jump conditions at transition times. We
state optimality conditions in the form of the weak maximum principle for
optimal control problems with hybrid systems exhibiting sliding modes and with
piecewise differentiable controls. The second algorithm is for optimal control
problems with hybrid systems which do not exhibit sliding motion. In the case
of this algorithm we assume that control functions are measurable functions.
For each algorithm, we show that every accumulation point of the sequence
generated by the algorithm satisfies the weak maximum principle.
