cvx 学习笔记

本文记录了对CVX优化工具的学习心得,重点在于理解如何使用MATLAB实现优化问题,涉及矩阵函数和目标函数的构建。
摘要由CSDN通过智能技术生成
构造cvx变量对象的结构Keyword
banded(lb,ub)  diagonal  hankel  hermitian
skew_symmetric  symmetric  toeplitz  tridiagonal
lower_bidiagonal lower_hessenberg lower_triangular
upper_bidiagonal upper_hankel upper_hessenberg upper_triangular


Sn+: the cone of symmetric positive semidefinite n*n matrices
semidefinite:symmetric/Hermitian positive semidefinite (PSD) matrices 
在matlab里面没有集合操作符,所以在cvx里面我们用一些函数来模拟集合,这些函数能返回一些未命名的新变量如:semidefinite(n) which returns an unnamed new variable, that is constrained to be positive semidefinite.


To require that the matrix expression X be symmetric positive semidefinite, we use the syntax X == semidefinite(n)
the semidefinite constraint above can be replaced by X <In> semidefinite(n);(注意 <In> 不可以在cvx model 外部使用)
例子:
consider the constraint that a (matrix) variable X is a correlation matrix, i.e., it is symmetric,has unit diagonal elements, and is positive semidefinite. In CVX we can declare such a variable and impose these constraints using:
variable X(n,n) symmetric;
X == semidefinite(n);

diag(X) == 1;


variables x y;
z = 2*x - y;
square( z ) <= 3;
quad_over_lin( x, z ) <= 1;
expression holder z is used to differentiate it from a formally declared CVX variable


目标变量和目标表达式的异同

A variable object holds an optimization variable, and cannot be overwritten or assigned in the CVX specification. (After solving the problem, however, CVX will overwrite optimization variables with optimal values.) An expression object, on the other hand, is initialized to zero, and should be thought of as a temporary place to store CVX expressions; it can be assigned to, freely re-assigned, and overwritten in a CVX specification.


DCP ruleset
The DCP ruleset 对于判断凸函数性只是一个充分不必要条件  So it is possible to construct expressions that violate the ruleset but are in fact convex.


四种类型的曲率: constant, affine, convex, and concave
here is significant overlap in these categories. 常数表达式也是放射表达式,而实放射表达式既是凸表达式也是凹表达式,所以常数表达式既是凸表达式也是凹表达式。(For example, constant expressions are also affine,and (real) affine expressions are both convex and concave.)


cvx解决的三类问题:
CVX supports three different types of disciplined convex programs:
• A minimization problem, consisting of a convex objective function and zero or more constraints.
• A maximization problem, consisting of a concave objective function and zero or more constraints.
• A feasibility problem, consisting of one or more constraints and no objective.


cvx Constraints 的三类约束
• An equality constraint, constructed using ==, where both sides are affine.
• A less-than inequality constraint, using <=, where the left side is convex and the right side is concave.
• A greater-than inequality constraint, using >=, where the left side is concave and the right side is convex.


注意事项:
Non-equality constraints, constructed using ~=, are never allowed. (Such constraints are not convex.)
One or both sides of an equality constraint may be complex; inequality constraints, on the other hand, must be real. A complex equality constraint is equivalent to two real equality constraints, one for the real part and one for the imaginary part. An equality constraint with a real side and a complex side has the effect of constraining the imaginary part of the complex side to be zero.


DCP表达式定义规则
• A valid constant expression is
– any well-formed Matlab expression that evaluates to a finite value.
• A valid affine expression is
– a valid constant expression;
– a declared variable;
– a valid call to a function in the atom library with an affine result;
– the sum or difference of affine expressions;
– the product of an affine expression and a constant.
• A valid convex expression is
– a valid constant or affine expression;
– a valid call to a function in the atom library with a convex result;
– an affine scalar raised to a constant power p 1, p 6 = 3; 5; 7; 9; :::;
– a convex scalar quadratic form—see Scalar quadratic forms;
– the sum of two or more convex expressions;
– the difference between a convex expression and a concave expression;
– the product of a convex expression and a nonnegative constant;
– the product of a concave expression and a nonpositive constant;
– the negation of a concave expression.
• A valid concave expression is
– a valid constant or affine expression;
– a valid call to a function in the atom library with a concave result;
– a concave scalar raised to a power p 2 (0; 1);
– a concave scalar quadratic form—see Scalar quadratic forms;
– the sum of two or more concave expressions;
– the difference between a concave expression and a convex expression;
– the product of a concave expression and a nonnegative constant;
– the product of a convex expression and a nonpositive constant;
– the negation of a convex expression.
If an expression cannot be categorized by this ruleset, it is rejected by CVX. For matrix and array expressions, these rules are applied on an elementwise basis.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值