def tourney_select()

in src/genetic_algorithm.py [0:0]


def tourney_select(population):
    # we use Tourney selection here, which is nothing more than selecting X
    # candidates and using the best one.  It's the fastest selection method
    # available, and strikes a nice balance between randomness and leaning
    # towards quality.  Increase the tourney size to lean more towards quality.
    # Decrease the tourney size (to a minimum of 1) to increase genetic
    # diversity (aka randomness).
    selected = random.sample(population, TOURNEY_SIZE)
    best = min(selected, key=lambda c: c.fitness_score)
    return best