CVX简介,下载和安装

CVX

CVX 是基于matlab的凸函数最优化问题建模系统,可以将matlab语言转变成建模语言,允许利用标准的matlab表示符号,加入约束和特定的目标函数,例如考虑下列凸函数最优化模型:

minimize

∥Ax−b∥2

subject to

Cx=d

∥x∥∞≤e

用CVX工具箱提供的方法可以将matlab代码写为:

m = 20; n = 10; p = 4;

A = randn(m,n); b = randn(m,1);

C = randn(p,n); d = randn(p,1); e = rand;

cvx_begin

    variable x(n)

    minimize( norm( A * x - b, 2 ) )

    subject to

        C * x == d

        norm( x, Inf ) <= e

cvx_end

 

 

下载和安装:

在matlab中运行mexext,根据输出结果和平台选择合适的下载包下载。

下载地址:

http://cvxr.com/cvx/download/

本文设备平台为win7,matlab mexext显示 mexw64

1下载cwx-w64.zip并解压缩

2将解压文件夹放在一个目录中,如D:\我的文档\我的程序\cvx-w64\cvx

3. 用matlab进入该文件夹,在Current Folder窗口中打开cvx文件夹
4.在Command Window中输入cvx_setup
5.显示:
Testing the cvx distribution. If this script aborts with
an error, please report the error to the authors.
-------------------------------------------------------------
No errors! cvx has been successfully installed.

NOTE: The MATLAB path has been updated to point to the cvx distribution.
In order to use cvx regularly, you must save this new path definition.
6.在MATLAB的File菜单下的set path把此路径加上。

7.把路径加进去后在file→Preferences→General的Toolbox Path Caching里点击update Toolbox Path Cache更新一下
8.完成


你可能感兴趣的:(CVX简介,下载和安装)