Пример #1
0
 public void start() {
   System.out.println();
   openga.util.timeClock timeClock1 = new openga.util.timeClock();
   timeClock1.start();
   GaMain.startGA();
   timeClock1.end();
   // System.out.println("\nThe final result");
   int bestInd = getBestSolnIndex(GaMain.getArchieve());
   System.out.println(GaMain.getArchieve().getSingleChromosome(bestInd).toString1());
   String implementationResult = "";
   implementationResult +=
       fileName
           + "\t"
           + numberOfJob
           + "\t"
           + DEFAULT_crossoverRate
           + "\t"
           + DEFAULT_mutationRate
           + "\t"
           + DEFAULT_PopSize
           + "\t"
           + GaMain.getArchieve().getSingleChromosome(bestInd).getObjValue()[0]
           + "\t"
           + timeClock1.getExecutionTime() / 1000.0
           + "\n";
   // implementationResult += fileName + "\t" + evaporationMethod + "\t" +
   // GaMain.getArchieve().getSingleChromosome(bestInd).getObjValue()[0] + "\t" +
   // timeClock1.getExecutionTime() / 1000.0 + "\n";
   // implementationResult += fileName+"\t"+numberOfJob+"\t"+startingGeneration+"\t"+interval+"\t"+
   // GaMain.getArchieve().getSingleChromosome(bestInd).getObjValue()[0]+"\t"+timeClock1.getExecutionTime()/1000.0+"\n";
   writeFile("SingleMachine_PREDA1002", implementationResult);
   System.out.println(implementationResult);
 }
Пример #2
0
 /**
  * For single objective problem
  *
  * @param arch1
  * @return
  */
 public int getBestSolnIndex(populationI arch1) {
   int index = 0;
   double bestobj = Double.MAX_VALUE;
   for (int k = 0; k < GaMain.getArchieve().getPopulationSize(); k++) {
     if (bestobj > GaMain.getArchieve().getObjectiveValues(k)[0]) {
       bestobj = GaMain.getArchieve().getObjectiveValues(k)[0];
       index = k;
     }
   }
   return index;
 }