source: framspy/evolalg/run_frams_islands.py @ 1225

Last change on this file since 1225 was 1205, checked in by Maciej Komosinski, 21 months ago

Splitting (potentially) multiple .sim files is already done by FramsticksLib?.py

File size: 2.2 KB
Line 
1from FramsticksLib import FramsticksLib
2
3from .frams_base.experiment_frams_islands import ExperimentFramsIslands
4
5
6def 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 =ExperimentFramsIslands.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(
16        parsed_args.path, parsed_args.lib, parsed_args.sim)
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 = ExperimentFramsIslands(frams_lib=framsLib,
26                                        optimization_criteria=opt_criteria,
27                                        hof_size=parsed_args.hof_size,
28                                        constraints=constrains,
29                                        genformat=parsed_args.genformat,
30                                        popsize=parsed_args.popsize,
31                                        migration_interval=parsed_args.generations_migration,
32                                        number_of_populations=parsed_args.islands,
33                                        save_only_best=parsed_args.save_only_best)
34
35    experiment.evolve(hof_savefile=parsed_args.hof_savefile,
36                      generations=parsed_args.generations,
37                      initialgenotype=parsed_args.initialgenotype,
38                      pmut=parsed_args.pmut,
39                      pxov=parsed_args.pxov,
40                      tournament_size=parsed_args.tournament)
41
42
43if __name__ == "__main__":
44    main()
Note: See TracBrowser for help on using the repository browser.