A General Framework for Constraint Minimization for the Inversion of Electromagnetic Measurements