【CVX】Chebyshev center of a polyhedron

Chebyshev center of a polyhedron

We consider the problem of finding the largest Euclidean ball that lies in a polyhedron described by linear inequalities
P = { x ∈ R n ∣ a i T x ≤ b i , i = 1 , 2 , … , m } \mathcal{P}=\{x\in\mathbb{R}^n\mid a_i^Tx\leq b_i, i=1,2, \dots, m\} P={xRnaiTxbi,i=1,2,,m}
The ball is represented as follows:
B = { x c + u ∣ ∥ u ∥ 2 ≤ r } \mathcal{B}=\{x_c+u\mid\lVert u\rVert_2\leq r\} B={xc+uu2r}
And, we wish to maximize r r r subject to the constraint B ⊆ P \mathcal{B}\subseteq \mathcal{P} BP.
We start by considering the simpler constraint that B \mathcal{B} B lies in one halfspace a i T x ≤ b a_i^Tx\leq b aiTxb, i.e.,
∥ u ∥ 2 ≤ r ⟹ a i T ( x c + u ) ≤ b i (1) \lVert u\rVert_2\leq r\Longrightarrow a_i^T(x_c+u)\leq b_i\tag{1} u2raiT(xc+u)bi(1)
Since
sup ⁡ { a i T u ∣ ∥ u ∥ 2 ≤ r } = r ∥ a i ∥ 2 \sup\{a_i^Tu\mid \lVert u\rVert_2\leq r\}=r\lVert a_i \rVert_2 sup{aiTuu2r}=rai2
we can write ( 1 ) (1) (1) as
a i T x c + r ∥ a i ∥ 2 ≤ b i a_i^Tx_c+r\lVert a_i\rVert_2\leq b_i aiTxc+rai2bi
which is a linear inequality in x c x_c xc and r r r. Hence the Chebshev center can be determined by solving the LP
max ⁡ r s . t . a i T x c + r ∥ a i ∥ 2 ≤ b i , i = 1 , 2 , … , m \max r\\ s.t.\quad a_i^Tx_c+r\lVert a_i\rVert_2\leq b_i, i=1,2, \dots, m maxrs.t.aiTxc+rai2bi,i=1,2,,m

CVX code

%% compute and display the Chebyshev center of a 2D polyhedron
% Generate the input data
a1 = [2; 1];
a2 = [2; -1];
a3 = [-1; 2];
a4 = [-1; -2];
b = ones(4, 1);

% solve model
cvx_begin
    variables r(1) x_c(2);
    maximize r;
    a1'*x_c+r*norm(a1, 2)<=b(1);
    a2'*x_c+r*norm(a2, 2)<=b(2);
    a3'*x_c+r*norm(a3, 2)<=b(3);
    a4'*x_c+r*norm(a4, 2)<=b(4);
cvx_end

% plot
x = linspace(-2, 2);
theta = 0:pi/100:2*pi;
hold on;
% constraints
plot(x, -x*a1(1)./a1(2)+b(1)./a1(2), 'b-');
plot(x, -x*a2(1)./a2(2)+b(2)./a2(2), 'b-');
plot(x, -x*a3(1)./a3(2)+b(3)./a3(2), 'b-');
plot(x, -x*a4(1)./a4(2)+b(4)./a4(2), 'b-');

% Euclidean ball
plot(x_c(1)+r*cos(theta), x_c(2)+r*sin(theta), 'r');

% chebshev center
plot(x_c(1), x_c(2), 'k+');

xlabel('x_1');
ylabel('x_2');
title('Largest Euclidean ball in polyhedron');
axis([-1 1 -1 1]);
axis equal
hold off;

Biggest E-ball

Chebyshev center with random constraints

%%
rng(729);
n = 10; 
m = 2*n;
A = randn(m, n);
b = A*rand(n, 1)+2*rand(m, 1);
norm_ai = sum(A.^2, 2).^(0.5);

fprintf(1, 'Computing Chebyshev center...');
cvx_solver mosek;
cvx_begin
    variables r x_c(n);
    dual variable y
    maximize r;
    y: A*x_c+r*norm_ai<=b;
cvx_end

fprintf(1, 'The Chebyshev center coordinates are: \n');
disp(x_c);
fprintf(1, 'The radius of the largest Euclidean ball is: \n');
disp(r);

Reference

Convex Optimization. Boyd

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Quant0xff

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值