コード例 #1
0
 public double[][] getReferenceSet() {
   openga.applications.data.parallelMachine data1 = new openga.applications.data.parallelMachine();
   if (numberOfJob == 35) {
     return data1.getParetoJob35M10();
   } else if (numberOfJob == 50) {
     return data1.getParetoJob50M15();
   } else { // for job = 65
     return data1.getParetoJob65M18();
   }
 }
コード例 #2
0
  public void initiateVars() {
    // initiate scheduling data. We use the benchmark problem.
    openga.applications.data.parallelMachine data1 = new openga.applications.data.parallelMachine();
    dueDay = data1.getTestData3_DueDay(numberOfJob);
    processingTime = data1.getTestData3_processingTime(numberOfJob);
    weights = new double[numberOfSubPopulations][numberOfObjs];

    objectiveMinimization = new boolean[numberOfObjs];
    objectiveMinimization[0] = true;
    objectiveMinimization[1] = true;
    encodeType = true;

    // GA objects
    GaMain = new MainWeightScalarizationI[numberOfSubPopulations];
    Population = new populationI[numberOfSubPopulations];
    Selection = new SelectI[numberOfSubPopulations];
    Crossover = new CrossoverI[numberOfSubPopulations];
    // Crossover2  = new CrossoverI[numberOfSubPopulations];
    Mutation = new MutationI[numberOfSubPopulations];
    // Mutation2  = new MutationI[numberOfSubPopulations];
    // clone1     = new cloneI[numberOfSubPopulations];
    ObjectiveFunction = new ObjectiveFunctionScheduleI[numberOfSubPopulations][numberOfObjs];
    Fitness = new FitnessI[numberOfSubPopulations];

    for (int i = 0; i < numberOfSubPopulations; i++) {
      GaMain[i] =
          new SPGAwithSharedParetoSet(); // singleThreadGA SPGAwithSharedParetoSet adaptiveGA
      Population[i] = new population();

      if (tournamentSize
          == 2) { // binaryTournament similaritySelection2 tenaryTournament varySizeTournament
        Selection[i] = new binaryTournament();
      } else if (tournamentSize == 5) {
        Selection[i] = new quintetTournament();
      } else if (tournamentSize == 10) {
        Selection[i] = new tenaryTournament();
      } else {
        Selection[i] = new twentyTournament();
      }
      // random generate solutionVectorClone solutionVectorCloneWithMutation
      // solutionVectorCloneAdjacentSwapWithMutation solutionVectorCloneWithMiningGene
      clone1 = new solutionVectorCloneWithMutation();

      Crossover[i] =
          new twoPointCrossover2(); // oneByOneChromosomeCrossover twoPointCrossover2
                                    // twoPointCrossover2withAdpative
      Crossover2 = new PMX();
      Mutation[i] = new swapMutation(); // swapMutation shiftMutation swapMutationWithAdaptive
      Mutation2 = new shiftMutation(); // shiftMutation

      ObjectiveFunction[i] = new ObjectiveFunctionScheduleI[numberOfObjs];
      ObjectiveFunction[i][0] = new ObjectiveMakeSpan(); // the first objective, makespan
      ObjectiveFunction[i][1] = new ObjectiveTardiness(); // the second one.
      Fitness[i] = new FitnessByScalarizedM_objectives();

      // set schedule data to the objectives
      ObjectiveFunction[i][0].setScheduleData(processingTime, numberOfMachines);
      ObjectiveFunction[i][1].setScheduleData(dueDay, processingTime, numberOfMachines);
      // set the data to the GA main program.
      GaMain[i].setData(
          Population[i],
          Selection[i],
          Crossover[i],
          Mutation[i],
          ObjectiveFunction[i],
          Fitness[i],
          firstIteration,
          DEFAULT_PopSize * 2,
          DEFAULT_PopSize,
          numberOfJob,
          DEFAULT_crossoverRate,
          DEFAULT_mutationRate,
          objectiveMinimization,
          numberOfObjs,
          encodeType,
          elitism);
      // set weight data
      weights[i] = calcWeightsForEachSubPop(i);
      GaMain[i].setWeight(weights[i]);
      // set secondary crossover and mutation operator.
      GaMain[i].setSecondaryCrossoverOperator(Crossover2, applySecCRX);
      GaMain[i].setSecondaryMutationOperator(Mutation2, applySecMutation);
      // GaMain[i].setCloneOperatpr(clone1, applyClone);
    }
  }