def run(args): genes = utils.get_genes_from(args.cities_fn) if args.verbose: print("-- Running Model with {} cities --".format(len(genes))) history = ga.run_ga(genes, args.pop_size, args.n_gen, args.tourn_size, args.mut_rate, args.verbose) if args.verbose: print("-- Drawing Route --") utils.plot(history['cost'], history['route']) if args.verbose: print("-- Done --")
def run(args): genes = utils.get_genes_from(args.cities_fn) history = ga.run_ga(genes, args.pop_size, args.n_gen, args.tourn_size, args.mut_rate, args.verbose)
import utils import random import argparse import GeneticAlg as ga from datetime import datetime cidades = 'cidades.csv' distancia = 'distancia.csv' pop_size = 500 n_gen = 200 tourn_size = 25 mut_rate = 0.02 genes = utils.get_genes_from(cidades, distancia) history = ga.run_ga(genes, pop_size, n_gen, tourn_size, mut_rate) utils.plot(history['cost'][0], history['route'])
import utils import random import argparse import GeneticAlg as ga from datetime import datetime variaveis = 'variaveis.csv' pop_size = 20 n_gen = 10 tourn_size = 5 mut_rate = 0.05 genes = utils.get_genes_from(variaveis) history = ga.run_ga(genes, pop_size, n_gen, tourn_size, mut_rate) utils.plot(history['testCase'])