⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 separate_pt_poly.m

📁 斯坦福大学Grant和Boyd教授等开发的凸优化matlab工具箱
💻 M
字号:
% Section 8.1.1: Separating a point from a polyhedron% Boyd & Vandenberghe "Convex Optimization"% Joelle Skaf - 10/09/05%% The goal is to produce a hyperplane separating x0 and the polyhedron% defined as {x | Ax <= b}%           minimize    mu'*x0 - b'*lambda%                       A'*lambda = mu%                       norm(mu)* <= 1%                       lambda >= 0cvx_quiet(true);% Input datarandn('seed',0);n  = 10;m  = 2*n;x0 = randn(n,1);A  = randn(m,n);b  = rand(m,1);% CVX solutionfprintf(1,'Finding a separating hyperplane between the 2 polyhedra...');cvx_begin    variables muu(n) lambda(m)    maximize ( muu'*x0 - b'*lambda )    A'*lambda == muu;    norm(muu) <= 1;    lambda >= 0;cvx_endfprintf(1,'Done! \n');% Verificationdisp('------------------------------------------------------------------');disp('Note that 0 is in {x | Ax <= b} by construction...' );disp('Verifying that x0 is separated from {x | Ax <= b} i.e. mu^T*x0 > 0');disp([' mu^T*x0 = ' num2str(muu'*x0) ]);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -