yalmip

yalmip是一个前端优化,后端可以连接多种优化器,推荐使用Mosek,具体安装请参看两者的官网

yalmip官网 https://yalmip.github.io/

% yalmip 优化LASSO的例子
x = sdpvar(T, 1)
Objective = 1/2 * norm(y-A*x,2) + lambda * norm(x,1);
options = sdpsettings('solver','mosek','verbose',0,'allownonconvex',0);
optimize([],Objective,options);
x = value(x);

CVX

cvx是一种建模语言,写起来会比较简单,但是只能在matlab里使用

cvx官网 http://cvxr.com/cvx/

% cvx 优化LASSO的例子
cvx_begin
    variable x(T)
    variable u(T)
    minimize(0.5*sum_square(y-A*x)+lambda * norm(x,1));
cvx_end

MOSEK

mosek官网 https://mosek.com/

Mosek是一个商业优化器,Mosek有两种接口,一种是低级的是直接接口写起来会比较复杂,另一种是Fusion接口这是一种面向对象式的接口,在多种语言上都通用。这种接口实际上是针对二阶锥优化的。

results matching ""

    No results matching ""