Given N points, I want to find the optimal configuration for which all the points are as far away from each other as possible.

The metric I’m considering is an approximation to the perceived distance between two colors:

The colors are constrained between 0 and 255. And there are N colors of maximum pair distance I want to find, in addition to these N colors, there’s a point in the origin (black) and in the topmost right-front corner (white) which are fixed in place.

This reminds me of sphere packing, but I don’t know the optimal size of the sphere so that they’d fill the whole volume… And since this metric is not translation invariant, I’m not sure how to calculate the sphere positions even if I knew the sphere size.

I’ve tried minimizing some cost functions, such as

or the columb force inspired

But it’s not very efficient, and is very dependent on initial guess (and it seems my euclidean grid-based guess isn’t optimal).

Is there a generalized form of the sphere packing algorithm which would give me the global minima, without the need to minimize these complex cost functions and fall into the many local minima, or get stuck in zero gradient areas?