Example #1
0
  public void initiateVars() {
    GaMain = new singleThreadGAwithProbabilityMatrixPREDA();
    Population = new population();
    Selection = new binaryTournament();
    Crossover = new twoPointCrossover2(); //
    Crossover2 = new PMX();

    Mutation = new swapMutation();
    // Mutation   = new swapMutationWithMining2();//swapMutationWithMining2 shiftMutationWithMining2
    Mutation2 = new inverseMutation();
    ObjectiveFunction = new ObjectiveFunctionScheduleI[numberOfObjs];
    ObjectiveFunction[0] =
        new ObjectiveEarlinessTardinessPenalty(); // the first objective, tardiness,
                                                  // ObjectiveTardiness
                                                  // ObjectiveEarlinessTardinessPenalty
    Fitness = new singleObjectiveFitness();
    objectiveMinimization = new boolean[numberOfObjs];
    objectiveMinimization[0] = true;
    // objectiveMinimization[1] = true;
    encodeType = true;
    clone1 = new solutionVectorCloneWithMutation(); // swap mutation
    // set schedule data to the objectives
    ObjectiveFunction[0].setScheduleData(dueDay, processingTime, numberOfMachines);
    // set the data to the GA main program.
    GaMain.setLearningRate(lamda, beta); // Interaction Learning rate
    GaMain.setWeight(w1, w2); // model=uni*w1 + bi*w2
    GaMain.setProbabilityMatrixData(startingGeneration, interval);
    GaMain.setSequenceStrategy(strategy);
    totalSolnsToExamine = 125000;
    DEFAULT_PopSize = 100;
    // System.out.println(DEFAULT_PopSize);
    // System.exit(0);
    DEFAULT_generations = totalSolnsToExamine / (DEFAULT_PopSize);
    GaMain.setEvaporationMethod(applyEvaporation, evaporationMethod);
    GaMain.setData(
        Population,
        Selection,
        Crossover,
        Mutation,
        ObjectiveFunction,
        Fitness,
        DEFAULT_generations,
        DEFAULT_PopSize,
        DEFAULT_PopSize,
        numberOfJob,
        DEFAULT_crossoverRate,
        DEFAULT_mutationRate,
        objectiveMinimization,
        numberOfObjs,
        encodeType,
        elitism);
    GaMain.setSecondaryCrossoverOperator(Crossover2, false);
    GaMain.setSecondaryMutationOperator(Mutation2, false);
  }