Matlab内置的约束优化函数用法课件

上传人:hs****ma 文档编号:569374957 上传时间:2024-07-29 格式:PPT 页数:25 大小:366KB
返回 下载 相关 举报
Matlab内置的约束优化函数用法课件_第1页
第1页 / 共25页
Matlab内置的约束优化函数用法课件_第2页
第2页 / 共25页
Matlab内置的约束优化函数用法课件_第3页
第3页 / 共25页
Matlab内置的约束优化函数用法课件_第4页
第4页 / 共25页
Matlab内置的约束优化函数用法课件_第5页
第5页 / 共25页
点击查看更多>>
资源描述

《Matlab内置的约束优化函数用法课件》由会员分享,可在线阅读,更多相关《Matlab内置的约束优化函数用法课件(25页珍藏版)》请在金锄头文库上搜索。

1、约束优化-Matlabfminconhelp fmincondoc fmincontype fminconEdit fminconx = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)Karush-Kuhn-Tucker (KKT) conditions例1 线性约束fmincon linprog也可解此类问题lingprogf=5 3;A=5 3;-1 -1;-1 0;0 -1;b=70;-15;-5;0;x0=0;0;x,fval=linprog(f,A,b, , ,x0)x = linprog(f,A,b,Aeq,beq,lb,ub,x

2、0)f=5 3;A=5 3;-1 -1;b=70;-15;x0=0;0;lb=5;0;x,fval=linprog(f,A,b, , ,lb,x0)x = linprog(f,A,b,Aeq,beq,lb,ub,x0)function f=ros(x)f=5*x(1) + 3*x(2);A=5 3;-1 -1;b=70;-15;x0=0;0;lb=5;0;x, fval = fmincon(ros,x0,A,b,lb)x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)例2: Rosenbrocks Function非线性约束fmincon

3、s.t.x = fmincon(myfun,x0,A,b,Aeq,beq,lb,ub,mycon)where mycon isa MATLAB function such asfunction c,ceq = mycon(x)c = . % Compute nonlinear inequalities at x.ceq = . % Compute nonlinear equalities at x.function f = rosenbrock(x)f = 100*(x(2) - x(1)2)2 + (1 - x(1)2;function c, ceq = unitdisk(x)c = x(1

4、)2 + x(2)2 - 1;ceq = ;function c,ceq = mycon(x)c = . % Compute nonlinear inequalities at x.ceq = . % Compute nonlinear equalities at x.x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)options = optimset(Display,iter,Algorithm,active-set);x,fval = fmincon(rosenbrock,0 0,. ,unitdisk,options)x,fval

5、 = fmincon(rosenbrock,0 0, ,unitdisk)例3 线性和非线性约束 fminconx = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)例4Constrained Minimization Using patternsearchpatternsearchfunction y = simple_objective(x)y = (4 - 2.1*x(1)2 + x(1)4/3)*x(1)2 + x(1)*x(2) + (-4 + 4*x(2)2)*x(2)2;function c, ceq = simple_cons

6、traint(x)c = 1.5 + x(1)*x(2) + x(1) - x(2);-x(1)*x(2) + 10;ceq = ;ObjectiveFunction = simple_objective;X0 = 0 0; % Starting pointLB = 0 0; % Lower boundUB = 1 13; % Upper boundConstraintFunction = simple_constraint;x,fval = patternsearch(ObjectiveFunction,X0,. LB,UB,ConstraintFunction)options = psoptimset(PlotFcns,psplotbestf,psplotmaxconstr,Display,iter);x,fval = patternsearch(ObjectiveFunction,X0,LB,UB,ConstraintFunction,options)

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 建筑/环境 > 施工组织

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号