The shape optimization of magnetic devices is efficiently performed with field calculation and sensitivity analysis based on the finite element method. Several sequential unconstrained optimization techniques are discussed and evaluated with respect to their application in engineering design. The optimization of the geometry of a salient pole generator so as to achieve a desired field configuration in the airgap is used as an illustrative numerical example to demonstrate the geometric parametrization technique, emphasize the importance of constraints in engineering design, and highlight the advantageous features of the augmented Lagrangian multiplier method for nonlinear constrained optimization. For the required geometric parametrization a recent novel use of structural mapping is extended to incorporate constrained optimization. For the benefit of the electrical engineering readership, the associated equations of structural mapping are presented.