首页 模拟退火算法解决路径优化的源代码

模拟退火算法解决路径优化的源代码

举报
开通vip

模拟退火算法解决路径优化的源代码ÎÒÓÐsimulatedannealingwithmetropolies(MonteCarlo)×öµÄÒ»¸öÏîÄ¿µÄ´úÂ룬ÄãÒª¿´¿´Ã´£¿voidanneal(intnparam,intnstep,intnstep_per_block,doublet0,constdouble*param_in,doublecost_in,double*params_out,double*cost_out){intnblock;intstep;intblock;intnactive;intrank;intn_...

模拟退火算法解决路径优化的源代码
ÎÒÓÐsimulatedannealingwithmetropolies(MonteCarlo)×öµÄÒ»¸öÏîÄ¿µÄ´úÂ룬ÄãÒª¿´¿´Ã´£¿voidanneal(intnparam,intnstep,intnstep_per_block,doublet0,constdouble*param_in,doublecost_in,double*params_out,double*cost_out){intnblock;intstep;intblock;intnactive;intrank;intn_accepted=0;inti,j,n;doublecost_current,cost_trial;int*param_index;double*param_current;double*param_trial;double*Q;double*S;double*u;double*dp;double*A;FILE*fp_log_file;charfname[FILENAME_MAX];doubletemp=t0;doubletempmax=temp;doubleebar,evar,emin,eta,specific_heat;doubledelta;doublechi=0.8;//Annealingscheduledoublechi_s=3.0;//Vanderbilt/Louie'growthfactor'doublerm;doubleroot3=sqrt(3.0);doublep=0.02/sqrt(3.0);//maxsizeofannealingstepparam_current=newdouble[nparam];param_trial=newdouble[nparam];cost_current=cost_in;MPI_Comm_rank(MPI_COMM_WORLD,&rank);sprintf(fname,"a_%4.4d.log",rank);fp_log_file=fopen(fname,"a");if(fp_log_file==(FILE*)NULL)errorMessage("fopen(log)failed\n");//Workoutthenumberofactiveparameters,andsetupthe//indextableoftheactiveparameters.//Notethatthecompletearrayofparameters(param_trial)must//beusedtoevaluatethecostfunction.推荐精选推荐精选推荐精选nactive=0;for(n=0;nP.max[n])param_trial[n]=P.max[n];}//calculatenewcostfunctionscorep_model->setParameters(param_trial);cost_trial=p_costWild->getCost();cost_trial+=p_costLHY->getCost();cost_trial+=p_costTOC1->getCost();cost_trial+=p_costAPRR->getCost();//Metropolisdelta=cost_trial-cost_current;if(delta<0.0||r_uniform()
本文档为【模拟退火算法解决路径优化的源代码】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
机构认证用户
夕夕资料
拥有专业强大的教研实力和完善的师资团队,专注为用户提供合同简历、论文写作、PPT设计、计划书、策划案、各类模板等,同时素材和资料部分来自网络,仅供参考.
格式:doc
大小:27KB
软件:Word
页数:0
分类:成人教育
上传时间:2021-03-30
浏览量:9