__author__ = 'Agostino Sturaro' import os import netw_creator as nc import shared_functions as sf # This is a simple file to run custom tests this_dir = os.path.normpath(os.path.dirname(__file__)) os.chdir(this_dir) logging_conf_fpath = os.path.normpath('logging_base_conf.json') sf.setup_logging(logging_conf_fpath) for i in range(0, 10): netw_conf_fpath = os.path.normpath( '../Simulations/temp/config_{}.ini'.format(i)) conf_path = os.path.abspath(netw_conf_fpath) nc.run(conf_path)
line_num = 0 for a_opts, b_opts, inter_opts, misc_opts in zip(build_a_options, build_b_options, build_inter_options, misc_options): # inner cycle creates a number of instances with the same structure created_for_type = 0 while created_for_type < instances_per_type: if first_group is True: seed = my_random.randint(0, sys.maxsize) seeds.append(seed) print('seeds[{}] = {}'.format(len(seeds) - 1, seed)) else: seed = seeds[instance_num % instances_per_type] print('seeds[{}] = {}'.format(instance_num % instances_per_type, seed)) misc_opts['seed'] = seed instance_dir = os.path.join(base_dir, 'instance_{}'.format(instance_num)) conf_fpath = os.path.join(base_dir, 'config_{}.ini'.format(instance_num)) write_conf(instance_dir, conf_fpath, a_opts, b_opts, inter_opts, misc_opts) nc.run(conf_fpath) created_for_type += 1 instance_num += 1 line_num += 1 first_group = False
__author__ = 'Agostino Sturaro' import os import netw_creator as nc import shared_functions as sf # This is a simple file to run custom tests this_dir = os.path.normpath(os.path.dirname(__file__)) os.chdir(this_dir) logging_conf_fpath = os.path.normpath('logging_base_conf.json') netw_conf_fpath = os.path.normpath('../Simulations/test_2/example_gen_2.ini') sf.setup_logging(logging_conf_fpath) conf_path = os.path.abspath(netw_conf_fpath) nc.run(conf_path)
my_random = random.Random(256) # create directory if it does not exist, clean it if it already exists sf.makedirs_clean(base_dir, True) # outer cycle sets different network structure parameters, mixing build options for the 2 networks instance_num = 0 line_num = 0 for a_opts, b_opts, inter_opts, misc_opts in zip(build_a_options, build_b_options, build_inter_options, misc_options): # inner cycle creates a number of instances with the same structure created_for_type = 0 while created_for_type < instances_per_type: if first_group is True: seed = my_random.randint(0, sys.maxsize) seeds.append(seed) print("seeds[{}] = {}".format(len(seeds) - 1, seed)) else: seed = seeds[instance_num % instances_per_type] print("seeds[{}] = {}".format(instance_num % instances_per_type, seed)) misc_opts["seed"] = seed instance_dir = os.path.join(base_dir, "instance_{}".format(instance_num)) conf_fpath = os.path.join(base_dir, "config_{}.ini".format(instance_num)) write_conf(instance_dir, conf_fpath, a_opts, b_opts, inter_opts, misc_opts) nc.run(conf_fpath) created_for_type += 1 instance_num += 1 line_num += 1 first_group = False