In this paper, we are interested in finding the optimal shape
of a magnet. The criterion to maximize is the jump of the
electromagnetic field between two different configurations.
We prove existence of an optimal shape into a natural class
of domains. We introduce a quasi-Newton type algorithm which
moves the boundary. This method is very efficient to improve
an initial shape. We give some numerical results.