请问哪位有模拟退火遗传算法的源程序?

作者&投稿:乘眨 (若有异议请与网页底部的电邮联系)
谁有遗传退火模拟算法的源程序啊~

我有遗传算法的源代码!模拟退火我没仔细研究!一般来说,当其他算法应用在遗传算法中时一般是为了修改“变异率”,其实你可以用自适应的方法代替模拟退火,即自适应遗传算法就够用了吧?!

你真幸福。我刚刚编了一个模拟退火算法,计算旅行商问题:注意:一共三个文件,第一个是主程序,下面两个是子函数。
% for d=1:50 %循环10次发现最小路径为4.115,循环50次有3次出现4.115
T_max=80; %input('please input the start temprature');
T_min=0.001; %input('please input the end temprature');
iter_max=100;%input('please input the most interp steps on the fit temp');
s_max=100; %input('please input the most steady steps ont the fit temp');
T=T_max;
load .\address.txt;

order1=randperm(size(address,1))';%生成初始解。
figure(1);
plot(address(order1,1),address(order1,2),'*r-')
title('随机产生的路径');
totaldis1=distance(address,order1);
for n=1:size(address,1)
text(address(n,1)+0.01,address(n,2),num2str(n))%标号
end
text(0.9,0.9,num2str(totaldis1))

figure(2);

while T>=T_min
iter_num=1;
s_num=1;
plot(T,totaldis1,'r.')
hold on
while iter_num<iter_max&s_num<s_max;
order2=exhgpath(order1); %随机交换两个城市位置
totaldis2=distance(address,order2);
R=rand;
DeltaDis=totaldis2-totaldis1; %新的距离-原来的距离
if DeltaDis<0;
order1=order2;
totaldis1=totaldis2; %新距离小,无条件接受
elseif (exp((totaldis1-totaldis2)/(T))>R)%%%%本算法最核心的思想:以一定概率接受坏的结果,防止局部最优
order1=order2;
totaldis1=totaldis2;
else s_num=s_num+1;
end
iter_num=iter_num+1;
end
T=T*0.99;
end

set(gca,'xscale','log');%或者使用semilogx,有相同效果
xlabel('退火温度');ylabel('总距离');
order1
totaldis1
figure(3)
plot(address(order1,1),address(order1,2),'*b-')
title('最终路径');
for n=1:size(address,1)
text(address(n,1)+0.01,address(n,2),num2str(n))%标号
end
text(0.9,0.9,num2str(totaldis1))
dstc(d)=totaldis1;
% end
——————————————————————————————
function y=exhgpath(order)
while 1
b=size(order,1);
r=unidrnd(b,1,2);
if r(1)-r(2)~=0
break
end
end
b=order(r(2));
order(r(2))=order(r(1));
order(r(1))=b;
y=order;
------------------------------------------------------------
function y=distance(address,order)
nmb=size(address,1);
y=0;
for i=1:nmb-1
y=y+sqrt((address(order(i+1),1)-address(order(i),1))^2+(address(order(i+1),2)-address(order(i),2))^2);
end
y=y+sqrt((address(order(i+1),1)-address(order(1),1))^2+(address(order(i+1),2)-address(order(1),2))^2);

遗传算法求解f(x)=xcosx+2的最大值

其中在尺度变换部分应用到了类似模拟退火算法部分,所有变量均使用汉语拼音很好懂

//中国电子科技集团公司

//第一研究室

//呼文韬

//hu_hu605@163.com

//随机初始种群
//编码方式为格雷码
//选择方法为随机遍历
//采用了精英保存策略
//采用了自适应的交叉率和变异率
//采用了与模拟退火算法相结合的尺度变换
//采用了均匀交叉法

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <iostream.h>
#include <iomanip.h>
#include <time.h>
#include <windows.h>
#define IM1 2147483563
#define IM2 2147483399
#define AM (1.0/IM1)
#define IMM1 (IM1-1)
#define IA1 40014
#define IA2 40692
#define IQ1 53668
#define IQ2 52774
#define IR1 12211
#define IR2 3791
#define NTAB 32
#define NDIV (1+IMM1/NTAB)
#define EPS 1.2e-7
#define RNMX (1.0-EPS)
#define zhizhenjuli 0.005
#define PI 3.14159265358
#define T0 100000//温度要取得很高才行。
#define zhongqunshu1 200
#define zuobianjie -2000
#define youbianjie 2000
unsigned int seed=0; //seed 为种子,要设为全局变量
void mysrand(long int i) //初始化种子
{
seed = -i;
}
long a[1];
//double hundun;
//double c=4;
//设置全局变量
struct individual
{
unsigned *chrom; //染色体;
double geti;//变量值
double shiyingdu; //目标函数的值;
double fitness; //变换后的适应度值;
};
individual *zuiyougeti;//精英保存策略
int zhongqunshu; //种群大小
individual *nowpop;//当前代
individual *newpop;//新一代
double sumfitness;//当代的总适应度fitness
double sumshiyingdu;//当代的总适应度shiyingdu
double maxfitness;//最大适应度
double avefitness;//平均适应度
double maxshiyingdu;//最大适应度
double avgshiyingdu;//平均适应度
float pc;//交叉概率
float pm;//变异概率
int lchrom;//染色体长度
int maxgen;//最大遗传代数
int gen;//遗传代数
//函数
int flipc(double ,double );//判断是否交叉
int flipm(double );//判断是否变异
int rnd(int low,int high);//产生low与high之间的任意数
void initialize();//遗传算法初始化
void preselectfitness(); //计算sumfiness,avefitness,maxfitness
void generation();
double suijibianli();//产生随机遍历指针
int fuzhi(float );//选择要复制的个体
void crossover(individual ,individual ,individual &,individual &);//交叉
void bianyi(individual &);//变异
void mubiaohanshu(individual &);//计算适应度
void chidubianhuan(individual &);//对shiyingdu进行尺度变换赋给fitness
double ran1(long *);//随机数初始
void bianma(double bianliang,unsigned *p);//编码
double yima(unsigned *p);
void guanjiancanshujisuan();//计算shiyingdu,根据shiyingdu计算sumshiyingdu,对shiyingdu进行尺度变换变成fitness,根据fitness计算sumfitness,avefitness,maxfitness
void jingyingbaoliu();
void glp(int n,int s,int *,int (*)[1],float (*)[1]);//glp生成函数
BOOL Exist(int Val, int Num, int *Array);//判断一个数在前面是否出现过
int cmpfitness(const void *p1,const void *p2)
{
float i=((individual *)p1)->shiyingdu;//现在是按照"适应度"排序,改成"个体"的话就是按照"个体"排序
float j=((individual *)p2)->shiyingdu;
return i<j ? -1:(i==j ? 0:1);//现在是按升序牌排列,将1和-1互换后就是按降序排列
}
void main()
{
initialize();
cout<<zuiyougeti->geti<<" "<<zuiyougeti->shiyingdu<<endl;/////////////
for(gen=1;gen<maxgen;gen++)
{ generation();
}
jingyingbaoliu();
cout<<setiosflags(ios::fixed)<<setprecision(6)<<zuiyougeti->geti<<" "<<setiosflags(ios::fixed)<<setprecision(6)<<(zuiyougeti->shiyingdu)<<endl;////////////////
delete [] newpop;
delete [] nowpop;
delete [] zuiyougeti;
system("pause");
}
void initialize()
{
int q[zhongqunshu1][1],s=1;
float xx[zhongqunshu1][1];//生成的glp用x储存
int h[1]={1};//生成向量
zuiyougeti=new individual;//最优个体的生成
zhongqunshu=200;//种群数量
nowpop=new individual[zhongqunshu1];//当代
newpop=new individual[zhongqunshu1];//新一代
maxgen=150;//最大代数
gen=0;//起始代
lchrom=22;//基因数量的初始化
mysrand(time(0));//随机数种子
a[0]=seed;//随机数种子
//对最优个体的初始化
zuiyougeti->geti=0;
zuiyougeti->fitness=0;
zuiyougeti->shiyingdu=0;
//
glp(zhongqunshu,s,h,q,xx);
//for(int i=0;i<zhongqunshu1;i++)//产生初始种群
//{
// for(int j=0;j<s;j++)
// {
// nowpop[i].geti=zuobianjie+(youbianjie-zuobianjie)*xx[i][j];
// }
//}
for(int i=0;i<zhongqunshu1;i++)//产生初始种群
{
nowpop[i].geti=zuobianjie+(youbianjie-(zuobianjie))*ran1(a);
}
//nowpop[0].geti=999;//////////////////////////
guanjiancanshujisuan();
jingyingbaoliu(); //精英保留的实现
guanjiancanshujisuan();//计算shiyingdu,根据shiyingdu计算sumshiyingdu,对shiyingdu进行尺度变换变成fitness,根据fitness计算sumfitness,avefitness,maxfitness
}
void jingyingbaoliu() //精英保留的实现
{
individual *zuiyougetiguodu;
zuiyougetiguodu=new individual[zhongqunshu1];//建立一个过渡数组
for(int i=0;i<zhongqunshu;i++)//将当代个体复制到过渡数组中
zuiyougetiguodu[i]=nowpop[i];
qsort(zuiyougetiguodu,zhongqunshu1,sizeof(individual),&cmpfitness);//按fitness升序排序
// cout<<"zuiyougetiguodu适应度:"<<zuiyougetiguodu[zhongqunshu1-1].shiyingdu<<endl;///////////
// cout<<"zuiyougeti适应度:"<<zuiyougeti->shiyingdu<<endl;///////////////////
//system("pause");
if(zuiyougetiguodu[zhongqunshu-1].shiyingdu>zuiyougeti->shiyingdu)
{
*zuiyougeti=zuiyougetiguodu[zhongqunshu1-1];//如果最优个体的fitness比当代最大的fitness小则用当代的代替之
//cout<<"zuiyougetiguodu个体:"<<zuiyougetiguodu[zhongqunshu1-1].geti<<endl;/////////////
//cout<<"zuiyougeti个体:"<<zuiyougeti->geti<<endl;/////////////
}
else
nowpop[rnd(0,(zhongqunshu1-1))]=*zuiyougeti;//否则的话从当代中随机挑选一个用最优个体代替之
delete [] zuiyougetiguodu;//释放过渡数组
}
void guanjiancanshujisuan()//计算shiyingdu,根据shiyingdu计算sumshiyingdu,对shiyingdu进行尺度变换变成fitness,根据fitness计算sumfitness,avefitness,maxfitness
{
for(int i=0;i<zhongqunshu;i++)//计算shiyingdu
mubiaohanshu(nowpop[i]);
for(i=0;i<zhongqunshu;i++)//对shiyingdu进行尺度变换变成fitness
chidubianhuan(nowpop[i]);
preselectfitness();//根据fitness计算sumfitness,avefitness,maxfitness
}
void mubiaohanshu(individual &bianliang)//计算shiyingdu
{
bianliang.shiyingdu=(bianliang.geti*cos(bianliang.geti)+2.0);//目标函数
}
void chidubianhuan(individual &bianliang)//对shiyingdu进行尺度变换变成fitness
{
double T;//退火温度
T=T0*(pow(0.99,(gen+1-1)));
double sum=0;
for(int j=0;j<zhongqunshu;j++)
sum+=exp(nowpop[j].shiyingdu/T);
bianliang.fitness=exp(bianliang.shiyingdu/T)/sum;//算出fitness
}
void preselectfitness()//根据fitness计算sumfitness,avefitness,maxfitness
{
int j;
sumfitness=0;
for(j=0;j<zhongqunshu;j++)
sumfitness+=nowpop[j].fitness;
individual *guodu;
guodu=new individual[zhongqunshu1];
for(j=0;j<zhongqunshu;j++)
guodu[j]=nowpop[j];
qsort(guodu,zhongqunshu1,sizeof(individual),&cmpfitness);
maxfitness=guodu[zhongqunshu1-1].fitness;
avefitness=sumfitness/zhongqunshu1;
delete [] guodu;
}
void generation()
{
individual fuqin1,fuqin2,*pipeiguodu,*pipeichi;
int *peiduishuzu;//用来存放产生的随机配对
pipeiguodu=new individual[zhongqunshu1];
pipeichi=new individual[zhongqunshu1];
peiduishuzu=new int[zhongqunshu1];
int member1,member2,j=0,fuzhijishu=0,i=0,temp=0,tt=0;
float zhizhen;
//随机遍历的实现
for(zhizhen=suijibianli();zhizhen<1;(zhizhen=zhizhen+zhizhenjuli))//设定指针1/66
{
pipeichi[fuzhijishu]=nowpop[fuzhi(zhizhen)];
fuzhijishu++;
}

//交叉与变异的实现
//交叉
for(i=0;i<zhongqunshu1;i++)
{
peiduishuzu[i]=-1;
}
for (i=0; i<zhongqunshu1; i++)
{
temp =rnd(0,zhongqunshu1-1); //产生值在0-zhongqunshu1-1的随机数
while(Exist(temp, i, peiduishuzu))//判断产生的随机数是否已经产生过,如果是,则再产生一个随机数
{
temp =rnd(0,zhongqunshu1-1);
}
//如果没有的话,则把产生的随机数放在peiduishuzu中
*(peiduishuzu+i) = temp;
}
for(i=0;i<zhongqunshu1-1;i=i+2)
{
fuqin1=pipeichi[peiduishuzu[i]];
fuqin2=pipeichi[peiduishuzu[i+1]];
crossover(fuqin1,fuqin2,newpop[i],newpop[i+1]);
}
for(j=0;j<zhongqunshu1;j++)
{
//if(newpop[j].geti<-1000)
//cout<<"个体数值小于下界了";
nowpop[j].geti=newpop[j].geti;
}
//
guanjiancanshujisuan();
//变异的实现
for(j=0;j<zhongqunshu;j++)
{
bianyi(nowpop[j]);
}
//
guanjiancanshujisuan();
//精英保留的实现
jingyingbaoliu();
//
guanjiancanshujisuan();
delete [] peiduishuzu;
delete [] pipeichi;
delete [] pipeiguodu;
}
void crossover(individual parent1,individual parent2,individual &child1,individual &child2)//交叉
{
int j;
unsigned *panduan;
panduan=new unsigned[lchrom];
parent1.chrom=new unsigned[lchrom];
parent2.chrom=new unsigned[lchrom];
child1.chrom=new unsigned[lchrom];
child2.chrom=new unsigned[lchrom];
//cout<<"jiaocha"<<endl;///////////////////////
bianma(parent1.geti,parent1.chrom);
bianma(parent2.geti,parent2.chrom);
if(flipc(parent1.fitness,parent2.fitness))
{
for(j=0;j<lchrom;j++)
panduan[j]=rnd(0,1);
//for(j=0;j<lchrom;j++)////////////////
// {
// cout<<panduan[j];/////////////
// }
// cout<<endl;////////////////
// system("pause");////////////////
for(j=0;j<lchrom;j++)
{
if(panduan[j]==1)
child1.chrom[j]=parent1.chrom[j];
else
child1.chrom[j]=parent2.chrom[j];
}
for(j=0;j<lchrom;j++)
{
if(panduan[j]==0)
child2.chrom[j]=parent1.chrom[j];
else
child2.chrom[j]=parent2.chrom[j];
}
//for(j=0;j<lchrom;j++)////////////////
//{
// cout<<child1.chrom[j];/////////////
// }
//cout<<endl;////////////////
// system("pause");////////////////
child1.geti=yima(child1.chrom);
child2.geti=yima(child2.chrom);
delete [] child2.chrom;
delete [] child1.chrom;
delete [] parent2.chrom;
delete [] parent1.chrom;
delete [] panduan;
}
else
{
for(j=0;j<lchrom;j++)
{
child1.chrom[j]=parent1.chrom[j];
child2.chrom[j]=parent2.chrom[j];
}
child1.geti=yima(child1.chrom);
child2.geti=yima(child2.chrom);
delete [] child2.chrom;
delete [] child1.chrom;
delete [] parent2.chrom;
delete [] parent1.chrom;
delete [] panduan;
}
}
void bianyi(individual &child)//变异
{
child.chrom=new unsigned[lchrom];
//cout<<"变异"<<endl;
bianma(child.geti,child.chrom);
for(int i=0;i<lchrom;i++)
if(flipm(child.fitness))
{
if(child.chrom[i]=0)
child.chrom[i]=1;
else
child.chrom[i]=0;
}
child.geti=yima(child.chrom);
delete [] child.chrom;
}
void bianma(double bianliang,unsigned *p)//编码
{
unsigned *q;
unsigned *gray;
q=new unsigned[lchrom];
gray=new unsigned[lchrom];
int x=0;
int i=0,j=0;
if(bianliang<zuobianjie)///////////////////
{
cout<<"bianliang:"<<bianliang<<endl;/////////
system("pause");
}
//cout<<youbianjie-(zuobianjie)<<endl;
//system("pause");
x=(bianliang-(zuobianjie))*((pow(2,lchrom)-1)/(youbianjie-(zuobianjie)));
//cout<<x<<endl;///////////
if(x<0)
system("pause");///////////
for(i=0;i<lchrom;i++)
{
q[i]=0;
p[i]=0;
}
i=0;
while (x!=0&&(i!=lchrom))
{
q[i]=(unsigned)(x%2);
x=x/2;
i++;
}
// for(i=0;i<lchrom;i++)//////////////////
// cout<<q[i];///////////////
// cout<<endl;///////////
int w=lchrom-1;
if(q[w]!=0&&q[w]!=1)
system("pause");
for(j=0;j<lchrom&&w>0;j++)
{
p[j]=q[w];
w--;
}
//cout<<"yuanma"<<endl;
//for(j=0;j<lchrom;j++)///////////
// cout<<p[j];////////
//cout<<endl;////////////////////
gray[0]=p[0];
for(j=1;j<lchrom;j++)
{
if(p[j-1]==p[j])
gray[j]=0;
else if(p[j-1]!=p[j])
gray[j]=1;
}
for(j=0;j<lchrom;j++)
p[j]=gray[j];
//cout<<"geleima"<<endl;
//for(j=0;j<lchrom;j++)///////////
// cout<<p[j];////////
//cout<<endl;////////////////////
//system("pause");///////////

delete [] gray;
delete [] q;
}
double yima(unsigned *p) //译码
{

int i=0;
// for(i=0;i<lchrom;i++)/////////
// {
// cout<<p[i];//////
// }
// cout<<endl;/////////
// system("pause");//////////
int x=0;
unsigned *q;
q=new unsigned[lchrom];
q[0]=p[0];
// cout<<q[0]<<endl;//////////////////
// system("pause");//////////

for(int j=1;j<lchrom;j++)
{
if(q[j-1]==p[j])
q[j]=0;
else if(q[j-1]!=p[j])
q[j]=1;
}
// for(i=0;i<lchrom;i++)//////
// {
// cout<<q[i];//////////
// if(q[i]!=0&&q[i]!=1)
// {
// cout<<q[i];
// system("pause");
// }
// }
// cout<<endl;////////
// system("pause");///////////////////
for(i=0;i<lchrom;i++)
x=x+q[i]*pow(2,(lchrom-i-1));
if(x<0)
{
cout<<"译码出错1"<<endl;
system("pause");
}
//cout<<"x:"<<x<<endl;
double bianliang;
//cout<<pow(2,22)<<endl;
//cout<<2000*x<<endl;
//cout<<(x*(2000/(pow(2,22)-1)))<<endl;
bianliang=(x*((youbianjie-(zuobianjie))/(pow(2,lchrom)-1)))+zuobianjie;
if(bianliang<zuobianjie)
{
cout<<"译码出错2"<<endl;
system("pause");
}
delete [] q;
return bianliang;
}
double ran1(long *idum)
{
int j;
long k;
static long idum2=123456789;
static long iy=0;
static long iv[NTAB];
float temp;
if (*idum <= 0)
{
if (-(*idum) < 1) *idum=1;
else *idum = -(*idum);
idum2=(*idum);
for (j=NTAB+7;j>=0;j--)
{
k=(*idum)/IQ1;
*idum=IA1*(*idum-k*IQ1)-k*IR1;
if (*idum < 0) *idum += IM1;
if (j < NTAB) iv[j] = *idum;
}
iy=iv[0];
}
k=(*idum)/IQ1;
*idum=IA1*(*idum-k*IQ1)-k*IR1;
if (*idum < 0) *idum += IM1;
k=idum2/IQ2;
idum2=IA2*(idum2-k*IQ2)-k*IR2;
if (idum2 < 0) idum2 += IM2;
j=iy/NDIV;
iy=iv[j]-idum2;
iv[j] = *idum;
if (iy < 1) iy += IMM1;
if ((temp=AM*iy) > RNMX) return RNMX;
else return temp;
}
double suijibianli()//随机遍历
{
double i=ran1(a);
while(i>zhizhenjuli)
{
i=ran1(a);
}
//cout<<i<<endl;//////////////
return i;
}
int fuzhi(float p)//复制
{
int i;
double sum=0;
if(sumfitness!=0)
{
for(i=0;(sum<p)&&(i<zhongqunshu);i++)
sum+=nowpop[i].fitness/sumfitness;
}
else
i=rnd(1,zhongqunshu1);
return(i-1);
}

int rnd(int low, int high) /*在整数low和high之间产生一个随机整数*/
{
int i;
if(low >= high)
i = low;
else
{
i =(int)((ran1(a) * (high - low + 1)) + low);
if(i > high) i = high;
}
return(i);
}
int flipc(double p,double q)//判断是否交叉
{
double pc1=0.9,pc2=0.6;
if((p-q)>0)
{
if(p>=avefitness)
{
pc=pc1-(pc1-pc2)*(p-avefitness)/(maxfitness-avefitness);
}
else
pc=pc1;
}
else
{
if(q>=avefitness)
{
pc=pc1-(pc1-pc2)*(q-avefitness)/(maxfitness-avefitness);
}
else
pc=pc1;
}
if(ran1(a)<=pc)
return(1);
else
return(0);
}
int flipm(double p)//判断是否变异
{
double pm1=0.001,pm2=0.0001;
if(p>=avefitness)
{
pm=(pm1-(pm1-pm2)*(maxfitness-p)/(maxfitness-avefitness));
}
else
pm=pm1;
if(ran1(a)<=pm)
return(1);
else
return(0);
}
void glp(int n,int s,int *h,int (*q)[1],float (*xx)[1])//glp
{
int i=0,j=0;
//求解q
for(i=0;i<n;i++)
{
for(j=0;j<s;j++)
{
*(*(q+i)+j)=((i+1)*(*(h+j)))%n;
}
}
i=n-1;
for(j=0;j<s;j++)
{
*(*(q+i)+j)=n;
}
//求解x
for(i=0;i<n;i++)
{
for(j=0;j<s;j++)
{
*(*(xx+i)+j)=(float)(2*(*(*(q+i)+j))-1)/(2*n);
}
}
}
BOOL Exist(int Val, int Num, int *Array)//判断一个数是否在一个数组的前Num个数中
{
BOOL FLAG = FALSE;
int i;
for (i=0; i<Num; i++)
if (Val == *(Array + i))
{
FLAG = TRUE;
break;
}
return FLAG;
}

反编译就是了啊
如果实在没有源代码(source)
不应该叫源程序


请问哪位有模拟退火遗传算法的源程序?
\/\/中国电子科技集团公司 \/\/第一研究室 \/\/呼文韬 \/\/hu_hu605@163.com \/\/随机初始种群 \/\/编码方式为格雷码 \/\/选择方法为随机遍历 \/\/采用了精英保存策略 \/\/采用了自适应的交叉率和变异率 \/\/采用了与模拟退火算法相结合的尺度变换 \/\/采用了均匀交叉法 #include <stdlib.h> #include <stdio.h> #include <...

模拟退火遗传算法的介绍
模拟退火算法是基于Monte Carlo迭代求解法后种启发式随机搜索算法,它模拟固体物质退火过程的热平衡问题与随机搜索寻优问题的相似性来达到寻找全局最优或近似全局最优的目的。

C语言中退火模拟
Simulate Anneal Arithmetic (SAA,模拟退火算法) 模拟退火算法 模拟退火算法来源于固体退火原理,将固体加温至充分高,再让其徐徐冷却,加温时,固体内部粒子随温升变为无序状,内能增大,而徐徐冷却时粒子渐趋有序,在每个温度都达到平衡态,最后在常温时达到基态,内能减为最小。根据Metropolis准则,粒子在温度T时趋于平衡的概...

正交试验方法、粒子群算法、遗传算法和模拟退火算法有什么不同_百度知...
正交试验方法、粒子群算法、遗传算法和模拟退火算法都是优化算法,但它们在应用领域、优化目标、优化过程等方面存在一些不同。应用领域:正交试验方法主要应用于实验设计和质量控制,通过有限数量的试验系统地测试和评估各种因素对产品或过程的影响,以确定最佳方案。粒子群算法是一种通过模拟鸟群觅食行为而发展...

请问一下遗传算法,模拟退火算法和遗传模拟退火算法的区别,最好能有根据...
遗传算法是种群择优,模拟退火是择优降火,里头的差别不大,就是生成新链,然后计算适应度什么的。这两种优化算法都能解决TSP问题,源代码没有,不过matlab有工具箱可以实现吧,你再找找。

地下水管理模型求解方法研究进展
近年来,最优化技术有了很大的进展,一些基于试探式具有全局寻优特点的求解方法被应用于地下水管理之中,如遗传算法、模拟退火算法、人工神经网络算法、禁忌搜索算法以及一些混合智能算法等。 1.2.3.1 遗传算法(Genetic Algorithm,GA) 遗传算法是20世纪70年代初期由Holland等人创立,并由Goldberg发展完善起来的一种新型寻优方法...

模拟退火算法和粒子群算法的优缺点有那些?具体点,谢啦
退火优点:计算过程简单,通用,鲁棒性强,适用于并行处理,可用于求解复杂的非线性优化问题。缺点:收敛速度慢,执行时间长,算法性能与初始值有关及参数敏感等缺点。PSO:演化计算的优势在于可以处理一些传统方法不能处理的例子例如不可导的节点传递函数或者没有梯度信息存在。但是缺点在于:在某些问题上性能...

区间调度问题的解决方案有什么?
遗传算法:遗传算法是一种模拟自然选择和遗传机制的全局优化方法。它通过模拟生物进化的过程,不断迭代和优化解,最终得到最优解。遗传算法的优点是可以找到全局最优解,但是计算复杂性也较高,需要大量的计算资源。模拟退火算法:模拟退火算法是一种随机搜索算法,它通过模拟物质退火的过程,不断调整解的...

对于解决多目标优化问题,遗传算法、粒子群、模拟退火哪个比较好啊?哪位...
个人感觉是遗传算法吧,当然可以和模拟退火算法结合来使用。多目标遗传算法可解决多目标优化问题,和模拟退火算法相结合时还能强化局部搜索能力。

怎么把退火算法求得的最优路径用matlab画图?谢谢。
我有更好的答案推荐于2017-12-16 16:36:32 最佳答案 会用模拟退火,那么下面这段代码你该懂的~function DrawPath(Chrom,X)%% 画路径函数%输入% Chrom 待画路径 % X 各城市坐标位置R=[Chrom(1,:) Chrom(1,1)]; %一个随机解(个体)figure;hold onplot(X(:,1),X(:,2),'o','color',[0.5,0.5...

富源县13637228817: 急求,模拟退火遗传算法的MATLAB程序!谢谢 -
能邢达力: 你真幸福.我刚刚编了一个模拟退火算法,计算旅行商问题:注意:一共三个文件,第一个是主程序,下面两个是子函数.% for d=1:50 %循环10次发现最小路径为4.115,循环50次有3次出现4.115 T_max=80; %input('please input the start ...

富源县13637228817: 谁有遗传退火模拟算法的源程序啊
能邢达力: 我有遗传算法的源代码!模拟退火我没仔细研究!一般来说,当其他算法应用在遗传算法中时一般是为了修改“变异率”,其实你可以用自适应的方法代替模拟退火,即自适应遗传算法就够用了吧?!

富源县13637228817: 谁能给我举一个模拟退火算法MATLAB源代码的简单例子 -
能邢达力: clear clc a = 0.95 k = [5;10;13;4;3;11;13;10;8;16;7;4]; k = -k; % 模拟退火算法是求解最小值,故取负数 d = [2;5;18;3;2;5;10;4;11;7;14;6]; restriction = 46; num = 12; sol_new = ones(1,num); % 生成初始解 E_current = inf;E_best = inf; % E_current...

富源县13637228817: 遗传模拟退火算法优化BP神经网络的Matlab程序 -
能邢达力: “模拟退火”算法是源于对热力学中退火过程的模拟,在某一给定初温下,通过缓慢下降温度参数,使算法能够在多项式时间内给出一个近似最优解.退火与冶金学上的'退火'相似,而与冶金学的淬火有很大区别,前者是温度缓慢下降,后者是温度迅速下降.“模拟退火”的原理也和金属退火的原理近似:我们将热力学的理论套用到统计学上,将搜寻空间内每一点想像成空气内的分子;分子的能量,就是它本身的动能;而搜寻空间内的每一点,也像空气分子一样带有“能量”,以表示该点对命题的合适程度.算法先以搜寻空间内一个任意点作起始:每一步先选择一个“邻居”,然后再计算从现有位置到达“邻居”的概率.很抱歉,回答者上传的附件已失效

富源县13637228817: 请问一下遗传算法,模拟退火算法和遗传模拟退火算法的区别,最好能有根据同一个数学问题的matalb程序源代 -
能邢达力: 遗传算法全局优化能力较强,模拟退火算法局部优化能力较强,这是两者的最大区别.遗传模拟退火算法是两者的混合算法,综合了两者的优点.参考资料中是改进遗传算法解决TSP问题的matlab代码.一时半会应该是搞不清楚的,你可以买一本智能优化算法的书来看,详细了解一下遗传算法和模拟退火算法的原理.

富源县13637228817: 求高人用遗传算法和模拟退火算法相结合求解TSP问题
能邢达力: 模拟退火算法求解TSP问题http://www.vckbase.com/document/viewdoc/?id=1477

富源县13637228817: 求货郎担问题的matlab算法 -
能邢达力: 货郎担问题有很多解法,模拟退火,遗传算法,动态规划等.基于matlab TSP问题遗传算法的实现%TSP问题(又名:旅行商问题,货郎担问题)遗传算法通用matlab程序%D是距离矩阵,n为种群个数,建议取为城市个数的1~2倍,%C为停止...

富源县13637228817: 请问如何利用matlab实现基于模拟退火遗传算法的多个自变量的筛选 -
能邢达力: 唉,就在这个相同版面的下方!标题是:关于遗传算法、模拟退火、人工神经网络的matlab算法与程序发帖人是cx2005,你仔细找找!还有,论坛对下载可能有限制,搜索应该是没有问题的吧!

富源县13637228817: 高分求模拟退火法解 TSP问题 C++或C语言程序 -
能邢达力: tsproblem.hclass tsproblem{private:int *parrayc;int *parrayj;int icost;int icurpoint, isize;unsigned long ls;unsigned long power(int i, int j);int g(int i, unsigned long s);public:tsproblem(int size, int point);tsproblem(int size, int point, int *...

富源县13637228817: matlab在数学建模中都会用到哪些东西.. -
能邢达力: 数学建模中,用的比较多的是算法,像模拟退火、遗传算法、神经网络算法等等,当然还有很重要的一方面,一些模拟仿真也需要使用matlab,matlab博大精深,如果仅仅是为了数学建模,那么了解一些简单的算法,能够编一些简单的仿真,都是可以的.

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网