Finds a subset of nondominated individuals in a given list

    :param population: a list of individuals
    :return: a set of indices corresponding to nondominated individuals

def find_pareto_front(population):
    """Finds a subset of nondominated individuals in a given list

    :param population: a list of individuals
    :return: a set of indices corresponding to nondominated individuals
    """

    pareto_front = set(range(len(population)))

    for i in range(len(population)):
        if i not in pareto_front:
            continue

        ind1 = population[i]
        for j in range(i + 1, len(population)):
            ind2 = population[j]

            # if individuals are equal on all objectives, mark one of them (the first encountered one) as dominated
            # to prevent excessive growth of the Pareto front
            if ind2.fitness.dominates(ind1.fitness) or ind1.fitness == ind2.fitness:
                pareto_front.discard(i)

            if ind1.fitness.dominates(ind2.fitness):
                pareto_front.discard(j)

    return pareto_front