def caso1(): "erros por passos, com populacao = 6" name = "media_erros_passos_pop6" X = [50, 100, 200, 500, 1000, 10000] Y = [] # Y = [68.05, 67.32, 66.21, 63.15, 60.43, 47.77] for x in X: y = run_tests(steps=x, population_size=6) Y.append(y) gerar_grafico( name=name, label="erro", title="erros por passos, com populacao = 6", X=X, Y=Y ) times = avg_times() reset_times() gerar_arquivo_dados(name, Y, times)
def caso3(): "erros por crossover, com populacao = 40, passos = 100" name = "avg_erro_cross_pop40_passos100" X = [0.5, 0.6, 0.7, 0.8, 0.9, 1.0] Y = [] # Y = [1,2,3,4,5,6] for x in X: y = run_tests(steps=100, population_size=40, crossover_chance=x) Y.append(y) gerar_grafico( name=name, label="erro", title="erros por crossover, com populacao = 40, passos = 100", X=X, Y=Y ) times = avg_times() reset_times() gerar_arquivo_dados(name, Y, times)
def caso4(): "erros por mutacao, com populacao = 40, passos = 100" name = "avg_erro_mut_pop40_passos100" X = [0.1, 0.2, 0.3, 0.4, 0.5] Y = [] # Y = [55.13, 56.16, 56.41, 57.36, 57.79] for x in X: y = run_tests(steps=100, population_size=40, mutation_chance=x) Y.append(y) gerar_grafico( name=name, label="erro", title="erros por mutacao, com populacao = 40, passos = 100", X=X, Y=Y ) times = avg_times() reset_times() gerar_arquivo_dados(name, Y, times)
def caso2(): "erros por populacao, com passos = 100" name = "media_erros_pop_passos100" X = [10, 20, 30, 40, 50, 60, 70] Y = [] # Y = [63.73, 61.11, 58.04, 57.03, 55.08, 55.14, 55] for x in X: y = run_tests(steps=100, population_size=x, crossover_chance=0.8) Y.append(y) gerar_grafico( name=name, label="erro", title="erros por populacao, com passos = 100", X=X, Y=Y ) times = avg_times() reset_times() gerar_arquivo_dados(name, Y, times)