加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

YALMIP学习总结1

(2010-01-25 16:12:36)
标签:

academic

optimization

software

yalmip

杂谈

分类: 建模优化
1.norm(x,n):x的n范数,在SOCP中经常使用
2.当对QP问题优化时,最好引入辅助变量,这使得内点算法面临的矩阵稀疏化,有利于快速求解
aux = sdpvar(length(residuals),1);
solvesdp([aux == residuals],aux'*aux);
3.方阵默认是对称的,因此>=0是正定的意思;非方阵以及full paremeterized方阵(如P = sdpvar(3,3,'full'))>=0是针对每个元素而言的
4.所有约束用一个[]扩起来,“,”号分割
  C = [P>=0, P(1,1)<=2, sum(sum(P))==10];
5.几种特殊矩阵(也可以用sdpvar()的第三个参数来指定)
x = sdpvar(n,1);
D = diag(x) ;    % Diagonal matrix
H = hankel(x);   % Hankel matrix
T = toeplitz(x); % Toeplitz matrix
6.SOCP的建模与求解
Let us continue with our regression problem from the linear and quadratic programming tutorial.

The problem boiled down to solving the problem minimize ||Ax-y|| for some suitable norm. Let us select the 2-norm, but this

time solve the extension where we minimize the worst-case cost, under the assumption that the matrix A is uncertain,A=A+d,

where ||d||2<1. This can be shown to be equivalent to minimizing ||Ax-y||2 + ||x||2.

This problem can easily be solved using YALMIP. Begin by defining the data.
x = [1 2 3 4 5 6]';
t = (0:0.02:2*pi)';
A = [sin(t) sin(2*t) sin(3*t) sin(4*t) sin(5*t) sin(6*t)];
e = (-4+8*rand(length(A),1));
y = A*x+e;


As a first approach, we will do the modelling by hand, by adding second order cones using the low-level command cone.
xhat = sdpvar(6,1);
sdpvar u v

F = [cone(y-A*xhat,u), cone(xhat,v)];
solvesdp(F,u + v);


By using the automatic modelling support in the nonlinear operator framework, we can alternatively write
solvesdp([],norm(y-A*xhat,2) + norm(xhat,2));

YALMIP will automatically model this as a second order cone problem, and solve it as such if a second order cone programming

solver is installed (SeDuMi, SDPT3 or Mosek). If no second order cone programming solver is found, YALMIP will convert the

model to a semidefinite program and solve it using any installed semidefinite programming solver. 

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有