def runRound(par, parComb, parCount, logIndex, numberOfThreads, round,
             broadcast, messenger, progressions, definitions, islandSizes,
             percentageOfBestIndividualsForMigrationAllIslands, islandNumber):
    islandStart = datetime.now()
    population_size = int(par[islandNumber + parCount][1])
    numberOfGenerations = int(par[islandNumber + parCount][2])
    crossoverType = int(par[islandNumber + parCount][3])
    crossoverTasksNumPerc = float(par[islandNumber + parCount][4])
    crossoverProbability = float(par[islandNumber + parCount][5])
    mutationType = int(par[islandNumber + parCount][6])
    mutationTasksNumPerc = float(par[islandNumber + parCount][7])
    tasksMutationStartProbability = float(par[islandNumber + parCount][8])
    tasksMutationEndProbability = float(par[islandNumber + parCount][9])
    operatorsMutationStartProbability = float(par[islandNumber + parCount][10])
    operatorsMutationEndProbability = float(par[islandNumber + parCount][11])
    changeMutationRateType = int(par[islandNumber + parCount][12])
    changeMutationRateExpBase = float(par[islandNumber + parCount][13])
    drivenMutation = int(par[islandNumber + parCount][14])
    drivenMutationPart = float(par[islandNumber + parCount][15])
    limitBestFitnessRepetionCount = int(par[islandNumber + parCount][16])
    numberOfcyclesAfterDrivenMutation = int(par[islandNumber + parCount][17])
    completenessWeight = float(par[islandNumber + parCount][18])
    TPweight = float(par[islandNumber + parCount][19])
    precisenessStart = float(par[islandNumber + parCount][22])
    simplicityStart = int(par[islandNumber + parCount][23])
    evolutionEnd = int(par[islandNumber + parCount][24])
    completenessAttemptFactor1 = int(par[islandNumber + parCount][25])
    completenessAttemptFactor2 = float(par[islandNumber + parCount][26])
    elitismPerc = float(par[islandNumber + parCount][27])
    selectionOp = int(par[islandNumber + parCount][28])
    selectionTp = int(par[islandNumber + parCount][29])
    lambdaValue = int(par[islandNumber + parCount][30])
    HammingThreshold = int(par[islandNumber + parCount][31])
    migrationtime = int(par[islandNumber + parCount][32])
    percentageOfBestIndividualsForMigrationPerIsland = float(par[islandNumber +
                                                                 parCount][34])
    percentageOfIndividualsForMigrationPerIsland = float(par[islandNumber +
                                                             parCount][35])
    fitnessStrategy = int(par[islandNumber + parCount][37])
    #Depois deve existir no Excel
    maxTempGen = 100
    satime = 1
    expectedProgression = 0.5

    names = [
        '[8] tasksMutationStartProbability',
        '[10] operatorsMutationStartProbability', '[32] migrationtime',
        '[34] percentageOfBestIndividualsForMigrationPerIsland',
        '[35] percentageOfIndividualsForMigrationPerIsland'
    ]

    if fitnessStrategy == 0:
        precisenessWeight = float(par[islandNumber + parCount][20])
        simplicityWeight = float(par[islandNumber + parCount][21])
    else:
        precisenessWeight = 0
        simplicityWeight = 0
    islandSizes[islandNumber] = population_size
    percentageOfBestIndividualsForMigrationAllIslands[
        islandNumber] = percentageOfBestIndividualsForMigrationPerIsland
    alphabet = []
    log = copy.deepcopy(logs.logList[logIndex])
    logSizeAndMaxTraceSize = [0, float('inf'), 0]
    iniPop.createAlphabet(log, alphabet)
    iniPop.processLog(log, logSizeAndMaxTraceSize)
    highestValueAndPosition = [[0, 0, 0], -1]
    if highestValueAndPosition[0][1] >= precisenessStart:
        precisenessWeight = float(par[islandNumber + parCount][20])
    (population, evaluatedPopulation, referenceCromossome,
     averageEnabledTasks) = iniPop.initializePopulation(
         islandNumber, population_size, TPweight, precisenessWeight,
         simplicityWeight, completenessWeight, completenessAttemptFactor1,
         completenessAttemptFactor2, selectionOp, alphabet, log)
    fitnessEvolution = []
    (highestValueAndPosition,
     sortedEvaluatedPopulation) = cycle.chooseHighest(evaluatedPopulation)
    lowestValue = cycle.chooseLowest(sortedEvaluatedPopulation)
    averageValue = cycle.calculateAverage(evaluatedPopulation)
    fitnessEvolution.append([
        lowestValue, highestValueAndPosition[0][0], averageValue, 0,
        highestValueAndPosition[0][1], highestValueAndPosition[0][2],
        highestValueAndPosition[0][3], highestValueAndPosition[0][4], 0, 0, 0,
        0
    ])
    if (fitnessEvolution[0][10] >= simplicityStart) and (precisenessWeight >
                                                         0):
        simplicityWeight = float(par[islandNumber + parCount][21])
    print('LOG:', logIndex, '| COMB:', parComb, '| RND:', round, '| GEN:', 0,
          '| TF:', '%.6f' % highestValueAndPosition[0][0], '| C:',
          '%.6f' % highestValueAndPosition[0][1], '| TP:',
          '%.6f' % highestValueAndPosition[0][2], '| P:',
          '%.6f' % highestValueAndPosition[0][3], '| S:',
          '%.6f' % highestValueAndPosition[0][4], '| REP:',
          fitnessEvolution[0][3], fitnessEvolution[0][8],
          fitnessEvolution[0][9], fitnessEvolution[0][10],
          fitnessEvolution[0][11], '| ISL:', islandNumber, '| PAR:',
          islandNumber)
    drivenMutatedIndividuals = [0 for _ in range(len(population))]
    drivenMutatedGenerations = 0
    for currentGeneration in range(1, numberOfGenerations):
        if highestValueAndPosition[0][1] >= precisenessStart:
            precisenessWeight = float(par[islandNumber + parCount][20])
        (tasksMutationProbability,
         operatorsMutationProbability) = op.defineMutationProbability(
             tasksMutationStartProbability, tasksMutationEndProbability,
             operatorsMutationStartProbability,
             operatorsMutationEndProbability, numberOfGenerations,
             currentGeneration, changeMutationRateType,
             changeMutationRateExpBase)
        (population, evaluatedPopulation, drivenMutatedIndividuals,
         drivenMutatedGenerations) = cycle.generation(
             population, referenceCromossome, evaluatedPopulation,
             crossoverType, crossoverProbability, crossoverTasksNumPerc,
             mutationType, mutationTasksNumPerc, tasksMutationProbability,
             operatorsMutationProbability, drivenMutation, drivenMutationPart,
             limitBestFitnessRepetionCount,
             fitnessEvolution[currentGeneration - 1][3],
             drivenMutatedIndividuals, drivenMutatedGenerations, TPweight,
             precisenessWeight, simplicityWeight, completenessWeight,
             elitismPerc, sortedEvaluatedPopulation, selectionOp, selectionTp,
             lambdaValue, HammingThreshold, currentGeneration,
             completenessAttemptFactor1, completenessAttemptFactor2,
             numberOfcyclesAfterDrivenMutation, alphabet, log)
        (highestValueAndPosition,
         sortedEvaluatedPopulation) = cycle.chooseHighest(evaluatedPopulation)
        isl.set_broadcast(population, sortedEvaluatedPopulation, islandNumber,
                          percentageOfBestIndividualsForMigrationPerIsland,
                          broadcast)
        lowestValue = cycle.chooseLowest(sortedEvaluatedPopulation)
        averageValue = cycle.calculateAverage(evaluatedPopulation)
        fitnessEvolution.append([
            lowestValue, highestValueAndPosition[0][0], averageValue, 0,
            highestValueAndPosition[0][1], highestValueAndPosition[0][2],
            highestValueAndPosition[0][3], highestValueAndPosition[0][4], 0, 0,
            0, 0
        ])
        if fitnessEvolution[currentGeneration][1] == fitnessEvolution[
                currentGeneration - 1][1]:
            fitnessEvolution[currentGeneration][8] = fitnessEvolution[
                currentGeneration - 1][8] + 1
        if fitnessEvolution[currentGeneration][4] == fitnessEvolution[
                currentGeneration - 1][4]:
            fitnessEvolution[currentGeneration][3] = fitnessEvolution[
                currentGeneration - 1][3] + 1
        if fitnessEvolution[currentGeneration][5] == fitnessEvolution[
                currentGeneration - 1][5]:
            fitnessEvolution[currentGeneration][9] = fitnessEvolution[
                currentGeneration - 1][9] + 1
        if fitnessEvolution[currentGeneration][6] == fitnessEvolution[
                currentGeneration - 1][6]:
            fitnessEvolution[currentGeneration][10] = fitnessEvolution[
                currentGeneration - 1][10] + 1
        if fitnessEvolution[currentGeneration][7] == fitnessEvolution[
                currentGeneration - 1][7]:
            fitnessEvolution[currentGeneration][11] = fitnessEvolution[
                currentGeneration - 1][11] + 1
        if (fitnessEvolution[currentGeneration][10] >=
                simplicityStart) and (precisenessWeight > 0):
            simplicityWeight = float(par[islandNumber + parCount][21])
        print('LOG:', logIndex, '|COMB:', parComb, '|RND:', round, '|GEN:',
              currentGeneration, '|TF:',
              '%.6f' % highestValueAndPosition[0][0], '|C:',
              '%.6f' % highestValueAndPosition[0][1], '|TP:',
              '%.6f' % highestValueAndPosition[0][2], '|P:',
              '%.6f' % highestValueAndPosition[0][3], '|S:',
              '%.6f' % highestValueAndPosition[0][4], '|REP:',
              fitnessEvolution[currentGeneration][8],
              fitnessEvolution[currentGeneration][3],
              fitnessEvolution[currentGeneration][9],
              fitnessEvolution[currentGeneration][10],
              fitnessEvolution[currentGeneration][11], '|ISL:', islandNumber,
              '|PAR:', islandNumber)
        if ((fitnessStrategy == 0) and
            ((highestValueAndPosition[0][1] >= 1.0) and
             (fitnessEvolution[currentGeneration][8] >= evolutionEnd))) or (
                 (fitnessStrategy == 1) and
                 ((highestValueAndPosition[0][1] == 1.0) and
                  (highestValueAndPosition[0][3] > 0) and
                  (highestValueAndPosition[0][4] > 0) and
                  (fitnessEvolution[currentGeneration][10] >= evolutionEnd) and
                  (fitnessEvolution[currentGeneration][11] >= evolutionEnd))):
            #if (highestValueAndPosition[0][1] == 1.0) and (highestValueAndPosition[0][2] == 1.0):
            broadcast[-1] = 0
        if broadcast[-1] == 0:
            break
        isl.send_individuals(population, sortedEvaluatedPopulation,
                             islandNumber, numberOfThreads, messenger)
        if (currentGeneration > 0) and (currentGeneration % migrationtime
                                        == 0):
            island_fitness = []
            for i in range(len(evaluatedPopulation[1])):
                island_fitness.append(evaluatedPopulation[1][i][0])
            isl.receive_individuals(population, islandNumber, island_fitness,
                                    messenger)
            isl.do_migration(
                population, islandNumber, numberOfThreads, island_fitness,
                percentageOfIndividualsForMigrationPerIsland,
                percentageOfBestIndividualsForMigrationPerIsland, broadcast,
                islandSizes, percentageOfBestIndividualsForMigrationAllIslands)
            evaluatedPopulation = fit.evaluationPopulation(
                population, referenceCromossome, TPweight, precisenessWeight,
                simplicityWeight, completenessWeight,
                completenessAttemptFactor1, completenessAttemptFactor2,
                selectionOp, alphabet, log)
            (highestValueAndPosition, sortedEvaluatedPopulation
             ) = cycle.chooseHighest(evaluatedPopulation)

        if (currentGeneration > 0
                and (numberOfGenerations - currentGeneration > 10)
                and currentGeneration % satime == 0):
            print("ISLAND: ", islandNumber, "currently at Simulated Annealing")
            #Simulated Annealing
            island_fitness = []
            for i in range(len(evaluatedPopulation[1])):
                island_fitness.append(evaluatedPopulation[1][i][0])
            currentFitness = max(island_fitness)
            parametersTP = [
                tasksMutationStartProbability,
                operatorsMutationStartProbability, migrationtime,
                percentageOfBestIndividualsForMigrationPerIsland,
                percentageOfIndividualsForMigrationPerIsland
            ]
            sa.SA(islandNumber, expectedProgression, currentGeneration,
                  maxTempGen, definitions, progressions, parametersTP,
                  currentFitness)
            tasksMutationStartProbability = parametersTP[0]

    #Update altered parameters (somente para [10] operatorsMutationStartProbability)
    df = pd.read_csv("input-parameters.csv", sep=";")
    parI = 0
    for name in names:
        df.at[islandNumber + parCount - 1, name] = parametersTP[parI]
        #print("changed", name, 'of island', islandNumber, 'to', parametersTP[parI])
        parI += 1
    df.to_csv("input-parameters.csv", sep=";", index=False)
    print("ISLAND: ", islandNumber, "finished with Simulated Annealing")

    cycle.postProcessing(population, alphabet)
    #plot.plot_evolution_per_island(fitnessEvolution, str(islandNumber), str(round), islandNumber)
    prevPlot = []
    with open('results/plotting_{0}.txt'.format(islandNumber), 'r') as plott:
        for line in isl.nonblank_lines(plott):
            prevPlot.append(literal_eval(line))
    plott.close()
    prevPlot.extend(fitnessEvolution)
    with open('results/plotting_{0}.txt'.format(islandNumber), 'w') as plott:
        for ini in range(len(prevPlot)):
            plott.write(str(prevPlot[ini]) + '\n')
    plott.close()
    islandEnd = datetime.now()
    islandDuration = islandEnd - islandStart
    record.record_evolution(logIndex, log, str(parComb), str(islandNumber),
                            str(round), par[islandNumber + parCount],
                            islandNumber, highestValueAndPosition[0],
                            fitnessEvolution, alphabet,
                            population[highestValueAndPosition[1]],
                            islandStart, islandEnd, islandDuration,
                            currentGeneration)
    print(islandNumber, islandDuration, '%.5f' % highestValueAndPosition[0][0],
          '%.5f' % highestValueAndPosition[0][1],
          '%.5f' % highestValueAndPosition[0][2],
          '%.5f' % highestValueAndPosition[0][3], alphabet,
          population[highestValueAndPosition[1]])
    return
예제 #2
0
def runRound(par, parameter, population_size, numberOfGenerations, crossoverType, crossoverTasksNumPerc, crossoverProbability, mutationType, mutationTasksNumPerc, tasksMutationStartProbability, tasksMutationEndProbability, operatorsMutationStartProbability, operatorsMutationEndProbability, changeMutationRateType, changeMutationRateExpBase, drivenMutation, drivenMutationPart, limitBestFitnessRepetionCount, numberOfcyclesAfterDrivenMutation, completenessWeight, TPweight, precisenessWeight, simplicityWeight, precisenessStart, simplicityStart, evolutionEnd, completenessAttemptFactor1, completenessAttemptFactor2, elitismPerc, selectionOp, selectionTp, lambdaValue, HammingThreshold, migrationtime, percentageOfBestIndividualsForMigrationPerIsland, percentageOfIndividualsForMigrationPerIsland, alphabet, log, fitnessStrategy, logIndex, num_threads, round, broadcast, islandNumber):
    islandStart = datetime.now()
    highestValueAndPosition = [[0, 0, 0], -1]
    if highestValueAndPosition[0][1] >= precisenessStart:
        precisenessWeight = float(par[parameter][20])
    (population, evaluatedPopulation, referenceCromossome, averageEnabledTasks) = iniPop.initializePopulation(islandNumber, population_size, TPweight, precisenessWeight, simplicityWeight, completenessWeight, completenessAttemptFactor1, completenessAttemptFactor2, selectionOp, alphabet, log)
    fitnessEvolution = []
    (highestValueAndPosition, sortedEvaluatedPopulation) = cycle.chooseHighest(evaluatedPopulation)
    lowestValue = cycle.chooseLowest(sortedEvaluatedPopulation)
    averageValue = cycle.calculateAverage(evaluatedPopulation)
    fitnessEvolution.append([lowestValue, highestValueAndPosition[0][0], averageValue, 0, highestValueAndPosition[0][1], highestValueAndPosition[0][2], highestValueAndPosition[0][3], highestValueAndPosition[0][4], 0, 0, 0, 0])
    if (fitnessEvolution[0][8] >= simplicityStart) and (precisenessWeight > 0):
        simplicityWeight = float(par[parameter][21])
    print('LOG:', logIndex, '| PAR:', parameter, '| RND:', round, '| GEN:', 0, '| TF:', '%.5f' % highestValueAndPosition[0][0], '| C:', '%.5f' % highestValueAndPosition[0][1], '| TP:', '%.5f' % highestValueAndPosition[0][2], '| P:', '%.5f' % highestValueAndPosition[0][3], '| S:', '%.5f' % highestValueAndPosition[0][4], '| REP:', fitnessEvolution[0][3], fitnessEvolution[0][8], fitnessEvolution[0][9], fitnessEvolution[0][10], fitnessEvolution[0][11], '| ISL:', islandNumber)
    drivenMutatedIndividuals = [0 for _ in range(len(population))]
    drivenMutatedGenerations = 0
    for currentGeneration in range(1, numberOfGenerations):
        if highestValueAndPosition[0][1] >= precisenessStart:
            precisenessWeight = float(par[parameter][20])
        (tasksMutationProbability, operatorsMutationProbability) = op.defineMutationProbability(tasksMutationStartProbability, tasksMutationEndProbability, operatorsMutationStartProbability, operatorsMutationEndProbability, numberOfGenerations, currentGeneration, changeMutationRateType, changeMutationRateExpBase)
        (population, evaluatedPopulation, drivenMutatedIndividuals, drivenMutatedGenerations) = cycle.generation(population, referenceCromossome, evaluatedPopulation, crossoverType, crossoverProbability, crossoverTasksNumPerc, mutationType, mutationTasksNumPerc, tasksMutationProbability, operatorsMutationProbability, drivenMutation, drivenMutationPart, limitBestFitnessRepetionCount, fitnessEvolution[currentGeneration - 1][3], drivenMutatedIndividuals, drivenMutatedGenerations, TPweight, precisenessWeight, simplicityWeight, completenessWeight, elitismPerc, sortedEvaluatedPopulation, selectionOp, selectionTp, lambdaValue, HammingThreshold, currentGeneration, completenessAttemptFactor1, completenessAttemptFactor2, numberOfcyclesAfterDrivenMutation, alphabet, log)
        (highestValueAndPosition, sortedEvaluatedPopulation) = cycle.chooseHighest(evaluatedPopulation)
        isl.set_broadcast(population, sortedEvaluatedPopulation, islandNumber,percentageOfBestIndividualsForMigrationPerIsland, broadcast)
        lowestValue = cycle.chooseLowest(sortedEvaluatedPopulation)
        averageValue = cycle.calculateAverage(evaluatedPopulation)
        fitnessEvolution.append([lowestValue, highestValueAndPosition[0][0], averageValue, 0, highestValueAndPosition[0][1], highestValueAndPosition[0][2], highestValueAndPosition[0][3], highestValueAndPosition[0][4], 0, 0, 0, 0])
        if fitnessEvolution[currentGeneration][1] == fitnessEvolution[currentGeneration - 1][1]:
            fitnessEvolution[currentGeneration][8] = fitnessEvolution[currentGeneration - 1][8] + 1
        if fitnessEvolution[currentGeneration][4] == fitnessEvolution[currentGeneration - 1][4]:
            fitnessEvolution[currentGeneration][3] = fitnessEvolution[currentGeneration - 1][3] + 1
        if fitnessEvolution[currentGeneration][5] == fitnessEvolution[currentGeneration - 1][5]:
            fitnessEvolution[currentGeneration][9] = fitnessEvolution[currentGeneration - 1][9] + 1
        if fitnessEvolution[currentGeneration][6] == fitnessEvolution[currentGeneration - 1][6]:
            fitnessEvolution[currentGeneration][10] = fitnessEvolution[currentGeneration - 1][10] + 1
        if fitnessEvolution[currentGeneration][7] == fitnessEvolution[currentGeneration - 1][7]:
            fitnessEvolution[currentGeneration][11] = fitnessEvolution[currentGeneration - 1][11] + 1
        if (fitnessEvolution[currentGeneration][10] >= simplicityStart) and (precisenessWeight > 0):
            simplicityWeight = float(par[parameter][21])
        print('LOG:', logIndex, '| PAR:', parameter, '| RND:', round, '| GEN:', currentGeneration, '| TF:', '%.6f' % highestValueAndPosition[0][0], '| C:', '%.5f' % highestValueAndPosition[0][1], '| TP:', '%.5f' % highestValueAndPosition[0][2], '| P:', '%.5f' % highestValueAndPosition[0][3], '| S:', '%.5f' % highestValueAndPosition[0][4], '| REP:', fitnessEvolution[currentGeneration][8], fitnessEvolution[currentGeneration][3], fitnessEvolution[currentGeneration][9], fitnessEvolution[currentGeneration][10], fitnessEvolution[currentGeneration][11], '| ISL:', islandNumber)
        if ((fitnessStrategy == 0) and ((highestValueAndPosition[0][1] >= 1.0) and (fitnessEvolution[currentGeneration][8] >= evolutionEnd))) or ((fitnessStrategy == 1) and ((highestValueAndPosition[0][1] == 1.0) and (highestValueAndPosition[0][3] > 0) and (highestValueAndPosition[0][4] > 0) and (fitnessEvolution[currentGeneration][10] >= evolutionEnd) and (fitnessEvolution[currentGeneration][11] >= evolutionEnd))):
            broadcast[len(broadcast)-1] = 0
        if (currentGeneration > 0) and (currentGeneration % migrationtime == 0):
            island_fitness = []
            for i in range(len(evaluatedPopulation[1])):
                valor = evaluatedPopulation[1][i]
                island_fitness.append(valor[0])
            isl.do_migration2(population, islandNumber, num_threads, island_fitness, percentageOfIndividualsForMigrationPerIsland, percentageOfBestIndividualsForMigrationPerIsland, broadcast)
            migraNeed = []
            migraNeed.append(broadcast[len(broadcast)-1])
            if migraNeed[0] == 0:
                break
            evaluatedPopulation = fit.evaluationPopulation(population, referenceCromossome, TPweight, precisenessWeight, simplicityWeight, completenessWeight, completenessAttemptFactor1, completenessAttemptFactor2, selectionOp, alphabet, log)
            (highestValueAndPosition, sortedEvaluatedPopulation) = cycle.chooseHighest(evaluatedPopulation)
    cycle.postProcessing(population, alphabet)
    plot.plot_evolution_per_island(fitnessEvolution, str(parameter), str(round), islandNumber)
    prevPlot = []
    with open('results/plotting_{0}.txt'.format(islandNumber), 'r') as plott:
        for line in isl.nonblank_lines(plott):
            prevPlot.append(literal_eval(line))
    plott.close()
    prevPlot.extend(fitnessEvolution)
    with open('results/plotting_{0}.txt'.format(islandNumber), 'w') as plott:
        for ini in range(len(prevPlot)):
            plott.write(str(prevPlot[ini]) + '\n')
    plott.close()
    islandEnd = datetime.now()
    islandDuration = islandEnd - islandStart
    record.record_evolution(log, str(parameter), str(round), par[parameter], islandNumber, highestValueAndPosition[0], fitnessEvolution, alphabet, population[highestValueAndPosition[1]], islandStart, islandEnd, islandDuration, currentGeneration)
    print(islandNumber, islandDuration, '%.5f' % highestValueAndPosition[0][0], '%.5f' % highestValueAndPosition[0][1], '%.5f' % highestValueAndPosition[0][2], '%.5f' % highestValueAndPosition[0][3], alphabet, population[highestValueAndPosition[1]])
    return
예제 #3
0
def initializeOp(barrier, island):
    start = datetime.now()
    logSizeAndMaxTraceSize = [0, float('inf'), 0]
    iniPop.createAlphabet(iniPop.log, iniPop.alphabet)
    iniPop.processLog(iniPop.log, logSizeAndMaxTraceSize)
    
    for parameter in range(len(par)):
        numberOfRounds = par[parameter][0]
        population_size = par[parameter][1]
        numberOfGenerations = par[parameter][2]
        crossoverType = par[parameter][3]
        crossoverTasksNumPerc = par[parameter][4]
        crossoverProbability = par[parameter][5]
        mutationType = par[parameter][6]
        mutationTasksNumPerc = par[parameter][7]
        tasksMutationStartProbability = par[parameter][8]
        tasksMutationEndProbability = par[parameter][9]
        operatorsMutationStartProbability = par[parameter][10]
        operatorsMutationEndProbability = par[parameter][11]
        changeMutationRateType = par[parameter][12]
        changeMutationRateExpBase = par[parameter][13]
        drivenMutation = par[parameter][14]
        drivenMutationPart = par[parameter][15]
        limitBestFitnessRepetionCount = par[parameter][16]
        numberOfcyclesAfterDrivenMutation = par[parameter][17]
        TPweight = par[parameter][18]
        completenessWeight = par[parameter][19]
        precisenessWeight = 0
        simplicityWeight = 0
        precisenessStart = par[parameter][22]
        simplicityStart = par[parameter][23]
        completenessAttemptFactor1 = par[parameter][24]
        completenessAttemptFactor2 = par[parameter][25]
        elitismPerc = par[parameter][26]
        selectionOp = par[parameter][27]
        selectionTp = par[parameter][28]
        lambdaValue = par[parameter][29]
        HammingThreshold = par[parameter][30]
        migrationtime = par[parameter][31]
        for round in range(numberOfRounds):
            highestValueAndPosition = [[0, 0, 0], -1]
            if highestValueAndPosition[0][1] >= precisenessStart:
                precisenessWeight = par[parameter][20]
            (population, evaluatedPopulation, referenceCromossome, averageEnabledTasks) = iniPop.initializePopulation(island, population_size, TPweight, precisenessWeight, simplicityWeight, completenessWeight, completenessAttemptFactor1, completenessAttemptFactor2, selectionOp)
            fitnessEvolution = []
            (highestValueAndPosition, sortedEvaluatedPopulation) = cycle.chooseHighest(evaluatedPopulation)
            lowestValue = cycle.chooseLowest(sortedEvaluatedPopulation)
            averageValue = cycle.calculateAverage(evaluatedPopulation)
            fitnessEvolution.append([lowestValue, highestValueAndPosition[0][0], averageValue, 0, highestValueAndPosition[0][1], highestValueAndPosition[0][2], highestValueAndPosition[0][3], highestValueAndPosition[0][4], 0, 0])
            if fitnessEvolution[0][8] >= simplicityStart:
                simplicityWeight = par[parameter][21]
            print('par:', parameter, '/ round:', round, '/ gen:', 0, '/ total fitness:', "%.5f" % highestValueAndPosition[0][0], '/ comp:',  "%.5f" % highestValueAndPosition[0][1], '/ TP:', "%.5f" % highestValueAndPosition[0][2], '/ prec:',  "%.5f" % highestValueAndPosition[0][3], '/ simp:',  "%.5f" % highestValueAndPosition[0][4], '/ eqCount:', fitnessEvolution[0][3], fitnessEvolution[0][8], fitnessEvolution[0][9])
            #if (highestValueAndPosition[0][2] == 1) and (highestValueAndPosition[0][1] == 1):
            #if (highestValueAndPosition[0][1] == 1):
            #    break
            drivenMutatedIndividuals = [0 for _ in range(len(population))]
            drivenMutatedGenerations = 0
            for currentGeneration in range(1,numberOfGenerations):
                print("Geração -----", currentGeneration, "da ilha -----", island) #printar a geração - Joon
                with open("evaluation_{0}.txt".format(island), "w") as eva_list: #extrair a população do arquivo Island para o vetor na memória - Joon 
                    for i in range(len(evaluatedPopulation[1])):
                        vector = evaluatedPopulation[1][i]
                        eva_list.write(str(vector[0]) + '\n')
                if highestValueAndPosition[0][1] >= precisenessStart:
                    precisenessWeight = par[parameter][20]
                (tasksMutationProbability, operatorsMutationProbability) = op.defineMutationProbability(tasksMutationStartProbability, tasksMutationEndProbability, operatorsMutationStartProbability, operatorsMutationEndProbability, numberOfGenerations, currentGeneration, changeMutationRateType, changeMutationRateExpBase)
                (population, evaluatedPopulation, drivenMutatedIndividuals, drivenMutatedGenerations) = cycle.generation(population, referenceCromossome, evaluatedPopulation, crossoverType, crossoverProbability, crossoverTasksNumPerc, mutationType, mutationTasksNumPerc, tasksMutationProbability, operatorsMutationProbability, drivenMutation, drivenMutationPart, limitBestFitnessRepetionCount, fitnessEvolution[currentGeneration - 1][3], drivenMutatedIndividuals, drivenMutatedGenerations, TPweight, precisenessWeight, simplicityWeight, completenessWeight, elitismPerc, sortedEvaluatedPopulation, selectionOp, selectionTp, lambdaValue, HammingThreshold, currentGeneration, completenessAttemptFactor1, completenessAttemptFactor2, numberOfcyclesAfterDrivenMutation)
                (highestValueAndPosition, sortedEvaluatedPopulation) = cycle.chooseHighest(evaluatedPopulation)
                set_broadcast(population, highestValueAndPosition[0][0], highestValueAndPosition[1], island) #armazenar os melhores indivudos no broadcast da ilha - Joon
                lowestValue = cycle.chooseLowest(sortedEvaluatedPopulation)
                set_broadcast_lowest(lowestValue, island) #armazenar os piores individuos no broad. da ilha - Joon
                averageValue = cycle.calculateAverage(evaluatedPopulation)
                fitnessEvolution.append([lowestValue, highestValueAndPosition[0][0], averageValue, 0, highestValueAndPosition[0][1], highestValueAndPosition[0][2], highestValueAndPosition[0][3], highestValueAndPosition[0][4], 0, 0])
                if fitnessEvolution[currentGeneration][4] ==  fitnessEvolution[currentGeneration - 1][4]:
                    fitnessEvolution[currentGeneration][3] = fitnessEvolution[currentGeneration - 1][3] + 1
                if fitnessEvolution[currentGeneration][6] ==  fitnessEvolution[currentGeneration - 1][6]:
                    fitnessEvolution[currentGeneration][8] = fitnessEvolution[currentGeneration - 1][8] + 1
                if fitnessEvolution[currentGeneration][7] ==  fitnessEvolution[currentGeneration - 1][7]:
                    fitnessEvolution[currentGeneration][9] = fitnessEvolution[currentGeneration - 1][9] + 1
                if fitnessEvolution[currentGeneration][8] >= simplicityStart:
                    simplicityWeight = par[parameter][21]
                print('par:', parameter, '/ round:', round, '/ gen:', currentGeneration, '/ total fitness:', "%.5f" % highestValueAndPosition[0][0], '/ comp:',  "%.5f" % highestValueAndPosition[0][1], '/ TP:', "%.5f" % highestValueAndPosition[0][2], '/ prec:',  "%.5f" % highestValueAndPosition[0][3], '/ simp:',  "%.5f" % highestValueAndPosition[0][4], '/ eqCount:', fitnessEvolution[currentGeneration][3], fitnessEvolution[currentGeneration][8], fitnessEvolution[currentGeneration][9])
                #if ((highestValueAndPosition[0][2] == 1) and (highestValueAndPosition[0][1] == 1)) and (fitnessEvolution[currentGeneration][3] == 100):
                if ((highestValueAndPosition[0][1] == 1)) and (fitnessEvolution[currentGeneration][9] == 30):
                    #fechar barreira - Joon
                    break
                if currentGeneration > 0 and currentGeneration%migrationtime == 0: #realizar a migração - Joon 
                    barrier.wait()
                    barrier.reset()
            cycle.postProcessing(population)
            print("%.5f" % highestValueAndPosition[0][0], "%.5f" % highestValueAndPosition[0][1], "%.5f" % highestValueAndPosition[0][2], "%.5f" % highestValueAndPosition[0][3], iniPop.alphabet, population[highestValueAndPosition[1]])
            plot.plot_evolution(fitnessEvolution, str(par[parameter]), str(parameter), str(round))
            duration = datetime.now() - start
            print(start)
            print(datetime.now())
            print(duration)
            record.record_evolution(iniPop.log, 'PAR-COMB-' + str(par[parameter]), highestValueAndPosition[0], fitnessEvolution, iniPop.alphabet, population[highestValueAndPosition[1]], duration, currentGeneration)