A new mathematical approach to finding global solutions of the magnetic structure determination problem