def GA_run(toolbox, ngen=500, npop=100, seed=666, cpus=1, callback=None):
    logging.debug("GA setup: ngen={0} npop={1} cpus={2} seed={3}".\
                    format(ngen, npop, cpus, seed))
    if cpus > 1:
        pool = multiprocessing.Pool(cpus)
        toolbox.register("map", pool.map)
    random.seed(seed)
    pop = toolbox.population(n=npop)
    hof = tools.HallOfFame(1)

    stats = tools.Statistics(lambda ind: ind.fitness.values)
    stats.register("max", max)
    stats.register("min", min)

    eaSimpleConverge(pop, toolbox, .7, .2, ngen, stats=stats,
                     halloffame=hof, callback=callback)
    tour = hof[0]
    if 1 > cpus:
        pool.terminate()
    return tour, tour.fitness
dataset/ETHPy150Open tanghaibao/jcvi/algorithms/ec.py/GA_run/swapped operands of `>`