Optimal control of low-frequency electromagnetic fields in multiply connected conductors