  A common optimization problem in the areas of magnetized plasmas and fusion
energy is the design of magnets to produce a given three-dimensional magnetic
field distribution to high precision. When designing arrays of permanent
magnets for stellarator plasma confinement, such problems have tens of
thousands of degrees of freedom whose solutions, for practical reasons, should
be constrained to discrete spaces. We perform a direct comparison between two
algorithms that have been developed previously for this purpose, and
demonstrate that composite procedures that apply both algorithms in sequence
can produce substantially improved results. One approach uses a continuous,
quasi-Newton procedure to optimize the dipole moments of a set of magnets and
then projects the solution onto a discrete space. The second uses an inherently
discrete greedy optimization procedure that has been enhanced and generalized
for this work. The approaches are both applied to design arrays cubic
rare-Earth permanent magnets to confine a quasi-axisymmetric plasma with a
magnetic field on axis of 0.5 T. The first approach tends to find solutions
with higher field accuracy, whereas the second can find solutions with
substantially (up to 30%) fewer magnets. When the approaches are combined, they
can obtain solutions with magnet quantities comparable to the second approach
while matching the field accuracy of the first.
