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: 297 variables, 147 equality constraints
For improved efficiency, sedumi is solving the dual problem.
------------------------------------------------------------
SeDuMi 1.21 by AdvOL, 2005-2008 and Jos F. Sturm, 1998-2003.
Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500
eqs m = 147, order n = 217, dim = 352, blocks = 82
nnz(A) = 317 + 0, nnz(ADA) = 805, nnz(L) = 484
it : b*y gap delta rate t/tP* t/tD* feas cg cg prec
0 : 1.10E+01 0.000
1 : -2.70E+00 3.15E+00 0.000 0.2863 0.9000 0.9000 3.05 1 1 1.5E+00
2 : -7.56E+00 9.54E-01 0.000 0.3029 0.9000 0.9000 0.92 1 1 7.2E-01
3 : -1.35E+01 3.33E-01 0.000 0.3492 0.9000 0.9000 0.53 1 1 2.7E-01
4 : -1.78E+01 1.08E-01 0.000 0.3252 0.9000 0.9000 0.65 1 1 9.8E-02
5 : -2.00E+01 2.27E-02 0.000 0.2095 0.9000 0.9000 0.84 1 1 2.2E-02
6 : -2.05E+01 6.39E-03 0.000 0.2816 0.9000 0.9000 0.97 1 1 6.3E-03
7 : -2.05E+01 7.97E-06 0.101 0.0012 0.9000 0.0000 0.99 1 1 2.2E-03
8 : -2.06E+01 1.54E-06 0.000 0.1931 0.9168 0.9000 1.00 1 1 4.7E-04
9 : -2.06E+01 8.40E-08 0.000 0.0546 0.9187 0.9900 1.00 1 1 2.9E-05
10 : -2.06E+01 3.64E-09 0.000 0.0433 0.9900 0.9615 1.00 1 1 1.3E-06
11 : -2.06E+01 2.75E-10 0.366 0.0755 0.9479 0.9900 1.00 1 1 9.5E-08
12 : -2.06E+01 1.00E-11 0.000 0.0364 0.9900 0.9900 1.00 1 1 3.5E-09
iter seconds digits c*x b*y
12 0.1 Inf -2.0646323157e+01 -2.0646323148e+01
|Ax-b| = 3.5e-09, [Ay-c]_+ = 3.9E-09, |x|= 4.1e+01, |y|= 8.5e+00
Detailed timing (sec)
Pre IPM Post
1.000E-02 9.000E-02 0.000E+00
Max-norms: ||b||=1, ||c|| = 2,
Cholesky |add|=0, |skip| = 0, ||L.L|| = 2.97702.
------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +20.6463
Done!