alpha = 0.5; beta = 2; gamma = 0.5; delta = 2;
N = 10;
Afloor = logspace(1,3,N);
Awall = [100 1000 10000];
opt_volumes = zeros(length(Awall),N);
disp('Computing optimal box volume for:')
for k = 1:length(Awall)
Awall_k = Awall(k);
fprintf( 'Awall = %d:\n', Awall(k) );
for n = 1:N
Afloor_n = Afloor(n);
fprintf( ' Afloor = %7.2f: ', Afloor(n) );
cvx_begin gp quiet
variables h w d
maximize( h*w*d )
subject to
2*(h*w + h*d) <= Awall_k;
w*d <= Afloor_n;
alpha <= h/w <= beta;
gamma <= d/w <= delta;
cvx_end
fprintf( 'max_volume = %3.2f\n', cvx_optval );
opt_volumes(k,n) = cvx_optval;
end
end
figure, clf
loglog(Afloor,opt_volumes(1,:), Afloor,opt_volumes(2,:), Afloor,opt_volumes(3,:));
xlabel('Afloor'); ylabel('V');
Computing optimal box volume for:
Awall = 100:
Afloor = 10.00: max_volume = 77.46
Afloor = 16.68: max_volume = 102.11
Afloor = 27.83: max_volume = 131.87
Afloor = 46.42: max_volume = 170.32
Afloor = 77.43: max_volume = 192.45
Afloor = 129.15: max_volume = 192.45
Afloor = 215.44: max_volume = 192.45
Afloor = 359.38: max_volume = 192.45
Afloor = 599.48: max_volume = 192.45
Afloor = 1000.00: max_volume = 192.45
Awall = 1000:
Afloor = 10.00: max_volume = 89.44
Afloor = 16.68: max_volume = 192.70
Afloor = 27.83: max_volume = 415.16
Afloor = 46.42: max_volume = 894.43
Afloor = 77.43: max_volume = 1926.98
Afloor = 129.15: max_volume = 2841.16
Afloor = 215.44: max_volume = 3669.50
Afloor = 359.38: max_volume = 4739.34
Afloor = 599.48: max_volume = 5998.71
Afloor = 1000.00: max_volume = 6085.81
Awall = 10000:
Afloor = 10.00: max_volume = 89.44
Afloor = 16.68: max_volume = 192.70
Afloor = 27.83: max_volume = 415.16
Afloor = 46.42: max_volume = 894.43
Afloor = 77.43: max_volume = 1926.98
Afloor = 129.15: max_volume = 4151.56
Afloor = 215.44: max_volume = 8944.27
Afloor = 359.38: max_volume = 19269.85
Afloor = 599.48: max_volume = 41515.63
Afloor = 1000.00: max_volume = 77459.67