内容发布更新时间 : 2024/12/22 15:34:56星期一 下面是文章的全部内容请认真阅读。
}
} for (j=0;j return jcross; void mutation(unsigned int a[],float b) //随机多次对换方式的变异函数 { float random_mutate; int i,j,k,temp,random; random=rand()000; random_mutate=(float)random/10000; if (random_mutate nmutation=nmutation+1; i=rand()0; //i是随机产生的对换次数 for(;i<100;i++) { j=rand()%lchrom; k=rand()%lchrom; temp=a[j]; a[j]=a[k]; a[k]=temp; } } } void report(int gen,struct individual *pop) { int i; } fprintf(outfp2,\%d\\n\ printf(\ compare_count=%d\\n\printf(\ ,lchrom,popsize,maxgen); printf(\VG=%8.4f MIN=%8.4f\\n\\n\ ,ncross,nmutation,gen,avg,min); printf(\//以下为输出每一代的最短路路径的相关信息 fprintf(outfp,\fprintf(outfp,\ Minpath:\for (i=0;i fprintf(outfp,\