A variational problem for a system of magnetic monopoles joined by Abrikosov vortices