There are two possible ways for finding the required optimal dipoles. The first is a minimization iteration, where a few optimal dipoles are found in an arbitrary region. The steepest slope with respect to the spatial coordinate is then found and a new search region is obtained. Optimal dipoles in that region are found, a new slope is determined and so on, until the best of all optimal dipoles is found.