Exemplo n.º 1
0
print("Starting...")

Net = Network(folderName="Topologia1")
allPossibilities = list(map(list, product(range(minimumValue, maximumValue + 1), repeat=sizeOfLinkBundles)))

for individual in allPossibilities:
    print("Iteration Number: " + str(iterationNumber) + "\tpercentage: " + str(round(float(iterationNumber/len(allPossibilities) * 100), 2)))

    result = evaluateNetwork(Net, individual)
    if not result[1] >= 1.1:

        ResultLog.log(result)
    iterationNumber += 1

ResultLog.save()

stopTime = timeit.default_timer()

print('Execution Time:', stopTime - startTime)

with open(fileName + '.txt') as f:
    lines = f.readlines()

solution_list = []
count = 0
for line in lines:
    print('loading file, percentage: \t' + str(round(float(count/len(lines) * 100), 2)))
    solution = Solution(number_of_variables=7, number_of_objectives=2)
    result = eval(line)
    solution.objectives[0] = result[0]
Exemplo n.º 2
0
                       crossover=IntegerSBXCrossover(probability=0.3,
                                                     distribution_index=20),
                       termination_criterion=StoppingByEvaluationsCustom(
                           max_evaluations=max_evaluations,
                           reference_point=[5000, 2.1],
                           AlgorithmName='Reference')
                       # termination_criterion=stopCriterion
                       )

    progress_bar = ProgressBarObserver(max=max_evaluations)
    algorithm.observable.register(progress_bar)

    algorithm.run()
    solutions = algorithm.get_result()

    for solution in solutions:
        if not solution.objectives[1] >= 1.3:
            solutionsResult.append(solution)

    if executions == (timesToRun - 1):
        frontResult = get_non_dominated_solutions(solutionsResult)
        for sol in frontResult:
            log_front.log(
                str(sol.objectives[0]) + " " + str(sol.objectives[1]))
log_front.save()
plot_front = Plot(title='Pareto front approximation',
                  axis_labels=['Interfaces', 'TIRF'])
plot_front.plot(frontResult, label='NSGAII-OTN')

stopTime = timeit.default_timer()
print('Execution Time:', stopTime - startTime)