# Objective: nonconvex nonlinear # Constraints: bounds param n := 15; param pi := 3.14159; option randseed ''; var theta {1..n}; # >= 0, <= 2*pi; var phi {1..n} >= 0, <= pi; maximize separation: sum {i in 1..n} sum {j in i+1..n} log( (cos(theta[i])*sin(phi[i]) - cos(theta[j])*sin(phi[j]))^2 + (sin(theta[i])*sin(phi[i]) - sin(theta[j])*sin(phi[j]))^2 + ( cos(phi[i]) - cos(phi[j]))^2 ); let {i in 1..n} theta[i] := 2*pi*Uniform01(); let {i in 1..n} phi [i] := pi*Uniform01(); #param m := floor(sqrt(n)); #let {i in 1..n} theta[i] := 0.05 + 0.9*(2*pi*(i/m - floor(i/m))); #let {i in 1..n} phi [i] := 0.05 + 0.9*(pi*floor(i/m)/m); option solver loqo; option loqo_options "pred_corr=0 mufactor=0.0 steplen=0.5 \ verbose=2 sigfig=6 inftol=1.0e-6"; #option solver minos; ## fails!!! display separation; solve; param x {i in 1..n}; param y {i in 1..n}; param z {i in 1..n}; let {i in 1..n} x[i] := cos(theta[i])*sin(phi[i]); let {i in 1..n} y[i] := sin(theta[i])*sin(phi[i]); let {i in 1..n} z[i] := cos(phi[i]); display x, y, z; #display {i in 1..n, j in i+1..n} x[i]*x[j] + y[i]*y[j] + z[i]*z[j]; #display {i in 1..n, j in i+1..n} acos(x[i]*x[j] + y[i]*y[j] + z[i]*z[j])*180/pi;