def fitness_function(individual, edges):
    """
    Implements the logic that calculates the fitness
    measure of an individual. It sums all the costs of going
    from node to node in the tour.

    :param individual: chromosome of genes representing an individual
    :param edges: dictionary with cost between all nodes
    :return: the fitness of the individual
    """

    total_length = 0
    for i in range(individual.shape[0] - 1):
        total_length += edges[(individual[i], individual[i + 1])]

    total_length += edges[(individual[0], individual[-1])]

    return -round(total_length, 2)