The calculation of the sensitivity versus a geometric or physical parameter and its use in an optimization process are presented. The 2-D finite-element method is used in the magnetic field calculation. The quasiNewton method is used to determine the direction of minimization, and the constraints of upper and lower bounds of parameters are treated by the penalty function. A cubic approximation method is used in the unidimensional minimization. Minimization of the current density (J c) while keeping the force desired for a relay model is presented as an example