程序有两部分组成,分别是gen和DNA程序。其中gen用来生成50条原始链,作为DNA初始化数据。DNA程序在gen生成的50条链的基础上完成交叉,变异直到找到最优答案。

d:/工业/hk/bestLength.csv

d:/工业/hk/aaa.csv

d:/工业/hk/规划1.csv  初始化数据,30个工件和每个工件的耗时

d:/工业/hk/组合.csv

d:/工业/hk/矩阵.csv

d:/工业/hk/遗传.csv

这个程序中有6个本地路径,其中d:/工业/hk/规划1.csv是初始数据,其余保存的都是中间数据。

使用方法

1.在d:/工业/hk/规划1.csv这个位置手工制作规划1.csv文件,格式为序数,序数,工时。

2.调用gen程序,生成50条链,保存在矩阵.csv文件中

3.调用DNA程序

第一部分gen代码

第二部分DNA代码

第三部分 规划1.csv文件

第一部分gen代码

package tree1;import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.ParseException;
import java.util.Random;public class gen {//用于实现遗传算法,生成50条链//种群数量 50  交叉概率 0.75  变异概率0.05  最大迭代数200static int cityNum=30; //工件static int ant=10;     //机器static int iter=1000 ;static int tiao=50;private static double alpha=0.0001;  //信息素重要程度的参数            1private static double beta=14;   //启发式因子重要程度的参数     5private static double rho=0.5;   //信息素蒸发系数                                 0.5static double bestLength=Integer.MAX_VALUE;   //最佳长度static double[][] pheromone= new double[cityNum][cityNum]; //信息素矩阵static double[][] distance= new double[cityNum][cityNum];   //距离矩阵static double[][] pher= new double[cityNum][cityNum]; //信息素矩阵static double[][] bestTour  =new double[cityNum+1][1]; //最佳路径static double [][] tabu=new double[cityNum][1];static int [][] allowedCities=new int[cityNum][1];static double[][] delta = new double[cityNum][cityNum];; //信息素变化矩阵static int firstCity;   //起始城市static int currentCity; //当前城市static  int[] x= new int[cityNum];  static  int[] y= new int[cityNum]; static int [][]ta=new int[ant][cityNum];// static int [][][]dgen=new int[tiao][cityNum][1];static int count1;static int flag;public static  void maco(String filename) throws IOException, ParseException {//初始化距离矩阵//初始化信息素矩阵String strbuff;  BufferedReader data = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));  for (int i = 0; i < cityNum; i++) {  strbuff = data.readLine(); String[] strcol = strbuff.split(",");  x[i] = Integer.valueOf(strcol[1]);  y[i] = Integer.valueOf(strcol[2]);   // System.out.println(x[i]+"  "+ y[i]);}  for (int i = 0; i < cityNum  ; i++) {  distance[i][i] = 0;  //对角线为0for (int j = 0; j < cityNum; j++) {     if(i!=j){distance[i][j] =y[j]  ;  }if(i==j){distance[i][j] =0  ;  }    }}  for(int i=0;i<cityNum;i++)  {  for(int j=0;j<cityNum;j++){pheromone[i][j]=0.1;   //  System.out.println(distance[i][j]+" "+i+"  "+j);}}           solve();}public static void push(int td ,int [][] tad , int js) throws IOException, ParseException{int t=td;int [][]tta=tad;int t1=0;int tem1=0;int max1=0;for(int a=0 ;a<cityNum ;a++){ if(tta[js][a]!=0){max1++;}}// System.out.println("   *************** ");for(int a=0 ;a<max1 ;a++){// System.out.println( tta[js][a]+"  "+a );tem1=tem1+tta[js][a]; }t1=t-tem1;// System.out.println(t+"  "+max1+"   "+tem1+"  "+t1+"   *t1 ");if(t1-tta[js][max1]==0){count1++;//  System.out.println(  count1 +"  和  " ); tta[js][max1]=selectNextCity(   count1   );//System.out.println(tta[max1]+"  ****  "+  count1 ); }}public static void solve() throws IOException, ParseException{for(int gen=0 ;gen<iter ;gen++){count1=ant-1;//  System.out.println("   迭代开始    "+count1);ta=new int[ant][cityNum];tabu=new double[cityNum][1];for (int i = 0; i < cityNum; i++) {allowedCities[i][0]=0;           //允许搜索城市列表}for (int i = 0; i < cityNum; i++) {for (int j = 0; j < cityNum; j++) { delta[i][j] = 0.0;                   //信息素矩阵列表 都是0}}ta[0][0]=init(  );for(int a=1 ;a<ant ;a++){ta[a][0]=selectNextCity( a ); }/******************************/ //用于初始化for(int t=0 ;t<100 ;t++)  {int pan =0;for(int c=0 ;c<ant ;c++ ){pan=0;push(t ,ta ,c );for(int b=0 ;b<cityNum ;b++){ if(allowedCities[b][0]==1){pan++;}}if(pan==cityNum){break;}}if(pan==cityNum){break;}}int max=0;int [][]rc=new int[ant][1];double ave=0.0;for(int a=0 ;a<ant;a++) {for(int b=0 ;b<cityNum ;b++){ rc[a][0]=rc[a][0]+ta[a][b];ave=ave+ta[a][b];}if(max<rc[a][0]){max=rc[a][0];}// System.out.println(a+"      rc[a][0]    " +max );}ave=1000*ave/cityNum;// System.out.println(max+"  *** "+gen);double disx=0.0;disx=max;if (disx < bestLength) {for (int n = 0; n < cityNum; n++) {for (int m = 0; m < cityNum; m++) {if(tabu[m][0]==n){   bestTour[n][0]=m;}}}bestTour[cityNum][0]=bestTour[0][0];bestLength=disx;flag=gen;}for (int j = 0; j < cityNum-1; j++) {delta[j ][j+1] = (double) (1./disx);delta[j+1][j ] = (double) (1./disx); // delta[j ][j+1] = (double) (1./ave);// delta[j+1][j ] = (double) (1./ave); }    for(int i=0;i<cityNum;i++){for(int j=0;j<cityNum;j++){ pher[i][j] += delta[i][j];}  }updatePheromone();//printOptimal();}}public static int init(  ) {//允许城市列表//选出下一个城市//并将这个城市加入禁忌表//选出的城市被作为current city 返回Random random2 = new Random(System.currentTimeMillis());int s1 = random2.nextInt();Random random1 = new Random( );int s = random1.nextInt();Random random = new Random( (s+s1) );firstCity = random.nextInt(cityNum);//firstCity = 4;// System.out.println( firstCity  );for (int i = 0; i < cityNum; i++) {if (i == firstCity) {allowedCities[i][0]=1;  //去掉等于i的这项break;}} for (int i = 0; i < cityNum; i++) {if (i == firstCity) {tabu[i][0]=0;  //去掉等于i的这项break;}} currentCity = firstCity;// System.out.println( "currentCity  "+ currentCity   +"  "+y[currentCity]  );return x[currentCity];}public static int selectNextCity( int  time  ) throws IOException, ParseException {double [] p = new double[cityNum];double sum = 0.0;//计算分母部分//System.out.println(  currentCity +"  currentCity  " );for (int i = 0; i < cityNum; i++) {if (allowedCities[i][0] != 1 ) {sum += Math.pow(pheromone[currentCity][i], alpha)*Math.pow(1.0/distance[currentCity][i], beta);/*System.out.println( i + "  "+      "   sum:    "  +  sum +"  "+Math.pow(pheromone[currentCity][i], alpha)  +" a  "+ Math.pow(1.0/distance[currentCity][i], beta)+" b " +distance[currentCity][i] +" d "+pheromone[currentCity][i]+" p "+alpha+"  "+beta+"  " +currentCity+ "  ");*/}} for (int i = 0; i < cityNum; i++) {boolean flag = false;if (allowedCities[i][0] != 1 ) {p[i] =   (Math.pow(pheromone[currentCity][i], alpha)*Math.pow(1.0/distance[currentCity][i], beta) )   /sum;flag = true;// System.out.println(p[i]+"  * "+i);}if (flag == false) {p[i] = 0.0;}} Random random3 = new Random(System.currentTimeMillis());int s3 = random3.nextInt();Random random4 = new Random( );int s4 = random4.nextInt();Random rand = new Random( (s3+s4) );double slectP = rand.nextDouble( );int selectCity = 0;double ff = 0.0;for (int i = 0; i < cityNum; i++) {ff += p[i];if (ff >= slectP) {selectCity = i;// System.out.println(slectP+"  slectP     " + ff+"   "+i +"  ");break;}}// System.out.println(selectCity+"     selectCity        "   );for (int i = 0; i < cityNum; i++) {if (i== selectCity ) {allowedCities[i][0]=1;}} for (int i = 0; i < cityNum; i++) {if (i== selectCity ) {tabu[i][0]=time;//  System.out.println( tabu[i][0]+"  nant "+nant);}} //将当前城市改为选择的城市  currentCity = selectCity;return x[currentCity];}private static void updatePheromone(){// System.out.println( "  updatePheromone    "  );for(int i=0;i<cityNum;i++)  {for(int j=0;j<cityNum;j++)  {pheromone[i][j]=pheromone[i][j]*(1-rho);}}for(int i=0;i<cityNum;i++){for(int j=0;j<cityNum;j++){pheromone[i][j] += pher[i][j];}  }}private static void printOptimal() throws IOException{FileWriter fileWriter2=new FileWriter("d:/工业/hk/bestLength.csv");  FileWriter fileWriter1=new FileWriter("d:/工业/hk/aaa.csv");  // System.out.println("The optimal length is: " + bestLength);fileWriter2.write( bestLength +"\r\n ");fileWriter2.flush();for (int i = 0; i < cityNum ; i++) {// System.out.println(bestTour[i][0]+"  ***  ");fileWriter1.write( (int)bestTour[i][0] +"\r\n ");fileWriter1.flush();}fileWriter1.write( (int)bestTour[0][0] +"\r\n ");fileWriter1.flush();}private static int[][] d3() throws IOException, ParseException{double b=100000;int count=-1;//    while(b>=48 && count < 100 ) while(b> 52 )            {// System.out.println( count+ "  count**** "+ tiao+"  "+b);maco("d:/工业/hk/规划1.csv");// maco("d:/工业/hk/zz.csv");printOptimal();String aa= read.conv.read("d:/工业/hk/bestLength.csv" );aa=aa.replaceAll(",","");b= Double.parseDouble(aa.trim());// System.out.println(  " count "+ b);}return ta;}public static void shellSort(double[] data) {int j = 0;double temp = 0;//每次将步长缩短为原来的一半for (int increment = data.length / 2; increment > 0; increment /= 2){for (int i = increment; i < data.length; i++) {temp = data[i];for (j = i; j >= increment; j -= increment) {if(temp > data[j - increment])//如想从小到大排只需修改这里//   if(temp < data[j - increment])//如想从小到大排只需修改这里{   data[j] = data[j - increment];}else{break;}} data[j] = temp;}}}private static int[][] cd() throws IOException, ParseException{//产生用于 交叉 变异的数组int count=0;int [][]tem=new int[ant][cityNum];int [][]dgen=new int[cityNum][tiao];for(int a=0 ;a<tiao ;a++){tem=d3();//    static int [][]ta=new int[ant][cityNum];int [] dant=new int[cityNum];for(int d=1 ;d<cityNum+1 ;d++){for (int b = 0; b < ant; b++) {for (int c = 0; c < 5; c++) {//System.out.println(tem[b][c]+"  "+b+"  "+c);if(tem[b][c]==d){//System.out.println(tem[b][c]+"  "+b+"   " +d+"  ");dant[d-1]=b;}}}  }/*****************/for(int d=0 ;d<cityNum ;d++){System.out.println(dant[d]+"  "+d+" *"+a);   dgen[d][a]=dant[d];}}/******************************************/System.out.println( "*********************");   for(int a=0 ;a<tiao ;a++){            for(int d=0 ;d<cityNum ;d++){     System.out.println(dgen[d][a]+"  "+a+"  "+d);   //机器编号    列    行}}return dgen;  }public static void main(String[] args) throws IOException, ParseException {FileWriter fileWriter1=new FileWriter("d:/工业/hk/组合.csv");  FileWriter fileWriter2=new FileWriter("d:/工业/hk/矩阵.csv"); int [][]dgen=cd();System.out.println( "*********************");   for(int a=0 ;a<tiao ;a++){            for(int d=0 ;d<cityNum ;d++){             System.out.println(dgen[d][a]+"  "+a+"  "+d);   //机器编号    列    行 fileWriter2.write( dgen[d][a] +"\r\n ");fileWriter2.flush();}}  int bei=2;int [] s1=new int[tiao*bei];int [] s2=new int[tiao*bei];for(int a=0 ; a< tiao*bei ;a++){Random rand1 =new Random();int ti1=rand1.nextInt(tiao);Random rand2 =new Random();int ti2=rand2.nextInt(tiao);System.out.println(ti1+"  "+ti2);s1[a]=ti1;s2[a]=ti2;}System.out.println("****************");for(int a=0 ; a< tiao*bei ;a++){for(int b=a+1 ; b< tiao*bei ;b++){if(s1[a]==s1[b]&&s2[a]==s2[b]){s1[a]=0;s2[a]=0;System.out.println(a+" ** 相同 "+b);}   }for(int b=0 ; b< cityNum*bei ;b++){if(s1[a]==s2[b]&&s2[a]==s1[b]){s1[a]=0;s2[a]=0;System.out.println(a+" ** 反向  "+b);} }}//s1 s2 里面的就是没有重复 没有相同 没有反向相同 的组合int count=0;for(int a=0 ; a< tiao*bei ;a++){if( (s1[a]!=0||  s2[a]!=0) && count<50){System.out.println(s1[a]+"  "+s2[a]+"  " +count  );fileWriter1.write( s1[a]+" , "+s2[a] +"\r\n ");fileWriter1.flush();count++;}}}}

第二部分

package tree1;import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.ParseException;
import java.util.Random;
import java.util.regex.Pattern;public class DNA {//需要用gen 得到初始数组//遗传算法用于多机并行调度/** 400   11  12                  18  22          1   23  25                  16  23          2   2   13  27              6   11  18      3   1   8   18  28          2   4   17  15  4   0   9   10  16          3   12  10  14  5   5   15  17              7   26  6       6   19  29                  27  13          7   20  22                  11  26          8   3   4   6   7   24      4   5   9   13  79  14  21  26              8   17  15      */static int tiao=50;static int cityNum=30;static int [][] dgen2=new int[cityNum][tiao];public static void shellSort(int[] data) {int j = 0;int temp = 0;//每次将步长缩短为原来的一半for (int increment = data.length / 2; increment > 0; increment /= 2){for (int i = increment; i < data.length; i++) {temp = data[i];for (j = i; j >= increment; j -= increment) {// if(temp > data[j - increment])//如想从小到大排只需修改这里if(temp < data[j - increment])//如想从小到大排只需修改这里{   data[j] = data[j - increment];}else{break;}} data[j] = temp;}}}private static int cross( int [][]xgen ) throws IOException, ParseException{int ant=10;int changerate=3; //变异概率  这个是   4%  double droprate=0.25;  //按照时间 淘汰的概率  这个就是 小数int bei=100;             //0.85 bei>3  要随着droprate 的增加变大 因为 去掉 90%以后要用10 个随机出50个这个重复概率加大int [][] dgen=xgen;int [] mina=new int[tiao];for(int a=0 ;a<tiao ;a++){            int [] tem= new int[cityNum];for(int d=0 ;d<cityNum ;d++){ //  System.out.println(dgen [d][a]+"  "+a+"  "+d+"  dgen2  后 ");   tem[d]=dgen [d][a];}int tem1=value( tem);mina[a]=tem1;  //计算时间数组}shellSort( mina  );  //将时间按大小排序  进行 淘汰/****************************************/int [][] dgenorder=new int[cityNum][tiao];int count=0;for(int b=0 ;b<tiao ;b++){int tem1=0;for(int a=0 ;a<tiao ;a++){            int [] tem=new int[cityNum];for(int d=0 ;d<cityNum ;d++){ tem[d]=dgen [d][a];}  tem1=value( tem); //System.out.println(tem1+"  "+mina[b]+"  "+count+ " b "+b);if(tem1==mina[b]){// System.out.println(tem1+"  "+mina[b]+"  "+count+ " ****** b "+b);for(int d=0 ;d<cityNum ;d++){ dgenorder[d][count]=dgen [d][a];}count++;break;}}}//System.out.println("****************   "+ (int)(tiao*(1-droprate))*bei  );int [] s1=new int[(int)(tiao*(1-droprate))*bei];int [] s2=new int[(int)(tiao*(1-droprate))*bei];for(int a=0 ; a< (int)(tiao*(1-droprate))*bei ;a++){Random rand1 =new Random();int ti1=rand1.nextInt((int)(tiao*(1-droprate)));Random rand2 =new Random();int ti2=rand2.nextInt((int)(tiao*(1-droprate)));// System.out.println(ti1+"  "+ti2+"  "+ (int)(tiao*(1-droprate))*bei +" "+a );s1[a]=ti1;s2[a]=ti2;}for(int a=0 ; a< (int)(tiao*(1-droprate))*bei ;a++){for(int b=a+1 ; b< (int)(tiao*(1-droprate))*bei ;b++){if(s1[a]==s1[b]&&s2[a]==s2[b]){s1[a]=0;s2[a]=0;//    System.out.println(a+" ** 相同 "+b);}}//System.out.println("****************");for(int b=0 ; b< (int)(tiao*(1-droprate))*bei ;b++){if(s1[a]==s2[b]&&s2[a]==s1[b]){s1[a]=0;s2[a]=0;// System.out.println(a+" ** 反向  "+b);}}}//s1 s2 里面的就是没有重复 没有相同 没有反向相同 的组合int count1=0;for(int a=0 ; a< (int)(tiao*(1-droprate))*bei ;a++){if( (s1[a]!=0||  s2[a]!=0) && count1< tiao ){// System.out.println(s1[a]+"  "+s2[a]+"  ***  " +count1  );count1++;}}/*************************************///int [][] dgen2=new int[cityNum][tiao];for(int n=0 ;n<tiao;n++)//for(int n=0 ;n<1 ;n++){//s1[n]=Integer.parseInt( as1[2*n] );//s2[n]=Integer.parseInt( as1[2*n+1] );//System.out.println(s1[n]+"  "+s2[n]+"   " +n);int [] t1=new int[cityNum];int [] t2=new int[cityNum];int [] t3=new int[cityNum];int [] t4=new int[cityNum];for(int a=0 ;a<tiao ;a++){            for(int d=0 ;d<cityNum ;d++){             //System.out.println(dgen[d][a]+"  "+a+"  "+d); //机器编号    列    行  if(a==s1[n]){t1[d]=dgenorder[d][a];}if(a==s2[n]){t2[d]=dgenorder[d][a];}}}Random rand1 =new Random();int ti1=rand1.nextInt(cityNum);for(int d=0 ;d<cityNum ;d++){t3[d]=t1[d];t4[d]=t2[d];}//中继数组for(int d=0 ;d<cityNum ;d++){if(d>ti1){t1[d]=t4[d];}}for(int d=0 ;d<cityNum ;d++){if(d>ti1){t2[d]=t3[d];}}//t1 t2 完成交叉的数组/**********************************************/for(int d=0 ;d<cityNum ;d++){//System.out.println(n+"  "+ n*2+"  "+ (n*2+1)  );dgen2[d][n*2]=t1[d];dgen2[d][n*2+1]=t2[d];}if(n*2+1 ==tiao-1 ){break;}//将交叉后的结果写入 dgen2}//s1 s2里面就是排列组合/************************************************/for(int a=0 ;a<tiao ;a++){            for(int d=0 ;d<cityNum ;d++){ //  System.out.println(dgen2[d][a]+"  "+a+"  "+d+"  dgen2  前 "); }}for(int a=0 ;a<tiao ;a++){          for(int d=0 ;d<cityNum ;d++){ // System.out.println(dgen2[d][a]+"  "+a+"  "+d+"  dgen2 "); Random rand1 =new Random();int ti1=rand1.nextInt(99);if(ti1<changerate)  //按照指定概率进行变异{Random rand2 =new Random();int ti2=rand2.nextInt(ant);//System.out.println(dgen2[d][a]+"  "+a+"  "+d+"    "+ ti2); dgen2[d][a]=ti2;   }}}/*********************************/for(int a=0 ;a<tiao ;a++){          for(int d=0 ;d<cityNum ;d++){ //  System.out.println(dgen2[d][a]+"  "+a+"  "+d+"  dgen2  后 "); }}//dgen2[d][a] 里面存放的就是经过    交叉    变异   后数组/****************************************/int min=100000;for(int a=0 ;a<tiao ;a++){           int [] tem= new int[cityNum];for(int d=0 ;d<cityNum ;d++){ //  System.out.println(dgen2[d][a]+"  "+a+"  "+d+"  dgen2  后 ");   tem[d]=dgen2[d][a];}int tem1=value( tem);if(tem1<min){min=tem1;}}//用于计算最小值//  System.out.println(min+ " max " );return min;}private static  int  value( int [] test) throws IOException, ParseException{int cityNum=30;int ant=10;int[] x= new int[cityNum];  int[] y= new int[cityNum]; int [] ar=test;String strbuff;  BufferedReader data = new BufferedReader(new InputStreamReader(new FileInputStream("d:/工业/hk/规划1.csv")));  for (int i = 0; i < cityNum; i++) {  strbuff = data.readLine(); String[] strcol = strbuff.split(",");  x[i] = Integer.valueOf(strcol[1]);  y[i] = Integer.valueOf(strcol[2]);   // System.out.println(x[i]+"  "+ y[i]);}int max=0;int min=100000;// System.out.println( y[15]+"   *  y[15]  *   ");for(int c=0 ;c<ant ;c++){int tem=0;for(int b=0 ; b<cityNum  ;b++){              if(ar[b]==c){// System.out.println( y[b]+"  "+c+" * "+b);tem=tem+y[b];}}// System.out.println(tem+"  tem  ");if(tem>max){max=tem;// System.out.println(max+"  max  ");}if(tem<min){min=tem;// System.out.println(min+"  min  ");}}//   System.out.println(max+"   max "+ min +"  min  ");return max;}public static void main(String[] args) throws IOException, ParseException {int ww=100;int cityNum=30;// int tiao=50;FileWriter fileWriter1=new FileWriter("d:/工业/hk/遗传.csv");  int [][] dgen=new int[cityNum][tiao];String aw=read.conv.read("d:/工业/hk/矩阵.csv");String[] as =Pattern.compile(",").split(aw);    for(int n=0 ;n<as.length;n++){//System.out.println(as[n]+"  "+n);dgen[n-cityNum*(n/cityNum)][n/cityNum]=Integer.parseInt( as[n].trim() );}int count=0;// while (ww >41 && count<200)int find=40;while (ww >find ){long sysDate1 = System.currentTimeMillis();ww= cross(dgen);long sysDate2 = System.currentTimeMillis();for(int a=0 ;a<tiao ;a++){           for(int d=0 ;d<cityNum ;d++){ dgen[d][a]= dgen2[d][a] ;}}count++;System.out.println(ww+ "  max  "+count );fileWriter1.write( ww+","+ (sysDate2-sysDate1  ) +"\r\n ");fileWriter1.flush();}//查看最优解for(int a=0 ;a<tiao ;a++){           int [] tem= new int[cityNum];for(int d=0 ;d<cityNum ;d++){ //  System.out.println(dgen2[d][a]+"  "+a+"  "+d+"  dgen2  后 ");   //dgen2[d][a] 30个工件对应的机器编号tem[d]=dgen2[d][a];}int tem1=value( tem); //最优值工时if(tem1==find){System.out.println(tem1+"    tem1   ");    for(int d=0 ;d<cityNum ;d++){ System.out.println(dgen2[d][a]+"  "+a+"  "+d ); //最优解}break;}}}}

程序中出现的read.conv.read( string );

public static String read(String a) throws IOException{String as;{       String tops="";BufferedReader ins=new BufferedReader(new FileReader(a));String ss;List<String> nns=new LinkedList<String>();while((ss=ins.readLine())!=null)nns.add(ss);String kps = nns.toString();kps = kps.substring(1,kps.length()-1);//System.out.println(kp+"*-*");tops=kps;// System.out.println(top+"*-*");ins.close();as=tops;}as=as.trim();return as;}

第三部分

文中规划1.csv如下,用10台机器加工30个工件

1

1

3

2

2

2

3

3

6

4

4

4

5

5

5

6

6

7

7

7

9

8

8

13

9

9

4

10

10

12

11

11

10

12

12

18

13

13

22

14

14

11

15

15

8

16

16

26

17

17

14

18

18

6

19

19

17

20

20

27

21

21

11

22

22

17

23

23

26

24

24

16

25

25

7

26

26

23

27

27

15

28

28

18

29

29

15

30

30

13

Java遗传算法并行多机调度程序相关推荐

  1. 并行多机调度遗传算法调参记录---变异和淘汰哪个更重要?

    遗传算法主要有3个参数,变异率,淘汰率和染色体数量.本文通过一个并行多机调度问题,通过交叉验证的实验的方法找到这几个参数可能的最优值. 有3台机器要完成30个工件,计算完成所有工件的最短时间. 首先优 ...

  2. 《Java遗传算法编程》—— 1.5 生物进化

    本节书摘来异步社区<Java遗传算法编程>一书中的第1章,第1.5节,作者: [英]Lee Jacobson(雅各布森) , [美]Burak Kanber(坎贝尔),更多章节内容可以访问 ...

  3. java程序模拟atm机_Java项目实现模拟ATM机

    本文实例为大家分享了Java实现模拟ATM机的具体代码,供大家参考,具体内容如下 项目名称 模拟ATM机 项目描述 简单实现ATM机功能 代码实现 测试类 public class Test { // ...

  4. java如何获取本机IP

    java如何获取本机IP import java.net.*;public class Test6 {public static void main(String[] args) {// TODO A ...

  5. java基础项目-抽奖机-模拟双色球-大乐透

    java基础项目-抽奖机-模拟双色球-大乐透: 创建了很多的方法逐个编译的,做的很新手 不足之处希望多多交流.谢谢. 需求分析: 欢迎界面 欢迎使用超级幸运抽奖机 选彩种(1.双色球:2.超级大乐透) ...

  6. Java 程序获取本机 ip 地址

    Java程序获取本机ip地址: host_ip_list = new ArrayList<String>(); try {for (NetworkInterface networkInte ...

  7. Java算法:华为机试算法(下),华为算法Java版,牛客网华为算法73~108题

    接上篇:Java算法:华为机试算法(中),华为算法Java版,牛客网华为算法55~72题   HJ73 计算日期到天数转换 计算日期到天数转换 题目描述 根据输入的日期,计算是这一年的第几天.. 测试 ...

  8. 使用java代码查询本机ip地址

    一.使用java代码查询本机ip地址 public class TestInetAddress {public static void main(String[] args) {try {String ...

  9. Java遗传算法(GA)简单例子

    文章目录 前言 一.解决的函数 二.遗传和变异算子 1.交叉 2.变异 源代码 前言 Java遗传算法(GA)简单例子 采用的是实数编码 一.解决的函数 f(x) = x1²+x2²+x3² //计算 ...

最新文章

  1. OpenCV中图像Mat,二维指针和CxImage类之间的转换
  2. opencv 头盔检测
  3. 获取mac地址方法之一 GetAdaptersInfo()
  4. php mysql 绑定变量,在MYSQL中,怎么用PDO绑定变量的方式插入数据?
  5. java 枚举类 扑克牌_Java中的枚举和多态,扑克牌示例
  6. 《Python编程从入门到实践》记录之列表遍历
  7. JavaEE Tutorials (13) - 使用锁定控制对实体数据的并发访问
  8. Flex的动画效果与变换(1)
  9. 使用iScroll实现上、下滑动刷新和加载更多数据
  10. R并行做大数据时间序列分析与bootstrap
  11. python实现图书借阅管理系统
  12. 华为路由器时间同步_华为路由器肿么和互联网时间同步
  13. WPS 解决插入尾注后无法添加分节页符
  14. html桂花酿网页,桂花酒的做法
  15. 【谈判】——如何在博弈中获得更多
  16. BZOJ-1076: [SCOI2008]奖励关 (概率期望DP 未完待续)
  17. 快捷指令通知运行html,快捷指令怎样运行这段,一个书签
  18. android横屏竖屏设置
  19. css 下拉框 下三角形
  20. [PTA]习题9-3 平面向量加法

热门文章

  1. plt.acorr()函数使用实例-ValueError: object too deep for desired array
  2. VMD_test matlab仿真
  3. android studio撤销按钮,Android Studio无法撤消(Android Studio Can't Undo)
  4. 流媒体传输协议---RTP--基础
  5. Happy Matt Friends(HDU5119 + dp)
  6. 记录一些精品开源项目
  7. Ubuntu - 安装 jdk 、配置 Java 环境变量、编辑 Test.java 文件并输出 Hello World!
  8. 11深入理解C指针之---指针和常量
  9. linux wheel组
  10. asp.net mvc 从数据库中读取图片的实现代码