{Date[], $Version}

Load the MathOptimizer Professional Package

Needs["MathOptimizerProS95F`callLGO`"]

Run a test optimization

callLGO[x, {}, {{x, -5, 5}}]

Define a function outerdist which gives the maximum distance from the origin to any point on a circle with radius r and center { x[r], y[r], z[r] }

outerdist[r_] := r  + (Sqrt[x[r]^2 + y[r]^2 + z[r]^2])

Define a function pairdist which gives the minimum distance between two circles of radii r1 and r2 and centers { x[r1], y[r1], z[r1] } and { x[r2], y[r2], z[r2] }

pairdist[{r1_, 
          r2_}] :=   (Sqrt[(((x[r1] - x[r2]))^2) + (((y[r1] - y[r2]))^2) + (((z[r1] - z[r2]))^2)]) - r1 - r2

Define a function which sets up the optimization problem of packing a set of spheres of radius r into an enclosing sphere, where the upper limit on the radius of the enclosing sphere is max.  Comments describing each line are given above the line in blue.

packspheres[r_List, max_]:=
Module[
{num  =  Length[r], maxouter, pairs,  cons, vars, bds, 
            lb, ub, soln, rcirc, pd},
  
vars = Join[x  /@  r, y  /@  r,  z  /@  r];
  
bds  =  (max - #) &  /@  r;
  
ub  =  Join[bds, bds, bds];
  
lb = -ub;
  
vwb = Transpose[{vars, lb, ub}];
  
maxouter  =  Max[outerdist  /@  r];
  
pairs  =  
              Select[Flatten[ Outer[List, r, r], 
                  1], #[[1]] < #[[2]] &];
  
cons =  
              Join[Thread[
                  pairdist  /@  
                      pairs  ≥    0], {maxouter  ≤ max}];
  
{maxouter, cons, vwb}
]

Set up the problem for 10 spheres with radii 1, the cube root of 1/2, etc.  The volumes of the spheres are therefore in the ratios 1, 1/2, 1/3, etc.  The maximum possible radius of the enclosing sphere is set at 2.25.

prob10  =  packspheres[Range[10]^(-1/3), 2.25];

Perform the optimization using MathOptimizer Professional.  It takes 0.67 seconds and returns a result of 1.90528.

AbsoluteTiming[callLGO  @@  prob10]

Modify the problem description for NMinimize by putting the objective function and constraints into one list.

prob10nm  =  {Join[{prob10[[1]]}, 
            prob10[[2]] ], 
          prob10[[3]]};

Perform the optimization with NMinimize. It takes 132 seconds and returns a result of 1.9055.

AbsoluteTiming[NMinimize  @@  prob10nm]

The NMinimize result is approximately 1/4 % better than the MathOptimizer Professional result.

((1.90055 - 1.90528)/1.90528)

However, NMinimize took approximately 200 times longer to peform the optimization.

(132.328/0.67185)