⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 a.txt

📁 求解一些数学中最常见遇到的非线性最优化的模型
💻 TXT
字号:
一,function RES=myobjfunc(g)
RES=0.1394*(0.56*(120-g(1))+0.0091*(120-g(2))^2)+0.0738*(0.495*(120-g(1))+0.0081*(120-g(2))^2)+...
    0.6068*(2.7*(120-g(1))+0.00427*(120-g(3))^2)+0.09*g(3);
function[C,CEQ]=mymodelcons(g)
C(1)=g(1)+g(2)+g(3)-117;
CEQ=[];
                                                                     >> g0=[117/3,117/3,117/3];
>> A=[1 1 1;-1 0 0; 0 -1 0;0 0 -1];
>> b=[117;-10;-10;-10];
>> [g,fval]=fmincon(@myobjfunc,g0,A,b)
Warning: Large-scale (trust region) method does not currently solve this type of problem,
 switching to medium-scale (line search).
> In fmincon at 274
Optimization terminated: first-order optimality measure less
 than options.TolFun and maximum constraint violation is less
 than options.TolCon.
Active inequalities (to within options.TolCon = 1e-006):
  lower      upper     ineqlin   ineqnonlin
                          1           
                          3           
                          4           

g =

    97    10    10


fval =

   95.1520


function RES=myobjfunc(g)
RES=0.1258*(0.56*(120-g(1))+0.0091*(120-g(2))^2)+0.0666*(0.495*(120-g(1))+0.0081*(120-g(2))^2)+...
    0.5476*(2.7*(120-g(1))+0.00427*(120-g(3))^2)+0.13*g(3);
function[C,CEQ]=mymodelcons(g)
C(1)=g(1)+g(2)+g(3)-117;
CEQ=[];


>> g0=[117/3,117/3,117/3];
>> A=[1 1 1;-1 0 0; 0 -1 0;0 0 -1];
>> b=[117;-10;-10;-10];
>> [g,fval]=fmincon(@myobjfunc,g0,A,b)
Warning: Large-scale (trust region) method does not currently solve this type of problem,
 switching to medium-scale (line search).
> In fmincon at 274
Optimization terminated: first-order optimality measure less
 than options.TolFun and maximum constraint violation is less
 than options.TolCon.
Active inequalities (to within options.TolCon = 1e-006):
  lower      upper     ineqlin   ineqnonlin
                          1           
                          3           
                          4           

g =

    97    10    10


fval =

   86.3567
第三个和第一个的程序是一样的,第四个的程序和第二个一样的。也就是只要第一个系数不变,另外两个变化不影响结果。(这个是我的计算结果)



五,function RES=myobjfunc(g)
RES=0.102*(0.56*(120-g(1))+0.0091*(120-g(2))^2)+0.054*(0.495*(120-g(1))+0.0081*(120-g(2))^2)+...
    0.444*(2.7*(120-g(1))+0.00427*(120-g(3))^2)+0.2*g(3);
function[C,CEQ]=mymodelcons(g)
C(1)=g(1)+g(2)+g(3)-117;
CEQ=[];

>> g0=[117/3,117/3,117/3];
>> A=[1 1 1;-1 0 0; 0 -1 0;0 0 -1];
>> b=[117;-10;-10;-10];
>> [g,fval]=fmincon(@myobjfunc,g0,A,b)
Warning: Large-scale (trust region) method does not currently solve this type of problem,
 switching to medium-scale (line search).
> In fmincon at 274
Optimization terminated: first-order optimality measure less
 than options.TolFun and maximum constraint violation is less
 than options.TolCon.
Active inequalities (to within options.TolCon = 1e-006):
  lower      upper     ineqlin   ineqnonlin
                          1           
                          3           
                          4           

g =

    97    10    10


fval =

   70.9649



六,
function RES=myobjfunc(g)
RES=0.085*(0.56*(120-g(1))+0.0091*(120-g(2))^2)+0.045*(0.495*(120-g(1))+0.0081*(120-g(2))^2)+...
    0.37*(2.7*(120-g(1))+0.00427*(120-g(3))^2)+0.25*g(3);
function[C,CEQ]=mymodelcons(g)
C(1)=g(1)+g(2)+g(3)-117;
CEQ=[];


>> g0=[117/3,117/3,117/3];
>> A=[1 1 1;-1 0 0; 0 -1 0;0 0 -1];
>> b=[117;-10;-10;-10];
>> [g,fval]=fmincon(@myobjfunc,g0,A,b)
Warning: Large-scale (trust region) method does not currently solve this type of problem,
 switching to medium-scale (line search).
> In fmincon at 274
Optimization terminated: first-order optimality measure less
 than options.TolFun and maximum constraint violation is less
 than options.TolCon.
Active inequalities (to within options.TolCon = 1e-006):
  lower      upper     ineqlin   ineqnonlin
                          1           
                          3           
                          4           

g =

    97    10    10


fval =

   59.9707

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -