Figure 8.17: Fourth-order placement problem
linewidth = 1;
markersize = 5;
fixed = [ 1 1 -1 -1 1 -1 -0.2 0.1;
1 -1 -1 1 -0.5 -0.2 -1 1]';
M = size(fixed,1);
N = 6;
A = [ 1 0 0 -1 0 0 0 0 0 0 0 0 0 0
1 0 -1 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 -1 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 -1 0 0 0 0 0 0 0
1 0 0 0 0 0 0 -1 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 -1 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 -1
0 1 -1 0 0 0 0 0 0 0 0 0 0 0
0 1 0 -1 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 -1 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 -1 0 0 0 0 0 0
0 1 0 0 0 0 0 0 -1 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0 0 -1 0
0 0 1 -1 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 -1 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0 -1 0 0 0
0 0 0 1 -1 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 -1 0 0 0 0 0
0 0 0 1 0 0 0 0 0 -1 0 0 0 0
0 0 0 1 0 0 0 0 0 0 0 -1 0 0
0 0 0 1 0 -1 0 0 0 0 0 -1 0 0
0 0 0 0 1 -1 0 0 0 0 0 0 0 0
0 0 0 0 1 0 -1 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 -1 0 0 0 0
0 0 0 0 1 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 1 0 0 -1 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 -1 0 0 0 ];
nolinks = size(A,1);
fprintf(1,'Computing the optimal locations of the 6 free points...');
cvx_begin
variable x(N+M,2)
minimize ( sum(square_pos(square_pos(norms( A*x,2,2 )))))
x(N+[1:M],:) == fixed;
cvx_end
fprintf(1,'Done! \n');
free_sum = x(1:N,:);
figure(1);
dots = plot(free_sum(:,1), free_sum(:,2), 'or', fixed(:,1), fixed(:,2), 'bs');
set(dots(1),'MarkerFaceColor','red');
hold on
legend('Free points','Fixed points','Location','Best');
for i=1:nolinks
ind = find(A(i,:));
line2 = plot(x(ind,1), x(ind,2), ':k');
hold on
set(line2,'LineWidth',linewidth);
end
axis([-1.1 1.1 -1.1 1.1]) ;
axis equal;
title('Fourth-order placement problem');
figure(2)
all = [free_sum; fixed];
bins = 0.05:0.1:1.95;
lengths = sqrt(sum((A*all).^2')');
[N2,hist2] = hist(lengths,bins);
bar(hist2,N2);
hold on;
xx = linspace(0,2,1000); yy = (6/1.5^4)*xx.^4;
plot(xx,yy,'--');
axis([0 1.5 0 4.5]);
hold on
plot([0 2], [0 0 ], 'k-');
title('Distribution of the 27 link lengths');
Computing the optimal locations of the 6 free points...
Calling SeDuMi: 255 variables (12 free), 162 equality constraints
------------------------------------------------------------------------
SeDuMi 1.1 by AdvOL, 2005 and Jos F. Sturm, 1998, 2001-2003.
Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500
Split 12 free variables
eqs m = 162, order n = 187, dim = 322, blocks = 82
nnz(A) = 416 + 0, nnz(ADA) = 1276, nnz(L) = 1101
it : b*y gap delta rate t/tP* t/tD* feas cg cg prec
0 : 5.42E+000 0.000
1 : 6.92E+000 1.47E+000 0.000 0.2713 0.9000 0.9000 2.13 1 1 1.6E+000
2 : 1.17E+001 4.55E-001 0.000 0.3097 0.9000 0.9000 0.84 1 1 6.2E-001
3 : 1.69E+001 1.40E-001 0.000 0.3086 0.9000 0.9000 0.67 1 1 2.3E-001
4 : 1.99E+001 2.59E-002 0.000 0.1841 0.9000 0.9000 0.83 1 1 4.5E-002
5 : 2.05E+001 5.68E-003 0.000 0.2197 0.9000 0.9000 0.97 1 1 1.0E-002
6 : 2.06E+001 1.34E-003 0.000 0.2350 0.9000 0.9000 0.99 1 1 2.4E-003
7 : 2.06E+001 1.26E-004 0.000 0.0944 0.9900 0.9900 1.00 1 1 2.3E-004
8 : 2.06E+001 2.22E-006 0.000 0.0176 0.9900 0.9900 1.00 1 1 6.1E-006
9 : 2.06E+001 1.31E-009 0.059 0.0006 0.9900 0.9713 1.00 1 1 1.9E-007
10 : 2.06E+001 6.82E-011 0.126 0.0521 0.9900 0.9902 1.00 2 2 9.4E-009
iter seconds digits c*x b*y
10 0.1 Inf 2.0646323254e+001 2.0646323360e+001
|Ax-b| = 4.7e-008, [Ay-c]_+ = 8.2E-010, |x|= 1.9e+001, |y|= 3.8e+001
Detailed timing (sec)
Pre IPM Post
2.003E-002 1.302E-001 0.000E+000
Max-norms: ||b||=1, ||c|| = 1,
Cholesky |add|=0, |skip| = 0, ||L.L|| = 11.157.
------------------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +20.6463
Done!