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