  Shortening quantum circuits is crucial to reducing the destructive effect of
environmental decoherence and enabling useful algorithms. Here, we demonstrate
an improvement in such compilation tasks via a combination of using hybrid
discrete-continuous optimization across a continuous gate set, and
architecture-tailored implementation. The continuous parameters are discovered
with a gradient-based optimization algorithm, while in tandem the optimal gate
orderings are learned via a deep reinforcement learning algorithm, based on
projective simulation. To test this approach, we introduce a framework to
simulate collective gates in trapped-ion systems efficiently on a classical
device. The algorithm proves able to significantly reduce the size of relevant
quantum circuits for trapped-ion computing. Furthermore, we show that our
framework can also be applied to an experimental setup whose goal is to
reproduce an unknown unitary process.
