  We apply advanced methods of control theory to open quantum systems and we
determine finite-time processes which are optimal with respect to thermodynamic
performances. General properties and necessary conditions characterizing
optimal drivings are derived, obtaining bang-bang type solutions corresponding
to control strategies switching between adiabatic and isothermal
transformations. A direct application of these results is the maximization of
the work produced by a generic quantum heat engine, where we show that the
maximum power is directly linked to a particular conserved quantity naturally
emerging from the control problem. Finally we apply our general approach to the
specific case of a two level system, which can be put in contact with two
different baths at fixed temperatures, identifying the processes which minimize
heat dissipation. Moreover, we explicitly solve the optimization problem for a
cyclic two-level heat engine driven beyond the linear-response regime,
determining the corresponding optimal cycle, the maximum power, and the
efficiency at maximum power.
