clear;
x0=[1,5,5,1]';%初始点
x0_old=x0;x0_new=x0+1;
x1=x0;x1_old=x1;x1_new=x1+1;xx=x1;
r=10;%递增系数
r0=0.01;%初始系数值
e=[1,0,0,0;0,1,0,0;0,0,1,0;0,0,0,1];% 坐标轮换法的搜索方向
r1=r0;%临时变量,代表i为不同值时的r的值
f0=getf(x0,r1);
while norm(x0_old-x0_new)>1e-8
x0_old=x1;x0=x1;
r1=r*r0;
f0=getf(x0,r1);
i=1;
while norm(x1_old-x1_new)>1e-5
x1_old=x1;
i=1;
h=3;
f1=getf(x1,r1);
while i<5
i=i+1;
while abs(h)>1e-5
f1=getf(x1,r1);
xx=x1+h.*e(i,:)';
f=getf(xx,r1);
if f<f1
h=h*2;x1=xx;f1=f;
else
h=-h/4;
end
end
end
x1_new=x1;
end
x0_new=x1;
end
x0
getf(x0,r1)
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Outside-the-penalty-function-method.rar (9个子文件)
Outside the penalty function method
zcx.m 135B
main.m 885B
Untitled.asv 789B
getf.asv 323B
Untitled.m 885B
getf.m 357B
Untitled2.m 820B
getdf.m 598B
getdf.asv 707B
共 9 条
- 1
资源评论
weixin_42651887
- 粉丝: 79
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功