• test for cvx library in matlab


    Download the zip file of cvx

    http://cvxr.com/cvx/download/ by downloading cvx-w64.zip

    Require a licence for academic use

    a file named cvx_license.dat 

    Install with licence

    unzip the zip file into the toolbox directory ($MatlabRoot oolbox)

    run the command in matlab after entering the directory of cvx (adding the path of licence file)

    >> cvx_setup E:softwareMATLABR2014a oolboxcvxcvx_license.dat

    Then

    ---------------------------------------------------------------------------
    CVX: Software for Disciplined Convex Programming (c)2014 CVX Research
    Version 2.1, Build 1112 (ef41608) Sun Oct 2 17:15:09 2016
    ---------------------------------------------------------------------------

    Test with simple script

    cvx_test.m

     1 m = 20; n = 10; p = 4;
     2 A = randn(m,n); b = randn(m,1);
     3 C = randn(p,n); d = randn(p,1); e = rand;
     4 cvx_begin
     5     variable x(n)
     6     minimize( norm( A * x - b, 2 ) )
     7     subject to
     8         C * x == d
     9         norm( x, Inf ) <= e
    10 cvx_end

    run the script

     1 >> cvx_test
     2  
     3 Calling SDPT3 4.0: 56 variables, 22 equality constraints
     4    For improved efficiency, SDPT3 is solving the dual problem.
     5 ------------------------------------------------------------
     6 
     7  num. of constraints = 22
     8  dim. of socp   var  = 41,   num. of socp blk  = 11
     9  dim. of linear var  = 11
    10  dim. of free   var  =  4 *** convert ublk to lblk
    11 *******************************************************************
    12    SDPT3: Infeasible path-following algorithms
    13 *******************************************************************

    ------------------------For abbreviatin --------------
    14 rel. primal infeas (scaled problem) = 2.01e-09 15 rel. dual " " " = 6.95e-10 16 rel. primal infeas (unscaled problem) = 0.00e+00 17 rel. dual " " " = 0.00e+00 18 norm(X), norm(y), norm(Z) = 1.5e+00, 4.5e+00, 6.4e+00 19 norm(A), norm(b), norm(C) = 1.8e+01, 2.0e+00, 6.3e+00 20 Total CPU time (secs) = 0.07 21 CPU time per iteration = 0.01 22 termination code = 0 23 DIMACS: 2.0e-09 0.0e+00 1.2e-09 0.0e+00 6.3e-09 6.2e-09 24 ------------------------------------------------------------------- 25 26 ------------------------------------------------------------ 27 Status: Solved 28 Optimal value (cvx_optval): +4.29018
  • 相关阅读:
    Cocos Creator脚本开发事例
    java调用sap的webservice(需要登录验证)
    Lua require 相对路径
    C++学习笔记
    Lua MD5加密字符串
    USE " cc.exports.* = value " INSTEAD OF SET GLOBAL VARIABLE"
    cocos2d-x学习笔记
    麻将胡牌算法研究
    Tomcat服务器配置https双向认证(使用keytool生成证书)
    MySQL密码忘了怎么办?MySQL重置root密码方法
  • 原文地址:https://www.cnblogs.com/loadofleaf/p/6202667.html
Copyright © 2020-2023  润新知