In this work we present a micromagnetic study of the performance potential of bit-patterned (BP) magnetic recording media via joint optimization of the design of the media and of the magnetic write heads. Because the design space is large and complex, we developed a novel computational framework suitable for parallel implementation on compute clusters. Our technique combines advanced global optimization algorithms and finite-element micromagnetic solvers. Targeting data bit densities of $4mathrm{Tb}/mathrm{in}^2$, we optimize designs for centered, staggered, and shingled BP writing. The magnetization dynamics of the switching of the exchange-coupled composite BP islands of the media is treated micromagnetically. Our simulation framework takes into account not only the dynamics of on-track errors but also of the thermally induced adjacent-track erasure. With co-optimized write heads, the results show superior performance of shingled BP magnetic recording where we identify two particular designs achieving write bit-error rates of $1.5mathrm{x}10^{-8}$ and $8.4mathrm{x}10^{-8}$, respectively. A detailed description of the key design features of these designs is provided and contrasted with centered and staggered BP designs which yielded write bit error rates of only $2.8mathrm{x}10^{-3}$ (centered design) and $1.7mathrm{x}10^{-2}$ (staggered design) even under optimized conditions.