Ejemplo n.º 1
0
    nu = 20
    strength = 0.5
    lambda_ = 7
    max_age = 10

    for _ in range(1):
        darwin = ugp4.Darwin(
            constraints=library,
            operators=operators,
            mu=mu,
            nu=nu,
            lambda_=lambda_,
            strength=strength,
            max_age=max_age,
        )

        # Evolve____________________________________________________________________________________________________________
        darwin.evolve()
        logging.bare("This is the final population:")
        for individual in darwin.population:
            ugp4.print_individual(individual)
            ugp4.logging.bare(individual.fitness)
            ugp4.logging.bare("")

        # Print best individuals
        logging.bare("These are the best ever individuals:")
        ugp4.print_individual(darwin.archive.individuals, plot=True)

    ugp4.logging.log_cpu(ugp4.logging.INFO, "Program completed")
    sys.exit(0)
Ejemplo n.º 2
0
    mu = 10
    nu = 20
    strength = 0.7
    lambda_ = 7
    max_age = 10

    darwin = ugp4.Darwin(
        constraints=library,
        operators=operators,
        mu=mu,
        nu=nu,
        lambda_=lambda_,
        strength=strength,
        max_age=max_age,
    )

    # Evolve and print individuals in population
    darwin.evolve()
    logging.bare("This is the final population:")
    for individual in darwin.population:
        msg = f"Solution {str(individual.id)} "
        ugp4.print_individual(individual, msg=msg, plot=False, score=True)

    # Print best individuals
    ugp4.print_individual(darwin.archive.individuals,
                          msg="These are the best ever individuals:",
                          plot=False)

    ugp4.logging.log_cpu(ugp4.logging.INFO, "Program completed")
    sys.exit(0)
Ejemplo n.º 3
0
    operators += ugp4.GenOperator(ugp4.macro_pool_one_cut_point_crossover, 2)
    operators += ugp4.GenOperator(ugp4.macro_pool_uniform_crossover, 2)

    # Create the object that will manage the evolution
    mu = 10
    nu = 20
    strength = 0.7
    lambda_ = 7
    max_age = 10

    darwin = ugp4.Darwin(
        constraints=library,
        operators=operators,
        mu=mu,
        nu=nu,
        lambda_=lambda_,
        strength=strength,
        max_age=max_age,
    )

    # Evolve
    darwin.evolve()

    # Print best individuals
    logging.bare("These are the best ever individuals:")
    for i in darwin.archive.individuals:
        print(f"{i}\n\n\n")

    ugp4.logging.log_cpu(ugp4.logging.INFO, "Program completed")
    sys.exit(0)
Ejemplo n.º 4
0
    mu = 10
    nu = 20
    strength = 0.7
    lambda_ = 7
    max_age = 10

    darwin = ugp4.Darwin(
        constraints=library,
        operators=operators,
        mu=mu,
        nu=nu,
        lambda_=lambda_,
        strength=strength,
        max_age=max_age,
    )

    # Evolve and print individuals in population
    darwin.evolve()
    logging.bare("Final population:")
    for individual in darwin.population:
        msg = f"Solution {str(individual.id)} "
        ugp4.print_individual(individual, msg=msg, plot=False)
        ugp4.logging.bare(f"Fitness: {individual.fitness}")
        ugp4.logging.bare("")

    # Print best individuals
    ugp4.print_individual(darwin.archive.individuals, msg="Archive:", plot=True, score=True)

    ugp4.logging.log_cpu(ugp4.logging.INFO, "Program completed")
    sys.exit(0)