  We consider a linear-quadratic deterministic optimal control problem where
the control takes values in a two-dimensional simplex. The phase portrait of
the optimal synthesis contains second-order singular extremals and exhibits
modes of infinite accumulations of switchings in finite time, so-called
chattering. We prove the presence of an entirely new phenomenon, namely the
chaotic behaviour of bounded pieces of optimal trajectories. We find the
hyperbolic domains in the neighbourhood of a homoclinic point and estimate the
corresponding contraction-extension coefficients. This gives us the possibility
to calculate the entropy and the Hausdorff dimension of the non-wandering set
which appears to have a Cantor-like structure as in Smale's Horseshoe. The
dynamics of the system is described by a topological Markov chain. In the
second part it is shown that this behaviour is generic for piece-wise smooth
Hamiltonian systems in the vicinity of a junction of three discontinuity
hyper-surface strata.
