MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   进化计算 (https://www.labfans.com/bbs/forumdisplay.php?f=46)
-   -   一个模拟退火算法函数运行小问题,请教高人给指点一下 (https://www.labfans.com/bbs/showthread.php?t=9799)

qjjqh 2009-09-30 09:39

一个模拟退火算法函数运行小问题,请教高人给指点一下
 
在编写一个模拟退火算法时,有一个函数调用时报错如下"??? Attempt to execute SCRIPT an11 as a function.

Error in ==> sa_0930 at 6
f1=an11(x1);"


两函数如下:
这是an11.m函数
functon y=aneal_f1(x)
y=100*(x(1)^2-x(2))^2+(1-x(1))^2;
下面是主函数
x1=[1 1];
T=10000;
a=0.9;
N=1;
while T>1
f1=an11(x1);
x2(1)=x1(1)+0.2*(rand-0.5);
x2(2)=x1(2)+0.2*(rand-0.5);
f2=an11(x2);
if f2-f1<0
T=T*a;
x1=x2;
cc(N)=f2;
N=N+1;
elseif exp((f1-f2)/T)>rand
T=T*a;
x1=x2;
cc(N)=f2;
N=N+1;
end
end
f1=an11(x1);
disp('The result are:')
disp('x(1) x(2)')
disp(x1)
disp('The objective fuction is:')
disp(f1)
tt=1:N-1;
plot(tt,cc)
time1=datestr(now)
mm=1;
while mm<=1000
aneal_f1;
opf(mm)=f1;
mm=mm+1;
end
time2=datestr(now)
min(opf)
max(opf)
mean(opf)

toby1713 2009-10-29 21:02

回复: 一个模拟退火算法函数运行小问题,请教高人给指点一下
 
你好,我在另外一个你回复的帖子上看到你是遗传算法优化神经网络的高手。能否将遗传算法优化神经网络的程序传我一份呢?在此谢过了。
我原先从网上下载的程序现在运行不了了。小弟在论文中用到该方法,因为论文修改,相应修改了一些数据,但是就不晓得现在怎么运行不出来了。而我对编写程序这方面基本不懂。非常感谢。:)
希望这个大哥能传小弟一份。邮箱地址为[email protected].

qjjqh 2009-11-01 09:51

回复: 一个模拟退火算法函数运行小问题,请教高人给指点一下
 
1 个附件
我给你一份放这,你自己下哈,要还不行我再发你邮箱


所有时间均为北京时间。现在的时间是 19:59

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.