Optimal Inverse Design of Magnetic Field Profiles in a Magnetically Shielded Cylinder