[1190] | 1 | from FramsticksLib import FramsticksLib
|
---|
[1289] | 2 | from .structures.individual import Individual
|
---|
[1190] | 3 |
|
---|
| 4 | from .frams_base.experiment_frams_niching import ExperimentFramsNiching
|
---|
| 5 |
|
---|
| 6 |
|
---|
| 7 | def main():
|
---|
| 8 | # random.seed(123) # see FramsticksLib.DETERMINISTIC below, set to True if you want full determinism
|
---|
| 9 | # must be set before FramsticksLib() constructor call
|
---|
| 10 | FramsticksLib.DETERMINISTIC = False
|
---|
| 11 | parsed_args = ExperimentFramsNiching.get_args_for_parser().parse_args()
|
---|
[1289] | 12 | Individual.fitness_set_negative_to_zero = parsed_args.fitness_set_negative_to_zero # setting the "static" field once
|
---|
[1190] | 13 | print("Argument values:", ", ".join(
|
---|
| 14 | ['%s=%s' % (arg, getattr(parsed_args, arg)) for arg in vars(parsed_args)]))
|
---|
| 15 | # multiple criteria not supported here. If needed, use FramsticksEvolution.py
|
---|
| 16 | opt_criteria = parsed_args.opt.split(",")
|
---|
| 17 | framsLib = FramsticksLib(
|
---|
[1205] | 18 | parsed_args.path, parsed_args.lib, parsed_args.sim)
|
---|
[1190] | 19 | constrains = {"max_numparts": parsed_args.max_numparts,
|
---|
| 20 | "max_numjoints": parsed_args.max_numjoints,
|
---|
| 21 | "max_numneurons": parsed_args.max_numneurons,
|
---|
| 22 | "max_numconnections": parsed_args.max_numconnections,
|
---|
| 23 | "max_numgenochars": parsed_args.max_numgenochars,
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | experiment = ExperimentFramsNiching(frams_lib=framsLib,
|
---|
| 27 | optimization_criteria=opt_criteria,
|
---|
| 28 | hof_size=parsed_args.hof_size,
|
---|
| 29 | constraints=constrains,
|
---|
| 30 | normalize=parsed_args.normalize,
|
---|
| 31 | dissim=parsed_args.dissim,
|
---|
[1308] | 32 | crowding_dissim=parsed_args.crowding_dissim,
|
---|
[1190] | 33 | fit=parsed_args.fit,
|
---|
| 34 | genformat=parsed_args.genformat,
|
---|
| 35 | popsize=parsed_args.popsize,
|
---|
| 36 | archive_size=parsed_args.archive,
|
---|
[1270] | 37 | save_only_best=parsed_args.save_only_best,
|
---|
| 38 | knn_niching=parsed_args.knn_niching,
|
---|
| 39 | knn_nslc=parsed_args.knn_nslc)
|
---|
[1190] | 40 |
|
---|
| 41 | experiment.evolve(hof_savefile=parsed_args.hof_savefile,
|
---|
| 42 | generations=parsed_args.generations,
|
---|
| 43 | initialgenotype=parsed_args.initialgenotype,
|
---|
| 44 | pmut=parsed_args.pmut,
|
---|
| 45 | pxov=parsed_args.pxov,
|
---|
| 46 | tournament_size=parsed_args.tournament)
|
---|
| 47 |
|
---|
| 48 |
|
---|
| 49 | if __name__ == "__main__":
|
---|
| 50 | main()
|
---|