• 第三章 非线性规划


    注意:请安装 TeX All The Things 这款Chrome浏览器插件才能正确显示公式。

    链接如下:https://chrome.google.com/webstore/detail/tex-all-the-things/cbimabofgmfdkicghcadidpemeenbffn


     3.1 非线性规划的Matlab解法

    Matlab中非线性规划的数学模型:

    [egin{gathered}
    egin{array}{*{20}{c}}
    {}
    end{array}egin{array}{*{20}{c}}
    {}
    end{array}min egin{array}{*{20}{c}}
    {}
    end{array}f(x) hfill \
    s.t.left{ egin{gathered}
    A cdot x leqslant b, hfill \
    Aeq cdot x = beq, hfill \
    c(x) leqslant 0, hfill \
    ceq(x) = 0, hfill \
    lb leqslant x leqslant ub. hfill \
    end{gathered} ight. hfill \
    end{gathered} ]

    Matlab中的命令是:

    [x,fval]=fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)
    

    例 求下列非线性规划:

    [egin{gathered}
    egin{array}{*{20}{c}}
    {}
    end{array}egin{array}{*{20}{c}}
    {}
    end{array}min egin{array}{*{20}{c}}
    {}
    end{array}f(x) = x_1^2 + x_2^2 + x_3^2 + 8, hfill \
    s.t.left{ egin{gathered}
    x_1^2 - {x_2} + x_3^2 geqslant 0, hfill \
    {x_1} + x_2^2 + x_3^2 leqslant 20, hfill \
    - {x_1} - x_2^2 + 2 = 0, hfill \
    {x_2} + 2x_3^2 = 3, hfill \
    {x_1},{x_2},{x_3} geqslant 0. hfill \
    end{gathered} ight. hfill \
    end{gathered} ]

    Matlab 编程如下:

    共分为三部分:

    子函数1:

    function f=fun1(x);
    f=sum(x.^2)+8;

    子函数2:

    function [g,h]=fun2(x);
    g=[-x(1)^2+x(2)-x(3)^2
    x(1)+x(2)^2+x(3)^3-20];  %非线性不等式约束
    h=[-x(1)-x(2)^2+2
    x(2)+2*x(3)^2-3]; %非线性等式约束
    

    主函数:

    [x,y]=fmincon('fun1',rand(3,1),[],[],[],[],zeros(3,1),[],'fun2')

     


    3.2约束极值问题


    3.2.1二次规划

    [egin{gathered}
    min egin{array}{*{20}{c}}
    {}
    end{array}frac{1}{2}{{mathbf{x}}^T}{mathbf{Hx}} + {f^T}{mathbf{x}} hfill \
    s.t.left{ egin{gathered}
    {mathbf{Ax}} leqslant b, hfill \
    Aeq cdot {mathbf{x}} = beq, hfill \
    lb leqslant {mathbf{x}} leqslant ub. hfill \
    end{gathered} ight. hfill \
    end{gathered} ]

    Matlab中求解二次规划的命令是:

    [x,fval]=quadprog(H,f,A,b,Aeq,beq,lb,ub,x0,options)
    

      

    例子:

    [egin{gathered}
    egin{array}{*{20}{c}}
    {}
    end{array}egin{array}{*{20}{c}}
    {}
    end{array}min f(x) = 2x_1^2 - 4{x_1}{x_2} + 4x_2^2 - 6{x_1} - 3{x_2} hfill \
    s.t.left{ egin{gathered}
    {x_1} + {x_2} leqslant 3, hfill \
    4{x_1} + {x_2} leqslant 9, hfill \
    {x_1},{x_2} geqslant 0. hfill \
    end{gathered} ight. hfill \
    end{gathered} ]

    解:程序如下

    h=[4,-4;-4,8];
    f=[-6;-3];
    a=[1,1;4,1];
    b=[3;9];
    [x,value]=quadprog(h,f,a,b,[],[],zeros(2,1))
    

      

      

  • 相关阅读:
    考虑浏览器兼容的文件上传(IE8不支持FormData)
    IDEA tomcat 部署WEB项目
    如何在springcloud分布式系统中实现分布式锁?
    ABAP DEMO33 选择周的搜索帮助
    ABAP函数篇1 日期函数
    ABAP函数篇2 测试DATE_CONVERT_TO_FACTORYDATE
    增强篇7 判断标准屏幕能否做屏幕增强
    增强篇6 CMOD增强删除
    ABAP DEMO 年月的搜索帮助
    HoloLens开发手记-配置开发环境 Install the tools
  • 原文地址:https://www.cnblogs.com/250101249-sxy/p/11246270.html
Copyright © 2020-2023  润新知