[1190] | 1 | from .numerical_example.numerical_islands_example import \
|
---|
| 2 | ExperimentNumericalIslands
|
---|
| 3 |
|
---|
| 4 |
|
---|
| 5 | def main():
|
---|
| 6 | parsed_args = ExperimentNumericalIslands.get_args_for_parser().parse_args()
|
---|
| 7 | print("Argument values:", ", ".join(
|
---|
| 8 | ['%s=%s' % (arg, getattr(parsed_args, arg)) for arg in vars(parsed_args)]))
|
---|
| 9 |
|
---|
| 10 | initialgenotype = [100, 100, 100, 100]
|
---|
| 11 | print('Best individuals:')
|
---|
| 12 | experiment = ExperimentNumericalIslands(
|
---|
| 13 | hof_size=parsed_args.hof_size,
|
---|
| 14 | popsize=parsed_args.popsize,
|
---|
| 15 | migration_interval=parsed_args.generations_migration,
|
---|
| 16 | number_of_populations=parsed_args.islands,
|
---|
| 17 | save_only_best=parsed_args.save_only_best)
|
---|
| 18 |
|
---|
| 19 | hof, stats = experiment.evolve(hof_savefile=parsed_args.hof_savefile,
|
---|
| 20 | generations=parsed_args.generations,
|
---|
| 21 | initialgenotype=initialgenotype,
|
---|
| 22 | pmut=parsed_args.pmut,
|
---|
| 23 | pxov=parsed_args.pxov,
|
---|
| 24 | tournament_size=parsed_args.tournament)
|
---|
| 25 | print(len(hof))
|
---|
| 26 | for ind in hof:
|
---|
| 27 | print(ind.genotype, ind.rawfitness)
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | if __name__ == "__main__":
|
---|
| 31 | main()
|
---|